CXXFLAGS=-g -Wall
LDFLAGS=-L/usr/X11R6/lib
LIBS=$(shell freetype-config --libs) $(shell libpq3-config) -lpqxx tinyptc/libtinyptc.a -lX11 -lXext
-CCBS_BIGSCREEN_OBJS=ccbs_bigscreen.o flagtrigger.o widestring.o fetch_current_tournament.o fetch_list_of_active_groups.o fetch_max_score_for_songs.o fetch_max_score_for_players.o fetch_group.o fetch_needs_update.o fetch_highscore.o fetch_auxilliary_screens.o fonts.o groupscreen.o splitscreen.o rotatescreen.o screen.o
+CCBS_BIGSCREEN_OBJS=ccbs_bigscreen.o flagtrigger.o widestring.o fetch_current_tournament.o fetch_list_of_active_groups.o fetch_max_score_for_songs.o fetch_max_score_for_players.o fetch_group.o fetch_needs_update.o fetch_highscore.o fetch_auxilliary_screens.o fonts.o groupscreen.o top10scorescreen.o splitscreen.o rotatescreen.o screen.o
all: ccbs-bigscreen
#include "fetch_auxilliary_screens.h"
#include "fonts.h"
#include "groupscreen.h"
+#include "top10scorescreen.h"
#include "splitscreen.h"
#include "rotatescreen.h"
conn.perform(FetchAuxilliaryScreens(&aux_screens));
for (std::vector<widestring>::const_iterator i = aux_screens.begin(); i != aux_screens.end(); ++i) {
-// std::fprintf(stderr, "Auxilliary screen '%s'\n", i->c_str());
+ if (*i == widestring("top10scores")) {
+ screens.push_back(new Top10ScoreScreen(conn, active_tournament.id));
+ continue;
+ }
+ std::fprintf(stderr, "Foobarbaz?\n");
}
// hack
--- /dev/null
+#include <cstdio>
+
+#include "top10scorescreen.h"
+
+Top10ScoreScreen::Top10ScoreScreen(pqxx::connection &conn, unsigned tournament)
+ : conn(conn), tournament(tournament), scores_changed(conn, "scores"), valid(false)
+{
+}
+
+Top10ScoreScreen::~Top10ScoreScreen()
+{
+}
+
+bool Top10ScoreScreen::check_invalidated()
+{
+ if (!valid)
+ return true;
+ if (!scores_changed.get_flag())
+ return false;
+
+ return true;
+}
+
+void Top10ScoreScreen::draw(unsigned char *buf)
+{
+ std::vector<TextDefer> td;
+ scores_changed.reset_flag();
+ memset(buf, 0, 800 * 600 * 4);
+
+ std::fprintf(stderr, "foo bar\n");
+
+ valid = true;
+ draw_all_deferred_text(buf, td, last_text);
+ last_text = td;
+}
+
--- /dev/null
+#ifndef _TOP10SCORESCREEN_H
+#define _TOP10SCORESCREEN_H 1
+
+#include <vector>
+#include <pqxx/connection>
+#include <time.h>
+#include <sys/time.h>
+
+#include "screen.h"
+#include "flagtrigger.h"
+#include "fonts.h"
+
+/* A screen class showing a group in the tournament */
+class Top10ScoreScreen : public GenericScreen {
+private:
+ pqxx::connection &conn;
+ unsigned tournament;
+ FlagTrigger scores_changed;
+ bool valid;
+ std::vector<TextDefer> last_text;
+
+public:
+ Top10ScoreScreen(pqxx::connection &conn, unsigned tournament);
+ virtual ~Top10ScoreScreen();
+
+ bool check_invalidated();
+ void draw(unsigned char *buf);
+};
+
+#endif /* !defined(_TOP10SCORESCREEN_H) */