-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyGame.cpp
41 lines (37 loc) · 851 Bytes
/
MyGame.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
#include "MyGame.h"
MyGame::MyGame()
{
// Default constructor
Penjin::setApplicationName("CromoZome");
}
PENJIN_ERRORS MyGame::init()
{
GFX::setResolution(320,240);
setInitialState(STATE_TITLE);
return GFX::resetScreen();
}
void MyGame::stateManagement()
{
// Check if the state itself wants to change states
uint next = state->getNextState();
if(state)
{
delete state;
state = NULL;
}
if(next == STATE_BASE)
state = new BaseState;
else if (next == STATE_MAIN)
state = new StateMain;
else if(next == STATE_TITLE)
state = new StateTitle;
else if(next == STATE_GAMEOVER)
state = new StateGameover;
else if(next == STATE_CREDITS)
state = new StateCredits;
else
{
cout << ErrorHandler().getErrorString(PENJIN_UNDEFINED_STATE);
exit(PENJIN_UNDEFINED_STATE);
}
}