1 #include "groupscreen.h"
2 #include "fetch_group.h"
5 GroupScreen::GroupScreen(pqxx::connection &conn, unsigned tournament, unsigned round, unsigned parallel)
6 : tournament(tournament), round(round), parallel(parallel), scores_changed(conn, "scores"), conn(conn), valid(false)
10 GroupScreen::~GroupScreen()
14 bool GroupScreen::check_invalidated()
16 // we might want to do this slightly more sophisticated later, but for now this will do
17 return !valid || scores_changed.get_flag();
20 void GroupScreen::draw(unsigned char *buf)
22 scores_changed.reset_flag();
25 conn.perform(FetchGroup(tournament, round, parallel, &group));
27 memset(buf, 0, 800 * 600 * 4);
29 // just as a test, show all the players and the scores (no headings)
31 for (std::vector<Player>::const_iterator i = group.players.begin(); i != group.players.end(); ++i) {
32 my_draw_text(i->nick, buf, 20, y, true, 255, 255, 255);
35 for (std::vector<Score>::const_iterator j = i->scores.begin(); j != i->scores.end(); ++j) {
41 sprintf(text, "%u", j->score);
43 my_draw_text(text, buf, x, y, true, 255, 255, 255);