From cae2b6192bd186ffdfc83ed11db8172bd1a804f5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 19 Feb 2012 21:15:32 +0100 Subject: [PATCH] =?utf8?q?For=20the=20top5/top10=20screens,=20split=20the?= =?utf8?q?=20=E2=80=9Cdata=E2=80=9D=20class.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bigscreen/theme.config | 8 +------- bigscreen/top10scorescreen.cpp | 24 ++++++++++++++---------- bigscreen/top5chosenscreen.cpp | 20 +++++++++++--------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/bigscreen/theme.config b/bigscreen/theme.config index ab01ebb..69ed4f1 100644 --- a/bigscreen/theme.config +++ b/bigscreen/theme.config @@ -36,18 +36,12 @@ freshcolumnheading.blue=0 rowheading.red=255 rowheading.green=255 rowheading.blue=255 -data.red=255 -data.green=255 -data.blue=255 -freshdata.red=255 -freshdata.green=0 -freshdata.blue=0 divider.red=127 divider.green=127 divider.blue=127 # available elements: background.groupscreen, background.top5chosenscreen, background.top10scorescreen, mainheading, (fresh)columnheading, randomsongname, nextsonginfo.player, nextsonginfo.title, nextsonginfo.highscore, need, divider -# available elements that also have .odd and .even: rowheading, (fresh)score, (fresh)chosensongname, (fresh)totalscore, (fresh)rank +# available elements that also have .odd and .even: rowheading, (fresh)score, (fresh)chosensongname, (fresh)totalscore, (fresh)rank, top10scores.(fresh)rowheading, top10scores.(fresh)nick, top10scores.(fresh)songname, top10scores.(fresh)frequency, top5chosensongs.(fresh)rowheading, top5chosensongs.(fresh)songname, top5chosensongs.(fresh)frequency ## How to draw rectangles in the background (up to ten, numbered 0-9): # background.groupscreen.rect1.x0=0 diff --git a/bigscreen/top10scorescreen.cpp b/bigscreen/top10scorescreen.cpp index a024e98..a9a52bf 100644 --- a/bigscreen/top10scorescreen.cpp +++ b/bigscreen/top10scorescreen.cpp @@ -67,31 +67,35 @@ void Top10ScoreScreen::draw(unsigned char *buf, unsigned width, unsigned height) unsigned row = 1, y = 140; for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { char str[16]; - std::string theme_element = "data"; - std::string heading_theme_element = "rowheading"; + std::string heading_theme_element = "top10scores.rowheading"; + std::string nick_theme_element = "top10scores.nick"; + std::string songname_theme_element = "top10scores.songname"; + std::string frequency_theme_element = "top10scores.frequency"; // print new entries in red if (seen_topscore.count(*i) == 0 && seen_topscore.size() > 0) { - theme_element = "freshdata"; - heading_theme_element = "freshrowheading"; + heading_theme_element = "top10scores.freshrowheading"; + nick_theme_element = "top10scores.freshnick"; + songname_theme_element = "top10scores.freshsongname"; + frequency_theme_element = "top10scores.freshfrequency"; } std::sprintf(str, "%u", row++); unsigned width = my_draw_text(str, NULL, 24.0, heading_theme_element); my_draw_text(str, buf, 24.0, heading_theme_element, RANK_X - width/2, y); - my_draw_text(i->nick, buf, 24.0, theme_element, PLAYER_X, y); + my_draw_text(i->nick, buf, 24.0, nick_theme_element, PLAYER_X, y); - if (my_draw_text(i->title, NULL, 24.0, theme_element) > SONG_MAX_WIDTH && + if (my_draw_text(i->title, NULL, 24.0, songname_theme_element) > SONG_MAX_WIDTH && !i->shorttitle.empty()) { - my_draw_text(i->shorttitle, buf, 24.0, theme_element, SONG_X, y); + my_draw_text(i->shorttitle, buf, 24.0, songname_theme_element, SONG_X, y); } else { - my_draw_text(i->title, buf, 24.0, theme_element, SONG_X, y); + my_draw_text(i->title, buf, 24.0, songname_theme_element, SONG_X, y); } std::sprintf(str, "%u", i->score); - width = my_draw_text(str, NULL, 24.0, theme_element); - my_draw_text(str, buf, 24.0, theme_element, SCORE_X - width/2, y); + width = my_draw_text(str, NULL, 24.0, frequency_theme_element); + my_draw_text(str, buf, 24.0, frequency_theme_element, SCORE_X - width/2, y); y += 40; } diff --git a/bigscreen/top5chosenscreen.cpp b/bigscreen/top5chosenscreen.cpp index d63b724..32ca278 100644 --- a/bigscreen/top5chosenscreen.cpp +++ b/bigscreen/top5chosenscreen.cpp @@ -65,28 +65,30 @@ void Top5ChosenScreen::draw(unsigned char *buf, unsigned width, unsigned height) unsigned row = 1, y = 140; for (std::vector::const_iterator i = scores.begin(); i != scores.end(); ++i) { char str[16]; - std::string theme_element = "data"; - std::string heading_theme_element = "rowheading"; + std::string heading_theme_element = "top5chosensongs.rowheading"; + std::string songname_theme_element = "top5chosensongs.songname"; + std::string frequency_theme_element = "top5chosensongs.frequency"; // print new entries in red if (seen_topchosen.count(*i) == 0 && seen_topchosen.size() > 0) { - theme_element = "freshdata"; - heading_theme_element = "freshrowheading"; + heading_theme_element = "top5chosensongs.freshrowheading"; + songname_theme_element = "top5chosensongs.freshsongname"; + frequency_theme_element = "top5chosensongs.freshfrequency"; } std::sprintf(str, "%u", row++); unsigned width = my_draw_text(str, NULL, 24.0, heading_theme_element); my_draw_text(str, buf, 24.0, heading_theme_element, RANK_X - width/2, y); - if (my_draw_text(i->title, NULL, 24.0, theme_element) > SONG_MAX_WIDTH) { - my_draw_text(i->shorttitle, buf, 24.0, theme_element, SONG_X, y); + if (my_draw_text(i->title, NULL, 24.0, songname_theme_element) > SONG_MAX_WIDTH) { + my_draw_text(i->shorttitle, buf, 24.0, songname_theme_element, SONG_X, y); } else { - my_draw_text(i->title, buf, 24.0, theme_element, SONG_X, y); + my_draw_text(i->title, buf, 24.0, songname_theme_element, SONG_X, y); } std::sprintf(str, "%u", i->frequency); - width = my_draw_text(str, NULL, 24.0, theme_element); - my_draw_text(str, buf, 24.0, theme_element, FREQUENCY_X - width/2, y); + width = my_draw_text(str, NULL, 24.0, frequency_theme_element); + my_draw_text(str, buf, 24.0, frequency_theme_element, FREQUENCY_X - width/2, y); y += 40; } -- 2.39.2