forked from martinohanlon/mayhem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_mgr.h
executable file
·51 lines (43 loc) · 1.34 KB
/
game_mgr.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
#ifndef __GAMEMANAGER_H_
#define __GAMEMANAGER_H_
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include "xc.h"
#define DEFAULT_WIDTH 1024
#define DEFAULT_HEIGHT 768
#define MAX_NUM_CONTROLLERS 4
class GameSequence {
public:
GameSequence(GameSequence *returnScreen) : iReturnScreen(returnScreen) {}
virtual ~GameSequence(){};
virtual GameSequence *doTick(ALLEGRO_BITMAP *screen_buffer,
bool key_pressed[ALLEGRO_KEY_MAX],
bool key_down[ALLEGRO_KEY_MAX], bool *exit_game,
double dt) {
return nullptr;
};
GameSequence *ReturnScreen() const { return iReturnScreen; };
protected:
GameSequence *iReturnScreen;
};
class GameManager {
public:
static void Init();
static void Shutdown();
static void Run(GameSequence *aSeq);
static void ChangeScreenRes(int width, int height);
static int display_width;
static int display_height;
static int native_width;
static int native_height;
static ALLEGRO_DISPLAY *display;
static ALLEGRO_FONT *font;
static int FPS;
static XC_STATE *joysticks[MAX_NUM_CONTROLLERS];
static int num_joysticks_loaded;
static float debug_start;
static float debug_time;
static void StartDebugTime();
static void EndDebugTime();
};
#endif