diff options
| author | Simon 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) |
| commit | ef6c4e91ae85e4a47408f92d4cfab9d9668c651d (patch) | |
| tree | c100bd2c0596077fc358daa7606590c709436b4f /src/game/GameView.cpp | |
| parent | cee845895356208dbfe87c602ae1eef35d55db6e (diff) | |
| download | powder-ef6c4e91ae85e4a47408f92d4cfab9d9668c651d.zip powder-ef6c4e91ae85e4a47408f92d4cfab9d9668c651d.tar.gz | |
Correct tooltip for save button
Diffstat (limited to 'src/game/GameView.cpp')
| -rw-r--r-- | src/game/GameView.cpp | 41 |
1 files changed, 32 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) { |
