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.

Classes

struct  KbdMouse

Public Member Functions

 SdlEventSource ()
virtual ~SdlEventSource ()
void setGraphicsManager (SdlGraphicsManager *gMan)
virtual bool pollEvent (Common::Event &event)
 Gets and processes SDL events.
virtual void resetKeyboardEmulation (int16 x_max, int16 y_max)
 Resets keyboard emulation after a video screen change.
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.

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 handleAxisToMouseMotion (int16 xAxis, int16 yAxis)
 Update the virtual mouse according to a joystick or game controller axis position change.
int16 computeJoystickMouseSpeedFactor () const
 Compute the virtual mouse movement speed factor according to the 'kbdmouse_speed' setting.
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 (SDLKey key, SDLMod mod, Uint16 unicode)
 Maps the ASCII value of key.
virtual void SDLModToOSystemKeyFlags (SDLMod mod, Common::Event &event)
 Configures the key modifiers flags status.
Common::KeyCode SDLToOSystemKeycode (const SDLKey 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.
SDLKey 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 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 void updateKbdMouse ()
virtual bool handleKbdMouse (Common::Event &event)

Protected Attributes

bool _scrollLock
 Scroll lock state - since SDL doesn't track it.
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.
Keyboard mouse emulation

Disabled by fingolfin 2004-12-18.

I am keeping the rest of the code in for now, since the joystick code (or rather, "hack") uses it, too.

KbdMouse _km

Detailed Description

The SDL event source.

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


Constructor & Destructor Documentation

SdlEventSource::SdlEventSource (  ) 

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

SdlEventSource::~SdlEventSource (  )  [virtual]

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


Member Function Documentation

void SdlEventSource::closeJoystick (  )  [protected]

Close the currently open joystick if any.

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

int16 SdlEventSource::computeJoystickMouseSpeedFactor (  )  const [protected]

Compute the virtual mouse movement speed factor according to the 'kbdmouse_speed' setting.

The speed factor is scaled with the display size.

Definition at line 314 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 565 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 1169 of file sdl-events.cpp.

bool SdlEventSource::handleAxisToMouseMotion ( int16  xAxis,
int16  yAxis 
) [protected, virtual]

Update the virtual mouse according to a joystick or game controller axis position change.

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

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

Reimplemented in ResVmSdlEventSource.

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

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

Reimplemented in ResVmSdlEventSource.

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

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

Reimplemented in ResVmSdlEventSource.

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

bool SdlEventSource::handleKbdMouse ( Common::Event event  )  [protected, virtual]

Reimplemented in ResVmSdlEventSource.

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

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

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

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

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

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

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

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

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

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

Definition at line 810 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 1175 of file sdl-events.cpp.

void SdlEventSource::loadGameControllerMappingFile (  )  [protected]

Search for a game controller db file and load it.

int SdlEventSource::mapKey ( SDLKey  key,
SDLMod  mod,
Uint16  unicode 
) [protected, virtual]

Maps the ASCII value of key.

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

SDLKey SdlEventSource::obtainKeycode ( const SDL_keysym  keySym  )  [protected]

Extracts the keycode for the specified key sym.

Definition at line 1191 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 1229 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 864 of file sdl-events.cpp.

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

Gets and processes SDL events.

Implements Common::EventSource.

Definition at line 524 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 119 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 Residual specific

Definition at line 201 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 1155 of file sdl-events.cpp.

void SdlEventSource::resetKeyboardEmulation ( int16  x_max,
int16  y_max 
) [virtual]

Resets keyboard emulation after a video screen change.

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

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

Configures the key modifiers flags status.

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

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

Translates SDL key codes to OSystem key codes.

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

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

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

void SdlEventSource::updateKbdMouse (  )  [protected, virtual]

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


Member Data Documentation

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 221 of file sdl-events.h.

The associated graphics manager.

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

SDL_Joystick* SdlEventSource::_joystick [protected]

Joystick.

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

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

Last screen id for checking if it was modified.

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

Whether _fakeMouseMove contains an event we need to send.

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

bool SdlEventSource::_scrollLock [protected]

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

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


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


Generated on Sat Jan 12 2019 05:03:25 for ResidualVM by doxygen 1.7.1
curved edge   curved edge