diff options
Diffstat (limited to 'Source/modules/asura-core/Input/InputDevice.h')
-rw-r--r-- | Source/modules/asura-core/Input/InputDevice.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Source/modules/asura-core/Input/InputDevice.h b/Source/modules/asura-core/Input/InputDevice.h new file mode 100644 index 0000000..2b3ff9b --- /dev/null +++ b/Source/modules/asura-core/Input/InputDevice.h @@ -0,0 +1,82 @@ +#ifndef _ASURA_ENGINE_INPUT_BASE_H_ +#define _ASURA_ENGINE_INPUT_BASE_H_ + +#include <asura-base/Math/Vector2.hpp> +#include <asura-base/Scripting/Scripting.h> +#include <asura-base/Singleton.hpp> + +#include <windows.h> + +#include "../CoreConfig.h" + +#include "KeyboardState.h" +#include "MouseState.h" +#include "JoystickState.h" + +namespace_begin(AsuraEngine) +namespace_begin(Input) + +class InputDevice ASURA_FINAL +{ +public: + + 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: + + bool UpdateState(); + + MouseState m_Mouse; + KeyboardState m_Keyboard; + JoystickState m_Joysticks; + +private: + + bool UpdateMousePosition(); + +}; + +extern InputDevice g_InputDevice; + +#if ASURA_EDITOR + +bool ConvertPositionToClientAreaCoord(); + +#elif ASURA_RUNNER + +bool ConvertPositionToClientAreaCoord(); + +#endif + +namespace_end +namespace_end + +namespace AEInput = AsuraEngine::Input; + +#endif
\ No newline at end of file |