Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
InputManager.hpp
1#pragma once
2
3#include "Common/Event/KeyPressCode.hpp"
4#include "Common/Event/MouseButtonCode.hpp"
5#include <Common/Input/InputInterface.hpp>
6
7namespace Grindstone {
8 namespace Events {
9 class Dispatcher;
10 }
11
12 namespace Input {
13 class Manager : public Interface {
14 public:
15 Manager(Events::Dispatcher* dispatcher);
16 virtual void SetCursorMode(CursorMode) override;
17 virtual CursorMode GetCursorMode() override;
18 virtual void SetCursorIsRawMotion(bool isRawMode) override;
19 virtual bool GetCursorIsRawMotion() override;
20 virtual void SetMainWindow(Grindstone::Window* window) override;
21 virtual bool IsMouseButtonPressed(Events::MouseButtonCode) override;
22 virtual void SetMousePosition(int, int) override;
23 virtual void GetMousePosition(int&, int&) override;
24 virtual bool IsFocused() override;
25 virtual bool IsKeyPressed(Events::KeyPressCode) override;
26
27 virtual void ResizeEvent(int, int) override;
28 virtual void SetMouseButton(Events::MouseButtonCode, bool) override;
29 virtual void OnMouseMoved(int, int) override;
30 virtual void SetIsFocused(bool) override;
31 virtual void MouseScroll(float, float) override;
32 virtual void SetKeyPressed(Events::KeyPressCode, bool) override;
33 virtual void AddCharacterTyped(unsigned short character) override;
34 virtual void TryQuit(Grindstone::Window* window) override;
35 virtual void ForceQuit(Grindstone::Window* window) override;
36 private:
37 Events::Dispatcher* dispatcher = nullptr;
38
39 bool isFocused = false;
40 int mousePositionX = 0;
41 int mousePositionY = 0;
42 bool keyPressed[(int)Events::KeyPressCode::Last];
43 bool mousePressed[(int)Events::MouseButtonCode::Last];
44 Grindstone::Window* window = nullptr;
45 }; // class Manager
46 } // namespace Input
47} // namespace Grindstone
Definition Dispatcher.hpp:14
Definition InputInterface.hpp:11
Definition InputManager.hpp:13
Definition Window.cs:7