]> git.sesse.net Git - ccbs/commitdiff
Add a constructor from const char * for widestring, begin drawing in GroupScreen.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 16:29:05 +0000 (16:29 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 19 Feb 2005 16:29:05 +0000 (16:29 +0000)
bigscreen/groupscreen.cpp
bigscreen/widestring.cpp
bigscreen/widestring.h

index e410de9b15019b5331e18e4d43fbd056d29db0f5..2827a6af3a111121e515b30db3ee0409820290bd 100644 (file)
@@ -1,5 +1,6 @@
 #include "groupscreen.h"
 #include "fetch_group.h"
+#include "fonts.h"
 
 GroupScreen::GroupScreen(pqxx::connection &conn, unsigned tournament, unsigned round, unsigned parallel)
        : tournament(tournament), round(tournament), parallel(parallel), scores_changed(conn, "scores"), conn(conn), valid(false)
@@ -23,6 +24,22 @@ void GroupScreen::draw(unsigned char *buf)
        Group group;
        conn.perform(FetchGroup(tournament, round, parallel, &group));
 
+       memset(buf, 0, 800 * 600 * 4);
+       
+       // just as a test, show all the players and the scores (no headings)
+       unsigned y = 50;
+       for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
+               my_draw_text(i->nick, buf, 20, y, true, 255, 255, 255);
+
+               unsigned x = 90;
+               for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j) {
+                       my_draw_text(widestring("1234"), buf, x, y, true, 255, 255, 255);
+                       x += 60;
+               }
+
+               y += 20;
+       }
+       
        valid = true;
 }
 
index c31f4fcb29981442173179bee2c32de8d1f810f5..52b7f559e48acf406ecb58e9bb008369b4ccd0a3 100644 (file)
@@ -7,6 +7,11 @@
 static iconv_t ucs4_iconv;
 static bool iconv_initialized = false;
 
+widestring::widestring(const char *from)
+{
+       *this = from;
+}
+
 void widestring::operator= (const char *from)
 {
        if (!iconv_initialized) {
index ca899bd5a68a5359efd09a4eb975acbc0e4bec54..67f00b5b59d96eae4d9b35474ca7a35141287606 100644 (file)
@@ -7,6 +7,7 @@
 class widestring : public std::wstring
 {
 public:
+       widestring(const char *from);
        void operator= (const char *from);
 };