SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Input.h
1#pragma once
2
3#include "spark/core/Export.h"
4
5#include "spark/base/KeyCodes.h"
6#include "spark/base/MouseCodes.h"
7#include "spark/math/Vector2.h"
8#include "spark/patterns/Signal.h"
9
10#include <unordered_map>
11
12namespace spark::core
13{
17 class SPARK_CORE_EXPORT Input
18 {
19 public:
25 static bool IsKeyPressed(base::KeyCode key);
26
32 static bool IsMousePressed(base::MouseCode button = base::MouseCodes::Left);
33
38 static math::Vector2<float> MousePosition();
39
43 static std::unordered_map<base::KeyCode, patterns::Signal<>> keyPressedEvents;
44
48 static std::unordered_map<base::KeyCode, patterns::Signal<>> keyReleasedEvents;
49
53 static std::unordered_map<base::MouseCode, patterns::Signal<>> mousePressedEvents;
54
58 static std::unordered_map<base::MouseCode, patterns::Signal<>> mouseReleasedEvents;
59
64 };
65}
A static class giving access to real-time input.
Definition Input.h:18
static patterns::Signal mouseMovedEvent
A signal that is triggered when the mouse is moved.
Definition Input.h:63
static std::unordered_map< base::MouseCode, patterns::Signal<> > mousePressedEvents
A map of signals that are triggered when a mouse button is pressed.
Definition Input.h:53
static std::unordered_map< base::KeyCode, patterns::Signal<> > keyReleasedEvents
A map of signals that are triggered when a key is released.
Definition Input.h:48
static std::unordered_map< base::KeyCode, patterns::Signal<> > keyPressedEvents
A map of signals that are triggered when a key is pressed.
Definition Input.h:43
static std::unordered_map< base::MouseCode, patterns::Signal<> > mouseReleasedEvents
A map of signals that are triggered when a mouse button is released.
Definition Input.h:58
A vector with two components.
Definition Vector2.h:13
A signal is a class used to emit events.
Definition Slot.h:10