about summary refs log tree commit diff stats
path: root/070display.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-25 09:31:08 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-25 09:31:08 -0700
commit596490f46834f99c35bc42f6c5878ccee19b7c63 (patch)
tree46e3c8a4b730d7a4d0c0301c2b79724216f91da6 /070display.cc
parent48bb86278826a08e2550f2c49e695167fb137957 (diff)
downloadmu-596490f46834f99c35bc42f6c5878ccee19b7c63.tar.gz
1656 - smooth refresh done
Had to take control of tb_present() after all. Termbox was wise.
Diffstat (limited to '070display.cc')
-rw-r--r--070display.cc40
1 files changed, 31 insertions, 9 deletions
diff --git a/070display.cc b/070display.cc
index db205d63..477552a0 100644
--- a/070display.cc
+++ b/070display.cc
@@ -8,6 +8,7 @@
 
 :(before "End Globals")
 long long int Display_row = 0, Display_column = 0;
+bool Autodisplay = true;
 
 :(before "End Primitive Recipe Declarations")
 OPEN_CONSOLE,
@@ -57,7 +58,7 @@ case CLEAR_LINE_ON_DISPLAY: {
     tb_change_cell(x, Display_row, ' ', TB_WHITE, TB_BLACK);
   }
   tb_set_cursor(Display_column, Display_row);
-  tb_present();
+  if (Autodisplay) tb_present();
   break;
 }
 
@@ -80,7 +81,7 @@ case PRINT_CHARACTER_TO_DISPLAY: {
       Display_column = 0;
       ++Display_row;
       tb_set_cursor(Display_column, Display_row);
-      tb_present();
+      if (Autodisplay) tb_present();
     }
     break;
   }
@@ -89,7 +90,7 @@ case PRINT_CHARACTER_TO_DISPLAY: {
       tb_change_cell(Display_column-1, Display_row, ' ', TB_WHITE, TB_BLACK);
       --Display_column;
       tb_set_cursor(Display_column, Display_row);
-      tb_present();
+      if (Autodisplay) tb_present();
     }
     break;
   }
@@ -106,7 +107,7 @@ case PRINT_CHARACTER_TO_DISPLAY: {
     ++Display_column;
     tb_set_cursor(Display_column, Display_row);
   }
-  tb_present();
+  if (Autodisplay) tb_present();
   break;
 }
 
@@ -133,7 +134,7 @@ case MOVE_CURSOR_ON_DISPLAY: {
   assert(scalar(ingredients.at(1)));
   Display_column = ingredients.at(1).at(0);
   tb_set_cursor(Display_column, Display_row);
-  tb_present();
+  if (Autodisplay) tb_present();
   break;
 }
 
@@ -148,7 +149,7 @@ case MOVE_CURSOR_DOWN_ON_DISPLAY: {
   if (Display_row < height-1) {
     Display_row++;
     tb_set_cursor(Display_column, Display_row);
-    tb_present();
+    if (Autodisplay) tb_present();
   }
   break;
 }
@@ -162,7 +163,7 @@ case MOVE_CURSOR_UP_ON_DISPLAY: {
   if (Display_row > 0) {
     Display_row--;
     tb_set_cursor(Display_column, Display_row);
-    tb_present();
+    if (Autodisplay) tb_present();
   }
   break;
 }
@@ -178,7 +179,7 @@ case MOVE_CURSOR_RIGHT_ON_DISPLAY: {
   if (Display_column < width-1) {
     Display_column++;
     tb_set_cursor(Display_column, Display_row);
-    tb_present();
+    if (Autodisplay) tb_present();
   }
   break;
 }
@@ -192,7 +193,7 @@ case MOVE_CURSOR_LEFT_ON_DISPLAY: {
   if (Display_column > 0) {
     Display_column--;
     tb_set_cursor(Display_column, Display_row);
-    tb_present();
+    if (Autodisplay) tb_present();
   }
   break;
 }
@@ -239,6 +240,27 @@ case SHOW_CURSOR_ON_DISPLAY: {
   break;
 }
 
+:(before "End Primitive Recipe Declarations")
+HIDE_DISPLAY,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["hide-display"] = HIDE_DISPLAY;
+:(before "End Primitive Recipe Implementations")
+case HIDE_DISPLAY: {
+  Autodisplay = false;
+  break;
+}
+
+:(before "End Primitive Recipe Declarations")
+SHOW_DISPLAY,
+:(before "End Primitive Recipe Numbers")
+Recipe_number["show-display"] = SHOW_DISPLAY;
+:(before "End Primitive Recipe Implementations")
+case SHOW_DISPLAY: {
+  Autodisplay = true;
+  tb_present();
+  break;
+}
+
 //:: Keyboard/mouse management
 
 :(before "End Primitive Recipe Declarations")