-
Notifications
You must be signed in to change notification settings - Fork 0
/
BitmapFont.h
69 lines (49 loc) · 1.13 KB
/
BitmapFont.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
68
69
/***
Bitmap Font: BITMAP FONT!
***/
#ifndef BITMAP_FONT_H
#define BITMAP_FONT_H
#include <string>
#include "SDL.h"
#include "SDL_image.h"
#include "SDL_Mixer.h"
#include "SDL_opengl.h"
#include "Metrics.h"
#include "StaticObject2D.h"
#include "DisplayScreen.h"
class BitmapFont
{
private:
// True if the font has been set
bool fontSet;
// The font bitmap
StaticObject2D font;
// Size of the bitmap font ***REFACTOR***
Size2I bitmapSize;
// The size of the char
Size2I charSize;
// Padding between chars
Size2I padding;
// The starting ascii character on the sprite sheet
char startingAsciiCharacter;
public:
BitmapFont();
// Rendering justifications
enum justifications
{
CENTER,
LEFT,
RIGHT
};
// Sets the butmap of the font
void SetBitmap( Texture* textureID, int point );
// Sets the size of the chars
void SetCharSize( int w, int h );
// Sets the padding size
void SetPaddingSize( int w, int h );
// Sets the first char on the sprite sheet
void SetFirstChar( char c );
// Renders the text at x, y
void RenderText( double x, double y, std::string text, int justification = 0 );
};
#endif // !BITMAP_FONT_H