gramods
Loading...
Searching...
No Matches
Public Member Functions | List of all members
gramods::gmTouch::SDLEventAdaptor Class Reference

Event adaptor for SDL2, providing means to input events into TouchState. More...

#include <SDLEventAdaptor.hh>

Inheritance diagram for gramods::gmTouch::SDLEventAdaptor:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmTouch::SDLEventAdaptor:
Collaboration graph
[legend]

Public Member Functions

void init (int width, int height) override
 Called by the owner (TouchState) when eventsInit is called.
 
void done () override
 Called by the owner (TouchState) when eventsDone is called.
 
void handleEvent (const SDL_Event &event)
 Updates the internal touch states based on the provided event.
 

Additional Inherited Members

- Protected Member Functions inherited from gramods::gmTouch::TouchState::EventAdaptor
void addTouchState (TouchPointId id, float x, float y)
 Adds a touch point sample.
 
void removeTouchState (TouchPointId id, float x, float y)
 Removes the touch point with the specified id.
 
void addMouseState (float x, float y, bool mouse_down)
 Add the specified mouse state.
 
void addMouseWheel (float s)
 Sets the wheel value, positive up and negative down.
 

Detailed Description

Event adaptor for SDL2, providing means to input events into TouchState.

Typical use:

int width, height;
SDL_GetWindowSize(sdl_window, &width, &height);
touchState.eventsInit(width, height);
SDL_Event event;
while(SDL_PollEvent(&event)) {
touchState.getEventAdaptor<gmTouch::SDLEventAdaptor>().handleEvent(event);
}
touchState.eventsDone();
Event adaptor for SDL2, providing means to input events into TouchState.
Definition SDLEventAdaptor.hh:34
void handleEvent(const SDL_Event &event)
Updates the internal touch states based on the provided event.
Definition SDLEventAdaptor.cpp:15

Member Function Documentation

◆ done()

void gramods::gmTouch::SDLEventAdaptor::done ( )
overridevirtual

Called by the owner (TouchState) when eventsDone is called.

Reimplemented from gramods::gmTouch::TouchState::EventAdaptor.

◆ handleEvent()

void gramods::gmTouch::SDLEventAdaptor::handleEvent ( const SDL_Event &  event)

Updates the internal touch states based on the provided event.

Call this once for each incoming event and finish with a call to eventsDone.

◆ init()

void gramods::gmTouch::SDLEventAdaptor::init ( int  width,
int  height 
)
overridevirtual

Called by the owner (TouchState) when eventsInit is called.

Reimplemented from gramods::gmTouch::TouchState::EventAdaptor.


The documentation for this class was generated from the following files: