mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-15 12:54:07 +02:00
Intro text, addresses #59
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include "dialogues/ConfirmPrompt.h"
|
#include "dialogues/ConfirmPrompt.h"
|
||||||
#include "Format.h"
|
#include "Format.h"
|
||||||
#include "QuickOption.h"
|
#include "QuickOption.h"
|
||||||
|
#include "IntroText.h"
|
||||||
|
|
||||||
|
|
||||||
class SplitButton;
|
class SplitButton;
|
||||||
@@ -170,7 +171,9 @@ GameView::GameView():
|
|||||||
toolTipPosition(-1, -1),
|
toolTipPosition(-1, -1),
|
||||||
shiftBehaviour(false),
|
shiftBehaviour(false),
|
||||||
ctrlBehaviour(false),
|
ctrlBehaviour(false),
|
||||||
showHud(true)
|
showHud(true),
|
||||||
|
introText(2048),
|
||||||
|
introTextMessage(introTextData)
|
||||||
{
|
{
|
||||||
|
|
||||||
int currentX = 1;
|
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())
|
if(colourRValue->IsFocused() || colourGValue->IsFocused() || colourBValue->IsFocused() || colourAValue->IsFocused())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(introText)
|
||||||
|
{
|
||||||
|
introText = 50;
|
||||||
|
}
|
||||||
|
|
||||||
if(selectMode!=SelectNone)
|
if(selectMode!=SelectNone)
|
||||||
{
|
{
|
||||||
if(selectMode==PlaceSave)
|
if(selectMode==PlaceSave)
|
||||||
@@ -1171,8 +1179,22 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
case 'f':
|
case 'f':
|
||||||
c->FrameStep();
|
c->FrameStep();
|
||||||
break;
|
break;
|
||||||
|
case KEY_F1:
|
||||||
|
if(!introText)
|
||||||
|
introText = 8047;
|
||||||
|
else
|
||||||
|
introText = 0;
|
||||||
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
showHud = !showHud;
|
if(ctrl)
|
||||||
|
{
|
||||||
|
if(!introText)
|
||||||
|
introText = 8047;
|
||||||
|
else
|
||||||
|
introText = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
showHud = !showHud;
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
@@ -1300,6 +1322,12 @@ void GameView::OnTick(float dt)
|
|||||||
{
|
{
|
||||||
c->DrawFill(toolIndex, currentMouse);
|
c->DrawFill(toolIndex, currentMouse);
|
||||||
}
|
}
|
||||||
|
if(introText)
|
||||||
|
{
|
||||||
|
introText -= int(dt)>0?int(dt):1;
|
||||||
|
if(introText < 0)
|
||||||
|
introText = 0;
|
||||||
|
}
|
||||||
if(infoTipPresence>0)
|
if(infoTipPresence>0)
|
||||||
{
|
{
|
||||||
infoTipPresence -= int(dt)>0?int(dt):1;
|
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)
|
void GameView::DoMouseDown(int x, int y, unsigned button)
|
||||||
{
|
{
|
||||||
|
if(introText)
|
||||||
|
introText = 50;
|
||||||
if(c->MouseDown(x, y, button))
|
if(c->MouseDown(x, y, button))
|
||||||
Window::DoMouseDown(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
|
//Draw info about simulation under cursor
|
||||||
std::stringstream sampleInfo;
|
std::stringstream sampleInfo;
|
||||||
@@ -1709,6 +1739,13 @@ void GameView::OnDraw()
|
|||||||
{
|
{
|
||||||
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, 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)
|
ui::Point GameView::lineSnapCoords(ui::Point point1, ui::Point point2)
|
||||||
|
Reference in New Issue
Block a user