1111 - start adding ncurses primitives
This commit is contained in:
parent
07efdfd707
commit
54d48b25a0
34
cpp/070console
Normal file
34
cpp/070console
Normal file
|
@ -0,0 +1,34 @@
|
|||
//: Text-mode cursor primitives. Currently thin wrappers around ncurses calls.
|
||||
|
||||
:(before "End Includes")
|
||||
#include<ncurses.h>
|
||||
|
||||
:(before "End Primitive Recipe Declarations")
|
||||
CONSOLE_MODE,
|
||||
:(before "End Primitive Recipe Numbers")
|
||||
Recipe_number["console-mode"] = CONSOLE_MODE;
|
||||
:(before "End Primitive Recipe Implementations")
|
||||
case CONSOLE_MODE: {
|
||||
initscr();
|
||||
break;
|
||||
}
|
||||
|
||||
:(before "End Primitive Recipe Declarations")
|
||||
RETRO_MODE,
|
||||
:(before "End Primitive Recipe Numbers")
|
||||
Recipe_number["retro-mode"] = RETRO_MODE;
|
||||
:(before "End Primitive Recipe Implementations")
|
||||
case RETRO_MODE: {
|
||||
endwin();
|
||||
break;
|
||||
}
|
||||
|
||||
:(before "End Primitive Recipe Declarations")
|
||||
WAIT_FOR_KEY,
|
||||
:(before "End Primitive Recipe Numbers")
|
||||
Recipe_number["wait-for-key"] = WAIT_FOR_KEY;
|
||||
:(before "End Primitive Recipe Implementations")
|
||||
case WAIT_FOR_KEY: {
|
||||
getch();
|
||||
break;
|
||||
}
|
5
cpp/console.mu
Normal file
5
cpp/console.mu
Normal file
|
@ -0,0 +1,5 @@
|
|||
recipe main [
|
||||
console-mode 0:literal/screen
|
||||
wait-for-key
|
||||
retro-mode 0:literal/screen
|
||||
]
|
|
@ -1,5 +1,5 @@
|
|||
mu: makefile enumerate/enumerate tangle/tangle mu.cc
|
||||
g++ -g -Wall -Wextra -fno-strict-aliasing mu.cc -o mu
|
||||
g++ -g -Wall -Wextra -fno-strict-aliasing mu.cc -lncurses -o mu
|
||||
|
||||
# To see what the program looks like after all layers have been applied, read
|
||||
# mu.cc
|
||||
|
|
Loading…
Reference in New Issue
Block a user