diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-04-28 21:28:34 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-04-28 21:28:34 -0700 |
commit | 0012c7037f63bf9a0195ba493448bc16f01655cd (patch) | |
tree | bff6784c7d39b711e4bdcb646350d502b88ef739 | |
parent | 9636c7ae2417a32831123c4f4ae3900c0a0bea16 (diff) | |
download | mu-0012c7037f63bf9a0195ba493448bc16f01655cd.tar.gz |
1215 - relative motions for cursor
-rw-r--r-- | cpp/070display.cc | 48 | ||||
-rw-r--r-- | cpp/display.mu | 8 |
2 files changed, 56 insertions, 0 deletions
diff --git a/cpp/070display.cc b/cpp/070display.cc index bf2ff85f..6a94cec9 100644 --- a/cpp/070display.cc +++ b/cpp/070display.cc @@ -110,6 +110,54 @@ case MOVE_CURSOR_ON_DISPLAY: { break; } +:(before "End Primitive Recipe Declarations") +MOVE_CURSOR_DOWN_ON_DISPLAY, +:(before "End Primitive Recipe Numbers") +Recipe_number["move-cursor-down-on-display"] = MOVE_CURSOR_DOWN_ON_DISPLAY; +:(before "End Primitive Recipe Implementations") +case MOVE_CURSOR_DOWN_ON_DISPLAY: { + Display_row++; + tb_set_cursor(Display_column, Display_row); + tb_present(); + break; +} + +:(before "End Primitive Recipe Declarations") +MOVE_CURSOR_UP_ON_DISPLAY, +:(before "End Primitive Recipe Numbers") +Recipe_number["move-cursor-up-on-display"] = MOVE_CURSOR_UP_ON_DISPLAY; +:(before "End Primitive Recipe Implementations") +case MOVE_CURSOR_UP_ON_DISPLAY: { + Display_row--; + tb_set_cursor(Display_column, Display_row); + tb_present(); + break; +} + +:(before "End Primitive Recipe Declarations") +MOVE_CURSOR_RIGHT_ON_DISPLAY, +:(before "End Primitive Recipe Numbers") +Recipe_number["move-cursor-right-on-display"] = MOVE_CURSOR_RIGHT_ON_DISPLAY; +:(before "End Primitive Recipe Implementations") +case MOVE_CURSOR_RIGHT_ON_DISPLAY: { + Display_column++; + tb_set_cursor(Display_column, Display_row); + tb_present(); + break; +} + +:(before "End Primitive Recipe Declarations") +MOVE_CURSOR_LEFT_ON_DISPLAY, +:(before "End Primitive Recipe Numbers") +Recipe_number["move-cursor-left-on-display"] = MOVE_CURSOR_LEFT_ON_DISPLAY; +:(before "End Primitive Recipe Implementations") +case MOVE_CURSOR_LEFT_ON_DISPLAY: { + Display_column--; + tb_set_cursor(Display_column, Display_row); + tb_present(); + break; +} + //:: Keyboard management :(before "End Primitive Recipe Declarations") diff --git a/cpp/display.mu b/cpp/display.mu index 1b472e7e..2891f91d 100644 --- a/cpp/display.mu +++ b/cpp/display.mu @@ -10,5 +10,13 @@ recipe main [ move-cursor-on-display 0:literal, 0:literal clear-line-on-display wait-for-key-from-keyboard + move-cursor-down-on-display + wait-for-key-from-keyboard + move-cursor-right-on-display + wait-for-key-from-keyboard + move-cursor-left-on-display + wait-for-key-from-keyboard + move-cursor-up-on-display + wait-for-key-from-keyboard return-to-console ] |