class Novika::Capabilities::Impl::Console

Defined in:

novika/capabilities/impl/console.cr

Instance Method Summary

Instance methods inherited from class Novika::Capabilities::IConsole

append_echo(engine, x : Decimal, y : Decimal, fg : Color, bg : Color, quote : Quote) append_echo, bg bg, clear(engine, fg : Color, bg : Color) clear, colors_256(engine) colors_256, colors_compat(engine) colors_compat, colors_truecolor(engine) colors_truecolor, fg fg, get_char_pressed(engine) : Quote get_char_pressed, had_alt_pressed?(engine) : Boolean had_alt_pressed?, had_backspace_pressed?(engine) : Boolean had_backspace_pressed?, had_char_pressed?(engine) : Boolean had_char_pressed?, had_ctrl_pressed?(engine) : Boolean had_ctrl_pressed?, had_delete_pressed?(engine) : Boolean had_delete_pressed?, had_down_pressed?(engine) : Boolean had_down_pressed?, had_end_pressed?(engine) : Boolean had_end_pressed?, had_fn_pressed?(engine) : Boolean had_fn_pressed?, had_home_pressed?(engine) : Boolean had_home_pressed?, had_insert_pressed?(engine) : Boolean had_insert_pressed?, had_key_pressed?(engine) : Boolean had_key_pressed?, had_left_pressed?(engine) : Boolean had_left_pressed?, had_pgdn_pressed?(engine) : Boolean had_pgdn_pressed?, had_pgup_pressed?(engine) : Boolean had_pgup_pressed?, had_right_pressed?(engine) : Boolean had_right_pressed?, had_shift_pressed?(engine) : Boolean had_shift_pressed?, had_up_pressed?(engine) : Boolean had_up_pressed?, inject(into target) inject, off(engine) off, on(engine) on, present(engine) present, read_key(engine, timeout : Decimal) read_key, size(engine) : Tuple(Decimal, Decimal) size

Class methods inherited from class Novika::Capabilities::IConsole

id : String id, on_by_default? : Bool on_by_default?, purpose : String purpose

Instance methods inherited from module Novika::ICapability

capabilities : CapabilityCollection capabilities, inject(into target : Block) inject

Constructor methods inherited from module Novika::ICapability

new(capabilities) new

Instance Method Detail

def append_echo(engine, x : Decimal, y : Decimal, fg : Color, bg : Color, quote : Quote) #
Description copied from class Novika::Capabilities::IConsole

Appends echo of quote colorized with fg and bg colors at the given x and y position (in columns, rows).


def change(engine, x : Decimal, y : Decimal, fg : Color, bg : Color) #

def clear(engine, fg : Color, bg : Color) #
Description copied from class Novika::Capabilities::IConsole

Clears the console with fg and bg colors.


def colors_256(engine) #
Description copied from class Novika::Capabilities::IConsole

Enables the 256-color output mode.


def colors_compat(engine) #
Description copied from class Novika::Capabilities::IConsole

Enables the compatibility color (8-color) output mode.


def colors_truecolor(engine) #
Description copied from class Novika::Capabilities::IConsole

Enables the truecolor output mode.


def get_char_pressed(engine) : Quote #
Description copied from class Novika::Capabilities::IConsole

Returns char quote for the key that was pressed. Usually a lowercase or uppercase letter; but also may look like '\\n' or '\\t', etc.)

In case the key that was pressed cannot be represented by the means of a quote, or if the user did not press any key, an empty quote is returned.


def had_alt_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the ALT key was pressed.


def had_backspace_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the Backspace key was pressed.


def had_char_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether EXCLUSIVELY a printable character key was pressed (no CTRL, ALT, etc.) Whether the SHIFT key was pressed or not is ignored.


def had_ctrl_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the CTRL key was pressed.


def had_delete_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the DELETE key was pressed.


def had_down_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the DOWN ARROW key was pressed.


def had_end_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the END key was pressed.


def had_fn_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether one of the function keys F1-F12 was pressed.


def had_home_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the HOME key was pressed.


def had_insert_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the INSERT key was pressed.


def had_key_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether any key was pressed.


def had_left_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the LEFT ARROW key was pressed.


def had_pgdn_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the PAGE DOWN key was pressed.


def had_pgup_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the PAGE UP key was pressed.


def had_right_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the RIGHT ARROW key was pressed.


def had_shift_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the SHIFT key was pressed.


def had_up_pressed?(engine) : Boolean #
Description copied from class Novika::Capabilities::IConsole

Returns whether the UP ARROW key was pressed.


def off(engine) #
Description copied from class Novika::Capabilities::IConsole

Disables the Console API.


def on(engine) #
Description copied from class Novika::Capabilities::IConsole

Enables the Console API.


def present(engine) #
Description copied from class Novika::Capabilities::IConsole

Syncs the internal buffer with console.


def read_key(engine, timeout : Decimal) #
Description copied from class Novika::Capabilities::IConsole

Peeks or waits for input. Refreshes the input state.

  • Negative timeout must wait indefinitely for input, and after receiving input refresh the state.

  • Zero timeout must refresh the input state without waiting for input.

  • Positive timeout must wait for input in a window timeout milliseconds long, and refresh the input state after receiving input.


def size(engine) : Tuple(Decimal, Decimal) #
Description copied from class Novika::Capabilities::IConsole

Returns the console width (in columns) and height (in rows).