Kemena3D
Loading...
Searching...
No Matches
kemena::kSystemEvent Struct Reference

Wraps an SDL_Event and provides helper accessors for input polling. More...

#include <kdatatype.h>

Public Member Functions

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.

Public Attributes

SDL_Event event
 Underlying SDL event.
std::vector< unsigned int > keys
 Currently-held key codes.

Detailed Description

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.

Member Function Documentation

◆ getKeyButton()

unsigned int kemena::kSystemEvent::getKeyButton ( )
inline

Returns the key code from the last key event.

Here is the caller graph for this function:

◆ getKeyDown()

bool kemena::kSystemEvent::getKeyDown ( unsigned int key)
inline

Returns true if the given key is currently held down.

Parameters
keyKey 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).
Here is the call graph for this function:

◆ 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.

Member Data Documentation

◆ event

SDL_Event kemena::kSystemEvent::event

Underlying SDL event.

◆ keys

std::vector<unsigned int> kemena::kSystemEvent::keys

Currently-held key codes.


The documentation for this struct was generated from the following file: