-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMiniGame.cpp
48 lines (44 loc) · 1.1 KB
/
MiniGame.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
#include "MiniGame.hpp"
#include "fases/FaseGame.hpp"
#include "fases/FaseMenu.hpp"
#include "ASCII_Engine/Sprite.hpp"
#include "ASCII_Engine/SpriteBuffer.hpp"
#include "ASCII_Engine/Fase.hpp"
SpriteBuffer MiniGame::screen(161, 40);
void MiniGame::run(){
FaseMenu fase("FaseMenu", Sprite("src/sprites/menuBackground.img"));
fase.init();
unsigned state = Fase::MENU;
unsigned level = Fase::LEVEL_1;
while(state != Fase::END_GAME){
switch (state)
{
case Fase::MENU:
state = fase.run(screen);
level = Fase::LEVEL_1;
break;
case Fase::OP_1:
{
if (level == Fase::LEVEL_1)
{
FaseGame level("Game",Sprite("src/sprites/gameBackground.img"));
level.init();
state = level.run(screen);
}
else
state = Fase::MENU;
}
break;
case Fase::OP_2:
system("clear");
std::cout << "Saindo...\n";
system("sleep 1");
state = Fase::END_GAME;
break;
case Fase::LEVEL_COMPLETE:
state = Fase::MENU;
break;
}
}
fase.closeThreads();
}