diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-18 17:33:44 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-18 17:33:44 (GMT) |
| commit | 26dbd547d3a3662c62e7b3ecadae5609f1726df4 (patch) | |
| tree | 8932ab52b1562ab90a9541962a85c93cea369683 /src/game/GameView.cpp | |
| parent | 80044bb0f06b4186bcc2f07e1c5ddc4e195f2426 (diff) | |
| download | powder-26dbd547d3a3662c62e7b3ecadae5609f1726df4.zip powder-26dbd547d3a3662c62e7b3ecadae5609f1726df4.tar.gz | |
Info tip for changing display modes
Diffstat (limited to 'src/game/GameView.cpp')
| -rw-r--r-- | src/game/GameView.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 62fd6a9..8fee0ed 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -33,7 +33,10 @@ GameView::GameView(): placeSaveThumb(NULL), mousePosition(0, 0), lastOffset(0), - drawSnap(false) + drawSnap(false), + toolTip(""), + infoTip(""), + infoTipPresence(0) { int currentX = 1; @@ -520,6 +523,17 @@ void GameView::NotifyPausedChanged(GameModel * sender) pauseButton->SetToggleState(sender->GetPaused()); } +void GameView::NotifyToolTipChanged(GameModel * sender) +{ + toolTip = sender->GetToolTip(); +} + +void GameView::NotifyInfoTipChanged(GameModel * sender) +{ + infoTip = sender->GetInfoTip(); + infoTipPresence = 120; +} + void GameView::NotifySaveChanged(GameModel * sender) { if(sender->GetSave()) @@ -922,6 +936,12 @@ void GameView::OnTick(float dt) { c->DrawFill(toolIndex, currentMouse); } + if(infoTipPresence>0) + { + infoTipPresence -= int(dt)>0?int(dt):1; + if(infoTipPresence<0) + infoTipPresence = 0; + } c->Update(); if(lastLogEntry > -0.1f) lastLogEntry -= 0.16*dt; @@ -1227,6 +1247,12 @@ void GameView::OnDraw() sampleInfo << ", Ctype: " << c->ElementResolve(sample.ctype); g->drawtext(XRES+BARSIZE-(10+Graphics::textwidth((char*)sampleInfo.str().c_str())), 10, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255); + + if(infoTipPresence) + { + int infoTipAlpha = (infoTipPresence>50?50:infoTipPresence)*5; + g->drawtext((XRES-Graphics::textwidth((char*)infoTip.c_str()))/2, (YRES/2)-2, (char*)infoTip.c_str(), 255, 255, 255, infoTipAlpha); + } } ui::Point GameView::lineSnapCoords(ui::Point point1, ui::Point point2) |
