[Orxonox-commit 616] r3148 - branches/pch/src/core/input
rgrieder at orxonox.net
rgrieder at orxonox.net
Thu Jun 11 22:26:40 CEST 2009
Author: rgrieder
Date: 2009-06-11 22:26:40 +0200 (Thu, 11 Jun 2009)
New Revision: 3148
Modified:
branches/pch/src/core/input/ExtendedInputState.cc
branches/pch/src/core/input/ExtendedInputState.h
branches/pch/src/core/input/HalfAxis.h
branches/pch/src/core/input/InputBuffer.cc
branches/pch/src/core/input/InputBuffer.h
branches/pch/src/core/input/InputCommands.cc
branches/pch/src/core/input/InputInterfaces.h
branches/pch/src/core/input/InputManager.cc
branches/pch/src/core/input/InputManager.h
branches/pch/src/core/input/InputState.h
branches/pch/src/core/input/KeyBinder.cc
branches/pch/src/core/input/KeyBinder.h
branches/pch/src/core/input/KeyDetector.cc
branches/pch/src/core/input/KeyDetector.h
branches/pch/src/core/input/SimpleInputState.cc
branches/pch/src/core/input/SimpleInputState.h
Log:
Another clean up in core/input
Modified: branches/pch/src/core/input/ExtendedInputState.cc
===================================================================
--- branches/pch/src/core/input/ExtendedInputState.cc 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/ExtendedInputState.cc 2009-06-11 20:26:40 UTC (rev 3148)
@@ -35,7 +35,7 @@
#include "ExtendedInputState.h"
#include <cassert>
-#include "util/Debug.h"
+#include "core/Executor.h"
namespace orxonox
{
@@ -456,4 +456,16 @@
this->bHandlersChanged_ = true;
}
+
+ void ExtendedInputState::onEnter()
+ {
+ if (executorOnEnter_)
+ (*executorOnEnter_)();
+ }
+
+ void ExtendedInputState::onLeave()
+ {
+ if (executorOnLeave_)
+ (*executorOnLeave_)();
+ }
}
Modified: branches/pch/src/core/input/ExtendedInputState.h
===================================================================
--- branches/pch/src/core/input/ExtendedInputState.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/ExtendedInputState.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -37,7 +37,6 @@
#include "core/CorePrereqs.h"
#include <vector>
-
#include "InputInterfaces.h"
#include "InputState.h"
@@ -88,6 +87,9 @@
void numberOfJoySticksChanged(unsigned int n);
void update();
+ void onEnter();
+ void onLeave();
+
std::vector<KeyHandler*> keyHandlers_;
std::vector<MouseHandler*> mouseHandlers_;
std::vector<std::vector<JoyStickHandler*> > joyStickHandlers_;
Modified: branches/pch/src/core/input/HalfAxis.h
===================================================================
--- branches/pch/src/core/input/HalfAxis.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/HalfAxis.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -36,6 +36,7 @@
#define _HalfAxis_H__
#include "core/CorePrereqs.h"
+
#include "Button.h"
#include "InputCommands.h"
Modified: branches/pch/src/core/input/InputBuffer.cc
===================================================================
--- branches/pch/src/core/input/InputBuffer.cc 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/InputBuffer.cc 2009-06-11 20:26:40 UTC (rev 3148)
@@ -28,8 +28,6 @@
#include "InputBuffer.h"
-#include <iostream>
-
#include "util/Clipboard.h"
#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
@@ -56,7 +54,7 @@
setConfigValues();
}
- InputBuffer::InputBuffer(const std::string allowedChars)
+ InputBuffer::InputBuffer(const std::string& allowedChars)
{
RegisterRootObject(InputBuffer);
Modified: branches/pch/src/core/input/InputBuffer.h
===================================================================
--- branches/pch/src/core/input/InputBuffer.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/InputBuffer.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -31,9 +31,8 @@
#include "core/CorePrereqs.h"
-#include <string>
#include <list>
-
+#include <string>
#include "core/OrxonoxClass.h"
#include "InputInterfaces.h"
@@ -79,7 +78,7 @@
public:
InputBuffer();
~InputBuffer();
- InputBuffer(const std::string allowedChars);
+ InputBuffer(const std::string& allowedChars);
void setConfigValues();
@@ -144,7 +143,7 @@
void updated();
void updated(const char& update, bool bSingleInput);
- inline std::string get() const
+ inline const std::string& get() const
{ return this->buffer_; }
inline unsigned int getSize() const
{ return this->buffer_.size(); }
Modified: branches/pch/src/core/input/InputCommands.cc
===================================================================
--- branches/pch/src/core/input/InputCommands.cc 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/InputCommands.cc 2009-06-11 20:26:40 UTC (rev 3148)
@@ -34,7 +34,6 @@
#include "InputCommands.h"
#include "util/Math.h"
-#include "core/CommandExecutor.h"
namespace orxonox
{
Modified: branches/pch/src/core/input/InputInterfaces.h
===================================================================
--- branches/pch/src/core/input/InputInterfaces.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/InputInterfaces.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -37,9 +37,9 @@
#include "core/CorePrereqs.h"
-#include "ois/OISKeyboard.h"
-#include "ois/OISMouse.h"
-#include "ois/OISJoyStick.h"
+#include <ois/OISKeyboard.h>
+#include <ois/OISMouse.h>
+#include <ois/OISJoyStick.h>
#include "util/Math.h"
namespace orxonox
Modified: branches/pch/src/core/input/InputManager.cc
===================================================================
--- branches/pch/src/core/input/InputManager.cc 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/InputManager.cc 2009-06-11 20:26:40 UTC (rev 3148)
@@ -37,26 +37,23 @@
#include <climits>
#include <cassert>
+#include <ois/OISException.h>
+#include <ois/OISInputManager.h>
-#include "ois/OISException.h"
-#include "ois/OISInputManager.h"
-#include "core/ConsoleCommand.h"
-
// HACK
#ifdef ORXONOX_PLATFORM_LINUX
-# include "ois/linux/LinuxMouse.h"
+# include <ois/linux/LinuxMouse.h>
#endif
#include "util/Exception.h"
+#include "util/Debug.h"
+#include "core/ConsoleCommand.h"
#include "core/Clock.h"
#include "core/CoreIncludes.h"
#include "core/ConfigValueIncludes.h"
-#include "core/CommandExecutor.h"
#include "core/CommandLine.h"
-#include "util/Debug.h"
#include "InputBuffer.h"
-#include "KeyBinder.h"
#include "KeyDetector.h"
#include "InputState.h"
#include "SimpleInputState.h"
Modified: branches/pch/src/core/input/InputManager.h
===================================================================
--- branches/pch/src/core/input/InputManager.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/InputManager.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -39,8 +39,13 @@
#include "core/CorePrereqs.h"
#include <map>
+#include <set>
+#include <string>
#include <vector>
-#include <stack>
+#include <ois/OISKeyboard.h>
+#include <ois/OISMouse.h>
+#include <ois/OISJoyStick.h>
+
#include "util/Math.h"
#include "util/OrxEnum.h"
#include "core/OrxonoxClass.h"
Modified: branches/pch/src/core/input/InputState.h
===================================================================
--- branches/pch/src/core/input/InputState.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/InputState.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -38,7 +38,6 @@
#include <string>
#include <vector>
-#include "core/Executor.h"
#include "InputInterfaces.h"
namespace orxonox
@@ -62,8 +61,8 @@
bool handlersChanged() { return this->bHandlersChanged_; }
void resetHandlersChanged() { bHandlersChanged_ = false; }
- virtual void onEnter() { if (executorOnEnter_) (*executorOnEnter_)(); }
- virtual void onLeave() { if (executorOnLeave_) (*executorOnLeave_)(); }
+ virtual void onEnter() = 0;
+ virtual void onLeave() = 0;
virtual void registerOnEnter(Executor* executor) { executorOnEnter_ = executor; }
virtual void unRegisterOnEnter() { executorOnEnter_ = 0; }
@@ -107,6 +106,8 @@
}
bool bHandlersChanged_;
+ Executor* executorOnEnter_;
+ Executor* executorOnLeave_;
private:
void setNumOfJoySticks(unsigned int n)
@@ -122,9 +123,6 @@
std::vector<bool> bInputDeviceEnabled_;
bool bAlwaysGetsInput_;
bool bTransparent_;
-
- Executor* executorOnEnter_;
- Executor* executorOnLeave_;
};
}
Modified: branches/pch/src/core/input/KeyBinder.cc
===================================================================
--- branches/pch/src/core/input/KeyBinder.cc 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/KeyBinder.cc 2009-06-11 20:26:40 UTC (rev 3148)
@@ -33,9 +33,6 @@
#include "KeyBinder.h"
-#include <fstream>
-#include <string>
-
#include "util/Convert.h"
#include "util/Debug.h"
#include "core/ConfigValueIncludes.h"
Modified: branches/pch/src/core/input/KeyBinder.h
===================================================================
--- branches/pch/src/core/input/KeyBinder.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/KeyBinder.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -37,8 +37,9 @@
#include "core/CorePrereqs.h"
+#include <cassert>
+#include <string>
#include <vector>
-#include <cassert>
#include "InputInterfaces.h"
#include "Button.h"
Modified: branches/pch/src/core/input/KeyDetector.cc
===================================================================
--- branches/pch/src/core/input/KeyDetector.cc 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/KeyDetector.cc 2009-06-11 20:26:40 UTC (rev 3148)
@@ -33,11 +33,9 @@
*/
#include "KeyDetector.h"
+
#include "util/Debug.h"
#include "core/CoreIncludes.h"
-#include "core/CommandExecutor.h"
-#include "core/CommandEvaluation.h"
-#include "InputCommands.h"
#include "Button.h"
namespace orxonox
Modified: branches/pch/src/core/input/KeyDetector.h
===================================================================
--- branches/pch/src/core/input/KeyDetector.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/KeyDetector.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -37,6 +37,7 @@
#include "core/CorePrereqs.h"
+#include <string>
#include "KeyBinder.h"
namespace orxonox
Modified: branches/pch/src/core/input/SimpleInputState.cc
===================================================================
--- branches/pch/src/core/input/SimpleInputState.cc 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/SimpleInputState.cc 2009-06-11 20:26:40 UTC (rev 3148)
@@ -33,6 +33,7 @@
*/
#include "SimpleInputState.h"
+#include "core/Executor.h"
namespace orxonox
{
@@ -147,4 +148,16 @@
// inform InputManager that there might be changes in EMPTY_HANDLER situation
bHandlersChanged_ = true;
}
+
+ void SimpleInputState::onEnter()
+ {
+ if (executorOnEnter_)
+ (*executorOnEnter_)();
+ }
+
+ void SimpleInputState::onLeave()
+ {
+ if (executorOnLeave_)
+ (*executorOnLeave_)();
+ }
}
Modified: branches/pch/src/core/input/SimpleInputState.h
===================================================================
--- branches/pch/src/core/input/SimpleInputState.h 2009-06-11 20:03:38 UTC (rev 3147)
+++ branches/pch/src/core/input/SimpleInputState.h 2009-06-11 20:26:40 UTC (rev 3148)
@@ -79,6 +79,9 @@
void update();
void numberOfJoySticksChanged(unsigned int n);
+ void onEnter();
+ void onLeave();
+
KeyHandler* keyHandler_;
MouseHandler* mouseHandler_;
std::vector<JoyStickHandler*> joyStickHandler_;
More information about the Orxonox-commit
mailing list