-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModuleUI.h
More file actions
125 lines (89 loc) · 2.28 KB
/
ModuleUI.h
File metadata and controls
125 lines (89 loc) · 2.28 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef __MODULEUI_H__
#define __MODULEUI_H__
#include "Module.h"
#include "SDL\include\SDL_pixels.h"
#include <iostream>
#define MAX_FONTS 10
#define MAX_FONT_CHARS 256
enum gameplay_state
{
NO,
LOGO,
GAMETITTLE,
SCENE,
WIN,
PAUSE
};
struct SDL_Texture;
struct Font
{
char table[MAX_FONT_CHARS];
SDL_Texture* graphic = nullptr;
uint rows, len, len2, len3, char_w, char_h, row_chars;
};
class ModuleUI : public Module
{
public:
ModuleUI();
~ModuleUI();
bool Start();
//update_status Update();
update_status PostUpdate();
bool CleanUp();
// Load Font
int Load(const char* texture_path, const char* characters, uint rows = 1);
void UnLoad(int font_id);
// Create a surface from text
void BlitText(int x, int y, int bmp_font_id, const char* text) const;
private:
Font fonts[MAX_FONTS];
public:
int lastResortBlueFont = -1;
int redNumbers = -1;
int unit1Pow = 0;
int unit2Pow = 0;
int pressToStart = 0;
int godModeBlink[2] = { 0 };
char score_text[10];
char redNumbers_text[10];
SDL_Texture* uiTexture = nullptr;
SDL_Rect p1Rect = { 1,0,22,8 };
SDL_Rect p1ShipRect = { 0,8,24,8 };
SDL_Rect powRect = { 0,16,96,8 };
SDL_Rect powBarRect;
SDL_Rect powBar2Rect;//player2
SDL_Rect p2Rect = { 161,16,23,8 };
SDL_Rect p2ShipRect = { 160,24,24,8 };
SDL_Rect pressRect = { 159,0,96,16 };
Uint32 score = 0;
Uint32 score2 = 0; //provisonal name to redNumbers call
uint lives1 = 0;
uint lives2 = 0;
uint zero = 0; //fast fix
int scores[10] = { 74000,63500,58200,43700,47000,43000,32900,21100,0,0 };
//Uint32 lastScore
//int scorePosY[10] = { 48,68,88,108,128,148,168,188,208,228 };
SDL_Rect coinsRect;
int coins = 0;
struct Players
{
char* name = nullptr;
char* topName = nullptr;
int score = 0;
};
Players ships[10];
char* names[10] = { "momar","elmascapo","ice","fire","albanian","mako","pete","john","player 1","player 2" };
char* topNames[10] = { "[momar]","[elmascapo]","[ice]","[fire]","[albanian]","[mako]","[pete]","[john]","[player 1]","[player 2]" };
char* topPlayer = nullptr;
Players aux;
bool computed = false;
gameplay_state UI;
bool bothPlayers = false;
// pause timer
Uint32 start_pause_time;
Uint32 now_pause_time;
Uint32 total_time_pausing = 500;
bool paused = false;
bool stopRendering = false;
};
#endif // __MODULEUI_H__