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
MWInput::InputManager Class Reference

Class that handles all input and key bindings for OpenMW. More...

#include <inputmanagerimp.hpp>

Inheritance diagram for MWInput::InputManager:
Collaboration diagram for MWInput::InputManager:

Public Member Functions

 InputManager (SDL_Window *window, osg::ref_ptr< osgViewer::Viewer > viewer, osg::ref_ptr< osgViewer::ScreenCaptureHandler > screenCaptureHandler, osgViewer::ScreenCaptureHandler::CaptureOperation *screenCaptureOperation, const std::string &userFile, bool userFileExists, const std::string &controllerBindingsFile, bool grab)
 
virtual ~InputManager ()
 
virtual bool isWindowVisible ()
 
virtual void clear ()
 Clear all savegame-specific data. More...
 
virtual void update (float dt, bool disableControls=false, bool disableEvents=false)
 
void setPlayer (MWWorld::Player *player)
 
virtual void changeInputMode (bool guiMode)
 
virtual void processChangedSettings (const Settings::CategorySettingVector &changed)
 
virtual void setDragDrop (bool dragDrop)
 
virtual void toggleControlSwitch (const std::string &sw, bool value)
 
virtual bool getControlSwitch (const std::string &sw)
 
virtual std::string getActionDescription (int action)
 
virtual std::string getActionKeyBindingName (int action)
 
virtual std::string getActionControllerBindingName (int action)
 
virtual int getNumActions ()
 
virtual std::vector< intgetActionKeySorting ()
 Actions available for binding to keyboard buttons. More...
 
virtual std::vector< intgetActionControllerSorting ()
 Actions available for binding to controller buttons. More...
 
virtual void enableDetectingBindingMode (int action, bool keyboard)
 If keyboard is true, only pay attention to keyboard events. If false, only pay attention to controller events (excluding esc) More...
 
virtual void resetToDefaultKeyBindings ()
 
virtual void resetToDefaultControllerBindings ()
 
virtual bool joystickLastUsed ()
 
virtual void keyPressed (const SDL_KeyboardEvent &arg)
 
virtual void keyReleased (const SDL_KeyboardEvent &arg)
 
virtual void textInput (const SDL_TextInputEvent &arg)
 
virtual void mousePressed (const SDL_MouseButtonEvent &arg, Uint8 id)
 
virtual void mouseReleased (const SDL_MouseButtonEvent &arg, Uint8 id)
 
virtual void mouseMoved (const SDLUtil::MouseMotionEvent &arg)
 
virtual void buttonPressed (int deviceID, const SDL_ControllerButtonEvent &arg)
 
virtual void buttonReleased (int deviceID, const SDL_ControllerButtonEvent &arg)
 
virtual void axisMoved (int deviceID, const SDL_ControllerAxisEvent &arg)
 
virtual void controllerAdded (int deviceID, const SDL_ControllerDeviceEvent &arg)
 
virtual void controllerRemoved (const SDL_ControllerDeviceEvent &arg)
 
virtual void windowVisibilityChange (bool visible)
 
virtual void windowFocusChange (bool have_focus)
 
virtual void windowResized (int x, int y)
 
virtual void windowClosed ()
 
virtual void channelChanged (ICS::Channel *channel, float currentValue, float previousValue)
 
virtual void mouseAxisBindingDetected (ICS::InputControlSystem *ICS, ICS::Control *control, ICS::InputControlSystem::NamedAxis axis, ICS::Control::ControlChangingDirection direction)
 
virtual void keyBindingDetected (ICS::InputControlSystem *ICS, ICS::Control *control, SDL_Scancode key, ICS::Control::ControlChangingDirection direction)
 
virtual void mouseButtonBindingDetected (ICS::InputControlSystem *ICS, ICS::Control *control, unsigned int button, ICS::Control::ControlChangingDirection direction)
 
virtual void joystickAxisBindingDetected (ICS::InputControlSystem *ICS, int deviceID, ICS::Control *control, int axis, ICS::Control::ControlChangingDirection direction)
 
virtual void joystickButtonBindingDetected (ICS::InputControlSystem *ICS, int deviceID, ICS::Control *control, unsigned int button, ICS::Control::ControlChangingDirection direction)
 
void clearAllKeyBindings (ICS::Control *control)
 
void clearAllControllerBindings (ICS::Control *control)
 
virtual int countSavedGameRecords () const
 
virtual void write (ESM::ESMWriter &writer, Loading::Listener &progress)
 
virtual void readRecord (ESM::ESMReader &reader, uint32_t type)
 
- Public Member Functions inherited from MWBase::InputManager
 InputManager ()
 
virtual void processChangedSettings (const std::set< std::pair< std::string, std::string > > &changed)=0
 
- Public Member Functions inherited from SDLUtil::KeyListener
virtual ~KeyListener ()
 
- Public Member Functions inherited from SDLUtil::MouseListener
virtual ~MouseListener ()
 
- Public Member Functions inherited from SDLUtil::WindowListener
virtual ~WindowListener ()
 
- Public Member Functions inherited from SDLUtil::ControllerListener
virtual ~ControllerListener ()
 

Private Types

enum  Actions {
  A_GameMenu, A_Unused, A_Screenshot, A_Inventory,
  A_Console, A_MoveLeft, A_MoveRight, A_MoveForward,
  A_MoveBackward, A_Activate, A_Use, A_Jump,
  A_AutoMove, A_Rest, A_Journal, A_Weapon,
  A_Spell, A_Run, A_CycleSpellLeft, A_CycleSpellRight,
  A_CycleWeaponLeft, A_CycleWeaponRight, A_ToggleSneak, A_AlwaysRun,
  A_Sneak, A_QuickSave, A_QuickLoad, A_QuickMenu,
  A_ToggleWeapon, A_ToggleSpell, A_TogglePOV, A_QuickKey1,
  A_QuickKey2, A_QuickKey3, A_QuickKey4, A_QuickKey5,
  A_QuickKey6, A_QuickKey7, A_QuickKey8, A_QuickKey9,
  A_QuickKey10, A_QuickKeysMenu, A_ToggleHUD, A_ToggleDebug,
  A_LookUpDown, A_LookLeftRight, A_MoveForwardBackward, A_MoveLeftRight,
  A_Last
}
 

Private Member Functions

void convertMousePosForMyGUI (int &x, int &y)
 
MyGUI::MouseButton sdlButtonToMyGUI (Uint8 button)
 
virtual std::string sdlControllerAxisToString (int axis)
 
virtual std::string sdlControllerButtonToString (int button)
 
void resetIdleTime ()
 
void updateIdleTime (float dt)
 
void setPlayerControlsEnabled (bool enabled)
 
void handleGuiArrowKey (int action)
 
void updateCursorMode ()
 
bool checkAllowedToUseItems () const
 
void toggleMainMenu ()
 
void toggleSpell ()
 
void toggleWeapon ()
 
void toggleInventory ()
 
void toggleConsole ()
 
void screenshot ()
 
void toggleJournal ()
 
void activate ()
 
void toggleWalking ()
 
void toggleSneaking ()
 
void toggleAutoMove ()
 
void rest ()
 
void quickLoad ()
 
void quickSave ()
 
void quickKey (int index)
 
void showQuickKeysMenu ()
 
bool actionIsActive (int id)
 
void loadKeyDefaults (bool force=false)
 
void loadControllerDefaults (bool force=false)
 

Private Attributes

SDL_Window * mWindow
 
bool mWindowVisible
 
osg::ref_ptr< osgViewer::Viewer > mViewer
 
osg::ref_ptr
< osgViewer::ScreenCaptureHandler > 
mScreenCaptureHandler
 
osgViewer::ScreenCaptureHandler::CaptureOperationmScreenCaptureOperation
 
bool mJoystickLastUsed
 
MWWorld::PlayermPlayer
 
ICS::InputControlSystem * mInputBinder
 
SDLUtil::InputWrappermInputManager
 
SDLUtil::VideoWrappermVideoWrapper
 
std::string mUserFile
 
bool mDragDrop
 
bool mGrabCursor
 
bool mInvertY
 
bool mControlsDisabled
 
float mCameraSensitivity
 
float mCameraYMultiplier
 
float mPreviewPOVDelay
 
float mTimeIdle
 
bool mMouseLookEnabled
 
bool mGuiCursorEnabled
 
bool mDetectingKeyboard
 
float mOverencumberedMessageDelay
 
float mGuiCursorX
 
float mGuiCursorY
 
int mMouseWheel
 
bool mUserFileExists
 
bool mAlwaysRunActive
 
bool mSneakToggles
 
bool mSneaking
 
bool mAttemptJump
 
std::map< std::string, boolmControlSwitch
 
float mInvUiScalingFactor
 
int mFakeDeviceID
 

Detailed Description

Class that handles all input and key bindings for OpenMW.

Member Enumeration Documentation

Enumerator
A_GameMenu 
A_Unused 
A_Screenshot 
A_Inventory 
A_Console 
A_MoveLeft 
A_MoveRight 
A_MoveForward 
A_MoveBackward 
A_Activate 
A_Use 
A_Jump 
A_AutoMove 
A_Rest 
A_Journal 
A_Weapon 
A_Spell 
A_Run 
A_CycleSpellLeft 
A_CycleSpellRight 
A_CycleWeaponLeft 
A_CycleWeaponRight 
A_ToggleSneak 
A_AlwaysRun 
A_Sneak 
A_QuickSave 
A_QuickLoad 
A_QuickMenu 
A_ToggleWeapon 
A_ToggleSpell 
A_TogglePOV 
A_QuickKey1 
A_QuickKey2 
A_QuickKey3 
A_QuickKey4 
A_QuickKey5 
A_QuickKey6 
A_QuickKey7 
A_QuickKey8 
A_QuickKey9 
A_QuickKey10 
A_QuickKeysMenu 
A_ToggleHUD 
A_ToggleDebug 
A_LookUpDown 
A_LookLeftRight 
A_MoveForwardBackward 
A_MoveLeftRight 
A_Last 

Constructor & Destructor Documentation

MWInput::InputManager::InputManager ( SDL_Window *  window,
osg::ref_ptr< osgViewer::Viewer >  viewer,
osg::ref_ptr< osgViewer::ScreenCaptureHandler >  screenCaptureHandler,
osgViewer::ScreenCaptureHandler::CaptureOperation screenCaptureOperation,
const std::string &  userFile,
bool  userFileExists,
const std::string &  controllerBindingsFile,
bool  grab 
)

Here is the call graph for this function:

MWInput::InputManager::~InputManager ( )
virtual

Reimplemented from MWBase::InputManager.

Member Function Documentation

bool MWInput::InputManager::actionIsActive ( int  id)
private

Here is the caller graph for this function:

void MWInput::InputManager::activate ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::axisMoved ( int  deviceID,
const SDL_ControllerAxisEvent &  arg 
)
virtual
Remarks
Joystick axis moved event

Implements SDLUtil::ControllerListener.

void MWInput::InputManager::buttonPressed ( int  deviceID,
const SDL_ControllerButtonEvent &  evt 
)
virtual
Remarks
Joystick button down event

Implements SDLUtil::ControllerListener.

Here is the call graph for this function:

void MWInput::InputManager::buttonReleased ( int  deviceID,
const SDL_ControllerButtonEvent &  evt 
)
virtual
Remarks
Joystick button up event

to escape initial movie

Implements SDLUtil::ControllerListener.

Here is the call graph for this function:

void MWInput::InputManager::changeInputMode ( bool  guiMode)
virtual

Implements MWBase::InputManager.

Here is the call graph for this function:

void MWInput::InputManager::channelChanged ( ICS::Channel *  channel,
float  currentValue,
float  previousValue 
)
virtual

Here is the call graph for this function:

bool MWInput::InputManager::checkAllowedToUseItems ( ) const
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::clear ( )
virtual

Clear all savegame-specific data.

Implements MWBase::InputManager.

void MWInput::InputManager::clearAllControllerBindings ( ICS::Control *  control)

Here is the caller graph for this function:

void MWInput::InputManager::clearAllKeyBindings ( ICS::Control *  control)

Here is the caller graph for this function:

void MWInput::InputManager::controllerAdded ( int  deviceID,
const SDL_ControllerDeviceEvent &  arg 
)
virtual
Remarks
Joystick Added

Implements SDLUtil::ControllerListener.

Here is the caller graph for this function:

void MWInput::InputManager::controllerRemoved ( const SDL_ControllerDeviceEvent &  arg)
virtual
Remarks
Joystick Removed

Implements SDLUtil::ControllerListener.

void MWInput::InputManager::convertMousePosForMyGUI ( int x,
int y 
)
private
int MWInput::InputManager::countSavedGameRecords ( ) const
virtual

Implements MWBase::InputManager.

void MWInput::InputManager::enableDetectingBindingMode ( int  action,
bool  keyboard 
)
virtual

If keyboard is true, only pay attention to keyboard events. If false, only pay attention to controller events (excluding esc)

Implements MWBase::InputManager.

std::string MWInput::InputManager::getActionControllerBindingName ( int  action)
virtual

Implements MWBase::InputManager.

Here is the call graph for this function:

std::vector< int > MWInput::InputManager::getActionControllerSorting ( )
virtual

Actions available for binding to controller buttons.

Implements MWBase::InputManager.

std::string MWInput::InputManager::getActionDescription ( int  action)
virtual

Implements MWBase::InputManager.

std::string MWInput::InputManager::getActionKeyBindingName ( int  action)
virtual

Implements MWBase::InputManager.

std::vector< int > MWInput::InputManager::getActionKeySorting ( )
virtual

Actions available for binding to keyboard buttons.

Implements MWBase::InputManager.

bool MWInput::InputManager::getControlSwitch ( const std::string &  sw)
virtual

Implements MWBase::InputManager.

Here is the caller graph for this function:

virtual int MWInput::InputManager::getNumActions ( )
inlinevirtual

Implements MWBase::InputManager.

void MWInput::InputManager::handleGuiArrowKey ( int  action)
private

Here is the call graph for this function:

Here is the caller graph for this function:

bool MWInput::InputManager::isWindowVisible ( )
virtual

Implements MWBase::InputManager.

void MWInput::InputManager::joystickAxisBindingDetected ( ICS::InputControlSystem *  ICS,
int  deviceID,
ICS::Control *  control,
int  axis,
ICS::Control::ControlChangingDirection  direction 
)
virtual

Here is the call graph for this function:

void MWInput::InputManager::joystickButtonBindingDetected ( ICS::InputControlSystem *  ICS,
int  deviceID,
ICS::Control *  control,
unsigned int  button,
ICS::Control::ControlChangingDirection  direction 
)
virtual

Here is the call graph for this function:

virtual bool MWInput::InputManager::joystickLastUsed ( )
inlinevirtual

Returns if the last used input device was a joystick or a keyboard

Returns
true if joystick, false otherwise

Implements MWBase::InputManager.

void MWInput::InputManager::keyBindingDetected ( ICS::InputControlSystem *  ICS,
ICS::Control *  control,
SDL_Scancode  key,
ICS::Control::ControlChangingDirection  direction 
)
virtual

Here is the call graph for this function:

void MWInput::InputManager::keyPressed ( const SDL_KeyboardEvent &  arg)
virtual

Implements SDLUtil::KeyListener.

Here is the call graph for this function:

void MWInput::InputManager::keyReleased ( const SDL_KeyboardEvent &  arg)
virtual

Implements SDLUtil::KeyListener.

Here is the call graph for this function:

void MWInput::InputManager::loadControllerDefaults ( bool  force = false)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::loadKeyDefaults ( bool  force = false)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::mouseAxisBindingDetected ( ICS::InputControlSystem *  ICS,
ICS::Control *  control,
ICS::InputControlSystem::NamedAxis  axis,
ICS::Control::ControlChangingDirection  direction 
)
virtual
void MWInput::InputManager::mouseButtonBindingDetected ( ICS::InputControlSystem *  ICS,
ICS::Control *  control,
unsigned int  button,
ICS::Control::ControlChangingDirection  direction 
)
virtual

Here is the call graph for this function:

void MWInput::InputManager::mouseMoved ( const SDLUtil::MouseMotionEvent arg)
virtual

Implements SDLUtil::MouseListener.

Here is the call graph for this function:

void MWInput::InputManager::mousePressed ( const SDL_MouseButtonEvent &  arg,
Uint8  id 
)
virtual

Implements SDLUtil::MouseListener.

Here is the call graph for this function:

void MWInput::InputManager::mouseReleased ( const SDL_MouseButtonEvent &  arg,
Uint8  id 
)
virtual

Implements SDLUtil::MouseListener.

Here is the call graph for this function:

void MWInput::InputManager::processChangedSettings ( const Settings::CategorySettingVector changed)
virtual

Here is the call graph for this function:

void MWInput::InputManager::quickKey ( int  index)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::quickLoad ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::quickSave ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::readRecord ( ESM::ESMReader reader,
uint32_t  type 
)
virtual

Implements MWBase::InputManager.

Here is the call graph for this function:

void MWInput::InputManager::resetIdleTime ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::resetToDefaultControllerBindings ( )
virtual

Implements MWBase::InputManager.

Here is the call graph for this function:

void MWInput::InputManager::resetToDefaultKeyBindings ( )
virtual

Implements MWBase::InputManager.

Here is the call graph for this function:

void MWInput::InputManager::rest ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::screenshot ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

MyGUI::MouseButton MWInput::InputManager::sdlButtonToMyGUI ( Uint8  button)
private

Here is the caller graph for this function:

std::string MWInput::InputManager::sdlControllerAxisToString ( int  axis)
privatevirtual

Implements MWBase::InputManager.

Here is the caller graph for this function:

std::string MWInput::InputManager::sdlControllerButtonToString ( int  button)
privatevirtual

Implements MWBase::InputManager.

Here is the caller graph for this function:

void MWInput::InputManager::setDragDrop ( bool  dragDrop)
virtual

Implements MWBase::InputManager.

void MWInput::InputManager::setPlayer ( MWWorld::Player player)
inline

Here is the caller graph for this function:

void MWInput::InputManager::setPlayerControlsEnabled ( bool  enabled)
private

Here is the caller graph for this function:

void MWInput::InputManager::showQuickKeysMenu ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::textInput ( const SDL_TextInputEvent &  arg)
virtual

Reimplemented from SDLUtil::KeyListener.

void MWInput::InputManager::toggleAutoMove ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleConsole ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleControlSwitch ( const std::string &  sw,
bool  value 
)
virtual
Note
7 switches at all, if-else is relevant

maybe crouching at this time

Implements MWBase::InputManager.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleInventory ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleJournal ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleMainMenu ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleSneaking ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleSpell ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleWalking ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::toggleWeapon ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::update ( float  dt,
bool  disableControls = false,
bool  disableEvents = false 
)
virtual

Implements MWBase::InputManager.

Here is the call graph for this function:

void MWInput::InputManager::updateCursorMode ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::updateIdleTime ( float  dt)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWInput::InputManager::windowClosed ( )
virtual

Reimplemented from SDLUtil::WindowListener.

Here is the call graph for this function:

void MWInput::InputManager::windowFocusChange ( bool  have_focus)
virtual
Remarks
The window got / lost input focus

Reimplemented from SDLUtil::WindowListener.

void MWInput::InputManager::windowResized ( int  x,
int  y 
)
virtual

Reimplemented from SDLUtil::WindowListener.

Here is the call graph for this function:

void MWInput::InputManager::windowVisibilityChange ( bool  visible)
virtual
Remarks
The window's visibility changed

Reimplemented from SDLUtil::WindowListener.

void MWInput::InputManager::write ( ESM::ESMWriter writer,
Loading::Listener progress 
)
virtual

Implements MWBase::InputManager.

Here is the call graph for this function:

Member Data Documentation

bool MWInput::InputManager::mAlwaysRunActive
private
bool MWInput::InputManager::mAttemptJump
private
float MWInput::InputManager::mCameraSensitivity
private
float MWInput::InputManager::mCameraYMultiplier
private
bool MWInput::InputManager::mControlsDisabled
private
std::map<std::string, bool> MWInput::InputManager::mControlSwitch
private
bool MWInput::InputManager::mDetectingKeyboard
private
bool MWInput::InputManager::mDragDrop
private
int MWInput::InputManager::mFakeDeviceID
private
bool MWInput::InputManager::mGrabCursor
private
bool MWInput::InputManager::mGuiCursorEnabled
private
float MWInput::InputManager::mGuiCursorX
private
float MWInput::InputManager::mGuiCursorY
private
ICS::InputControlSystem* MWInput::InputManager::mInputBinder
private
SDLUtil::InputWrapper* MWInput::InputManager::mInputManager
private
bool MWInput::InputManager::mInvertY
private
float MWInput::InputManager::mInvUiScalingFactor
private
bool MWInput::InputManager::mJoystickLastUsed
private
bool MWInput::InputManager::mMouseLookEnabled
private
int MWInput::InputManager::mMouseWheel
private
float MWInput::InputManager::mOverencumberedMessageDelay
private
MWWorld::Player* MWInput::InputManager::mPlayer
private
float MWInput::InputManager::mPreviewPOVDelay
private
osg::ref_ptr<osgViewer::ScreenCaptureHandler> MWInput::InputManager::mScreenCaptureHandler
private
osgViewer::ScreenCaptureHandler::CaptureOperation* MWInput::InputManager::mScreenCaptureOperation
private
bool MWInput::InputManager::mSneaking
private
bool MWInput::InputManager::mSneakToggles
private
float MWInput::InputManager::mTimeIdle
private
std::string MWInput::InputManager::mUserFile
private
bool MWInput::InputManager::mUserFileExists
private
SDLUtil::VideoWrapper* MWInput::InputManager::mVideoWrapper
private
osg::ref_ptr<osgViewer::Viewer> MWInput::InputManager::mViewer
private
SDL_Window* MWInput::InputManager::mWindow
private
bool MWInput::InputManager::mWindowVisible
private

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