summaryrefslogtreecommitdiffstats
path: root/src/object/robotmain.h
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 18:32:18 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-09-19 18:32:18 +0200
commit51884cef8e015bccbe1fa96dc56dc2f32439ccc5 (patch)
tree53974a01650d52101c96dd11da5e2235c61a02d6 /src/object/robotmain.h
parent4a639cf543c15d45a37674d7eadaf09c23c2203d (diff)
downloadcolobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.tar.gz
colobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.tar.bz2
colobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.zip
Input bindings rewrite
- moved input bindings to CRobotMain - added virtual keymod and joystick button key presses - fixed putenv error; other minor fixes
Diffstat (limited to 'src/object/robotmain.h')
-rw-r--r--src/object/robotmain.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/object/robotmain.h b/src/object/robotmain.h
index 25c55f6..bce8e17 100644
--- a/src/object/robotmain.h
+++ b/src/object/robotmain.h
@@ -19,8 +19,10 @@
#pragma once
#include "common/global.h"
-#include "common/misc.h"
+#include "common/singleton.h"
+
#include "graphics/engine/particle.h"
+
#include "object/object.h"
#include "object/mainmovie.h"
@@ -140,8 +142,22 @@ const int SATCOM_SOLUCE = 5;
const int SATCOM_MAX = 6;
+/**
+ * \enum InputBinding
+ * \brief Binding for input slot
+ */
+struct InputBinding
+{
+ //! Keyboard binding code (can be regular or virtual)
+ unsigned int key;
+ //! Joystick binding code (virtual)
+ unsigned int joy;
+
+ InputBinding() : key(KEY_INVALID), joy(KEY_INVALID) {}
+};
-class CRobotMain
+
+class CRobotMain : public CSingleton<CRobotMain>
{
public:
CRobotMain(CInstanceManager* iMan, CApplication* app);
@@ -149,6 +165,15 @@ public:
void CreateIni();
+ //! Sets the default input bindings
+ void SetDefaultInputBindings();
+
+ //! Management of input bindings
+ //@{
+ void SetInputBinding(InputSlot slot, InputBinding binding);
+ const InputBinding& GetInputBinding(InputSlot slot);
+ //@}
+
void ChangePhase(Phase phase);
bool EventProcess(const Event &event);
@@ -352,6 +377,9 @@ protected:
Ui::CDisplayInfo* m_displayInfo;
CSoundInterface* m_sound;
+ //! Bindings for user inputs
+ InputBinding m_inputBindings[INPUT_SLOT_MAX];
+
float m_time;
float m_gameTime;
float m_checkEndTime;