-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioManager.h
49 lines (45 loc) · 1.36 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
49
#ifndef SINGLE__H
#define SINGLE__H
#include <SDL.h>
#include <SDL_ttf.h>
#include <SDL_image.h>
#include <string>
#include <map>
#include <sstream>
using std::string;
#include "gamedata.h"
class IOManager {
public:
static IOManager& getInstance();
SDL_Surface * getScreen() const { return screen; }
~IOManager() {
std::map<std::string, TTF_Font*>::const_iterator it=fmap.begin();
while(it!=fmap.end()){
std::cout<<it->first<<std::endl;
TTF_CloseFont(it->second);
it++;
}
}
SDL_Surface* loadAndSet(const string& filename, bool setcolorkey) const;
void printMessageAt(const string& msg, Uint32 x, Uint32 y, std::string font) const;
void printMessageCenteredAt(const string& msg, Uint32 y, std::string font) const;
void printStringAfterMessage(const string&, Uint32 x, Uint32 y, std::string font) const;
template <typename T>
void printMessageValueAt(const string& msg, T value,
Uint32 x, Uint32 y, std::string font) 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;
std::map<std::string, TTF_Font*> fmap;
string inputString;
};
#endif