diff options
author | chai <chaifix@163.com> | 2019-08-07 21:08:47 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-07 21:08:47 +0800 |
commit | 0c391fdbce5a079cf03e483eb6174dd47806163d (patch) | |
tree | b06cd7a9d0ae0d9bb9e82f3dcb786dfce11f8628 /source/modules/asura-core/Input | |
parent | 9686368e58e25cbd6dc37d686bdd2be3f80486d6 (diff) |
*misc
Diffstat (limited to 'source/modules/asura-core/Input')
-rw-r--r-- | source/modules/asura-core/Input/Button.h | 2 | ||||
-rw-r--r-- | source/modules/asura-core/Input/InputAxis.h | 2 | ||||
-rw-r--r-- | source/modules/asura-core/Input/InputDevice.h | 53 | ||||
-rw-r--r-- | source/modules/asura-core/Input/InputEvent.h | 4 | ||||
-rw-r--r-- | source/modules/asura-core/Input/InputManager.cpp | 16 | ||||
-rw-r--r-- | source/modules/asura-core/Input/InputManager.h | 10 | ||||
-rw-r--r-- | source/modules/asura-core/Input/JoystickState.h | 2 | ||||
-rw-r--r-- | source/modules/asura-core/Input/MouseState.h | 2 |
8 files changed, 72 insertions, 19 deletions
diff --git a/source/modules/asura-core/Input/Button.h b/source/modules/asura-core/Input/Button.h index 5c3c0de..528063d 100644 --- a/source/modules/asura-core/Input/Button.h +++ b/source/modules/asura-core/Input/Button.h @@ -1,7 +1,7 @@ #ifndef __BUTTON_H__ #define __BUTTON_H__ -#include <asura-utils/Classes.h> +#include <asura-base/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Input) diff --git a/source/modules/asura-core/Input/InputAxis.h b/source/modules/asura-core/Input/InputAxis.h index 3052f0b..9f721d7 100644 --- a/source/modules/asura-core/Input/InputAxis.h +++ b/source/modules/asura-core/Input/InputAxis.h @@ -1,7 +1,7 @@ #ifndef _ASURA_ENGINE_INPUT_AXIS_H_ #define _ASURA_ENGINE_INPUT_AXIS_H_ -#include <asura-utils/Classes.h> +#include <asura-base/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Input) diff --git a/source/modules/asura-core/Input/InputDevice.h b/source/modules/asura-core/Input/InputDevice.h index 0ecce99..2b3ff9b 100644 --- a/source/modules/asura-core/Input/InputDevice.h +++ b/source/modules/asura-core/Input/InputDevice.h @@ -1,9 +1,11 @@ #ifndef _ASURA_ENGINE_INPUT_BASE_H_ #define _ASURA_ENGINE_INPUT_BASE_H_ -#include <asura-utils/Math/Vector2.hpp> -#include <asura-utils/Scripting/Portable.hpp> -#include <asura-utils/Singleton.hpp> +#include <asura-base/Math/Vector2.hpp> +#include <asura-base/Scripting/Scripting.h> +#include <asura-base/Singleton.hpp> + +#include <windows.h> #include "../CoreConfig.h" @@ -14,28 +16,63 @@ namespace_begin(AsuraEngine) namespace_begin(Input) -class InputDevice +class InputDevice ASURA_FINAL { public: InputDevice(); - virtual ~InputDevice(); + ~InputDevice(); + +#if ASURA_EDITOR + + bool Open(HWND window); + void Close(); + + bool ToggleFullscreen(bool fullscreen, HWND window); + + bool Process(bool discard); + LRESULT OnKey(HWND window, UINT message, WPARAM wParam, LPARAM lParam); + LRESULT OnInput(HWND window, UINT message, WPARAM wParam, LPARAM lParam); + LRESULT OnDeviceChange(LPCWSTR name, bool add); + + static bool ConvertPositionToClientAreaCoord(HWND activeWindow, POINT position, AEMath::Vector2f& newPos); + +#elif ASURA_RUNNER + + bool Open(); + void Close(); + +#endif + + bool Activate(bool active); + + bool GetJoystickNames(std::vector<std::string> &names); protected: - virtual bool UpdateState(); + bool UpdateState(); MouseState m_Mouse; KeyboardState m_Keyboard; JoystickState m_Joysticks; -private: +private: bool UpdateMousePosition(); }; -//bool ConvertPositionToClientAreaCoord(); +extern InputDevice g_InputDevice; + +#if ASURA_EDITOR + +bool ConvertPositionToClientAreaCoord(); + +#elif ASURA_RUNNER + +bool ConvertPositionToClientAreaCoord(); + +#endif namespace_end namespace_end diff --git a/source/modules/asura-core/Input/InputEvent.h b/source/modules/asura-core/Input/InputEvent.h index d7643b6..c643b75 100644 --- a/source/modules/asura-core/Input/InputEvent.h +++ b/source/modules/asura-core/Input/InputEvent.h @@ -2,8 +2,8 @@ #define _ASURA_ENGINE_INPUT_EVENT_H_ #include <asura-base/Configure.h> -#include <asura-utils/Classes.h> -#include <asura-utils/Math/Vector2.hpp> +#include <asura-base/Classes.h> +#include <asura-base/Math/Vector2.hpp> #include <windows.h> #include <vector> diff --git a/source/modules/asura-core/Input/InputManager.cpp b/source/modules/asura-core/Input/InputManager.cpp index fe49c29..cec1b36 100644 --- a/source/modules/asura-core/Input/InputManager.cpp +++ b/source/modules/asura-core/Input/InputManager.cpp @@ -17,69 +17,85 @@ void InputManager::Reset() bool InputManager::GetButton(const std::string& name) { + return 0; } bool InputManager::GetButtonDown(const std::string& name) { + return 0; } bool InputManager::GetButtonUp(const std::string& name) { + return 0; } bool InputManager::HasAxisOrButton(const std::string& name) { + return 0; } float InputManager::GetAxis(const std::string& name) { + return 0; } float InputManager::GetAxisRaw(const std::string& name) { + return 0; } bool InputManager::GetMouseButton(int mouseBut) { + return 0; } bool InputManager::GetMouseButtonState(int mouseBut) { + return 0; } bool InputManager::GetMouseButtonDown(int mouseBut) { + return 0; } bool InputManager::GetMouseButtonUp(int mouseBut) { + return 0; } bool InputManager::GetKey(int key) { + return 0; } bool InputManager::GetKeyDown(int key) { + return 0; } bool InputManager::GetKeyUp(int key) { + return 0; } const AEMath::Vector2f& InputManager::GetMouseDelta() { + return m_MouseDelta; } const AEMath::Vector2f& InputManager::GetMousePosition() { + return m_MousePos; } float InputManager::GetJoystickPosition() { + return 0; } void InputManager::setJoystickPosition() diff --git a/source/modules/asura-core/Input/InputManager.h b/source/modules/asura-core/Input/InputManager.h index bbdafd8..3c44745 100644 --- a/source/modules/asura-core/Input/InputManager.h +++ b/source/modules/asura-core/Input/InputManager.h @@ -1,11 +1,11 @@ #ifndef _ASURA_INPUT_MAMANGER_H_ #define _ASURA_INPUT_MAMANGER_H_ -#include <asura-utils/Math/Vector2.hpp> -#include <asura-utils/Scripting/Portable.hpp> -#include <asura-utils/Singleton.hpp> -#include <asura-utils/Classes.h> -#include <asura-utils/dynamic_bitset.h> +#include <asura-base/Math/Vector2.hpp> +#include <asura-base/Scripting/Scripting.h> +#include <asura-base/Singleton.hpp> +#include <asura-base/Classes.h> +#include <asura-base/Utilities/dynamic_bitset.h> #include <string> #include <vector> diff --git a/source/modules/asura-core/Input/JoystickState.h b/source/modules/asura-core/Input/JoystickState.h index 42d0a79..e97e235 100644 --- a/source/modules/asura-core/Input/JoystickState.h +++ b/source/modules/asura-core/Input/JoystickState.h @@ -1,7 +1,7 @@ #ifndef _ASURA_JOYSTICKSTATE_H_ #define _ASURA_JOYSTICKSTATE_H_ -#include <asura-utils/Classes.h> +#include <asura-base/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Input) diff --git a/source/modules/asura-core/Input/MouseState.h b/source/modules/asura-core/Input/MouseState.h index 1192a34..6b44070 100644 --- a/source/modules/asura-core/Input/MouseState.h +++ b/source/modules/asura-core/Input/MouseState.h @@ -1,7 +1,7 @@ #ifndef _ASURA_MOUSESTATE_H_ #define _ASURA_MOUSESTATE_H_ -#include <asura-utils/Classes.h> +#include <asura-base/Classes.h> namespace_begin(AsuraEngine) namespace_begin(Input) |