Correct tooltip for save button

This commit is contained in:
Simon Robertshaw
2012-08-14 15:02:49 +01:00
parent cee8458953
commit ef6c4e91ae
2 changed files with 34 additions and 9 deletions

View File

@@ -63,18 +63,18 @@ public:
} }
virtual void OnMouseMovedInside(int x, int y, int dx, int dy) virtual void OnMouseMovedInside(int x, int y, int dx, int dy)
{ {
if(x >= splitPosition) if(x >= splitPosition || !showSplit)
{ {
if(toolTip.length()>0 && GetParentWindow()) if(toolTip.length()>0 && GetParentWindow())
{ {
GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip); GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip2);
} }
} }
else if(x < splitPosition) else if(x < splitPosition)
{ {
if(toolTip2.length()>0 && GetParentWindow()) if(toolTip2.length()>0 && GetParentWindow())
{ {
GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip2); GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip);
} }
} }
} }
@@ -83,18 +83,18 @@ public:
isMouseInside = true; isMouseInside = true;
if(!Enabled) if(!Enabled)
return; return;
if(x >= splitPosition) if(x >= splitPosition || !showSplit)
{ {
if(toolTip.length()>0 && GetParentWindow()) if(toolTip.length()>0 && GetParentWindow())
{ {
GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip); GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip2);
} }
} }
else if(x < splitPosition) else if(x < splitPosition)
{ {
if(toolTip2.length()>0 && GetParentWindow()) if(toolTip2.length()>0 && GetParentWindow())
{ {
GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip2); GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip);
} }
} }
} }
@@ -1105,8 +1105,16 @@ void GameView::ExitPrompt()
void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip) void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip)
{ {
this->toolTip = toolTip; if(sender->Position.Y > Size.Y-17)
toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), Size.Y-MENUSIZE-10); {
buttonTip = toolTip;
buttonTipShow = 120;
}
else
{
this->toolTip = toolTip;
toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), Size.Y-MENUSIZE-10);
}
} }
void GameView::OnMouseWheel(int x, int y, int d) void GameView::OnMouseWheel(int x, int y, int d)
@@ -1401,6 +1409,12 @@ void GameView::OnTick(float dt)
if(infoTipPresence<0) if(infoTipPresence<0)
infoTipPresence = 0; infoTipPresence = 0;
} }
if(buttonTipShow>0)
{
buttonTipShow -= int(dt)>0?int(dt):1;
if(buttonTipShow<0)
buttonTipShow = 0;
}
c->Update(); c->Update();
if(lastLogEntry > -0.1f) if(lastLogEntry > -0.1f)
lastLogEntry -= 0.16*dt; lastLogEntry -= 0.16*dt;
@@ -1819,6 +1833,10 @@ void GameView::OnDraw()
{ {
sampleInfo << " (" << c->ElementResolve(sample.particle.ctype) << ")"; sampleInfo << " (" << c->ElementResolve(sample.particle.ctype) << ")";
} }
else
{
sampleInfo << " ()";
}
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure; sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f; sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
sampleInfo << ", Life: " << sample.particle.life; sampleInfo << ", Life: " << sample.particle.life;
@@ -1860,7 +1878,7 @@ void GameView::OnDraw()
std::stringstream fpsInfo; std::stringstream fpsInfo;
fpsInfo.precision(2); fpsInfo.precision(2);
#ifdef SNAPSHOT #ifdef SNAPSHOT
fpsInfo << "Snapshot " << SNAPSHOT_ID << ". "; fpsInfo << "Snapshot " << SNAPSHOT_ID << ", ";
#endif #endif
fpsInfo << "FPS: " << std::fixed << ui::Engine::Ref().GetFps(); fpsInfo << "FPS: " << std::fixed << ui::Engine::Ref().GetFps();
@@ -1882,6 +1900,11 @@ void GameView::OnDraw()
g->drawtext(toolTipPosition.X, toolTipPosition.Y, (char*)toolTip.c_str(), 255, 255, 255, 255); g->drawtext(toolTipPosition.X, toolTipPosition.Y, (char*)toolTip.c_str(), 255, 255, 255, 255);
} }
if(buttonTipShow > 0)
{
g->drawtext(6, Size.Y-MENUSIZE-10, (char*)buttonTip.c_str(), 255, 255, 255, buttonTipShow>51?255:buttonTipShow*5);
}
//Introduction text //Introduction text
if(introText) if(introText)
{ {

View File

@@ -46,6 +46,8 @@ private:
bool showDebug; bool showDebug;
bool wallBrush; bool wallBrush;
int introText; int introText;
int buttonTipShow;
std::string buttonTip;
std::string introTextMessage; std::string introTextMessage;
int toolIndex; int toolIndex;