about summary refs log tree commit diff stats
path: root/070display.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-04 20:46:50 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-04 20:47:17 -0700
commit57bcdaeefa83bdccc5ea15dd273747b0b50e836a (patch)
tree6e9001a7c764e0585dc5787865e4997d9e2cc9c2 /070display.cc
parent8a965c60280a566f3f82cc5f52d47479aeb6d30d (diff)
downloadmu-57bcdaeefa83bdccc5ea15dd273747b0b50e836a.tar.gz
1705 - change background color
Diffstat (limited to '070display.cc')
-rw-r--r--070display.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/070display.cc b/070display.cc
index a926c1ae..b6e4b9ca 100644
--- a/070display.cc
+++ b/070display.cc
@@ -76,6 +76,21 @@ case PRINT_CHARACTER_TO_DISPLAY: {
 //?   tb_shutdown(); //? 1
 //?   cerr << "AAA " << c << ' ' << (int)'\n' << ' ' << (int)'\r' << '\n'; //? 1
 //?   exit(1); //? 1
+  int color = TB_BLACK;
+  if (SIZE(ingredients) > 1) {
+    assert(scalar(ingredients.at(1)));
+    color = ingredients.at(1).at(0);
+//?     tb_shutdown(); //? 1
+//?     cerr << "AAA " << color << '\n'; //? 1
+//?     exit(1); //? 1
+  }
+  int bg_color = TB_BLACK;
+  if (SIZE(ingredients) > 2) {
+    assert(scalar(ingredients.at(2)));
+    bg_color = ingredients.at(2).at(0);
+    if (bg_color == 0) bg_color = TB_BLACK;
+  }
+  tb_change_cell(Display_column, Display_row, c, color, bg_color);
   if (c == '\n' || c == '\r') {
     if (Display_row < height-1) {
       Display_column = 0;
@@ -87,22 +102,13 @@ case PRINT_CHARACTER_TO_DISPLAY: {
   }
   if (c == '\b') {
     if (Display_column > 0) {
-      tb_change_cell(Display_column-1, Display_row, ' ', TB_WHITE, TB_BLACK);
+      tb_change_cell(Display_column-1, Display_row, ' ', color, bg_color);
       --Display_column;
       tb_set_cursor(Display_column, Display_row);
       if (Autodisplay) tb_present();
     }
     break;
   }
-  int color = TB_BLACK;
-  if (SIZE(ingredients) > 1) {
-    assert(scalar(ingredients.at(1)));
-    color = ingredients.at(1).at(0);
-//?     tb_shutdown(); //? 1
-//?     cerr << "AAA " << color << '\n'; //? 1
-//?     exit(1); //? 1
-  }
-  tb_change_cell(Display_column, Display_row, c, color, TB_BLACK);
   if (Display_column < width-1) {
     ++Display_column;
     tb_set_cursor(Display_column, Display_row);