Hymn to Beauty
C++ 3D Engine
Input.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <json/json.h>
4
#include <vector>
5
6
namespace
Utility
{
7
class
Window;
8
}
9
10
#if !ANDROID
11
struct
GLFWwindow;
12
#endif
13
16
class
Input
{
17
public
:
19
struct
Button
{
21
char
action
[255];
22
24
int
key
;
25
27
int
state
;
28
};
29
31
std::vector<Button*>
buttons
;
32
34
37
static
Input
&
GetInstance
();
38
40
43
void
SetWindow
(
Utility::Window
* window);
44
46
50
bool
CheckButton
(
int
index)
const
;
51
53
56
Json::Value
Save
()
const
;
57
59
62
void
Load
(
const
Json::Value& buttonsNode);
63
64
private
:
65
#if !ANDROID
66
GLFWwindow* window;
67
#endif
68
69
Input
() {}
70
71
Input
(
Input
const
&) =
delete
;
72
void
operator=(
Input
const
&) =
delete
;
73
};
Input
Definition:
Input.hpp:16
Input::Save
Json::Value Save() const
Save the buttons to a JSON value.
Definition:
Input.cpp:37
Input::Load
void Load(const Json::Value &buttonsNode)
Load buttons from JSON node.
Definition:
Input.cpp:50
Input::SetWindow
void SetWindow(Utility::Window *window)
Set the window to check for input against.
Definition:
Input.cpp:16
Input::buttons
std::vector< Button * > buttons
The buttons to register.
Definition:
Input.hpp:31
Input::CheckButton
bool CheckButton(int index) const
Check if a button was activated this frame.
Definition:
Input.cpp:22
Input::GetInstance
static Input & GetInstance()
Get the input singleton instance.
Definition:
Input.cpp:11
Utility::Window
Definition:
Window.hpp:14
Utility
Definition:
ResourceView.hpp:12
Input::Button
The information needed to identify a button.
Definition:
Input.hpp:19
Input::Button::key
int key
The GLFW key to press.
Definition:
Input.hpp:24
Input::Button::action
char action[255]
A string describing the action, e.g "Fire".
Definition:
Input.hpp:21
Input::Button::state
int state
The GLFW state of that key.
Definition:
Input.hpp:27
src
Engine
Input
Input.hpp
Generated by
1.9.2