-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsdlutils.h
executable file
·63 lines (50 loc) · 1.71 KB
/
sdlutils.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
#ifndef _SDLUTILS_H_
#define _SDLUTILS_H_
#include <string>
#include <vector>
#include "SDL/SDL.h"
#include "SDL/SDL_ttf.h"
#include "window.h"
namespace SDL_utils
{
// Text alignment
typedef enum
{
T_TEXT_ALIGN_LEFT = 0,
T_TEXT_ALIGN_RIGHT,
T_TEXT_ALIGN_CENTER
}
T_TEXT_ALIGN;
// Load an image using SDL_image
SDL_Surface *loadImage(const std::string &p_filename);
// Load a TTF font
TTF_Font *loadFont(const std::string &p_font, const int p_size);
// Apply a surface on another surface
void applySurface(const Sint16 p_x, const Sint16 p_y, SDL_Surface* p_source, SDL_Surface* p_destination, SDL_Rect *p_clip = NULL);
// Render a text
SDL_Surface *renderText(TTF_Font *p_font, const std::string &p_text, const SDL_Color &p_fg);
// Render a text and apply on a given surface
void applyText(const Sint16 p_x, const Sint16 p_y, SDL_Surface* p_destination, TTF_Font *p_font, const std::string &p_text, const SDL_Color &p_fg, const T_TEXT_ALIGN p_align = T_TEXT_ALIGN_LEFT);
// Create an image filled with the given color
SDL_Surface *createImage(const int p_width, const int p_height, const Uint32 p_color);
// Render all opened windows
void renderAll(void);
// Cleanup and quit
void hastalavista(void);
// Display a waiting window
void pleaseWait(void);
}
// Globals
namespace Globals
{
// Screen
extern SDL_Surface *g_screen;
// Colors
extern const SDL_Color g_colorTextNormal;
extern const SDL_Color g_colorTextTitle;
extern const SDL_Color g_colorTextDir;
extern const SDL_Color g_colorTextSelected;
// The list of opened windows
extern std::vector<CWindow *> g_windows;
}
#endif