Skip to content

os_events

BlidDev edited this page Jan 9, 2024 · 3 revisions

Overview:

Aside from traditional std::cin style user input shown in input_and_output, Niv offers a way to check immidate keyboard key presses.


handle_input

usage example:

handle_input

Desc:

When graphics are initilized: Refreshes the graphics window (i.e. make it respond to OS GUI input like the X button); Refreshes the pressed-keys buffer.

When graphics are not initilized: Only refreshes the key-pressed buffer.

Return value: Retruns true if the graphics window should close, otherwise (and when graphics aren't initilized) false.

For more complex examples check one of the graphical examples in the examples folder.


key_pressed

usage example:

// template
key_pressed key

// specific use
singleif (key_pressed Delete) = true (print "Delete\n")

Args:

  • key: STR or CHAR

Desc:

Checks if the specified key is pressed. The key name has got to be listed in the following page. Returns true if it's pressed.

Return value: BOOL.

For more complex examples check one of the graphical examples in the examples folder.

Clone this wiki locally