From 6cf5f0348c59d9e8e4d740572b5bfbaa74b9bf56 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 19 Feb 2005 22:49:06 +0000 Subject: [PATCH] Actually show a total for each player. --- bigscreen/fetch_group.cpp | 1 + bigscreen/groupscreen.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/bigscreen/fetch_group.cpp b/bigscreen/fetch_group.cpp index bdaa0c9..75e458a 100644 --- a/bigscreen/fetch_group.cpp +++ b/bigscreen/fetch_group.cpp @@ -52,6 +52,7 @@ void FetchGroup::operator() (pqxx::transaction<> &t) sc.score = -1; } else { sc.score = i["score"].as(sc.score); + curr_group.players[curr_group.players.size() - 1].total += sc.score; } curr_group.players[curr_group.players.size() - 1].scores.push_back(sc); diff --git a/bigscreen/groupscreen.cpp b/bigscreen/groupscreen.cpp index 5f16ebf..26d769a 100644 --- a/bigscreen/groupscreen.cpp +++ b/bigscreen/groupscreen.cpp @@ -123,6 +123,16 @@ void GroupScreen::draw(unsigned char *buf) x += width[col] + 20; } + // draw total + { + char text[16]; + sprintf(text, "%u", i->total); + + unsigned this_width = my_draw_text(text, NULL, 22.0); + my_draw_text(text, buf, 22.0, x + width[num_scores + 1] / 2 - this_width / 2, y); + x += width[num_scores + 1] + 20; + } + y += 40; } -- 2.39.2