Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Input::InputManager Class Reference

#include <InputManager.h>

Collaboration diagram for Input::InputManager:

Classes

struct  BoolAction
struct  BoolCallbackEntry
struct  CallbackHandle
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, BoolActionboolActions_
std::unordered_map< std::string, FloatActionfloatActions_
std::unordered_map< std::string, Vec2Actionvec2Actions_
uint64_t nextCallbackId_ = 1
bool callbacksDispatched_ = true

Detailed Description

Definition at line 23 of file InputManager.h.

Member Typedef Documentation

◆ BoolCallback

using Input::InputManager::BoolCallback = std::function<void( bool value )>

Definition at line 48 of file InputManager.h.

◆ BoolProvider

using Input::InputManager::BoolProvider = std::function<bool()>

Definition at line 44 of file InputManager.h.

◆ FloatCallback

using Input::InputManager::FloatCallback = std::function<void( float value )>

Definition at line 49 of file InputManager.h.

◆ FloatProvider

using Input::InputManager::FloatProvider = std::function<float()>

Definition at line 45 of file InputManager.h.

◆ Vec2Callback

using Input::InputManager::Vec2Callback = std::function<void( glm::vec2 value )>

Definition at line 50 of file InputManager.h.

◆ Vec2Provider

using Input::InputManager::Vec2Provider = std::function<glm::vec2()>

Definition at line 46 of file InputManager.h.

Member Enumeration Documentation

◆ DispatchRule

Enumerator
EveryFrame 
Changed 
Pressed 
Released 

Definition at line 26 of file InputManager.h.

Member Function Documentation

◆ beginFrame()

void Input::InputManager::beginFrame ( )

◆ bindBoolAction()

void Input::InputManager::bindBoolAction ( std::string name,
BoolProvider provider )

◆ bindFloatAction()

void Input::InputManager::bindFloatAction ( std::string name,
FloatProvider provider )

◆ bindVec2Action()

void Input::InputManager::bindVec2Action ( std::string name,
Vec2Provider provider )

◆ dispatchCallbacks()

void Input::InputManager::dispatchCallbacks ( )

◆ getBoolAction()

bool Input::InputManager::getBoolAction ( const std::string & name) const
nodiscard

◆ getFloatAction()

float Input::InputManager::getFloatAction ( const std::string & name) const
nodiscard

◆ getVec2Action()

glm::vec2 Input::InputManager::getVec2Action ( const std::string & name) const
nodiscard

◆ makeHandle()

CallbackHandle Input::InputManager::makeHandle ( )
nodiscardprivate

◆ onBoolAction()

CallbackHandle Input::InputManager::onBoolAction ( const std::string & name,
DispatchRule rule,
BoolCallback callback )

◆ onBoolPressed()

CallbackHandle Input::InputManager::onBoolPressed ( const std::string & name,
std::function< void()> callback )

◆ onBoolReleased()

CallbackHandle Input::InputManager::onBoolReleased ( const std::string & name,
std::function< void()> callback )

◆ onFloatAction()

CallbackHandle Input::InputManager::onFloatAction ( const std::string & name,
DispatchRule rule,
FloatCallback callback )

◆ onVec2Action()

CallbackHandle Input::InputManager::onVec2Action ( const std::string & name,
DispatchRule rule,
Vec2Callback callback )

◆ removeCallback()

void Input::InputManager::removeCallback ( CallbackHandle handle)

Member Data Documentation

◆ boolActions_

std::unordered_map<std::string, BoolAction> Input::InputManager::boolActions_
private

Definition at line 119 of file InputManager.h.

◆ callbacksDispatched_

bool Input::InputManager::callbacksDispatched_ = true
private

Definition at line 123 of file InputManager.h.

◆ floatActions_

std::unordered_map<std::string, FloatAction> Input::InputManager::floatActions_
private

Definition at line 120 of file InputManager.h.

◆ nextCallbackId_

uint64_t Input::InputManager::nextCallbackId_ = 1
private

Definition at line 122 of file InputManager.h.

◆ vec2Actions_

std::unordered_map<std::string, Vec2Action> Input::InputManager::vec2Actions_
private

Definition at line 121 of file InputManager.h.


The documentation for this class was generated from the following file:
  • /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Input/InputManager.h