ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

The SDL event source. More...

#include <sdl-events.h>

Inheritance diagram for SdlEventSource:
Collaboration diagram for SdlEventSource:

List of all members.

Public Member Functions

 SdlEventSource ()
virtual ~SdlEventSource ()
void setGraphicsManager (SdlGraphicsManager *gMan)
virtual bool pollEvent (Common::Event &event)
 Gets and processes SDL events.
void fakeWarpMouse (const int x, const int y)
 Emulates a mouse movement that would normally be caused by a mouse warp of the system mouse.
bool isJoystickConnected () const
 Returns whether a joystick is currently connected.
void setEngineRunning (bool value)
 Sets whether a game is currently running.

Protected Member Functions

void loadGameControllerMappingFile ()
 Search for a game controller db file and load it.
void openJoystick (int joystickIndex)
 Open the SDL joystick with the specified index.
void closeJoystick ()
 Close the currently open joystick if any.
virtual void preprocessEvents (SDL_Event *event)
 Pre process an event before it is dispatched.
virtual bool dispatchSDLEvent (SDL_Event &ev, Common::Event &event)
 Dispatchs SDL events for each handler.
virtual bool processMouseEvent (Common::Event &event, int x, int y, int relx=0, int rely=0)
 Assigns the mouse coords to the mouse event.
virtual bool remapKey (SDL_Event &ev, Common::Event &event)
 Remaps key events.
virtual int mapKey (SDL_Keycode key, SDL_Keymod mod, Uint16 unicode)
 Maps the ASCII value of key.
virtual void SDLModToOSystemKeyFlags (SDL_Keymod mod, Common::Event &event)
 Configures the key modifiers flags status.
Common::KeyCode SDLToOSystemKeycode (const SDL_Keycode key)
 Translates SDL key codes to OSystem key codes.
bool handleResizeEvent (Common::Event &event, int w, int h)
 Notify graphics manager of a resize request.
uint32 obtainUnicode (const SDL_Keysym keySym)
 Extracts unicode information for the specific key sym.
SDL_Keycode obtainKeycode (const SDL_Keysym keySym)
 Extracts the keycode for the specified key sym.
Event Handlers

Handlers for specific SDL events, called by SdlEventSource::dispatchSDLEvent().

This way, if a managers inherits fromt this SDL events manager, it can change the behavior of only a single event, without having to override all of SdlEventSource::dispatchSDLEvent().

virtual bool handleKeyDown (SDL_Event &ev, Common::Event &event)
virtual bool handleKeyUp (SDL_Event &ev, Common::Event &event)
virtual bool handleMouseMotion (SDL_Event &ev, Common::Event &event)
virtual bool handleMouseButtonDown (SDL_Event &ev, Common::Event &event)
virtual bool handleMouseButtonUp (SDL_Event &ev, Common::Event &event)
virtual bool handleSysWMEvent (SDL_Event &ev, Common::Event &event)
virtual int mapSDLJoystickButtonToOSystem (Uint8 sdlButton)
virtual bool handleJoyButtonDown (SDL_Event &ev, Common::Event &event)
virtual bool handleJoyButtonUp (SDL_Event &ev, Common::Event &event)
virtual bool handleJoyAxisMotion (SDL_Event &ev, Common::Event &event)
virtual bool handleJoyHatMotion (SDL_Event &ev, Common::Event &event)

Protected Attributes

bool _scrollLock
 Scroll lock state - since SDL doesn't track it.
bool _engineRunning
int _mouseX
int _mouseY
SDL_Joystick * _joystick
 Joystick.
int _lastScreenID
 Last screen id for checking if it was modified.
SdlGraphicsManager_graphicsManager
 The associated graphics manager.
bool _queuedFakeMouseMove
 Whether _fakeMouseMove contains an event we need to send.
Common::Event _fakeMouseMove
 A fake mouse motion event sent when the graphics manager is told to warp the mouse but the system mouse is unable to be warped (e.g.
uint8 _lastHatPosition

Detailed Description

The SDL event source.

Definition at line 41 of file sdl-events.h.


Constructor & Destructor Documentation

SdlEventSource::SdlEventSource (  ) 

Definition at line 85 of file sdl-events.cpp.

SdlEventSource::~SdlEventSource (  )  [virtual]

Definition at line 110 of file sdl-events.cpp.


Member Function Documentation

void SdlEventSource::closeJoystick (  )  [protected]

Close the currently open joystick if any.

Definition at line 752 of file sdl-events.cpp.

bool SdlEventSource::dispatchSDLEvent ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Dispatchs SDL events for each handler.

Definition at line 452 of file sdl-events.cpp.

void SdlEventSource::fakeWarpMouse ( const int  x,
const int  y 
)

Emulates a mouse movement that would normally be caused by a mouse warp of the system mouse.

Definition at line 943 of file sdl-events.cpp.

bool SdlEventSource::handleJoyAxisMotion ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Reimplemented in ResVmSdlEventSource.

Definition at line 810 of file sdl-events.cpp.

bool SdlEventSource::handleJoyButtonDown ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Reimplemented in ResVmSdlEventSource.

Definition at line 786 of file sdl-events.cpp.

bool SdlEventSource::handleJoyButtonUp ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Reimplemented in ResVmSdlEventSource.

Definition at line 798 of file sdl-events.cpp.

bool SdlEventSource::handleJoyHatMotion ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Definition at line 830 of file sdl-events.cpp.

bool SdlEventSource::handleKeyDown ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Definition at line 619 of file sdl-events.cpp.

bool SdlEventSource::handleKeyUp ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Definition at line 647 of file sdl-events.cpp.

bool SdlEventSource::handleMouseButtonDown ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Reimplemented in ResVmSdlEventSource.

Definition at line 673 of file sdl-events.cpp.

bool SdlEventSource::handleMouseButtonUp ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Reimplemented in ResVmSdlEventSource.

Definition at line 702 of file sdl-events.cpp.

bool SdlEventSource::handleMouseMotion ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Reimplemented in ResVmSdlEventSource.

Definition at line 667 of file sdl-events.cpp.

bool SdlEventSource::handleResizeEvent ( Common::Event event,
int  w,
int  h 
) [protected]

Notify graphics manager of a resize request.

Definition at line 961 of file sdl-events.cpp.

bool SdlEventSource::handleSysWMEvent ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Reimplemented in RISCOSSdlEventSource.

Definition at line 725 of file sdl-events.cpp.

bool SdlEventSource::isJoystickConnected (  )  const

Returns whether a joystick is currently connected.

Definition at line 949 of file sdl-events.cpp.

void SdlEventSource::loadGameControllerMappingFile (  )  [protected]

Search for a game controller db file and load it.

int SdlEventSource::mapKey ( SDL_Keycode  key,
SDL_Keymod  mod,
Uint16  unicode 
) [protected, virtual]

Maps the ASCII value of key.

Definition at line 114 of file sdl-events.cpp.

int SdlEventSource::mapSDLJoystickButtonToOSystem ( Uint8  sdlButton  )  [protected, virtual]

Definition at line 765 of file sdl-events.cpp.

SDL_Keycode SdlEventSource::obtainKeycode ( const SDL_Keysym  keySym  )  [protected]

Extracts the keycode for the specified key sym.

Definition at line 977 of file sdl-events.cpp.

uint32 SdlEventSource::obtainUnicode ( const SDL_Keysym  keySym  )  [protected]

Extracts unicode information for the specific key sym.

May only be used for key down events.

Definition at line 1015 of file sdl-events.cpp.

void SdlEventSource::openJoystick ( int  joystickIndex  )  [protected]

Open the SDL joystick with the specified index.

After this function completes successfully, SDL sends events for the device.

If the joystick is also a SDL game controller, open it as a controller so an extended button mapping can be used.

Definition at line 729 of file sdl-events.cpp.

bool SdlEventSource::pollEvent ( Common::Event event  )  [virtual]

Gets and processes SDL events.

Implements Common::EventSource.

Reimplemented in ResVmSdlEventSource.

Definition at line 416 of file sdl-events.cpp.

virtual void SdlEventSource::preprocessEvents ( SDL_Event *  event  )  [inline, protected, virtual]

Pre process an event before it is dispatched.

Reimplemented in PS3SdlEventSource.

Definition at line 113 of file sdl-events.h.

bool SdlEventSource::processMouseEvent ( Common::Event event,
int  x,
int  y,
int  relx = 0,
int  rely = 0 
) [protected, virtual]

Assigns the mouse coords to the mouse event.

Furthermore notify the graphics manager about the position change. ResidualVM addon: The parameters relx and rely for relative mouse movement are ResidualVM specific

Reimplemented in ResVmSdlEventSource.

Definition at line 182 of file sdl-events.cpp.

bool SdlEventSource::remapKey ( SDL_Event &  ev,
Common::Event event 
) [protected, virtual]

Remaps key events.

This allows platforms to configure their custom keys.

Definition at line 939 of file sdl-events.cpp.

void SdlEventSource::SDLModToOSystemKeyFlags ( SDL_Keymod  mod,
Common::Event event 
) [protected, virtual]

Configures the key modifiers flags status.

Definition at line 196 of file sdl-events.cpp.

Common::KeyCode SdlEventSource::SDLToOSystemKeycode ( const SDL_Keycode  key  )  [protected]

Translates SDL key codes to OSystem key codes.

Definition at line 221 of file sdl-events.cpp.

void SdlEventSource::setEngineRunning ( bool  value  ) 

Sets whether a game is currently running.

Definition at line 957 of file sdl-events.cpp.

void SdlEventSource::setGraphicsManager ( SdlGraphicsManager gMan  )  [inline]

Definition at line 46 of file sdl-events.h.


Member Data Documentation

Definition at line 69 of file sdl-events.h.

A fake mouse motion event sent when the graphics manager is told to warp the mouse but the system mouse is unable to be warped (e.g.

because the window is not focused).

Definition at line 206 of file sdl-events.h.

The associated graphics manager.

Definition at line 88 of file sdl-events.h.

SDL_Joystick* SdlEventSource::_joystick [protected]

Joystick.

Definition at line 75 of file sdl-events.h.

Definition at line 208 of file sdl-events.h.

Last screen id for checking if it was modified.

Definition at line 83 of file sdl-events.h.

int SdlEventSource::_mouseX [protected]

Definition at line 71 of file sdl-events.h.

int SdlEventSource::_mouseY [protected]

Definition at line 72 of file sdl-events.h.

Whether _fakeMouseMove contains an event we need to send.

Definition at line 199 of file sdl-events.h.

bool SdlEventSource::_scrollLock [protected]

Scroll lock state - since SDL doesn't track it.

Definition at line 67 of file sdl-events.h.


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


Generated on Sat Sep 19 2020 05:04:11 for ResidualVM by doxygen 1.7.1
curved edge   curved edge