]> git.sesse.net Git - ccbs/blob - bigscreen/top10scorescreen.cpp
Add the framework for a top 10 screen.
[ccbs] / bigscreen / top10scorescreen.cpp
1 #include <cstdio>
2
3 #include "top10scorescreen.h"
4
5 Top10ScoreScreen::Top10ScoreScreen(pqxx::connection &conn, unsigned tournament)
6         : conn(conn), tournament(tournament), scores_changed(conn, "scores"), valid(false)
7 {
8 }
9
10 Top10ScoreScreen::~Top10ScoreScreen()
11 {
12 }
13
14 bool Top10ScoreScreen::check_invalidated()
15 {
16         if (!valid)
17                 return true;
18         if (!scores_changed.get_flag())
19                 return false;
20
21         return true;
22 }
23
24 void Top10ScoreScreen::draw(unsigned char *buf)
25 {
26         std::vector<TextDefer> td;
27         scores_changed.reset_flag();
28         memset(buf, 0, 800 * 600 * 4);
29
30         std::fprintf(stderr, "foo bar\n");
31         
32         valid = true;
33         draw_all_deferred_text(buf, td, last_text);
34         last_text = td;
35 }
36