Procházet zdrojové kódy

Fixed scores (no month top score). Fixed colors.

Steve Thielemann před 3 roky
rodič
revize
93a39671c9
2 změnil soubory, kde provedl 24 přidání a 20 odebrání
  1. 11 4
      deck.cpp
  2. 13 16
      scores.cpp

+ 11 - 4
deck.cpp

@@ -1112,14 +1112,16 @@ door::Panel make_about(void) {
   library.
 
    */
+  door::ANSIColor c_color =
+      door::ANSIColor(door::COLOR::WHITE, door::COLOR::BLUE, door::ATTR::BOLD);
   about.addLine(
-      std::make_unique<door::Line>(SPACEACE " v" SPACEACE_VERSION, W));
+      std::make_unique<door::Line>(SPACEACE " v" SPACEACE_VERSION, W, c_color));
   std::string copyright = SPACEACE_COPYRIGHT;
   if (door::unicode) {
     replace(copyright, "(C)", "\u00a9");
   }
 
-  about.addLine(std::make_unique<door::Line>(copyright, W));
+  about.addLine(std::make_unique<door::Line>(copyright, W, c_color));
   about.addLine(std::make_unique<door::Line>("", W));
   about.addLine(
       std::make_unique<door::Line>("This door was written by Bugz.", W));
@@ -1158,13 +1160,18 @@ door::Panel make_help(void) {
   The more cards in your streak, the more points you earn.
 
    */
-  help.addLine(std::make_unique<door::Line>(SPACEACE " v" SPACEACE_VERSION, W));
+
+  door::ANSIColor c_color =
+      door::ANSIColor(door::COLOR::WHITE, door::COLOR::BLUE, door::ATTR::BOLD);
+
+  help.addLine(
+      std::make_unique<door::Line>(SPACEACE " v" SPACEACE_VERSION, W, c_color));
   std::string copyright = SPACEACE_COPYRIGHT;
   if (door::unicode) {
     replace(copyright, "(C)", "\u00a9");
   }
 
-  help.addLine(std::make_unique<door::Line>(copyright, W));
+  help.addLine(std::make_unique<door::Line>(copyright, W, c_color));
   help.addLine(std::make_unique<door::Line>("", W));
   help.addLine(std::make_unique<door::Line>(
       "Use Left/Right arrow keys, or 4/6 keys to move marker.", W));

+ 13 - 16
scores.cpp

@@ -27,11 +27,7 @@ std::unique_ptr<door::Panel> Scores::make_top_scores_panel() {
   door::ANSIColor panel_color =
       door::ANSIColor(door::COLOR::CYAN, panel_bg); //, door::ATTR::BOLD);
   door::ANSIColor heading_color = panel_color;
-  heading_color.setFg(door::COLOR::WHITE, door::ATTR::BOLD);
-  // door::ANSIColor(door::COLOR::WHITE, panel_bg, door::ATTR::BOLD);
-  door::ANSIColor spacer_color = panel_color;
-  spacer_color.setFg(door::COLOR::YELLOW, door::ATTR::BOLD);
-  // door::ANSIColor(door::COLOR::YELLOW, panel_bg, door::ATTR::BOLD);
+  heading_color.setFg(door::COLOR::GREEN, door::ATTR::BOLD);
 
   std::unique_ptr<door::Panel> p = std::make_unique<door::Panel>(W);
   p->setStyle(door::BorderStyle::DOUBLE);
@@ -43,14 +39,16 @@ std::unique_ptr<door::Panel> Scores::make_top_scores_panel() {
   p->addLine(std::move(heading));
 
   std::unique_ptr<door::Line> spacer = p->spacer_line(false);
-  spacer->setColor(spacer_color);
   p->addLine(std::move(spacer));
 
   auto monthly_scores = db.getMonthlyScores(15);
   if (monthly_scores.empty()) {
     // No Monthly Scores
+    door::ANSIColor nny_color =
+        door::ANSIColor(door::COLOR::YELLOW, panel_bg, door::ATTR::BOLD);
+
     std::unique_ptr<door::Line> heading =
-        std::make_unique<door::Line>("No, Not Yet!", W, heading_color);
+        std::make_unique<door::Line>("No, Not Yet!", W, nny_color);
     // heading->setColor(heading_color);
     p->addLine(std::move(heading));
   }
@@ -110,12 +108,9 @@ std::unique_ptr<door::Panel> Scores::make_top_scores_panel() {
 std::unique_ptr<door::Panel> Scores::make_top_this_month_panel() {
   const int W = 30;
   door::COLOR panel_bg = door::COLOR::BLUE;
-  door::ANSIColor panel_color =
-      door::ANSIColor(door::COLOR::CYAN, panel_bg); // , door::ATTR::BOLD);
+  door::ANSIColor panel_color = door::ANSIColor(door::COLOR::CYAN, panel_bg);
   door::ANSIColor heading_color =
-      door::ANSIColor(door::COLOR::WHITE, panel_bg, door::ATTR::BOLD);
-  door::ANSIColor spacer_color =
-      door::ANSIColor(door::COLOR::YELLOW, panel_bg, door::ATTR::BOLD);
+      door::ANSIColor(door::COLOR::GREEN, panel_bg, door::ATTR::BOLD);
 
   std::unique_ptr<door::Panel> p = std::make_unique<door::Panel>(W);
   p->setStyle(door::BorderStyle::DOUBLE);
@@ -135,14 +130,15 @@ std::unique_ptr<door::Panel> Scores::make_top_this_month_panel() {
   p->addLine(std::move(heading));
 
   std::unique_ptr<door::Line> spacer = p->spacer_line(false);
-  spacer->setColor(spacer_color);
   p->addLine(std::move(spacer));
 
   auto monthly_scores = db.getScores(15);
   if (monthly_scores.empty()) {
     // No Monthly Scores
+    door::ANSIColor nny_color =
+        door::ANSIColor(door::COLOR::YELLOW, panel_bg, door::ATTR::BOLD);
     std::unique_ptr<door::Line> heading =
-        std::make_unique<door::Line>("No, Not Yet!", W, heading_color);
+        std::make_unique<door::Line>("No, Not Yet!", W, nny_color);
     // heading->setColor(heading_color);
     p->addLine(std::move(heading));
   }
@@ -214,7 +210,8 @@ void Scores::display_scores(door::Door &door) {
   int padx = (mx - (top_scores->getWidth() + top_this_month->getWidth())) / 3;
   int pady = (my - h) / 2;
   top_scores->set(padx, pady);
-  door << *top_scores;
+  // display top_this_month, then top_scores.
+  // This gives the press a key prompt a good place to be.
   top_this_month->set(padx * 2 + top_scores->getWidth(), pady);
-  door << *top_this_month << door::reset << door::nl;
+  door << *top_this_month << *top_scores << door::reset << door::nl;
 }