1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 19:19:55 +00:00
openmw-tes3mp/apps/openmw/mwinput/inputmanagerimp.hpp

129 lines
3.6 KiB
C++
Raw Normal View History

#ifndef MWINPUT_MWINPUTMANAGERIMP_H
#define MWINPUT_MWINPUTMANAGERIMP_H
2015-05-13 14:50:47 +00:00
#include <osg/ref_ptr>
2017-11-09 17:26:27 +00:00
#include <osgViewer/ViewerEventHandlers>
2015-05-13 14:50:47 +00:00
#include <components/settings/settings.hpp>
2015-05-13 14:50:47 +00:00
#include <components/sdlutil/events.hpp>
#include "../mwbase/inputmanager.hpp"
2015-05-13 14:50:47 +00:00
2020-04-17 11:59:37 +00:00
#include "../mwgui/mode.hpp"
#include "actions.hpp"
namespace MWInput
{
class ControlSwitch;
class ActionManager;
class BindingsManager;
class ControllerManager;
class KeyboardManager;
class MouseManager;
class SensorManager;
}
namespace MWWorld
2010-07-17 17:58:15 +00:00
{
2012-08-12 18:45:02 +00:00
class Player;
2010-07-17 17:58:15 +00:00
}
namespace MWBase
2010-07-17 17:58:15 +00:00
{
2012-08-12 18:45:02 +00:00
class WindowManager;
2010-07-17 17:58:15 +00:00
}
2015-05-13 14:50:47 +00:00
namespace SDLUtil
{
class InputWrapper;
}
struct SDL_Window;
2012-08-12 18:45:02 +00:00
namespace MWInput
{
2012-08-12 18:45:02 +00:00
/**
* @brief Class that handles all input and key bindings for OpenMW.
*/
class InputManager :
public MWBase::InputManager
2012-08-12 18:45:02 +00:00
{
public:
2015-05-03 15:24:35 +00:00
InputManager(
2015-05-13 14:50:47 +00:00
SDL_Window* window,
osg::ref_ptr<osgViewer::Viewer> viewer,
osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler,
2017-11-09 17:26:27 +00:00
osgViewer::ScreenCaptureHandler::CaptureOperation *screenCaptureOperation,
const std::string& userFile, bool userFileExists,
2019-08-03 19:55:58 +00:00
const std::string& userControllerBindingsFile,
const std::string& controllerBindingsFile, bool grab);
2012-08-12 18:45:02 +00:00
virtual ~InputManager();
/// Clear all savegame-specific data
virtual void clear();
virtual void update(float dt, bool disableControls=false, bool disableEvents=false);
2012-08-12 18:45:02 +00:00
virtual void changeInputMode(bool guiMode);
virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
virtual void setDragDrop(bool dragDrop);
virtual void setGamepadGuiCursorEnabled(bool enabled);
virtual void setAttemptJump(bool jumping);
2012-08-12 18:45:02 +00:00
virtual void toggleControlSwitch (const std::string& sw, bool value);
virtual bool getControlSwitch (const std::string& sw);
2012-08-12 18:45:02 +00:00
2012-08-12 23:26:15 +00:00
virtual std::string getActionDescription (int action);
2014-12-09 03:57:32 +00:00
virtual std::string getActionKeyBindingName (int action);
virtual std::string getActionControllerBindingName (int action);
2012-08-12 23:26:15 +00:00
virtual int getNumActions() { return A_Last; }
2014-12-09 03:57:32 +00:00
virtual std::vector<int> getActionKeySorting();
virtual std::vector<int> getActionControllerSorting();
virtual void enableDetectingBindingMode (int action, bool keyboard);
virtual void resetToDefaultKeyBindings();
virtual void resetToDefaultControllerBindings();
2012-08-12 23:26:15 +00:00
virtual void setJoystickLastUsed(bool enabled);
virtual bool joystickLastUsed();
2014-12-20 20:46:11 +00:00
2016-10-20 00:12:01 +00:00
virtual int countSavedGameRecords() const;
virtual void write(ESM::ESMWriter& writer, Loading::Listener& progress);
virtual void readRecord(ESM::ESMReader& reader, uint32_t type);
virtual void resetIdleTime();
virtual void executeAction(int action);
2012-08-12 18:45:02 +00:00
private:
SDLUtil::InputWrapper* mInputWrapper;
2012-08-12 18:45:02 +00:00
bool mGrabCursor;
ControlSwitch* mControlSwitch;
2012-08-12 18:45:02 +00:00
ActionManager* mActionManager;
BindingsManager* mBindingsManager;
ControllerManager* mControllerManager;
KeyboardManager* mKeyboardManager;
MouseManager* mMouseManager;
SensorManager* mSensorManager;
2015-05-14 22:41:21 +00:00
void convertMousePosForMyGUI(int& x, int& y);
void handleGuiArrowKey(int action);
void updateCursorMode();
void quickKey(int index);
void showQuickKeysMenu();
void loadKeyDefaults(bool force = false);
2014-12-09 03:57:32 +00:00
void loadControllerDefaults(bool force = false);
2012-08-12 18:45:02 +00:00
};
}
#endif