-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathText.h
More file actions
30 lines (25 loc) · 667 Bytes
/
Text.h
File metadata and controls
30 lines (25 loc) · 667 Bytes
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
#pragma once
#include <string>
#include "SDL.h"
#include "SDL_ttf.h"
class Text
{
public:
Text();
Text(const char *text, int size, SDL_Color color);
Text(const char *text, int size, Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 0xFF);
~Text();
void setSize(int size);
void setColor(SDL_Color color);
void setColor(Uint8 red, Uint8 green, Uint8 blue, Uint8 alpha = 0xFF);
void setText(const char *text);
SDL_Texture *getTexture(SDL_Renderer *renderer);
private:
void init();
void reset();
std::string m_text;
int m_size;
SDL_Color m_color;
SDL_Texture *m_texture;
static SDL_Surface *m_font;
};