瀏覽代碼

Centering scores.

Steve Thielemann 3 年之前
父節點
當前提交
ee28fd52df
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      scores.cpp

+ 8 - 2
scores.cpp

@@ -199,8 +199,14 @@ Scores::Scores(door::Door &d, DBData &dbd) : door{d}, db{dbd} {
 void Scores::display_scores(door::Door &door) {
   if (cls_display_starfield)
     cls_display_starfield();
-  top_scores->set(1, 5);
+
+  int mx = door.width;
+  int my = door.height;
+
+  int padx = (mx - (top_scores->getWidth() + top_this_month->getWidth())) / 3;
+  int pady = (my - (15 + 2)) / 2;
+  top_scores->set(padx, pady);
   door << *top_scores;
-  top_this_month->set(44, 5);
+  top_this_month->set(padx * 2 + top_scores->getWidth(), pady);
   door << *top_this_month << door::reset << door::nl;
 }