summaryrefslogtreecommitdiff
path: root/src/gui/game/GameView.cpp
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-05-12 01:43:52 (GMT)
committer jacob1 <jfu614@gmail.com>2013-05-12 01:43:52 (GMT)
commit9d89d4b79b26584490e55cfb992fc58d3e11ea2b (patch)
tree4564d725ae9def30ee6d2128b67592fd7aaddfdd /src/gui/game/GameView.cpp
parent67e1213905edbd248ef4d434c3e5e53c151828a7 (diff)
downloadpowder-9d89d4b79b26584490e55cfb992fc58d3e11ea2b.zip
powder-9d89d4b79b26584490e55cfb992fc58d3e11ea2b.tar.gz
fix tooltips and dt
Diffstat (limited to 'src/gui/game/GameView.cpp')
-rw-r--r--src/gui/game/GameView.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp
index fcfa95c..925ff2c 100644
--- a/src/gui/game/GameView.cpp
+++ b/src/gui/game/GameView.cpp
@@ -171,6 +171,8 @@ GameView::GameView():
infoTip(""),
infoTipPresence(0),
buttonTipShow(0),
+ isToolTipFadingIn(false),
+ isButtonTipFadingIn(false),
toolTipPosition(-1, -1),
shiftBehaviour(false),
ctrlBehaviour(false),
@@ -1154,8 +1156,7 @@ void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::str
if (selectMode == PlaceSave || selectMode == SelectNone)
{
buttonTip = toolTip;
- if (buttonTipShow < 120)
- buttonTipShow += 3;
+ isButtonTipFadingIn = true;
}
}
else if(sender->Position.X > Size.X-BARSIZE)// < Size.Y-(quickOptionButtons.size()+1)*16)
@@ -1164,15 +1165,13 @@ void GameView::ToolTip(ui::Component * sender, ui::Point mousePosition, std::str
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);
- if (toolTipPresence < 120)
- toolTipPresence += 3;
+ isToolTipFadingIn = true;
}
else
{
this->toolTip = toolTip;
toolTipPosition = ui::Point(Size.X-27-Graphics::textwidth((char*)toolTip.c_str()), Size.Y-MENUSIZE-10);
- if (toolTipPresence < 160)
- toolTipPresence += 3;
+ isToolTipFadingIn = true;
}
}
@@ -1526,15 +1525,33 @@ void GameView::OnTick(float dt)
if(infoTipPresence<0)
infoTipPresence = 0;
}
- if (selectMode != PlaceSave && selectMode != SelectNone && buttonTipShow < 120)
- buttonTipShow += 2;
+ if (isButtonTipFadingIn || (selectMode != PlaceSave && selectMode != SelectNone))
+ {
+ isButtonTipFadingIn = false;
+ if(buttonTipShow < 120)
+ {
+ buttonTipShow += int(dt*2)>0?int(dt*2):1;
+ if(buttonTipShow>120)
+ buttonTipShow = 120;
+ }
+ }
else if(buttonTipShow>0)
{
buttonTipShow -= int(dt)>0?int(dt):1;
if(buttonTipShow<0)
buttonTipShow = 0;
}
- if(toolTipPresence>0)
+ if (isToolTipFadingIn)
+ {
+ isToolTipFadingIn = false;
+ if(toolTipPresence < 120)
+ {
+ toolTipPresence += int(dt*2)>0?int(dt*2):1;
+ if(toolTipPresence>120)
+ toolTipPresence = 120;
+ }
+ }
+ else if(toolTipPresence>0)
{
toolTipPresence -= int(dt)>0?int(dt):1;
if(toolTipPresence<0)