-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.cpp
More file actions
63 lines (44 loc) · 1.31 KB
/
App.cpp
File metadata and controls
63 lines (44 loc) · 1.31 KB
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
//================================================//
#include "App.hpp"
//================================================//
App::App(void) :
m_pAppStateManager(0)
{
}
//================================================//
App::~App(void)
{
delete m_pAppStateManager;
delete Base::getSingletonPtr();
}
//================================================//
void App::init(void)
{
// Declare the Base singleton
new Base();
if(!Base::getSingletonPtr()->init(0, 0))
return;
// Declare the Settings singleton
new Settings();
// Declare the TextRenderer singleton
new TextRenderer();
// Declare shared data singleton
new SharedData();
//#ifdef _DEBUG
if(AllocConsole()){
freopen("CONOUT$", "w", stdout);
SetConsoleTitle("Sparks Ogre Framework Debug Console");
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
}
//#endif
// Seed rand
srand(time(0));
Base::getSingletonPtr()->m_pLog->logMessage("App initialized!");
m_pAppStateManager = new AppStateManager();
// create all states
MenuState::create(m_pAppStateManager, "MenuState");
GameState::create(m_pAppStateManager, "GameState");
// start the first state
m_pAppStateManager->start(m_pAppStateManager->findByName("MenuState"));
}
//================================================//