8. Mouse support
Display and hide the mouse cursor
By default, the mouse cursor in visible in windowed mode, hidden in fullscreen mode. You can change it with:
static void TCODMouse::showCursor (bool visible)
void TCOD_mouse_show_cursor (bool visible)
mouse_show_cursor (visible)
Parameter | Description |
---|---|
visible | If true, this function turns the mouse cursor on. Else it turns the mouse cursor off. |
Getting the cursor status
You can get the current cursor status (hidden or visible) with:
static bool TCODMouse::isCursorVisible (void)
bool TCOD_mouse_is_cursor_visible (void)
mouse_is_cursor_visible ()
Setting the mouse cursor's position
You can set the cursor position (in pixel coordinates, where [0,0] is the window's top left corner) with:
static void TCODMouse::move (int x, int y)
void TCOD_mouse_move (int x, int y)
mouse_move (x, y)
Parameter | Description |
---|---|
x,y | New coordinates of the mouse cursor in pixels. |
Get the last known mouse cursor position
This function is only valid, and only returns updated values, after you have called event-related functions. Whether to check for events, or wait for events. It does not provide the actual mouse position at the time the call is made.
static TCOD_mouse_t TCODMouse::getStatus ()
void TCOD_mouse_get_status ()
mouse_get_status ()