forked from GuillemFP/DoubleDragon3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModuleFonts.h
67 lines (48 loc) · 1.93 KB
/
ModuleFonts.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
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef MODULEFONTS_H
#define MODULEFONTS_H
#include "Module.h"
#include "Point.h"
#include <vector>
#define MODULE_FONTS "ModuleFonts"
#define FONTS_SECTION "Config.Modules.Fonts"
struct SDL_Texture;
struct SDL_Rect;
struct TextLine
{
const char* line;
int x, y;
int id_font;
};
struct Font
{
int id_font;
int char_width;
char* table_char;
std::vector<SDL_Rect> textures_char;
};
class ModuleFonts : public Module
{
public:
ModuleFonts();
~ModuleFonts() {}
bool Start();
bool CleanUp();
int Load(const char* order, int char_width, int font_height, const iPoint& font_origin);
bool BlitScreenXCentered(int id_font, int y, const char* string) const { return BlitScreenXCentered(id_font, y, string, fDEFAULT_SPEED); }
bool BlitScreenXCentered(int id_font, int y, const char* string, float speed) const;
bool BlitScreenCentered(int id_font, const char* string) const { return BlitScreenCentered(id_font, string, fDEFAULT_SPEED); }
bool BlitScreenCentered(int id_font, const char* string, float speed) const;
bool BlitFromXCenter(int id_font, const iPoint& center_origin, const char* string) const { return BlitFromXCenter(id_font, center_origin, string, fDEFAULT_SPEED); }
bool BlitFromXCenter(int id_font, const iPoint& center_origin, const char* string, float speed) const;
bool BlitFromRight(int id_font, const iPoint& right_origin, const char* string) const { return BlitFromRight(id_font, right_origin, string, fDEFAULT_SPEED); }
bool BlitFromRight(int id_font, const iPoint& right_origin, const char* string, float speed) const;
bool Blit(int id_font, const iPoint& origin, const char* string) const { return Blit(id_font, origin, string, fDEFAULT_SPEED); }
bool Blit(int id_font, const iPoint& origin, const char* string, float speed) const;
void FillTextLine(TextLine* line, int num_line);
private:
SDL_Texture* texture;
std::vector<Font*> fonts;
int num_fonts = 0;
float fDEFAULT_SPEED = 1.0f;
};
#endif // !MODULEFONTS_H