From: Mikko Rasa Date: Mon, 3 Sep 2007 08:57:55 +0000 (+0000) Subject: Make use of the ability to load multiple arguments diretly into member variables X-Git-Tag: 0.9~49 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=5f1c235da9bc956332efffebbc1bf7700621d269;p=libs%2Fgl.git Make use of the ability to load multiple arguments diretly into member variables --- diff --git a/source/font.cpp b/source/font.cpp index 2cab462c..3b02583b 100644 --- a/source/font.cpp +++ b/source/font.cpp @@ -177,8 +177,8 @@ Font::Glyph::Loader::Loader(Glyph &g): glyph(g) { add("texcoords", &Loader::texcoords); - add("size", &Loader::size); - add("offset", &Loader::offset); + add("size", &Glyph::w, &Glyph::h); + add("offset", &Glyph::off_x, &Glyph::off_y); add("advance", &Glyph::advance); } @@ -190,17 +190,5 @@ void Font::Glyph::Loader::texcoords(float x1, float y1, float x2, float y2) glyph.y2=y2; } -void Font::Glyph::Loader::size(float w, float h) -{ - glyph.w=w; - glyph.h=h; -} - -void Font::Glyph::Loader::offset(float x, float y) -{ - glyph.off_x=x; - glyph.off_y=y; -} - } // namespace GL } // namespace Msp diff --git a/source/font.h b/source/font.h index 278a14aa..7307122a 100644 --- a/source/font.h +++ b/source/font.h @@ -42,20 +42,20 @@ public: void draw_string(const std::string &) const; void draw_string(const std::string &, Codecs::Decoder &) const; void draw_multiline(const std::string &) const; - + template float get_string_width(const std::string &str) const { typename C::Decoder dec; return get_string_width(str, dec); - } - + } + template void draw_string(const std::string &str) const { typename C::Decoder dec; draw_string(str, dec); - } + } private: struct Glyph { @@ -68,8 +68,6 @@ private: Glyph &glyph; void texcoords(float, float, float, float); - void size(float, float); - void offset(float, float); }; unsigned code;