-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.cpp
40 lines (33 loc) · 1.02 KB
/
help.cpp
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
#include <sstream>
#include "help.h"
#include "gamedata.h"
Help::Help() :
io( IOManager::getInstance() ),
words(),
position(),
space()
{
unsigned int n = Gamedata::getInstance()->getXmlInt("helpNumber");
position[0] = Gamedata::getInstance()->getXmlInt("helpX");
position[1] = Gamedata::getInstance()->getXmlInt("helpY");
std::stringstream strm;
for ( unsigned i = 0; i < n; ++i ) {
strm << "help" << i;
words.push_back( Gamedata::getInstance()->getXmlStr(strm.str()) );
strm.clear(); // clear error flags
strm.str(std::string()); // clear contents
}
space[0] = Gamedata::getInstance()->getXmlInt("helpSpaceX");
space[1] = Gamedata::getInstance()->getXmlInt("helpSpaceY");
}
void Help::update(Uint32){
}
void Help::draw() const {
int y = position[1];
io.printMessageCenteredAt(Gamedata::getInstance()->getXmlStr("helpTitle"), y, "large");
y += 2*space[1];
for (unsigned i = 0; i < words.size(); ++i) {
io.printMessageCenteredAt(words[i], y, "smaller");
y += space[1];
}
}