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