2#include "../FoundationBase.h"
51 bool keysDown[
static_cast<size_t>(Key::Count)] = {};
67 std::variant<Key, std::string>
data;
72 void submitKeyDown(
Key key,
double timestamp);
73 void submitKeyUp(
Key key,
double timestamp);
74 void submitChar(std::string ch,
double timestamp);
75 void submitReset(
double timestamp);
78 bool isKeyDown(
Key key)
const {
return state.keysDown[
static_cast<size_t>(key)]; }
80 bool hasChar(std::string_view ch)
const {
return state.chars.find(ch) != std::string::npos; }
81 bool wasKeyPressed(
Key key)
const;
82 bool wasKeyReleased(
Key key)
const;
88 const std::vector<Event>&
getEvents()
const {
return events; }
#define COGSFOUNDATION_API
Definition: FoundationBase.h:31
Definition: Keyboard.h:47
bool isKeyDown(Key key) const
Definition: Keyboard.h:78
std::vector< Event > eventQueue
Definition: Keyboard.h:94
const State & getState() const
Get the previous frame's keyboard state. Updated at the beginning of each new frame.
Definition: Keyboard.h:86
std::vector< Event > events
Definition: Keyboard.h:92
const std::vector< Event > & getEvents() const
Get the previous frame's event list. Updated at the beginning of each new frame.
Definition: Keyboard.h:88
bool isKeyUp(Key key) const
Definition: Keyboard.h:79
bool hasChar(std::string_view ch) const
Definition: Keyboard.h:80
State state
Definition: Keyboard.h:91
Main Cogs namespace.
Definition: MortonCode.h:5
@ Left
Definition: Mouse.h:16
@ Right
Definition: Mouse.h:17
@ Count
Definition: Mouse.h:20
Key
Definition: Keyboard.h:11
Definition: Keyboard.h:55
Type
Definition: Keyboard.h:56
std::variant< Key, std::string > data
Data associated with the event: Key for Press and Release events, std::string for AddChar events and ...
Definition: Keyboard.h:67
Type type
Event type.
Definition: Keyboard.h:63
double timestamp_ms
Timestamp in miliseconds.
Definition: Keyboard.h:64
Definition: Keyboard.h:50
std::string chars
List of characters generated by the keyboard this frame.
Definition: Keyboard.h:52