import "io/console";
Console provides an advanced access to the console. To use the console it must be activated first.
This gives an exclusive access to the console and changes how it behaves. This is incompatible
with basic functions such as print
and log
and they are therefore disabled
when the console is active. It is highly recommended to use the
set_log_function to implement custom logging.
Due to the historical reasons and a huge variety of various terminal emulators both the printing of various characters outside ASCII and ability to recognize various keys and their modifiers can be limited. What works on one platform or a terminal emulator may not work in another.
Use the global functions to use the console in a simple way.
COLOR_BLACK = 0 (0)
COLOR_DARK_RED = 1 (1)
COLOR_DARK_GREEN = 2 (2)
COLOR_DARK_YELLOW = 3 (3)
COLOR_DARK_BLUE = 4 (4)
COLOR_DARK_MAGENTA = 5 (5)
COLOR_DARK_CYAN = 6 (6)
COLOR_LIGHT_GRAY = 7 (7)
COLOR_DARK_GRAY = 8 (8)
COLOR_RED = 9 (9)
COLOR_GREEN = 10 (A)
COLOR_YELLOW = 11 (B)
COLOR_BLUE = 12 (C)
COLOR_MAGENTA = 13 (D)
COLOR_CYAN = 14 (E)
COLOR_WHITE = 15 (F)
static function is_present(): Boolean
static function set_active(active: Boolean)
static function is_active(): Boolean
static function get_width(): Integer
static function get_height(): Integer
0
when the size can't be determined).
static function clear()
static function put_text(text: String)
static function put_text(text: String, off: Integer, len: Integer)
static function get_cursor(): Integer[]
static function set_cursor(x: Integer, y: Integer)
static function move_cursor(rel_x: Integer, rel_y: Integer)
static function show_cursor()
static function hide_cursor()
static function reset_color()
static function set_color(background: Integer, foreground: Integer)
static function scroll(rel_y: Integer)
static function get_event(): ConsoleEvent
static function get_event(timeout: Integer): ConsoleEvent