diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-25 10:37:55 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-25 10:37:55 (GMT) |
| commit | 64a404263aec32cc5a0d88c4eeeaea77a8c1a03a (patch) | |
| tree | 9bbd444068b3c9b5599174b4b8bff40a59641dfe /src/game/GameView.cpp | |
| parent | 5c683f6bc39e1cab02169f1bf6e3603924362b18 (diff) | |
| download | powder-64a404263aec32cc5a0d88c4eeeaea77a8c1a03a.zip powder-64a404263aec32cc5a0d88c4eeeaea77a8c1a03a.tar.gz | |
Tooltips for quick options menu, #113
Diffstat (limited to 'src/game/GameView.cpp')
| -rw-r--r-- | src/game/GameView.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 5631ee0..74a1db5 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -179,7 +179,8 @@ GameView::GameView(): doScreenshot(false), recording(false), screenshotIndex(0), - recordingIndex(0) + recordingIndex(0), + toolTipPresence(0) { int currentX = 1; @@ -1155,10 +1156,19 @@ void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::str buttonTip = toolTip; buttonTipShow = 120; } + else if(sender->Position.X > Size.X-BARSIZE)// < Size.Y-(quickOptionButtons.size()+1)*16) + { + this->toolTip = toolTip; + toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), sender->Position.Y+3); + if(toolTipPosition.Y+10 > Size.Y-MENUSIZE) + toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), Size.Y-MENUSIZE-10); + toolTipPresence = 120; + } else { this->toolTip = toolTip; toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), Size.Y-MENUSIZE-10); + toolTipPresence = 160; } } @@ -1498,6 +1508,12 @@ void GameView::OnTick(float dt) if(buttonTipShow<0) buttonTipShow = 0; } + if(toolTipPresence>0) + { + toolTipPresence -= int(dt)>0?int(dt):1; + if(toolTipPresence<0) + toolTipPresence = 0; + } c->Update(); if(lastLogEntry > -0.1f) lastLogEntry -= 0.16*dt; @@ -2054,9 +2070,9 @@ void GameView::OnDraw() g->drawtext((XRES-Graphics::textwidth((char*)infoTip.c_str()))/2, (YRES/2)-2, (char*)infoTip.c_str(), 255, 255, 255, infoTipAlpha); } - if(toolTipPosition.X!=-1 && toolTipPosition.Y!=-1 && toolTip.length()) + if(toolTipPresence && toolTipPosition.X!=-1 && toolTipPosition.Y!=-1 && toolTip.length()) { - 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, toolTipPresence>51?255:toolTipPresence*5); } if(buttonTipShow > 0) |
