-
Notifications
You must be signed in to change notification settings - Fork 1
/
ioManager.h
48 lines (44 loc) · 1.26 KB
/
ioManager.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
#ifndef SINGLE__H
#define SINGLE__H
#include <SDL.h>
#include <SDL_ttf.h>
#include <SDL_image.h>
#include <string>
#include <sstream>
using std::string;
#include "gamedata.h"
class IOManager {
public:
static IOManager& getInstance();
SDL_Surface * getScreen() const { return screen; }
~IOManager() {
TTF_CloseFont(font);
TTF_CloseFont(damageFont);
}
SDL_Surface* loadAndSet(const string filename, bool setcolorkey) const;
void printDamage(const double& msg, Uint32 x, Uint32 y) const;
void printMessageAt(const string& msg, Uint32 x, Uint32 y) const;
void printMessageCenteredAt(const string& msg, Uint32 y) const;
void printStringAfterMessage(const string&, Uint32 x, Uint32 y) const;
template <typename T>
void printMessageValueAt(const string& msg, T value,
Uint32 x, Uint32 y) const;
void buildString(SDL_Event*);
void clearString() { inputString = ""; }
const string& getString() const { return inputString; }
private:
IOManager();
IOManager(const IOManager&);
IOManager& operator=(const IOManager&);
const Gamedata* gdata;
int viewWidth;
int viewHeight;
const unsigned MAX_STRING_SIZE;
SDL_Surface * screen;
TTF_Font *font;
TTF_Font *damageFont;
SDL_Color color;
string title;
string inputString;
};
#endif