-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathioManager.h
More file actions
45 lines (41 loc) · 1.22 KB
/
ioManager.h
File metadata and controls
45 lines (41 loc) · 1.22 KB
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
#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);
}
SDL_Surface* loadAndSet(const string& filename, bool setcolorkey) 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;
void printMessageAt(const string& msg, Uint32 x, Uint32 y, const string& fontname) 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;
SDL_Color color;
string inputString;
};
#endif