-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
78 lines (68 loc) · 2.18 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Made with
* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
* By Elias Pschernig and Trent Gamblin.
*
* Author: Luiz Philippe (https://github.com/luizppa & https://luizppa.com)
*/
#include <iostream>
#include <allegro5/allegro5.h>
#include <allegro5/error.h>
#include <allegro5/events.h>
#include <allegro5/fullscreen_mode.h>
#include <allegro5/allegro_opengl.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_acodec.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include "include/environment.hpp"
#include "include/menus.hpp"
#include "include/sounds.hpp"
#include "include/display.hpp"
#include "include/fonts.hpp"
#include "include/colors.hpp"
#include "include/setup.hpp"
int main() {
int result;
if(!setup::init()){
std::cout << "Setup failed" << std::endl;
return 1;
}
top_gear::display::draw_splash();
al_flush_event_queue(top_gear::environment::input_event_queue);
while (true) {
ALLEGRO_EVENT ev;
al_wait_for_event(top_gear::environment::input_event_queue, &ev);
if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
break;
}
else if(ev.type == ALLEGRO_EVENT_KEY_DOWN) {
if(ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE) {
break;
}
else if(ev.keyboard.keycode == ALLEGRO_KEY_ENTER){
top_gear::sounds::play_sample(top_gear::sounds::MENU_SELECT_SOUND);
result = top_gear::menus::main_menu();
if(result == MENU_ACTION_QUIT_GAME){
break;
}
else if(result == MENU_ACTION_GO_BACK){
top_gear::display::draw_title();
}
}
}
}
setup::finalize();
return 0;
}