summaryrefslogtreecommitdiff
path: root/src/game/GameView.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-07 17:34:39 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-07 17:34:39 (GMT)
commitbc1c967a6bb4a21893eea0447c800ffef407e38f (patch)
tree8623d2e347b0480c5e74fb88c3d75ec79a8a8f05 /src/game/GameView.cpp
parent46b2def1930b8a6741916b1b4dfebfed97f7e64d (diff)
downloadpowder-bc1c967a6bb4a21893eea0447c800ffef407e38f.zip
powder-bc1c967a6bb4a21893eea0447c800ffef407e38f.tar.gz
Intro text, addresses #59
Diffstat (limited to 'src/game/GameView.cpp')
-rw-r--r--src/game/GameView.cpp43
1 files changed, 40 insertions, 3 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index 9bb1ee7..84c305b 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -15,6 +15,7 @@
#include "dialogues/ConfirmPrompt.h"
#include "Format.h"
#include "QuickOption.h"
+#include "IntroText.h"
class SplitButton;
@@ -170,7 +171,9 @@ GameView::GameView():
toolTipPosition(-1, -1),
shiftBehaviour(false),
ctrlBehaviour(false),
- showHud(true)
+ showHud(true),
+ introText(2048),
+ introTextMessage(introTextData)
{
int currentX = 1;
@@ -1085,6 +1088,11 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
if(colourRValue->IsFocused() || colourGValue->IsFocused() || colourBValue->IsFocused() || colourAValue->IsFocused())
return;
+ if(introText)
+ {
+ introText = 50;
+ }
+
if(selectMode!=SelectNone)
{
if(selectMode==PlaceSave)
@@ -1171,8 +1179,22 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
case 'f':
c->FrameStep();
break;
+ case KEY_F1:
+ if(!introText)
+ introText = 8047;
+ else
+ introText = 0;
+ break;
case 'h':
- showHud = !showHud;
+ if(ctrl)
+ {
+ if(!introText)
+ introText = 8047;
+ else
+ introText = 0;
+ }
+ else
+ showHud = !showHud;
break;
case 'b':
if(ctrl)
@@ -1300,6 +1322,12 @@ void GameView::OnTick(float dt)
{
c->DrawFill(toolIndex, currentMouse);
}
+ if(introText)
+ {
+ introText -= int(dt)>0?int(dt):1;
+ if(introText < 0)
+ introText = 0;
+ }
if(infoTipPresence>0)
{
infoTipPresence -= int(dt)>0?int(dt):1;
@@ -1357,6 +1385,8 @@ void GameView::DoMouseMove(int x, int y, int dx, int dy)
void GameView::DoMouseDown(int x, int y, unsigned button)
{
+ if(introText)
+ introText = 50;
if(c->MouseDown(x, y, button))
Window::DoMouseDown(x, y, button);
}
@@ -1666,7 +1696,7 @@ void GameView::OnDraw()
}
}
- if(showHud)
+ if(showHud && !introText)
{
//Draw info about simulation under cursor
std::stringstream sampleInfo;
@@ -1709,6 +1739,13 @@ void GameView::OnDraw()
{
g->drawtext(toolTipPosition.X, toolTipPosition.Y, (char*)toolTip.c_str(), 255, 255, 255, 255);
}
+
+ //Introduction text
+ if(introText)
+ {
+ g->fillrect(0, 0, XRES+BARSIZE, YRES+MENUSIZE, 0, 0, 0, introText>51?102:introText*2);
+ g->drawtext(16, 20, (char*)introTextMessage.c_str(), 255, 255, 255, introText>51?255:introText*5);
+ }
}
ui::Point GameView::lineSnapCoords(ui::Point point1, ui::Point point2)