summaryrefslogtreecommitdiff
path: root/source/modules/asura-core/input
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core/input')
-rw-r--r--source/modules/asura-core/input/button.h41
-rw-r--r--source/modules/asura-core/input/input_device.h34
-rw-r--r--source/modules/asura-core/input/input_manager.h23
-rw-r--r--source/modules/asura-core/input/keyboard_state.h44
4 files changed, 68 insertions, 74 deletions
diff --git a/source/modules/asura-core/input/button.h b/source/modules/asura-core/input/button.h
index 0df8ed2..78f9b6d 100644
--- a/source/modules/asura-core/input/button.h
+++ b/source/modules/asura-core/input/button.h
@@ -1,32 +1,31 @@
#ifndef __BUTTON_H__
#define __BUTTON_H__
-namespace AsuraEngine
-{
- namespace Input
- {
+#include <asura-utils/classes.h>
- /// keyboard button \ mouse button \ joystick button
- class Button
- {
- public:
- inline Button(int key, bool state) :
- key(key),
- state(state)
- {
- }
+namespace_begin(AsuraEngine)
+namespace_begin(Input)
- inline int GetKey(void) const { return this->key; }
- inline bool GetState(void) const { return this->state; }
+/// keyboard button \ mouse button \ joystick button
+class Button
+{
+public:
+ inline Button(int key, bool state) :
+ key(key),
+ state(state)
+ {
+ }
- private:
- int key;
- bool state;
+ inline int GetKey(void) const { return this->key; }
+ inline bool GetState(void) const { return this->state; }
- };
+private:
+ int key;
+ bool state;
- }
-}
+};
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/input_device.h b/source/modules/asura-core/input/input_device.h
index 7082ea3..1c116e6 100644
--- a/source/modules/asura-core/input/input_device.h
+++ b/source/modules/asura-core/input/input_device.h
@@ -9,32 +9,30 @@
#include "keyboard_state.h"
-namespace AsuraEngine
-{
- namespace Input
- {
+namespace_begin(AsuraEngine)
+namespace_begin(Input)
- /// ͬƽ̨̳ಢʵhandleӿ
- ASURA_ABSTRACT class InputDevice : public Singleton<InputDevice>
- {
- protected:
+/// ͬƽ̨̳ಢʵhandleӿ
+ASURA_ABSTRACT class InputDevice : public Singleton<InputDevice>
+{
+protected:
- void OnKeyDown(int key);
- void OnKeyUp(int key);
+ void OnKeyDown(int key);
+ void OnKeyUp(int key);
- void OnMouseMove(const AEMath::Vector2f& position);
+ void OnMouseMove(const AEMath::Vector2f& position);
- void OnMouseButtonDown(int key);
- void OnMouseButtonUp(int key);
+ void OnMouseButtonDown(int key);
+ void OnMouseButtonUp(int key);
- void OnMouseWheel();
+ void OnMouseWheel();
- void OnInputChar();
+ void OnInputChar();
- };
+};
- }
-}
+namespace_end
+namespace_end
namespace AEInput = AsuraEngine::Input;
diff --git a/source/modules/asura-core/input/input_manager.h b/source/modules/asura-core/input/input_manager.h
index 4597d39..7e24b4e 100644
--- a/source/modules/asura-core/input/input_manager.h
+++ b/source/modules/asura-core/input/input_manager.h
@@ -3,23 +3,22 @@
#include <asura-utils/scripting/portable.hpp>
#include <asura-utils/singleton.hpp>
+#include <asura-utils/classes.h>
-namespace AsuraEngine
-{
- namespace Input
- {
+namespace_begin(AsuraEngine)
+namespace_begin(Input)
- /// ߼
- class InputManager : public Singleton<InputManager>
- {
- public :
+/// ߼
+class InputManager : public Singleton<InputManager>
+{
+public :
- private :
+private :
- };
+};
- }
-}
+namespace_end
+namespace_end
#endif \ No newline at end of file
diff --git a/source/modules/asura-core/input/keyboard_state.h b/source/modules/asura-core/input/keyboard_state.h
index f6aa5ea..5c43dff 100644
--- a/source/modules/asura-core/input/keyboard_state.h
+++ b/source/modules/asura-core/input/keyboard_state.h
@@ -5,35 +5,33 @@
#include "button.h"
-namespace AsuraEngine
-{
- namespace Input
- {
+namespace_begin(AsuraEngine)
+namespace_begin(Input)
- typedef std::vector<Button> Buttons;
+typedef std::vector<Button> Buttons;
- class KeyboardState
- {
- private:
- Buttons buttons;
+class KeyboardState
+{
+private:
+ Buttons buttons;
- public:
- inline KeyboardState(void)
- {
- this->buttons.reserve(256);
- }
+public:
+ inline KeyboardState(void)
+ {
+ this->buttons.reserve(256);
+ }
- inline const Buttons &GetButtons(void) const { return this->buttons; }
- inline void AddButton(int key, bool state) { this->buttons.push_back(Button(key, state)); }
+ inline const Buttons &GetButtons(void) const { return this->buttons; }
+ inline void AddButton(int key, bool state) { this->buttons.push_back(Button(key, state)); }
- void Reset(bool full)
- {
- this->buttons.clear();
- }
+ void Reset(bool full)
+ {
+ this->buttons.clear();
+ }
- };
+};
- }
-}
+namespace_end
+namespace_end
#endif \ No newline at end of file