Cogs.Core
|
Classes | |
struct | Event |
struct | State |
Public Member Functions | |
void | update () |
Reset the state and events and update them from the eventQueue. | |
void | submitKeyDown (Key key, double timestamp) |
Queue key down event for being processed in the next update. | |
void | submitKeyUp (Key key, double timestamp) |
Queue key up event for being processed in the next update. | |
void | submitChar (std::string ch, double timestamp) |
Queue char event for being processed in the next update. | |
void | submitReset (double timestamp) |
Queue reset event for being processed in the next update. | |
bool | isKeyDown (Key key) const |
bool | isKeyUp (Key key) const |
bool | hasChar (std::string_view ch) const |
bool | wasKeyPressed (Key key) const |
Return true if the key was pressed in the last frame, false otherwise. | |
bool | wasKeyReleased (Key key) const |
Return true if the key was released in the last frame, false otherwise. | |
const State & | getState () const |
Get the previous frame's keyboard state. Updated at the beginning of each new frame. | |
const std::vector< Event > & | getEvents () const |
Get the previous frame's event list. Updated at the beginning of each new frame. | |
Private Attributes | |
State | state |
std::vector< Event > | events |
std::vector< Event > | eventQueue |
Definition at line 46 of file Keyboard.h.
|
inline |
Get the previous frame's event list. Updated at the beginning of each new frame.
Definition at line 88 of file Keyboard.h.
Referenced by Cogs::Core::EventBasedInput::updateState().
|
inline |
Get the previous frame's keyboard state. Updated at the beginning of each new frame.
Definition at line 86 of file Keyboard.h.
|
inline |
Definition at line 80 of file Keyboard.h.
|
inline |
Definition at line 78 of file Keyboard.h.
|
inline |
Definition at line 79 of file Keyboard.h.
void Cogs::Keyboard::submitChar | ( | std::string | ch, |
double | timestamp | ||
) |
Queue char event for being processed in the next update.
Definition at line 47 of file Keyboard.cpp.
void Cogs::Keyboard::submitKeyDown | ( | Key | key, |
double | timestamp | ||
) |
Queue key down event for being processed in the next update.
Definition at line 39 of file Keyboard.cpp.
void Cogs::Keyboard::submitKeyUp | ( | Key | key, |
double | timestamp | ||
) |
Queue key up event for being processed in the next update.
Definition at line 43 of file Keyboard.cpp.
void Cogs::Keyboard::submitReset | ( | double | timestamp | ) |
Queue reset event for being processed in the next update.
Definition at line 51 of file Keyboard.cpp.
void Cogs::Keyboard::update | ( | ) |
Reset the state and events and update them from the eventQueue.
Definition at line 3 of file Keyboard.cpp.
References Cogs::Keyboard::State::chars, and Cogs::Keyboard::State::keysDown.
bool Cogs::Keyboard::wasKeyPressed | ( | Key | key | ) | const |
Return true if the key was pressed in the last frame, false otherwise.
Definition at line 55 of file Keyboard.cpp.
bool Cogs::Keyboard::wasKeyReleased | ( | Key | key | ) | const |
Return true if the key was released in the last frame, false otherwise.
Definition at line 61 of file Keyboard.cpp.
|
private |
Definition at line 94 of file Keyboard.h.
|
private |
Definition at line 92 of file Keyboard.h.
|
private |
Definition at line 91 of file Keyboard.h.