Topaz 5.0
Topaz Game Engine
Loading...
Searching...
No Matches

Description

Retrieve keyboard/mouse input.

Function Documentation

◆ install_char_typed_callback()

tz::error_code tz::os::install_char_typed_callback ( char_type_callback callback)

Install a callback which will be invoked whenever the user types a character on the keyboard.

Parameters
callbackPointer to a function which will be called whenever a character is typed. If you pass nullptr, the callback will safely be ignored.
Returns
- error_code::precondition_failure if a window has not yet been opened.

◆ is_key_pressed()

bool tz::os::is_key_pressed ( key k)

Query as to whether a specific key is pressed right now.

Parameters
kKeyboard key to query
Returns
True if the given key is currently pressed, otherwise false.

◆ get_mouse_position()

std::pair< unsigned int, unsigned int > tz::os::get_mouse_position ( )

Retrieve the mouse cursor's current position, in pixels, relative to the top-left of the window.

If for whatever reason the cursor pos cannot be retrieved, {-1, -1} is returned. Some reasons could include:

  • You haven't opened a window via open_window.
  • The mouse currently lies outside of the window.

Enumeration Type Documentation

◆ key

enum class tz::os::key
strong

Represents a key on your keyboard.