From b57d956ca84061974efe1be882b08b77633f26d2 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Thu, 20 Sep 2012 21:37:36 -0400 Subject: Icons and tooltips for everything in renderview. (Empty space not filled yet) diff --git a/src/graphics/Graphics.cpp b/src/graphics/Graphics.cpp index 8051a08..144f302 100644 --- a/src/graphics/Graphics.cpp +++ b/src/graphics/Graphics.cpp @@ -874,6 +874,51 @@ void Graphics::draw_icon(int x, int y, Icon icon, unsigned char alpha, bool inve drawchar(x, y, 0x89, 255, 255, 255, alpha); } break; + case IconVelocity: + drawchar(x, y, 0x98, 128, 160, 255, 255); + break; + case IconPressure: + drawchar(x, y, 0x99, 255, 212, 32, 255); + break; + case IconPersistant: + drawchar(x, y, 0x9A, 212, 212, 212, 255); + break; + case IconFire: + drawchar(x+1, y, 0x9B, 255, 0, 0, 255); + drawchar(x+1, y, 0x9C, 255, 255, 64, 255); + break; + case IconBlob: + drawchar(x, y, 0xBF, 55, 255, 55, 255); + break; + case IconHeat: + drawchar(x+2, y, 0xBE, 255, 0, 0, 255); + drawchar(x+2, y, 0xBD, 255, 255, 255, 255); + break; + case IconBlur: + drawchar(x, y, 0xC4, 100, 150, 255, 255); + break; + case IconGradient: + drawchar(x, y, 0xD3, 255, 50, 255, 255); + break; + case IconLife: + drawchar(x, y, 0xE0, 255, 255, 255, 255); + break; + case IconEffect: + drawchar(x, y, 0xE1, 255, 255, 160, 255); + break; + case IconGlow: + drawchar(x, y, 0xDF, 200, 255, 255, 255); + break; + case IconWarp: + drawchar(x, y, 0xDE, 255, 255, 255, 255); + break; + case IconBasic: + drawchar(x, y, 0xDB, 255, 255, 200, 255); + break; + case IconAltAir: + drawchar(x, y, 0xD4, 255, 55, 55, 255); + drawchar(x, y, 0xD5, 55, 255, 55, 255); + break; default: if(invert) drawchar(x, y, 't', 0, 0 ,0 ,alpha); diff --git a/src/graphics/Graphics.h b/src/graphics/Graphics.h index c23400f..edc61e2 100644 --- a/src/graphics/Graphics.h +++ b/src/graphics/Graphics.h @@ -82,7 +82,21 @@ enum Icon IconReport, IconUsername, IconPassword, - IconClose + IconClose, + IconEffect, + IconFire, + IconGlow, + IconBlur, + IconBlob, + IconBasic, + IconAltAir, + IconPressure, + IconVelocity, + IconWarp, + IconPersistant, + IconHeat, + IconLife, + IconGradient }; //"Graphics lite" - slightly lower performance due to variable size, diff --git a/src/interface/Checkbox.cpp b/src/interface/Checkbox.cpp index d7be324..7799561 100644 --- a/src/interface/Checkbox.cpp +++ b/src/interface/Checkbox.cpp @@ -34,7 +34,7 @@ std::string Checkbox::GetText() void Checkbox::SetIcon(Icon icon) { Appearance.icon = icon; - iconPosition.X = 19; + iconPosition.X = 17; iconPosition.Y = 3; } @@ -86,7 +86,7 @@ void Checkbox::Draw(const Point& screenPos) if (!Appearance.icon) g->drawtext(screenPos.X+18, screenPos.Y+4, text, 255, 255, 255, 255); else - g->draw_icon(screenPos.X+15, screenPos.Y+iconPosition.Y, Appearance.icon); + g->draw_icon(screenPos.X+iconPosition.X, screenPos.Y+iconPosition.Y, Appearance.icon); } else { @@ -94,7 +94,7 @@ void Checkbox::Draw(const Point& screenPos) if (!Appearance.icon) g->drawtext(screenPos.X+18, screenPos.Y+4, text, 255, 255, 255, 200); else - g->draw_icon(screenPos.X+15, screenPos.Y+iconPosition.Y, Appearance.icon); + g->draw_icon(screenPos.X+iconPosition.X, screenPos.Y+iconPosition.Y, Appearance.icon); } } diff --git a/src/render/RenderView.cpp b/src/render/RenderView.cpp index d29b426..087b20b 100644 --- a/src/render/RenderView.cpp +++ b/src/render/RenderView.cpp @@ -75,93 +75,115 @@ RenderView::RenderView(): { ui::Checkbox * tCheckbox; - tCheckbox = new ui::Checkbox(ui::Point(1, YRES+4), ui::Point(55, 16), "Effects", ""); + tCheckbox = new ui::Checkbox(ui::Point(1, YRES+4), ui::Point(55, 16), "Effects", "Adds Special flare effects to some elements"); renderModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconEffect); tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_EFFE)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(1, YRES+4+18), ui::Point(55, 16), "Fire", ""); + tCheckbox = new ui::Checkbox(ui::Point(1, YRES+4+18), ui::Point(55, 16), "Fire", "Fire effect for gasses"); renderModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconFire); tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_FIRE)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(61, YRES+4), ui::Point(55, 16), "Glow", ""); + tCheckbox = new ui::Checkbox(ui::Point(41, YRES+4), ui::Point(55, 16), "Glow", "Glow effect on some elements"); renderModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconGlow); tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_GLOW)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(61, YRES+4+18), ui::Point(55, 16), "Blur", ""); + tCheckbox = new ui::Checkbox(ui::Point(41, YRES+4+18), ui::Point(55, 16), "Blur", "Blur effect for liquids"); renderModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconBlur); tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_BLUR)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(121, YRES+4), ui::Point(55, 16), "Blob", ""); + tCheckbox = new ui::Checkbox(ui::Point(81, YRES+4), ui::Point(55, 16), "Blob", "Makes everything be drawn like a blob"); renderModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconBlob); tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_BLOB)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(121, YRES+4+18), ui::Point(55, 16), "Point", ""); + tCheckbox = new ui::Checkbox(ui::Point(81, YRES+4+18), ui::Point(55, 16), "Point", "Basic rendering, without this, most things will be invisible"); renderModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconBasic); tCheckbox->SetActionCallback(new RenderModeAction(this, RENDER_BASC)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(186, YRES+4), ui::Point(70, 16), "Alt. Air", ""); + tCheckbox = new ui::Checkbox(ui::Point(136, YRES+4), ui::Point(70, 16), "Alt. Air", "Displays pressure as red and blue, and velocity as white"); displayModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconAltAir); tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_AIRC)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(186, YRES+4+18), ui::Point(70, 16), "Pressure", ""); + tCheckbox = new ui::Checkbox(ui::Point(136, YRES+4+18), ui::Point(70, 16), "Pressure", "Displays pressure, red is positive and blue is negative"); displayModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconPressure); tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_AIRP)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(261, YRES+4), ui::Point(70, 16), "Velocity", ""); + tCheckbox = new ui::Checkbox(ui::Point(176, YRES+4), ui::Point(70, 16), "Velocity", "Displays velocity and positive pressure: up/down adds blue, right/left adds red, still pressure adds green"); displayModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconVelocity); tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_AIRV)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(261, YRES+4+18), ui::Point(70, 16), "Air-heat", ""); + tCheckbox = new ui::Checkbox(ui::Point(176, YRES+4+18), ui::Point(70, 16), "Air-heat", "Displays the temperature of the air like heat display does"); displayModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconHeat); tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_AIRH)); AddComponent(tCheckbox); - /*tCheckbox = new ui::Checkbox(ui::Point(336, YRES+4), ui::Point(70, 16), "Air", ""); + /*tCheckbox = new ui::Checkbox(ui::Point(216, YRES+4), ui::Point(70, 16), "Air", ""); displayModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconAltAir); tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_AIR)); AddComponent(tCheckbox);*/ - tCheckbox = new ui::Checkbox(ui::Point(336, YRES+4+18), ui::Point(70, 16), "Warp", ""); + tCheckbox = new ui::Checkbox(ui::Point(221, YRES+4+18), ui::Point(70, 16), "Warp", "Gravity lensing, Newtonian Gravity bends light with this on"); displayModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconWarp); tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_WARP)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(411, YRES+4), ui::Point(70, 16), "Persistent", ""); +#ifdef OGLR + tCheckbox = new ui::Checkbox(ui::Point(221, YRES+4), ui::Point(70, 16), "Effect", "I don't know what this does...") //I would remove the whole checkbox, but then there's a large empty space +#else + tCheckbox = new ui::Checkbox(ui::Point(221, YRES+4), ui::Point(70, 16), "Effect", "Does nothing"); +#endif displayModes.push_back(tCheckbox); - tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_PERS)); + tCheckbox->SetIcon(IconEffect); + tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_EFFE)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(336, YRES+4), ui::Point(70, 16), "Effect", ""); + tCheckbox = new ui::Checkbox(ui::Point(261, YRES+4), ui::Point(70, 16), "Persistent", "Element paths persist on the screen for a while"); displayModes.push_back(tCheckbox); - tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_EFFE)); + tCheckbox->SetIcon(IconPersistant); + tCheckbox->SetActionCallback(new DisplayModeAction(this, DISPLAY_PERS)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(486, YRES+4), ui::Point(50, 16), "Heat", ""); + tCheckbox = new ui::Checkbox(ui::Point(306, YRES+4), ui::Point(50, 16), "Heat", "Displays temperatures of the elements, dark blue is coldest, pink is hotest"); colourModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconHeat); tCheckbox->SetActionCallback(new ColourModeAction(this, COLOUR_HEAT)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(486, YRES+4+18), ui::Point(50, 16), "Life", ""); + tCheckbox = new ui::Checkbox(ui::Point(306, YRES+4+18), ui::Point(50, 16), "Life", "Displays the life value of elements in greyscale gradients"); colourModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconLife); tCheckbox->SetActionCallback(new ColourModeAction(this, COLOUR_LIFE)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(536, YRES+4+18), ui::Point(50, 16), "H-Gradient", ""); + tCheckbox = new ui::Checkbox(ui::Point(346, YRES+4+18), ui::Point(50, 16), "H-Gradient", "Changes colors of elements slightly to show heat diffusing through them"); colourModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconGradient); tCheckbox->SetActionCallback(new ColourModeAction(this, COLOUR_GRAD)); AddComponent(tCheckbox); - tCheckbox = new ui::Checkbox(ui::Point(536, YRES+4), ui::Point(50, 16), "Basic", ""); + tCheckbox = new ui::Checkbox(ui::Point(346, YRES+4), ui::Point(50, 16), "Basic", "No special effects at all for anything, overrides all other options and deco"); colourModes.push_back(tCheckbox); + tCheckbox->SetIcon(IconBasic); tCheckbox->SetActionCallback(new ColourModeAction(this, COLOUR_BASC)); AddComponent(tCheckbox); } @@ -246,13 +268,13 @@ void RenderView::OnDraw() ren->RenderEnd(); } g->draw_line(0, YRES, XRES-1, YRES, 200, 200, 200, 255); - g->draw_line(180, YRES, 180, YRES+MENUSIZE, 200, 200, 200, 255); - g->draw_line(330, YRES, 330, YRES+MENUSIZE, 200, 200, 200, 255); - g->draw_line(480, YRES, 480, YRES+MENUSIZE, 200, 200, 200, 255); + g->draw_line(130, YRES, 130, YRES+MENUSIZE, 200, 200, 200, 255); + g->draw_line(215, YRES, 215, YRES+MENUSIZE, 200, 200, 200, 255); + g->draw_line(300, YRES, 300, YRES+MENUSIZE, 200, 200, 200, 255); g->draw_line(XRES, 0, XRES, YRES+MENUSIZE, 255, 255, 255, 255); if(toolTipPresence && toolTip.length()) { - g->drawtext(6, Size.Y-MENUSIZE-10, (char*)toolTip.c_str(), 255, 255, 255, toolTipPresence>51?255:toolTipPresence*5); + g->drawtext(6, Size.Y-MENUSIZE-12, (char*)toolTip.c_str(), 255, 255, 255, toolTipPresence>51?255:toolTipPresence*5); } } @@ -269,7 +291,7 @@ void RenderView::OnTick(float dt) void RenderView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip) { this->toolTip = toolTip; - toolTipPresence = 160; + toolTipPresence = 500; } RenderView::~RenderView() { -- cgit v0.9.2-21-gd62e