1 #ifndef HB_INPUT_MANAGER_H
2 #define HB_INPUT_MANAGER_H
5 #include <SFML/Window.hpp>
6 #include <SFML/Graphics.hpp>
7 #include "../Core/MessageManager.h"
8 #include "../Core/Game.h"
17 typedef sf::Keyboard Keyboard;
18 typedef sf::Joystick Joystick;
19 typedef sf::Mouse Mouse;
20 typedef sf::Event Event;
42 x += Renderer::getWindow().getView().getCenter().x - Renderer::getWindow().getSize().x / 2;
43 y += Renderer::getWindow().getView().getCenter().y - Renderer::getWindow().getSize().y / 2;
44 Vector3d v = x * Renderer::getCamera().getInverseAxisX() + y * Renderer::getCamera().getInverseAxisY();
53 bool alt, control, shift, system;
54 explicit KeyPressed(
const Event::KeyEvent& ev):
66 bool alt, control, shift, system;
79 unsigned int joystickId, button;
81 joystickId(ev.joystickId),
89 unsigned int joystickId, button;
91 joystickId(ev.joystickId),
99 unsigned int joystickId;
102 explicit JoyAxis(
const Event::JoystickMoveEvent& ev):
103 joystickId(ev.joystickId),
105 position(ev.position)
111 unsigned int width, height;
118 class InputManager :
public hb::MessageManager<MouseButtonWindow, MouseButtonWorld, KeyPressed, KeyReleased, JoyButtonPressed, JoyButtonReleased, JoyAxis, WindowResized>
126 static std::unique_ptr<InputManager> s_instance;
128 std::map<Keyboard::Key, bool> m_pressed_keys;
129 std::map<std::pair<int, int>,
bool> m_pressed_buttons;
Generic message manager class.This class allows to define callbacks for a set of predefined events wi...
Definition: MessageManager.h:87
Definition: InputManager.h:63
A 3D vector.
Definition: Vector3d.h:14
Definition: InputManager.h:50
Definition: Box2DPlugin.h:6
Definition: InputManager.h:97
double y
y component of the vector.
Definition: Vector3d.h:18
Definition: InputManager.h:109
double x
x component of the vector.
Definition: Vector3d.h:17