-
Notifications
You must be signed in to change notification settings - Fork 0
/
Engine.h
55 lines (38 loc) · 1.32 KB
/
Engine.h
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
#ifndef _ENGINE_
#define _ENGINE_
#include <stdio.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
namespace Game {
class Screen;
class Engine {
public:
static const double FPS = 60.0; // Frame per second
static const double UPS = 60.0; // Update per second
static const int SCREEN_WIDTH = 720;
static const int SCREEN_HEIGHT = 720;
static const int SCREEN_SIZE = 30;
Screen *screen[SCREEN_SIZE];
int currentScreen;
double delta_time;
double draw_old_time;
double update_old_time;
bool endGame;
ALLEGRO_THREAD *thread_update;
ALLEGRO_MUTEX *mutex;
ALLEGRO_DISPLAY *display;
ALLEGRO_EVENT_QUEUE *event_queue;
ALLEGRO_TIMER *timerUpdate;
Engine();
~Engine();
void run();
void loop();
void addScreen(int index, Screen * screen);
void jumpScreen(int index);
static void *updateThread(ALLEGRO_THREAD *thr, void *arg);
};
}
#endif