summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-14 14:02:49 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-14 14:02:49 (GMT)
commitef6c4e91ae85e4a47408f92d4cfab9d9668c651d (patch)
treec100bd2c0596077fc358daa7606590c709436b4f /src
parentcee845895356208dbfe87c602ae1eef35d55db6e (diff)
downloadpowder-ef6c4e91ae85e4a47408f92d4cfab9d9668c651d.zip
powder-ef6c4e91ae85e4a47408f92d4cfab9d9668c651d.tar.gz
Correct tooltip for save button
Diffstat (limited to 'src')
-rw-r--r--src/game/GameView.cpp41
-rw-r--r--src/game/GameView.h2
2 files changed, 34 insertions, 9 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index d95a7b9..80c8772 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -63,18 +63,18 @@ public:
}
virtual void OnMouseMovedInside(int x, int y, int dx, int dy)
{
- if(x >= splitPosition)
+ if(x >= splitPosition || !showSplit)
{
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)
{
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;
if(!Enabled)
return;
- if(x >= splitPosition)
+ if(x >= splitPosition || !showSplit)
{
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)
{
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)
{
- this->toolTip = toolTip;
- toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), Size.Y-MENUSIZE-10);
+ if(sender->Position.Y > Size.Y-17)
+ {
+ 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)
@@ -1401,6 +1409,12 @@ void GameView::OnTick(float dt)
if(infoTipPresence<0)
infoTipPresence = 0;
}
+ if(buttonTipShow>0)
+ {
+ buttonTipShow -= int(dt)>0?int(dt):1;
+ if(buttonTipShow<0)
+ buttonTipShow = 0;
+ }
c->Update();
if(lastLogEntry > -0.1f)
lastLogEntry -= 0.16*dt;
@@ -1819,6 +1833,10 @@ void GameView::OnDraw()
{
sampleInfo << " (" << c->ElementResolve(sample.particle.ctype) << ")";
}
+ else
+ {
+ sampleInfo << " ()";
+ }
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
sampleInfo << ", Life: " << sample.particle.life;
@@ -1860,7 +1878,7 @@ void GameView::OnDraw()
std::stringstream fpsInfo;
fpsInfo.precision(2);
#ifdef SNAPSHOT
- fpsInfo << "Snapshot " << SNAPSHOT_ID << ". ";
+ fpsInfo << "Snapshot " << SNAPSHOT_ID << ", ";
#endif
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);
}
+ if(buttonTipShow > 0)
+ {
+ g->drawtext(6, Size.Y-MENUSIZE-10, (char*)buttonTip.c_str(), 255, 255, 255, buttonTipShow>51?255:buttonTipShow*5);
+ }
+
//Introduction text
if(introText)
{
diff --git a/src/game/GameView.h b/src/game/GameView.h
index b392bd1..93eb779 100644
--- a/src/game/GameView.h
+++ b/src/game/GameView.h
@@ -46,6 +46,8 @@ private:
bool showDebug;
bool wallBrush;
int introText;
+ int buttonTipShow;
+ std::string buttonTip;
std::string introTextMessage;
int toolIndex;