From: Matt Mullins Date: Sat, 16 Jun 2012 04:50:20 +0000 (-0700) Subject: Finish support for creating Text objects. X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=2e4bab3917708e24e72da635e1d1b715989ff424;p=IvanGame.git Finish support for creating Text objects. --- diff --git a/Text.cpp b/Text.cpp index 050a854..55e8d88 100644 --- a/Text.cpp +++ b/Text.cpp @@ -4,16 +4,28 @@ #include "Game.h" #include "fns.h" #include +#include +#include +#include +#include using namespace std; -Text::Text(string id, FontType t, int s, SDL_Color c, int w, int h) +Text::Text(string filename, string id, FontType t, int s, SDL_Color c, + int w, int h) : WorldObject(id), mFont(Game::game()->getFont(s, t)), color(c), width(w), height(h) { - + ifstream ifs(filename.c_str()); + YAML::Parser parser(ifs); + YAML::Node byLanguage; + parser.GetNextDocument(byLanguage); + + /** \todo un-hard-code this language */ + const YAML::Node& byId = byLanguage["en"]; + byId[id] >> text; } Text::Text(string name, string t, int s, SDL_Color c, int w, int h) @@ -24,7 +36,7 @@ Text::Text(string name, string t, int s, SDL_Color c, int w, int h) width(w), height(h) { - + throw new runtime_error("I haven't implemented this yet."); } Text::~Text() diff --git a/Text.h b/Text.h index 10e411b..b3b28dd 100644 --- a/Text.h +++ b/Text.h @@ -26,7 +26,7 @@ public: int width; int height; Text(string name, string t, int size = 24, SDL_Color c = WHITE, int w = 600, int h = 150); - Text(string id, FontType t, int size = 24, SDL_Color c = WHITE, int w = 600, int h = 150); + Text(string filename, string id, FontType t, int size = 24, SDL_Color c = WHITE, int w = 600, int h = 150); ~Text(); }; #endif