curses :: Window :: defaultinit
core :: Pointer :: address_is_null
Is the address behind this Object at NULL?core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
curses :: Window :: defaultinit
core :: Object :: defaultinit
core :: Pointer :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).
# A curse windows
extern class Window `{WINDOW *`}
# Initialize the screen
new `{
WINDOW *res;
res = initscr();
if (res == NULL) {
fprintf(stderr, "Error initialising ncurses.\n");
exit(EXIT_FAILURE);
}
raw();
keypad(res, TRUE);
noecho();
return res;
`}
# Move the cursor at the position (y,x) and print a string
# NOTE: as with the curses API, the position is (y,x)
fun mvaddstr(y,x: Int, str: String) import String.to_cstring `{
char *c_string = String_to_cstring( str );
mvaddstr(y, x, c_string);
`}
# Update the window
fun refresh `{
refresh();
`}
# Clear the entire window so it can be repainted from scratch with a refresh
fun wclear `{
wclear(self);
`}
# Delete the window
fun delwin `{
delwin(self);
`}
# Suspend the curses session and restore the previous terminal
fun endwin `{
endwin();
`}
end
lib/curses/curses.nit:22,1--64,3