/
instructions.cpp
executable file
·81 lines (71 loc) · 2.59 KB
/
instructions.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//==============================================================================
#include <hgeresource.h>
#include <hgefont.h>
#include <hgesprite.h>
#include <instructions.hpp>
#include <engine.hpp>
//------------------------------------------------------------------------------
Instructions::Instructions( Engine * engine )
:
Context( engine ),
m_dark( 0 )
{
}
//------------------------------------------------------------------------------
Instructions::~Instructions()
{
}
//------------------------------------------------------------------------------
// public:
//------------------------------------------------------------------------------
void
Instructions::init()
{
hgeResourceManager * rm( m_engine->getResourceManager() );
m_dark = new hgeSprite( 0, 0, 0, 1, 1 );
}
//------------------------------------------------------------------------------
void
Instructions::fini()
{
delete m_dark;
m_dark = 0;
}
//------------------------------------------------------------------------------
bool
Instructions::update( float dt )
{
HGE * hge( m_engine->getHGE() );
if ( hge->Input_GetKey() != 0 && ! m_engine->isPaused() )
{
m_engine->switchContext( STATE_MENU );
}
return false;
}
//------------------------------------------------------------------------------
void
Instructions::render()
{
hgeResourceManager * rm( m_engine->getResourceManager() );
m_dark->SetColor( 0xCC000309 );
m_dark->RenderStretch( 50.0f, 50.0f, 750.0f, 550.0f );
hgeFont * font( rm->GetFont( "menu" ) );
font->printf( 400.0f, 80.0f, HGETEXT_CENTER,
"I N S T R U C T I O N S" );
font->printf( 400.0f, 170.0f, HGETEXT_CENTER,
"you have 999 seconds and 3 lives to score big" );
font->printf( 400.0f, 210.0f, HGETEXT_CENTER,
"pilot your ship with W to thrust, A & D to rotate" );
font->printf( 400.0f, 250.0f, HGETEXT_CENTER,
"LMB shoots your weapon" );
font->printf( 400.0f, 290.0f, HGETEXT_CENTER,
"land safely to deploy \"Cap'n Onion\", S to return" );
font->printf( 400.0f, 330.0f, HGETEXT_CENTER,
"move him with A & D, with W to jump" );
font->printf( 400.0f, 370.0f, HGETEXT_CENTER,
"LMB shoots his weapon towards the mouse pointer" );
font->printf( 400.0f, 410.0f, HGETEXT_CENTER,
"score by destroying urchin and collecting coin" );
font->printf( 400.0f, 500.0f, HGETEXT_CENTER,
"G O O D L U C K" );
}