Wraps an SDL_Event and provides helper accessors for input polling.
More...
#include <kdatatype.h>
|
| SDL_Event * | getSdlEvent () |
| | Returns a pointer to the internal SDL_Event.
|
| bool | hasEvent () |
| | Polls one event from the SDL queue.
|
| unsigned int | getType () |
| | Returns the event type and maintains the held-key list.
|
| unsigned int | getMouseButton () |
| | Returns the mouse button index from the last button event.
|
| float | getMouseX () |
| | Returns the X position from the last mouse-button event.
|
| float | getMouseY () |
| | Returns the Y position from the last mouse-button event.
|
| float | getMouseMoveX () |
| | Returns the absolute X position from the last motion event.
|
| float | getMouseMoveY () |
| | Returns the absolute Y position from the last motion event.
|
| unsigned int | getKeyButton () |
| | Returns the key code from the last key event.
|
| bool | getKeyDown (unsigned int key) |
| | Returns true if the given key is currently held down.
|
| float | getMouseWheelX () |
| | Returns horizontal scroll delta from the last wheel event.
|
| float | getMouseWheelY () |
| | Returns vertical scroll delta from the last wheel event.
|
|
| SDL_Event | event |
| | Underlying SDL event.
|
| std::vector< unsigned int > | keys |
| | Currently-held key codes.
|
Wraps an SDL_Event and provides helper accessors for input polling.
Pass one of these to your main loop and call hasEvent() each frame to drain the SDL event queue. Key state (which keys are currently held) is tracked automatically inside the struct.
◆ getKeyButton()
| unsigned int kemena::kSystemEvent::getKeyButton |
( |
| ) |
|
|
inline |
Returns the key code from the last key event.
◆ getKeyDown()
| bool kemena::kSystemEvent::getKeyDown |
( |
unsigned int | key | ) |
|
|
inline |
Returns true if the given key is currently held down.
- Parameters
-
| key | Key code to test (use K_KEY_* constants). |
◆ getMouseButton()
| unsigned int kemena::kSystemEvent::getMouseButton |
( |
| ) |
|
|
inline |
Returns the mouse button index from the last button event.
◆ getMouseMoveX()
| float kemena::kSystemEvent::getMouseMoveX |
( |
| ) |
|
|
inline |
Returns the absolute X position from the last motion event.
◆ getMouseMoveY()
| float kemena::kSystemEvent::getMouseMoveY |
( |
| ) |
|
|
inline |
Returns the absolute Y position from the last motion event.
◆ getMouseWheelX()
| float kemena::kSystemEvent::getMouseWheelX |
( |
| ) |
|
|
inline |
Returns horizontal scroll delta from the last wheel event.
◆ getMouseWheelY()
| float kemena::kSystemEvent::getMouseWheelY |
( |
| ) |
|
|
inline |
Returns vertical scroll delta from the last wheel event.
◆ getMouseX()
| float kemena::kSystemEvent::getMouseX |
( |
| ) |
|
|
inline |
Returns the X position from the last mouse-button event.
◆ getMouseY()
| float kemena::kSystemEvent::getMouseY |
( |
| ) |
|
|
inline |
Returns the Y position from the last mouse-button event.
◆ getSdlEvent()
| SDL_Event * kemena::kSystemEvent::getSdlEvent |
( |
| ) |
|
|
inline |
Returns a pointer to the internal SDL_Event.
◆ getType()
| unsigned int kemena::kSystemEvent::getType |
( |
| ) |
|
|
inline |
Returns the event type and maintains the held-key list.
- Returns
- SDL event type value (matches K_EVENT_* constants).
◆ hasEvent()
| bool kemena::kSystemEvent::hasEvent |
( |
| ) |
|
|
inline |
Polls one event from the SDL queue.
- Returns
- true if an event was available, false if the queue was empty.
◆ event
| SDL_Event kemena::kSystemEvent::event |
◆ keys
| std::vector<unsigned int> kemena::kSystemEvent::keys |
Currently-held key codes.
The documentation for this struct was generated from the following file: