10 #include <yaml-cpp/yaml.h>
15 mFont(
Game::game()->getFont(t, s)),
19 lines(vector<string>()),
23 filename=
"ArtAssets/Story/"+filename+
".yaml";
24 ifstream fin(filename.c_str());
28 printf(
"Error opening %s\n\n",filename.c_str());
31 YAML::Parser parser(fin);
35 while(parser.GetNextDocument(doc)) {
37 const YAML::Node& section = doc[sectionName];
58 const YAML::Node& items = section[lang];
63 lines.push_back( tmp.size() > 0 && tmp[tmp.size()-1]==10 ? tmp.substr(0,tmp.size()-1):tmp);
75 mFont(
Game::game()->getFont(
Game::game()->Language, s)),
79 lines(vector<string>()),
95 int size =
lines.size();
105 SDL_Surface *initial;
106 SDL_Surface *intermediary;
113 fprintf(stderr,
"TTF_RenderUTF8_Blended: %s\n", TTF_GetError());
121 intermediary = SDL_CreateRGBSurface(0, w, h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
122 SDL_BlitSurface(initial, 0, intermediary, 0);
124 glBlendFunc(GL_ONE, GL_ONE);
127 glGenTextures(1, &texture.
image);
128 glBindTexture(GL_TEXTURE_2D, texture.
image);
129 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_BGRA, GL_UNSIGNED_BYTE, intermediary->pixels );
132 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
133 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
136 glBindTexture(GL_TEXTURE_2D, texture.
image);
138 glColor3f(1.0f, 1.0f, 1.0f);
142 glTexCoord2d(0.0f, 0.0f);
144 glTexCoord2d(1.0f, 0.0f);
146 glTexCoord2d(1.0f, 1.0f);
148 glTexCoord2d(0.0f, 1.0f);
157 SDL_FreeSurface(initial);
158 SDL_FreeSurface(intermediary);
159 glDeleteTextures(1, &texture.
image);
173 if(line <
lines.size())