X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=bigscreen%2Fgroupscreen.cpp;h=6639f4c057db0a83494ebe10e5c07963d9c1656e;hb=d4ec885cadcbcce077579bdd24c93ead18b06852;hp=b2a63159540810fcd1f3d6be6202fc3b44d735e2;hpb=b96dfdd47d90850d85715651e765e14f0f65d560;p=ccbs diff --git a/bigscreen/groupscreen.cpp b/bigscreen/groupscreen.cpp index b2a6315..6639f4c 100644 --- a/bigscreen/groupscreen.cpp +++ b/bigscreen/groupscreen.cpp @@ -3,6 +3,7 @@ #include #include +#include "design.h" #include "resolution.h" #include "groupscreen.h" #include "fetch_group.h" @@ -27,13 +28,12 @@ bool GroupScreen::check_invalidated() return true; if (!scores_changed.get_flag()) return false; + scores_changed.reset_flag(); bool needs_update; conn.perform(FetchNeedsUpdate(last_updated, tournament, round, parallel, &needs_update)); - if (!needs_update) - scores_changed.reset_flag(); - + valid = !needs_update; return needs_update; } @@ -61,7 +61,7 @@ void GroupScreen::draw_main_heading(std::vector &td) } unsigned width = my_draw_text(heading, NULL, 40.0); - my_draw_text_deferred(td, heading, 40.0, LOGICAL_SCREEN_WIDTH/2 - width/2, 60); + my_draw_text_deferred(td, heading, 40.0, LOGICAL_SCREEN_WIDTH/2 - width/2, 60, MAIN_HEADING_RED, MAIN_HEADING_GREEN, MAIN_HEADING_BLUE); } // make column headings from the first player's songs @@ -74,16 +74,16 @@ void GroupScreen::draw_column_headings(std::vector &td, const Group & for (std::vector::const_iterator i = group.players[0].scores.begin(); i != group.players[0].scores.end(); ++i, ++col) { if (!i->chosen) { unsigned this_width = my_draw_text(i->song.short_title, NULL, 12.0); - my_draw_text_deferred(td, i->song.short_title, 12.0, x + colwidth[col] / 2 - this_width / 2, 100); + my_draw_text_deferred(td, i->song.short_title, 12.0, x + colwidth[col] / 2 - this_width / 2, 100, COLUMN_HEADING_RED, COLUMN_HEADING_GREEN, COLUMN_HEADING_BLUE); } x += colwidth[col] + 20; } if (num_scores > 1) { - my_draw_text_deferred(td, "Total", 12.0, x + colwidth[num_scores + 1] / 2 - my_draw_text("Total", NULL, 12.0) / 2, 100); + my_draw_text_deferred(td, "Total", 12.0, x + colwidth[num_scores + 1] / 2 - my_draw_text("Total", NULL, 12.0) / 2, 100, COLUMN_HEADING_RED, COLUMN_HEADING_GREEN, COLUMN_HEADING_BLUE); x += colwidth[num_scores + 1] + 20; } - my_draw_text_deferred(td, "Rank", 12.0, x + colwidth[num_scores + 2] / 2 - my_draw_text("Rank", NULL, 12.0) / 2, 100); + my_draw_text_deferred(td, "Rank", 12.0, x + colwidth[num_scores + 2] / 2 - my_draw_text("Rank", NULL, 12.0) / 2, 100, COLUMN_HEADING_RED, COLUMN_HEADING_GREEN, COLUMN_HEADING_BLUE); } // show all the players and the scores @@ -101,7 +101,7 @@ void GroupScreen::draw_scores(std::vector &td, const Group &group, un if (m-1 < min_player) continue; - my_draw_text_deferred(td, i->nick, 18.0, 20, y); + my_draw_text_deferred(td, i->nick, 18.0, 20, y, ROW_HEADING_RED, ROW_HEADING_GREEN, ROW_HEADING_BLUE); x = 40 + colwidth[0]; @@ -198,7 +198,7 @@ void GroupScreen::find_column_widths(const Group &group, std::vector & for (unsigned i = 0; i <= num_scores + 2; ++i) sumcolwidth += colwidth[i] + 20; - if (sumcolwidth < 780) + if (sumcolwidth < LOGICAL_SCREEN_WIDTH - 20) break; if (mode == 0) { @@ -210,7 +210,7 @@ void GroupScreen::find_column_widths(const Group &group, std::vector & * If we have space to go, distribute as much as we can to the chosen song column, so we won't have * total and rank jumping around. */ - if (sumcolwidth < 780) { + if (sumcolwidth < LOGICAL_SCREEN_WIDTH - 20) { int first_chosen_col = -1; unsigned col = 1; @@ -222,7 +222,7 @@ void GroupScreen::find_column_widths(const Group &group, std::vector & } if (first_chosen_col != -1) { - colwidth[first_chosen_col] += 780 - sumcolwidth; + colwidth[first_chosen_col] += LOGICAL_SCREEN_WIDTH - 20 - sumcolwidth; } } } @@ -602,7 +602,13 @@ void GroupScreen::draw(unsigned char *buf, unsigned width, unsigned height) conn.perform(FetchGroup(tournament, round, parallel, &group)); gettimeofday(&last_updated, NULL); - memset(buf, 0, width * height * 4); + unsigned char *ptr = buf; + for (unsigned i = 0; i < width * height; ++i) { + *ptr++ = BACKGROUND_BLUE; + *ptr++ = BACKGROUND_GREEN; + *ptr++ = BACKGROUND_RED; + *ptr++ = 0; + } std::vector colwidth;