X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=bigscreen%2Fgroupscreen.cpp;h=222db2331cb02268990c1b9131f540b9ea6fee94;hp=8d408ec50358b56db1f560f425ebbbd938f9da21;hb=9c22e166f4d25f2d80766de9baab56efd9d952b0;hpb=0b3bb271ac40b5f8bcfc5a417d4423e92c4483b1;ds=sidebyside diff --git a/bigscreen/groupscreen.cpp b/bigscreen/groupscreen.cpp index 8d408ec..222db23 100644 --- a/bigscreen/groupscreen.cpp +++ b/bigscreen/groupscreen.cpp @@ -2,6 +2,7 @@ #include #include +#include "resolution.h" #include "groupscreen.h" #include "fetch_group.h" #include "fetch_max_score_for_songs.h" @@ -53,7 +54,7 @@ void GroupScreen::draw(unsigned char *buf) conn.perform(FetchGroup(tournament, round, parallel, &group)); gettimeofday(&last_updated, NULL); - memset(buf, 0, 800 * 600 * 4); + memset(buf, 0, SCREEN_WIDTH * SCREEN_HEIGHT * 4); // main heading char heading[64]; @@ -73,7 +74,7 @@ void GroupScreen::draw(unsigned char *buf) { unsigned width = my_draw_text(heading, NULL, 40.0); - my_draw_text_deferred(td, heading, 40.0, 800/2 - width/2, 60); + my_draw_text_deferred(td, heading, 40.0, SCREEN_WIDTH/2 - width/2, 60); } // Find out how wide each column has to be. First try unlimited width (ie. @@ -346,11 +347,11 @@ void GroupScreen::draw(unsigned char *buf) if (next_song != NULL) { widestring text = widestring("Next player: ") + next_player->nick; unsigned this_width = my_draw_text(text, NULL, 24.0); - my_draw_text(text, buf, 24.0, 400 - this_width/2, 420); + my_draw_text(text, buf, 24.0, (SCREEN_WIDTH/2) - this_width/2, 420); if (next_song->song.id != -1) { this_width = my_draw_text(next_song->song.title, NULL, 20.0); - my_draw_text(next_song->song.title, buf, 20.0, 400 - this_width/2, 457); + my_draw_text(next_song->song.title, buf, 20.0, (SCREEN_WIDTH/2) - this_width/2, 457); Highscore hs; conn.perform(FetchHighscore(next_song->song.id, &hs)); @@ -359,7 +360,7 @@ void GroupScreen::draw(unsigned char *buf) text = widestring("High score: ") + widestring(pqxx::to_string(hs.score)) + widestring(", by ") + hs.nick + widestring(" in ") + hs.tournament_name; this_width = my_draw_text(text, NULL, 16.0); - my_draw_text(text, buf, 16.0, 400 - this_width/2, 487); + my_draw_text(text, buf, 16.0, (SCREEN_WIDTH/2) - this_width/2, 487); } } @@ -456,7 +457,7 @@ void GroupScreen::draw(unsigned char *buf) if (lead_need > 0) { text = widestring("Needs to lead: ") + widestring(pqxx::to_string(lead_need)); this_width = my_draw_text(text, NULL, 18.0); - my_draw_text(text, buf, 18.0, 400 - this_width/2, y); + my_draw_text(text, buf, 18.0, (SCREEN_WIDTH/2) - this_width/2, y); y += 30; } @@ -469,7 +470,7 @@ void GroupScreen::draw(unsigned char *buf) text = widestring("Needs to win: ") + widestring(pqxx::to_string(win_need)); this_width = my_draw_text(text, NULL, 18.0); - my_draw_text(text, buf, 18.0, 400 - this_width/2, y); + my_draw_text(text, buf, 18.0, (SCREEN_WIDTH/2) - this_width/2, y); y += 30; } @@ -488,7 +489,7 @@ void GroupScreen::draw(unsigned char *buf) } this_width = my_draw_text(text, NULL, 18.0); - my_draw_text(text, buf, 18.0, 400 - this_width/2, y); + my_draw_text(text, buf, 18.0, (SCREEN_WIDTH/2) - this_width/2, y); y += 30; }