abstract class Novika::Capabilities::IConsole
- Novika::Capabilities::IConsole
- Reference
- Object
Overview
Enables the console API.
Exposed vocabulary:
console:on
, implemented by#on
console:off
, implemented by#off
console:256
, implemented by#colors_256
console:compat
, implemented by#colors_compat
console:truecolor
, implemented by#colors_truecolor
console:readKey
, implemented by#read_key
console:size
, implemented by#size
console:hadKeyPressed?
, implemented by#had_key_pressed?
console:hadCtrlPressed?
, implemented by#had_ctrl_pressed?
console:hadAltPressed?
, implemented by#had_alt_pressed?
console:hadShiftPressed?
, implemented by#had_shift_pressed?
console:hadBackspacePressed?
, implemented by#had_backspace_pressed?
console:hadFnPressed?
, implemented by#had_fn_pressed?
console:hadInsertPressed?
, implemented by#had_insert_pressed?
console:hadDeletePressed?
, implemented by#had_delete_pressed?
console:hadHomePressed?
, implemented by#had_home_pressed?
console:hadEndPressed?
, implemented by#had_end_pressed?
console:hadPgupPressed?
, implemented by#had_pgup_pressed?
console:hadPgdnPressed?
, implemented by#had_pgdn_pressed?
console:hadLeftPressed?
, implemented by#had_left_pressed?
console:hadRightPressed?
, implemented by#had_right_pressed?
console:hadUpPressed?
, implemented by#had_up_pressed?
console:hadDownPressed?
, implemented by#had_down_pressed?
console:getCharPressed
, implemented by#get_char_pressed
console:change
, implemented bychange
console:appendEcho
, implemented by#append_echo
console:present
, implemented by#present
console:clear
, implemented by#clear
Included Modules
Extended Modules
Defined in:
novika/capabilities/console.crConstant Summary
-
BG_DEFAULT =
Color.new(Decimal.new(0), Decimal.new(0), Decimal.new(0))
-
Background color used when there is no user-provided background color.
-
FG_DEFAULT =
Color.new(Decimal.new(255), Decimal.new(255), Decimal.new(255))
-
Foreground color used when there is no user-provided foreground color.
Class Method Summary
Instance Method Summary
-
#append_echo(engine, x : Decimal, y : Decimal, fg : Color, bg : Color, quote : Quote)
Appends echo of quote colorized with fg and bg colors at the given x and y position (in columns, rows).
-
#bg
Returns the active primary background color.
-
#clear(engine, fg : Color, bg : Color)
Clears the console with fg and bg colors.
-
#colors_256(engine)
Enables the 256-color output mode.
-
#colors_compat(engine)
Enables the compatibility color (8-color) output mode.
-
#colors_truecolor(engine)
Enables the truecolor output mode.
-
#fg
Returns the active primary foreground color.
-
#get_char_pressed(engine) : Quote
Returns char quote for the key that was pressed.
-
#had_alt_pressed?(engine) : Boolean
Returns whether the ALT key was pressed.
-
#had_backspace_pressed?(engine) : Boolean
Returns whether the Backspace key was pressed.
-
#had_char_pressed?(engine) : Boolean
Returns whether EXCLUSIVELY a printable character key was pressed (no CTRL, ALT, etc.) Whether the SHIFT key was pressed or not is ignored.
-
#had_ctrl_pressed?(engine) : Boolean
Returns whether the CTRL key was pressed.
-
#had_delete_pressed?(engine) : Boolean
Returns whether the DELETE key was pressed.
-
#had_down_pressed?(engine) : Boolean
Returns whether the DOWN ARROW key was pressed.
-
#had_end_pressed?(engine) : Boolean
Returns whether the END key was pressed.
-
#had_fn_pressed?(engine) : Boolean
Returns whether one of the function keys F1-F12 was pressed.
-
#had_home_pressed?(engine) : Boolean
Returns whether the HOME key was pressed.
-
#had_insert_pressed?(engine) : Boolean
Returns whether the INSERT key was pressed.
-
#had_key_pressed?(engine) : Boolean
Returns whether any key was pressed.
-
#had_left_pressed?(engine) : Boolean
Returns whether the LEFT ARROW key was pressed.
-
#had_pgdn_pressed?(engine) : Boolean
Returns whether the PAGE DOWN key was pressed.
-
#had_pgup_pressed?(engine) : Boolean
Returns whether the PAGE UP key was pressed.
-
#had_right_pressed?(engine) : Boolean
Returns whether the RIGHT ARROW key was pressed.
-
#had_shift_pressed?(engine) : Boolean
Returns whether the SHIFT key was pressed.
-
#had_up_pressed?(engine) : Boolean
Returns whether the UP ARROW key was pressed.
- #inject(into target)
-
#off(engine)
Disables the Console API.
-
#on(engine)
Enables the Console API.
-
#present(engine)
Syncs the internal buffer with console.
-
#read_key(engine, timeout : Decimal)
Peeks or waits for input.
-
#size(engine) : Tuple(Decimal, Decimal)
Returns the console width (in columns) and height (in rows).
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
Class Method Detail
Instance Method Detail
Appends echo of quote colorized with fg and bg colors at the given x and y position (in columns, rows).
Clears the console with fg and bg colors.
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.
Returns whether the ALT key was pressed.
Returns whether the Backspace key was pressed.
Returns whether EXCLUSIVELY a printable character key was pressed (no CTRL, ALT, etc.) Whether the SHIFT key was pressed or not is ignored.
Returns whether the CTRL key was pressed.
Returns whether the DELETE key was pressed.
Returns whether the DOWN ARROW key was pressed.
Returns whether the END key was pressed.
Returns whether one of the function keys F1-F12 was pressed.
Returns whether the HOME key was pressed.
Returns whether the INSERT key was pressed.
Returns whether any key was pressed.
Returns whether the LEFT ARROW key was pressed.
Returns whether the PAGE DOWN key was pressed.
Returns whether the PAGE UP key was pressed.
Returns whether the RIGHT ARROW key was pressed.
Returns whether the SHIFT key was pressed.
Returns whether the UP ARROW key was pressed.
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.
Returns the console width (in columns) and height (in rows).