OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
SDLUtil::InputWrapper Class Reference

A wrapper around SDL's event queue, mostly used for handling input-related events. More...

#include <sdlinputwrapper.hpp>

Collaboration diagram for SDLUtil::InputWrapper:

Public Member Functions

 InputWrapper (SDL_Window *window, osg::ref_ptr< osgViewer::Viewer > viewer, bool grab)
 
 ~InputWrapper ()
 
void setMouseEventCallback (MouseListener *listen)
 
void setKeyboardEventCallback (KeyListener *listen)
 
void setWindowEventCallback (WindowListener *listen)
 
void setControllerEventCallback (ControllerListener *listen)
 
void capture (bool windowEventsOnly)
 
bool isModifierHeld (SDL_Keymod mod)
 
bool isKeyDown (SDL_Scancode key)
 
void setMouseVisible (bool visible)
 
void setMouseRelative (bool relative)
 Set the mouse to relative positioning. Doesn't move the cursor and disables mouse acceleration. More...
 
bool getMouseRelative ()
 
void setGrabPointer (bool grab)
 Locks the pointer to the window. More...
 
OIS::KeyCode sdl2OISKeyCode (SDL_Keycode code)
 
void warpMouse (int x, int y)
 Moves the mouse to the specified point within the viewport. More...
 
void updateMouseSettings ()
 

Private Types

typedef std::map< SDL_Keycode,
OIS::KeyCode
KeyMap
 

Private Member Functions

void handleWindowEvent (const SDL_Event &evt)
 
bool _handleWarpMotion (const SDL_MouseMotionEvent &evt)
 Internal method for ignoring relative motions as a side effect of warpMouse() More...
 
void _wrapMousePointer (const SDL_MouseMotionEvent &evt)
 Wrap the mouse to the viewport. More...
 
MouseMotionEvent _packageMouseMotion (const SDL_Event &evt)
 Package mouse and mousewheel motions into a single event. More...
 
void _setupOISKeys ()
 

Private Attributes

SDL_Window * mSDLWindow
 
osg::ref_ptr< osgViewer::Viewer > mViewer
 
MouseListenermMouseListener
 
KeyListenermKeyboardListener
 
WindowListenermWindowListener
 
ControllerListenermConListener
 
KeyMap mKeyMap
 
Uint16 mWarpX
 
Uint16 mWarpY
 
bool mWarpCompensate
 
bool mWrapPointer
 
bool mAllowGrab
 
bool mWantMouseVisible
 
bool mWantGrab
 
bool mWantRelative
 
bool mGrabPointer
 
bool mMouseRelative
 
bool mFirstMouseMove
 
Sint32 mMouseZ
 
Sint32 mMouseX
 
Sint32 mMouseY
 
bool mWindowHasFocus
 
bool mMouseInWindow
 

Detailed Description

A wrapper around SDL's event queue, mostly used for handling input-related events.

Member Typedef Documentation

typedef std::map<SDL_Keycode, OIS::KeyCode> SDLUtil::InputWrapper::KeyMap
private

Constructor & Destructor Documentation

SDLUtil::InputWrapper::InputWrapper ( SDL_Window *  window,
osg::ref_ptr< osgViewer::Viewer >  viewer,
bool  grab 
)

Here is the call graph for this function:

SDLUtil::InputWrapper::~InputWrapper ( )

Member Function Documentation

bool SDLUtil::InputWrapper::_handleWarpMotion ( const SDL_MouseMotionEvent evt)
private

Internal method for ignoring relative motions as a side effect of warpMouse()

Here is the caller graph for this function:

MouseMotionEvent SDLUtil::InputWrapper::_packageMouseMotion ( const SDL_Event &  evt)
private

Package mouse and mousewheel motions into a single event.

Here is the caller graph for this function:

void SDLUtil::InputWrapper::_setupOISKeys ( )
private

Here is the caller graph for this function:

void SDLUtil::InputWrapper::_wrapMousePointer ( const SDL_MouseMotionEvent evt)
private

Wrap the mouse to the viewport.

Here is the call graph for this function:

Here is the caller graph for this function:

void SDLUtil::InputWrapper::capture ( bool  windowEventsOnly)

Here is the call graph for this function:

Here is the caller graph for this function:

bool SDLUtil::InputWrapper::getMouseRelative ( )
inline

Here is the caller graph for this function:

void SDLUtil::InputWrapper::handleWindowEvent ( const SDL_Event &  evt)
private

Here is the call graph for this function:

Here is the caller graph for this function:

bool SDLUtil::InputWrapper::isKeyDown ( SDL_Scancode  key)
bool SDLUtil::InputWrapper::isModifierHeld ( SDL_Keymod  mod)
OIS::KeyCode SDLUtil::InputWrapper::sdl2OISKeyCode ( SDL_Keycode  code)

Here is the caller graph for this function:

void SDLUtil::InputWrapper::setControllerEventCallback ( ControllerListener listen)
inline

Here is the caller graph for this function:

void SDLUtil::InputWrapper::setGrabPointer ( bool  grab)

Locks the pointer to the window.

Here is the call graph for this function:

Here is the caller graph for this function:

void SDLUtil::InputWrapper::setKeyboardEventCallback ( KeyListener listen)
inline

Here is the caller graph for this function:

void SDLUtil::InputWrapper::setMouseEventCallback ( MouseListener listen)
inline

Here is the caller graph for this function:

void SDLUtil::InputWrapper::setMouseRelative ( bool  relative)

Set the mouse to relative positioning. Doesn't move the cursor and disables mouse acceleration.

Here is the call graph for this function:

Here is the caller graph for this function:

void SDLUtil::InputWrapper::setMouseVisible ( bool  visible)

Here is the call graph for this function:

Here is the caller graph for this function:

void SDLUtil::InputWrapper::setWindowEventCallback ( WindowListener listen)
inline

Here is the caller graph for this function:

void SDLUtil::InputWrapper::updateMouseSettings ( )

Here is the caller graph for this function:

void SDLUtil::InputWrapper::warpMouse ( int  x,
int  y 
)

Moves the mouse to the specified point within the viewport.

Here is the caller graph for this function:

Member Data Documentation

bool SDLUtil::InputWrapper::mAllowGrab
private
ControllerListener* SDLUtil::InputWrapper::mConListener
private
bool SDLUtil::InputWrapper::mFirstMouseMove
private
bool SDLUtil::InputWrapper::mGrabPointer
private
KeyListener* SDLUtil::InputWrapper::mKeyboardListener
private
KeyMap SDLUtil::InputWrapper::mKeyMap
private
bool SDLUtil::InputWrapper::mMouseInWindow
private
MouseListener* SDLUtil::InputWrapper::mMouseListener
private
bool SDLUtil::InputWrapper::mMouseRelative
private
Sint32 SDLUtil::InputWrapper::mMouseX
private
Sint32 SDLUtil::InputWrapper::mMouseY
private
Sint32 SDLUtil::InputWrapper::mMouseZ
private
SDL_Window* SDLUtil::InputWrapper::mSDLWindow
private
osg::ref_ptr<osgViewer::Viewer> SDLUtil::InputWrapper::mViewer
private
bool SDLUtil::InputWrapper::mWantGrab
private
bool SDLUtil::InputWrapper::mWantMouseVisible
private
bool SDLUtil::InputWrapper::mWantRelative
private
bool SDLUtil::InputWrapper::mWarpCompensate
private
Uint16 SDLUtil::InputWrapper::mWarpX
private
Uint16 SDLUtil::InputWrapper::mWarpY
private
bool SDLUtil::InputWrapper::mWindowHasFocus
private
WindowListener* SDLUtil::InputWrapper::mWindowListener
private
bool SDLUtil::InputWrapper::mWrapPointer
private

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