Antkeeper  0.0.1
Public Member Functions | List of all members
input::action_map Class Reference

Maps input to a set of contextually-related actions. More...

#include <action-map.hpp>

Public Member Functions

void enable ()
 Enables the mapping of input events to actions. More...
 
void disable ()
 Disables the mapping of input events to actions. More...
 
void reset ()
 Resets the activation states of each action in the action map. More...
 
void set_event_dispatcher (event::dispatcher *dispatcher)
 Sets the event dispatcher from which this action map will receive input events. More...
 
void remove_mappings (action &action, mapping_type type)
 Unmaps input from an action. More...
 
void remove_mappings (action &action)
 Unmaps all input from an action. More...
 
void remove_mappings ()
 Unmaps all input from all actions in the action map. More...
 
std::vector< gamepad_axis_mappingget_gamepad_axis_mappings (const action &action) const
 Returns all of the gamepad axis mappings associated with an action. More...
 
std::vector< gamepad_button_mappingget_gamepad_button_mappings (const action &action) const
 Returns all of the gamepad button mappings associated with an action. More...
 
std::vector< key_mappingget_key_mappings (const action &action) const
 Returns all of the key mappings associated with an action. More...
 
std::vector< mouse_button_mappingget_mouse_button_mappings (const action &action) const
 Returns all of the mouse button mappings associated with an action. More...
 
std::vector< mouse_motion_mappingget_mouse_motion_mappings (const action &action) const
 Returns all of the mouse motion mappings associated with an action. More...
 
std::vector< mouse_scroll_mappingget_mouse_scroll_mappings (const action &action) const
 Returns all of the mouse scroll associated with an action. More...
 
constexpr bool is_enabled () const noexcept
 Returns true if the action map is enabled, false otherwise. More...
 
void add_mapping (action &action, const mapping &mapping)
 Maps input to an action. More...
 
void add_gamepad_axis_mapping (action &action, gamepad_axis_mapping mapping)
 Maps input to an action. More...
 
void add_gamepad_button_mapping (action &action, gamepad_button_mapping mapping)
 Maps input to an action. More...
 
void add_key_mapping (action &action, key_mapping mapping)
 Maps input to an action. More...
 
void add_mouse_button_mapping (action &action, mouse_button_mapping mapping)
 Maps input to an action. More...
 
void add_mouse_motion_mapping (action &action, mouse_motion_mapping mapping)
 Maps input to an action. More...
 
void add_mouse_scroll_mapping (action &action, mouse_scroll_mapping mapping)
 Maps input to an action. More...
 

Detailed Description

Maps input to a set of contextually-related actions.

Definition at line 42 of file action-map.hpp.

Member Function Documentation

◆ add_gamepad_axis_mapping()

void input::action_map::add_gamepad_axis_mapping ( action action,
gamepad_axis_mapping  mapping 
)

Maps input to an action.

Parameters
actionAction to which input will be mapped.
mappingInput mapping to add.

Definition at line 121 of file action-map.cpp.

◆ add_gamepad_button_mapping()

void input::action_map::add_gamepad_button_mapping ( action action,
gamepad_button_mapping  mapping 
)

Maps input to an action.

Parameters
actionAction to which input will be mapped.
mappingInput mapping to add.

Definition at line 127 of file action-map.cpp.

◆ add_key_mapping()

void input::action_map::add_key_mapping ( action action,
key_mapping  mapping 
)

Maps input to an action.

Parameters
actionAction to which input will be mapped.
mappingInput mapping to add.

Definition at line 133 of file action-map.cpp.

◆ add_mapping()

void input::action_map::add_mapping ( action action,
const mapping mapping 
)

Maps input to an action.

Parameters
actionAction to which input will be mapped.
mappingInput mapping to add.

Definition at line 87 of file action-map.cpp.

◆ add_mouse_button_mapping()

void input::action_map::add_mouse_button_mapping ( action action,
mouse_button_mapping  mapping 
)

Maps input to an action.

Parameters
actionAction to which input will be mapped.
mappingInput mapping to add.

Definition at line 139 of file action-map.cpp.

◆ add_mouse_motion_mapping()

void input::action_map::add_mouse_motion_mapping ( action action,
mouse_motion_mapping  mapping 
)

Maps input to an action.

Parameters
actionAction to which input will be mapped.
mappingInput mapping to add.

Definition at line 145 of file action-map.cpp.

◆ add_mouse_scroll_mapping()

void input::action_map::add_mouse_scroll_mapping ( action action,
mouse_scroll_mapping  mapping 
)

Maps input to an action.

Parameters
actionAction to which input will be mapped.
mappingInput mapping to add.

Definition at line 151 of file action-map.cpp.

◆ disable()

void input::action_map::disable ( )

Disables the mapping of input events to actions.

Definition at line 41 of file action-map.cpp.

◆ enable()

void input::action_map::enable ( )

Enables the mapping of input events to actions.

Definition at line 28 of file action-map.cpp.

◆ get_gamepad_axis_mappings()

std::vector< gamepad_axis_mapping > input::action_map::get_gamepad_axis_mappings ( const action action) const

Returns all of the gamepad axis mappings associated with an action.

Parameters
actionAction with which associated mappings will be returned.

Definition at line 412 of file action-map.cpp.

◆ get_gamepad_button_mappings()

std::vector< gamepad_button_mapping > input::action_map::get_gamepad_button_mappings ( const action action) const

Returns all of the gamepad button mappings associated with an action.

Parameters
actionAction with which associated mappings will be returned.

Definition at line 427 of file action-map.cpp.

◆ get_key_mappings()

std::vector< key_mapping > input::action_map::get_key_mappings ( const action action) const

Returns all of the key mappings associated with an action.

Parameters
actionAction with which associated mappings will be returned.

Definition at line 442 of file action-map.cpp.

◆ get_mouse_button_mappings()

std::vector< mouse_button_mapping > input::action_map::get_mouse_button_mappings ( const action action) const

Returns all of the mouse button mappings associated with an action.

Parameters
actionAction with which associated mappings will be returned.

Definition at line 457 of file action-map.cpp.

◆ get_mouse_motion_mappings()

std::vector< mouse_motion_mapping > input::action_map::get_mouse_motion_mappings ( const action action) const

Returns all of the mouse motion mappings associated with an action.

Parameters
actionAction with which associated mappings will be returned.

Definition at line 472 of file action-map.cpp.

◆ get_mouse_scroll_mappings()

std::vector< mouse_scroll_mapping > input::action_map::get_mouse_scroll_mappings ( const action action) const

Returns all of the mouse scroll associated with an action.

Parameters
actionAction with which associated mappings will be returned.

Definition at line 487 of file action-map.cpp.

◆ is_enabled()

constexpr bool input::action_map::is_enabled ( ) const
inlineconstexprnoexcept

Returns true if the action map is enabled, false otherwise.

Definition at line 146 of file action-map.hpp.

◆ remove_mappings() [1/3]

void input::action_map::remove_mappings ( )

Unmaps all input from all actions in the action map.

Definition at line 258 of file action-map.cpp.

◆ remove_mappings() [2/3]

void input::action_map::remove_mappings ( action action)

Unmaps all input from an action.

Parameters
actionAction from which input will be unmapped.

Definition at line 241 of file action-map.cpp.

◆ remove_mappings() [3/3]

void input::action_map::remove_mappings ( action action,
mapping_type  type 
)

Unmaps input from an action.

Parameters
actionAction from which input will be unmapped.
typeType of input mapping to remove.

Definition at line 157 of file action-map.cpp.

◆ reset()

void input::action_map::reset ( )

Resets the activation states of each action in the action map.

Definition at line 54 of file action-map.cpp.

◆ set_event_dispatcher()

void input::action_map::set_event_dispatcher ( event::dispatcher dispatcher)

Sets the event dispatcher from which this action map will receive input events.

Parameters
dispatcherEvent dispatcher from which this action map will receive input events.

Definition at line 62 of file action-map.cpp.


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