From 0c391fdbce5a079cf03e483eb6174dd47806163d Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 7 Aug 2019 21:08:47 +0800 Subject: *misc --- source/modules/asura-core/Input/Button.h | 2 +- source/modules/asura-core/Input/InputAxis.h | 2 +- source/modules/asura-core/Input/InputDevice.h | 53 ++++++++++++++++++++---- source/modules/asura-core/Input/InputEvent.h | 4 +- source/modules/asura-core/Input/InputManager.cpp | 16 +++++++ source/modules/asura-core/Input/InputManager.h | 10 ++--- source/modules/asura-core/Input/JoystickState.h | 2 +- source/modules/asura-core/Input/MouseState.h | 2 +- 8 files changed, 72 insertions(+), 19 deletions(-) (limited to 'source/modules/asura-core/Input') 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 +#include 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 +#include 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 -#include -#include +#include +#include +#include + +#include #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 &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 -#include -#include +#include +#include #include #include 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 -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include 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 +#include 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 +#include namespace_begin(AsuraEngine) namespace_begin(Input) -- cgit v1.1-26-g67d0