2D_Game_Engine
Loading...
Searching...
No Matches
src
input.cpp
Go to the documentation of this file.
1
#include <pch.hpp>
2
#include <
input.hpp
>
3
#include <
window.hpp
>
4
5
void
Input::UpdateStates
(){
6
for
(
auto
&
key
:m_KeyStates){
7
key
.second.previous=
key
.second.current;
8
key
.second.current=glfwGetKey(
Window::Window
,
key
.first);
9
}
10
11
for
(
auto
&button:m_MouseStates){
12
button.second.previous=button.second.current;
13
button.second.current=glfwGetMouseButton(
Window::Window
,button.first);
14
}
15
}
16
17
Vec2
Input::GetMousePosition
(){
18
double
x,y;
19
glfwGetCursorPos(
Window::Window
,&x,&y);
20
return
Vec2
(x/
Window::Width
*
Window::MAX_WIDTH
,(
Window::Height
-y)/
Window::Height
*
Window::MAX_HEIGHT
);
21
}
Input::UpdateStates
void UpdateStates()
Definition
input.cpp:5
Input::GetMousePosition
Vec2 GetMousePosition()
Definition
input.cpp:17
input.hpp
Window::Window
GLFWwindow * Window
Definition
window.cpp:225
Window::Height
float Height
Definition
window.hpp:43
Window::MAX_WIDTH
const float MAX_WIDTH
Definition
window.cpp:251
Window::Width
float Width
Definition
window.cpp:227
Window::MAX_HEIGHT
float MAX_HEIGHT
Definition
window.cpp:252
key
std::string key
Definition
sceneserializer.cpp:422
Vec2
Definition
structs.hpp:3
window.hpp
Generated by
1.10.0