TazGraph Project v0.1.0
Loading...
Searching...
No Matches
InputManager.h
1#pragma once
2
3#include "../../pch.h"
4
6public:
9
10 void update();
11
12 void pressKey(unsigned int keyID);
13 void releaseKey(unsigned int keyID);
14
15 //returns true if the key is held down
16 bool isKeyDown(unsigned int keyID);
17
18 //returns true if the key was just pressed
19 bool isKeyPressed(unsigned int keyID);
20
21 bool checkMouseCollision(glm::vec2 position, glm::ivec2 tr_size);
22 void setMouseCoords(float x, float y);
23
24 glm::vec2 getMouseCoords() const;
25
26 // Panning
27 void setPanningPoint(const glm::vec2 position);
28 glm::vec2 calculatePanningDelta(glm::vec2 position);
29
30 void setObjectRelativePos(glm::vec2 relativeObjectPos);
31 glm::vec2 getObjectRelativePos();
32
33 glm::vec2 convertWindowToViewportCoords(
34 const glm::vec2 windowDimensions,
35 const glm::vec2& windowPos,
36 const glm::vec2 viewportSize,
37 const ICamera& camera);
38
39 /*glm::vec2 convertCameraToWindowCoords(glm::vec2 mousePos,
40 glm::vec2 viewportSize,
41 glm::vec2 windowDimensions,
42 const glm::vec2& windowPos, const glm::vec2& windowSize,
43 const ICamera& camera);*/
44
45
46private:
47 bool wasKeyDown(unsigned int keyID);
48
49 std::unordered_map<unsigned int, bool> _keyMap;
50 std::unordered_map<unsigned int, bool> _prevKeyMap;
51
52 glm::vec2 _mouseCoords = glm::vec2(0);
53
54 glm::vec2 _panningPoint = glm::vec2(0);
55
56 glm::vec2 _relativeObjectPos = glm::vec2(0);
57};
Definition ICamera.h:10
Definition InputManager.h:5