You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.2 KiB
C++
55 lines
1.2 KiB
C++
6 years ago
|
#include <stdio.h>
|
||
|
#include <string>
|
||
|
|
||
|
#include "game.h"
|
||
|
|
||
|
using std::string;
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
//Allegro setup
|
||
|
if (!al_init()) {
|
||
|
fprintf(stderr, "failed to initialize allegro!\n");
|
||
|
return -1;
|
||
|
}
|
||
|
if (!al_init_font_addon()) {
|
||
|
fprintf(stderr, "failed to initialize font!\n");
|
||
|
return -1;
|
||
|
}
|
||
|
if (!al_init_primitives_addon()) {
|
||
|
fprintf(stderr, "failed to initialize primitives!\n");
|
||
|
return -1;
|
||
|
}
|
||
|
if (!al_init_image_addon()) {
|
||
|
fprintf(stderr, "failed to initialize image addon!\n");
|
||
|
return -1;
|
||
|
}
|
||
|
if (!al_install_audio()) {
|
||
|
fprintf(stderr, "failed to initialize audio!\n");
|
||
|
return -1;
|
||
|
}
|
||
|
if (!al_init_acodec_addon()) {
|
||
|
fprintf(stderr, "failed to initialize audio codecs!\n");
|
||
|
return -1;
|
||
|
}
|
||
|
if (!al_install_keyboard()) {
|
||
6 years ago
|
fprintf(stderr, "failed to initialize keyboard!\n");
|
||
6 years ago
|
return -1;
|
||
|
}
|
||
|
|
||
6 years ago
|
//Create display
|
||
6 years ago
|
ALLEGRO_DISPLAY* display = al_create_display(SCREEN_W, SCREEN_H);
|
||
|
al_clear_to_color(al_map_rgb(0, 0, 0));
|
||
|
|
||
6 years ago
|
//Create game, initialize and run it
|
||
6 years ago
|
Game main_game;
|
||
|
main_game.init();
|
||
|
main_game.run();
|
||
|
|
||
6 years ago
|
//Garbage collection
|
||
|
al_uninstall_audio();
|
||
|
al_uninstall_keyboard();
|
||
6 years ago
|
al_destroy_display(display);
|
||
6 years ago
|
|
||
6 years ago
|
return 0;
|
||
|
}
|