|
Vulkan Schnee 0.0.1
High-performance rendering engine
|
Action-based input dispatcher for polling providers and invoking callbacks. More...
#include <InputManager.h>
Classes | |
| struct | BoolAction |
| struct | BoolCallbackEntry |
| struct | CallbackHandle |
| Opaque handle for a registered input callback. More... | |
| struct | FloatAction |
| struct | FloatCallbackEntry |
| struct | Vec2Action |
| struct | Vec2CallbackEntry |
Public Types | |
| enum class | DispatchRule { EveryFrame , Changed , Pressed , Released } |
| using | BoolProvider = std::function<bool()> |
| using | FloatProvider = std::function<float()> |
| using | Vec2Provider = std::function<glm::vec2()> |
| using | BoolCallback = std::function<void( bool value )> |
| using | FloatCallback = std::function<void( float value )> |
| using | Vec2Callback = std::function<void( glm::vec2 value )> |
Public Member Functions | |
| void | bindBoolAction (std::string name, BoolProvider provider) |
| void | bindFloatAction (std::string name, FloatProvider provider) |
| void | bindVec2Action (std::string name, Vec2Provider provider) |
| CallbackHandle | onBoolAction (const std::string &name, DispatchRule rule, BoolCallback callback) |
| CallbackHandle | onBoolPressed (const std::string &name, std::function< void()> callback) |
| CallbackHandle | onBoolReleased (const std::string &name, std::function< void()> callback) |
| CallbackHandle | onFloatAction (const std::string &name, DispatchRule rule, FloatCallback callback) |
| CallbackHandle | onVec2Action (const std::string &name, DispatchRule rule, Vec2Callback callback) |
| void | removeCallback (CallbackHandle handle) |
| void | beginFrame () |
| void | dispatchCallbacks () |
| bool | getBoolAction (const std::string &name) const |
| float | getFloatAction (const std::string &name) const |
| glm::vec2 | getVec2Action (const std::string &name) const |
Private Member Functions | |
| CallbackHandle | makeHandle () |
Private Attributes | |
| std::unordered_map< std::string, BoolAction > | boolActions_ |
| std::unordered_map< std::string, FloatAction > | floatActions_ |
| std::unordered_map< std::string, Vec2Action > | vec2Actions_ |
| uint64_t | nextCallbackId_ = 1 |
| bool | callbacksDispatched_ = true |
Action-based input dispatcher for polling providers and invoking callbacks.
Definition at line 26 of file InputManager.h.
| using Input::InputManager::BoolCallback = std::function<void( bool value )> |
Definition at line 57 of file InputManager.h.
| using Input::InputManager::BoolProvider = std::function<bool()> |
Definition at line 53 of file InputManager.h.
| using Input::InputManager::FloatCallback = std::function<void( float value )> |
Definition at line 58 of file InputManager.h.
| using Input::InputManager::FloatProvider = std::function<float()> |
Definition at line 54 of file InputManager.h.
| using Input::InputManager::Vec2Callback = std::function<void( glm::vec2 value )> |
Definition at line 59 of file InputManager.h.
| using Input::InputManager::Vec2Provider = std::function<glm::vec2()> |
Definition at line 55 of file InputManager.h.
|
strong |
| Enumerator | |
|---|---|
| EveryFrame | |
| Changed | |
| Pressed | |
| Released | |
Definition at line 29 of file InputManager.h.
| void Input::InputManager::beginFrame | ( | ) |
| void Input::InputManager::bindBoolAction | ( | std::string | name, |
| BoolProvider | provider ) |
| void Input::InputManager::bindFloatAction | ( | std::string | name, |
| FloatProvider | provider ) |
| void Input::InputManager::bindVec2Action | ( | std::string | name, |
| Vec2Provider | provider ) |
| void Input::InputManager::dispatchCallbacks | ( | ) |
|
nodiscard |
|
nodiscard |
|
nodiscard |
|
nodiscardprivate |
| CallbackHandle Input::InputManager::onBoolAction | ( | const std::string & | name, |
| DispatchRule | rule, | ||
| BoolCallback | callback ) |
| CallbackHandle Input::InputManager::onBoolPressed | ( | const std::string & | name, |
| std::function< void()> | callback ) |
| CallbackHandle Input::InputManager::onBoolReleased | ( | const std::string & | name, |
| std::function< void()> | callback ) |
| CallbackHandle Input::InputManager::onFloatAction | ( | const std::string & | name, |
| DispatchRule | rule, | ||
| FloatCallback | callback ) |
| CallbackHandle Input::InputManager::onVec2Action | ( | const std::string & | name, |
| DispatchRule | rule, | ||
| Vec2Callback | callback ) |
| void Input::InputManager::removeCallback | ( | CallbackHandle | handle | ) |
|
private |
Definition at line 128 of file InputManager.h.
|
private |
Definition at line 132 of file InputManager.h.
|
private |
Definition at line 129 of file InputManager.h.
|
private |
Definition at line 131 of file InputManager.h.
|
private |
Definition at line 130 of file InputManager.h.