-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAllkit.h
More file actions
93 lines (73 loc) · 2.09 KB
/
Copy pathAllkit.h
File metadata and controls
93 lines (73 loc) · 2.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
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef ALLKIT_H
#define ALLKIT_H
#include <vector>
#include <string>
#include "allegro5/allegro.h"
#include "allegro5/allegro_image.h"
#include "allegro5/allegro_primitives.h"
#include "allegro5/allegro_native_dialog.h"
#include "allegro5/allegro_font.h"
#include "allegro5/allegro_ttf.h"
#include "allegro5/allegro_audio.h"
#include "allegro5/allegro_acodec.h"
#include "Color.h"
#include "Constants.h"
#include "Point.h"
#include "Sprite.h"
class Allkit {
public:
// No copy constructor
Allkit(const Allkit&) = delete;
// No copy assignment operator
Allkit& operator=(const Allkit&) = delete;
static Allkit& Get()
{
// Memory for instance is only created once!
static Allkit instance;
return instance;
}
enum Align {
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHT
};
void Init();
void Destroy();
void StartTimer();
void StopTimer();
void LoadLaunchSound();
void PlayLaunchSound();
void NextEvent();
bool IsArrowKeyUpPushed();
bool IsArrowKeyDownPushed();
bool IsEnterKeyPushed();
bool IsSpaceBarPushed();
bool IsMouseClicked();
bool IsMouseReleased();
bool HasMouseMoved();
Point& GetMouse();
bool IsScreenActive();
bool IsTimerEvent();
bool IsWindowClosed();
void ClearScreen();
void DrawOnScreen();
void DrawLine(Point& a, Point& b);
void DrawPoly(std::vector<Point>& body);
void DrawString(std::string& str, Point& location, Color& color, Align align, bool huge_font);
void DrawScaledBitmap(Sprite sprite, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
private:
// Private default constructor
Allkit() = default;
void ShowError(std::string msg);
int GetAlign(Allkit::Align align);
ALLEGRO_DISPLAY* display = NULL;
ALLEGRO_TIMER* timer = NULL;
ALLEGRO_EVENT_QUEUE* event_queue = NULL;
ALLEGRO_EVENT event;
ALLEGRO_FONT* font = NULL;
ALLEGRO_FONT* big_font = NULL;
ALLEGRO_SAMPLE* launch = NULL;
std::vector<ALLEGRO_BITMAP *> sprites;
Point mouse;
};
#endif