-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cpp
61 lines (44 loc) · 1.09 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stdlib.h>
#include <raylib.h>
#include <vector>
#include "Entity.hpp"
#include "Ui.hpp"
#include "BattleScene.hpp"
#include "Constants.hpp"
#include "TitleScene.hpp"
int main(void) {
InitWindow(Constants::DEFAULT_WIDTH, Constants::DEFAULT_HEIGHT, "Agile Battle");
HideCursor();
SetTargetFPS(60);
InitAudioDevice();
bool triggredBattleScene = false;
TitleScene* titleScene = new TitleScene();
BattleScene* battleScene = NULL;
while (!WindowShouldClose()) {
// TODO: this should be handled by an auxiliary class.
if (IsKeyPressed(KEY_F)) {
ToggleFullscreen();
}
BeginDrawing();
ClearBackground(WHITE);
if ((IsKeyPressed(KEY_ENTER) || IsMouseButtonReleased(MOUSE_BUTTON_LEFT)) && !triggredBattleScene) {
battleScene = new BattleScene();
triggredBattleScene = true;
delete titleScene;
titleScene = NULL;
}
if (titleScene != NULL) {
titleScene->Update();
}
else if (battleScene != NULL) {
battleScene->Update();
}
EndDrawing();
}
if (battleScene != NULL) {
delete battleScene;
}
CloseAudioDevice();
CloseWindow();
return EXIT_SUCCESS;
}