-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
42 lines (35 loc) · 1.09 KB
/
main.cpp
File metadata and controls
42 lines (35 loc) · 1.09 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
#include <iostream>
#include "game_interfaces/main_game.h"
using namespace std;
int main(int argc, const char **argv)
{
cout << "MAIN: Starting game " << endl;
while (!MainGame::get()->get_main_activity_state()){
MainGame::get()->show_menu();
AllegroEvent event;
MainGame::get()->wait_for_event(event);
if (event.type == ALLEGRO_EVENT_KEY_UP && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE)
{
MainGame::get()->set_main_activity_state(EXIT);
cout << "MAIN: Saliendo" << endl;
}
else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
{
MainGame::get()->set_main_activity_state(EXIT);
cout << "MAIN: Saliendo" << endl;
}
else if(event.type == ALLEGRO_EVENT_KEY_UP && event.keyboard.keycode == ALLEGRO_KEY_ENTER)
{
MainGame::get()->start_timer();
while (!MainGame::get()->get_game_activity_state())
{
AllegroEvent ev;
MainGame::get()->wait_for_event(ev);
MainGame::get()->manage_event(ev);
}
}
}
cout << "MAIN: Tiempo transcurrido: " << al_get_time() << endl;
MainGame::del();
return 0;
}