-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (38 loc) · 984 Bytes
/
main.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
#ifdef _WIN64
#include "SDL.h"
#endif //Windows Includes
#ifdef linux
#include "SDL2/SDL.h"
#endif //Linux includes
#include "Engine/Input.h"
#include "Engine/Video.h"
#include "Engine/SceneDirector.h"
#include <iostream>
SceneDirector* sDirector = NULL;
Input* sInputControl = NULL;
int main(int argc, char* args[])
{
sInputControl = Input::getInstance();
sDirector = SceneDirector::getInstance();
bool endGame = false;
while (!endGame)
{
if (sDirector->getCurrentScene()->mustReInit()) {
sDirector->getCurrentScene()->Reinit();
//Debug
sDirector->PrintLoaded();
sDirector->PrintCurrSceneTitle();
}
sInputControl->Update(endGame);
sDirector->getCurrentScene()->update();
//Render
Video::getInstance()->clearScreen(0x100000);
if (!sDirector->getCurrentScene()->mustReInit()) {
sDirector->getCurrentScene()->render();
}
Video::getInstance()->updateScreen();
Video::getInstance()->vSync();
}
Video::getInstance()->close();
return 0;
}