CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::InputManager Class Referencefinal

#include <CeresEngine/Input/InputManager.hpp>

Public Member Functions

 InputManager (InputProvider &provider) noexcept
 Create a new input manager.
 
 InputManager (const InputManager &)=delete
 
InputManager & operator= (const InputManager &)=delete
 
 ~InputManager ()
 Destroys the input manager.
 
InputAction & action (const StringView &name)
 Gets a action by it's name.
 
const InputAction & action (const StringView &name) const
 Gets a action by it's name.
 
InputRange & range (const StringView &name)
 Gets a range by it's name.
 
const InputRange & range (const StringView &name) const
 Gets a range by it's name.
 
InputContext & add (const StringView &contextName)
 Adds a new input context.
 
void remove (const StringView &contextName)
 Removes a input context.
 
InputContext & context (const StringView &contextName)
 Gets a input context by name.
 
const InputContext & context (const StringView &contextName) const
 Gets a input context by name.
 
void update ()
 Update input actions and ranges.
 
void setCursorMode (CursorMode mode)
 Sets the cursor mode.
 
const InputState & getInputState () const noexcept
 The current state of input.
 

Public Attributes

Event< void(const AnyInputEvent &)> didReceiveEvent
 
Event< void(const KeyEvent &)> onKeyDown
 
Event< void(const KeyEvent &)> onKeyUp
 
Event< void(const MouseEvent &)> onMouseDown
 
Event< void(const MouseEvent &)> onMouseUp
 
Event< void(const MouseEvent &)> onMouseMove
 
Event< void(const MouseEvent &)> onMouseDrag
 
Event< void(const MouseEvent &)> onMouseScroll
 
Event< void(const TextEvent &)> onTextInput
 

Private Attributes

Map< String, InputContext > contexts
 A map of all active contexts.
 
InputProvider & provider
 The input provider to fetch input state from.
 
InputState mInputState
 The current state of input.
 

Constructor & Destructor Documentation

◆ InputManager() [1/2]

CeresEngine::InputManager::InputManager ( InputProvider &  provider)
explicitnoexcept

Create a new input manager.

Parameters
providerThe InputProvider to capture input state from

◆ InputManager() [2/2]

CeresEngine::InputManager::InputManager ( const InputManager &  )
delete

◆ ~InputManager()

CeresEngine::InputManager::~InputManager ( )

Destroys the input manager.

Member Function Documentation

◆ action() [1/2]

InputAction & CeresEngine::InputManager::action ( const StringView &  name)

Gets a action by it's name.

Parameters
nameThe action name
Returns
A reference to the action

◆ action() [2/2]

const InputAction & CeresEngine::InputManager::action ( const StringView &  name) const

Gets a action by it's name.

Parameters
nameThe action name
Returns
A reference to the action

◆ add()

InputContext & CeresEngine::InputManager::add ( const StringView &  contextName)

Adds a new input context.

Parameters
contextNameThe input context name
Returns
A reference to the input context

◆ context() [1/2]

InputContext & CeresEngine::InputManager::context ( const StringView &  contextName)

Gets a input context by name.

Parameters
contextNameThe input context name
Returns
A reference to the input context

◆ context() [2/2]

const InputContext & CeresEngine::InputManager::context ( const StringView &  contextName) const

Gets a input context by name.

Parameters
contextNameThe input context name
Returns
A reference to the input context

◆ getInputState()

const InputState & CeresEngine::InputManager::getInputState ( ) const
inlinenoexcept

The current state of input.

This object is updated on the update() method based on the events queued from the provider.

◆ operator=()

InputManager & CeresEngine::InputManager::operator= ( const InputManager &  )
delete

◆ range() [1/2]

InputRange & CeresEngine::InputManager::range ( const StringView &  name)

Gets a range by it's name.

Parameters
nameThe range name
Returns
A reference to the range

◆ range() [2/2]

const InputRange & CeresEngine::InputManager::range ( const StringView &  name) const

Gets a range by it's name.

Parameters
nameThe range name
Returns
A reference to the range

◆ remove()

void CeresEngine::InputManager::remove ( const StringView &  contextName)

Removes a input context.

Parameters
contextNameThe input context to be removed

◆ setCursorMode()

void CeresEngine::InputManager::setCursorMode ( CursorMode  mode)

Sets the cursor mode.

Parameters
modeThe cursor mode to be set

◆ update()

void CeresEngine::InputManager::update ( )

Update input actions and ranges.

Member Data Documentation

◆ contexts

Map<String, InputContext> CeresEngine::InputManager::contexts
private

A map of all active contexts.

◆ didReceiveEvent

Event<void(const AnyInputEvent&)> CeresEngine::InputManager::didReceiveEvent

◆ mInputState

InputState CeresEngine::InputManager::mInputState
private

The current state of input.

This object is updated on the update() method based on the events queued from the provider.

◆ onKeyDown

Event<void(const KeyEvent&)> CeresEngine::InputManager::onKeyDown

◆ onKeyUp

Event<void(const KeyEvent&)> CeresEngine::InputManager::onKeyUp

◆ onMouseDown

Event<void(const MouseEvent&)> CeresEngine::InputManager::onMouseDown

◆ onMouseDrag

Event<void(const MouseEvent&)> CeresEngine::InputManager::onMouseDrag

◆ onMouseMove

Event<void(const MouseEvent&)> CeresEngine::InputManager::onMouseMove

◆ onMouseScroll

Event<void(const MouseEvent&)> CeresEngine::InputManager::onMouseScroll

◆ onMouseUp

Event<void(const MouseEvent&)> CeresEngine::InputManager::onMouseUp

◆ onTextInput

Event<void(const TextEvent&)> CeresEngine::InputManager::onTextInput

◆ provider

InputProvider& CeresEngine::InputManager::provider
private

The input provider to fetch input state from.


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