VEGO-Engine  0.1
Loading...
Searching...
No Matches
InputManager Class Reference

InputManager class to handle input events and actions. More...

#include <InputManager.h>

Classes

struct  InputAction
 InputAction struct to represent an action and its bindings. More...
 

Public Types

enum class  Key
 A list of every key that can be bound to an action.
 

Public Member Functions

void registerAction (const std::string &actionName, const std::vector< Key > &keys, std::function< void(bool)> callback, const std::string &context="Default")
 Register an action with a name, key bindings, and a callback function.
 
void setActiveContext (const std::string &context)
 set the active context, is "Default" by default
 
std::string getActiveContext () const
 Get the active context.
 

Detailed Description

InputManager class to handle input events and actions.

This class manages input events, allowing for the registration of actions and their corresponding key bindings.

Member Function Documentation

◆ registerAction()

void InputManager::registerAction ( const std::string & actionName,
const std::vector< Key > & keys,
std::function< void(bool)> callback,
const std::string & context = "Default" )

Register an action with a name, key bindings, and a callback function.

Parameters
actionNameThe name of the action
keysThe keys that are bound to this action
callbackThe function to call when the action is triggered
contextThe context in which the action is valid can be used to switch between e.g. gameplay and menu so the same keys can be used for different actions

◆ setActiveContext()

void InputManager::setActiveContext ( const std::string & context)

set the active context, is "Default" by default

Parameters
contextThe name of the context to set as active

The documentation for this class was generated from the following files: