Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
InputDeviceManager Class Reference

#include <InputDevice.h>

Public Member Functions

 InputDeviceManager ()=default
 
 ~InputDeviceManager ()=default
 
void RegisterDevice (const InputDeviceSlot &slot)
 
void UnregisterDevice (int deviceIndex)
 
InputDeviceSlotAutoAssignDevice (short playerID)
 
bool AssignDeviceToPlayer (int deviceIndex, short playerID)
 
bool UnassignDevice (short playerID)
 
InputDeviceSlotGetDeviceForPlayer (short playerID)
 
const InputDeviceSlotGetDeviceForPlayer (short playerID) const
 
std::vector< InputDeviceSlot * > GetAvailableDevices ()
 
std::vector< InputDeviceSlot * > GetAllDevices ()
 
void AddProfile (std::shared_ptr< InputProfile > profile)
 
std::shared_ptr< InputProfileGetProfile (const std::string &profileName)
 
void SetDefaultProfile (InputDeviceType deviceType, const std::string &profileName)
 
void AddActionMap (const ActionMap &actionMap)
 
ActionMapGetActionMap (const std::string &mapName)
 
std::vector< ActionMap * > GetActionMapsForContext (ActionMapContext context)
 
void SetLogLevel (const std::string &level)
 
void LogDeviceStatus () const
 

Static Public Member Functions

static InputDeviceManagerGet ()
 

Private Member Functions

InputDeviceSlotFindFirstAvailableDevice ()
 

Private Attributes

std::unordered_map< int, InputDeviceSlotm_deviceSlots
 
std::unordered_map< short, intm_playerAssignments
 
std::unordered_map< std::string, std::shared_ptr< InputProfile > > m_profiles
 
std::unordered_map< InputDeviceType, std::string > m_defaultProfiles
 
std::vector< ActionMapm_actionMaps
 
int m_logLevel = 2
 

Detailed Description

Definition at line 177 of file InputDevice.h.

Constructor & Destructor Documentation

◆ InputDeviceManager()

InputDeviceManager::InputDeviceManager ( )
default

◆ ~InputDeviceManager()

InputDeviceManager::~InputDeviceManager ( )
default

Member Function Documentation

◆ AddActionMap()

void InputDeviceManager::AddActionMap ( const ActionMap actionMap)

Definition at line 339 of file InputDevice.cpp.

References GetComponentTypeID_Static(), m_actionMaps, m_logLevel, and SYSTEM_LOG.

Referenced by InputsManager::InitializeInputSystem(), and InputConfigLoader::ParseActionMaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddProfile()

void InputDeviceManager::AddProfile ( std::shared_ptr< InputProfile profile)

Definition at line 315 of file InputDevice.cpp.

References m_logLevel, m_profiles, and SYSTEM_LOG.

Referenced by InputsManager::InitializeInputSystem(), and InputConfigLoader::ParseProfiles().

+ Here is the caller graph for this function:

◆ AssignDeviceToPlayer()

bool InputDeviceManager::AssignDeviceToPlayer ( int  deviceIndex,
short  playerID 
)

Definition at line 209 of file InputDevice.cpp.

References InputDeviceSlot::assignedPlayerID, GetComponentTypeID_Static(), m_deviceSlots, m_logLevel, m_playerAssignments, and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ AutoAssignDevice()

InputDeviceSlot * InputDeviceManager::AutoAssignDevice ( short  playerID)

◆ FindFirstAvailableDevice()

InputDeviceSlot * InputDeviceManager::FindFirstAvailableDevice ( )
private

Definition at line 398 of file InputDevice.cpp.

References GetComponentTypeID_Static(), Joystick, KeyboardMouse, and m_deviceSlots.

Referenced by AutoAssignDevice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Get()

static InputDeviceManager & InputDeviceManager::Get ( )
inlinestatic

◆ GetActionMap()

ActionMap * InputDeviceManager::GetActionMap ( const std::string &  mapName)

Definition at line 347 of file InputDevice.cpp.

References GetComponentTypeID_Static(), and m_actionMaps.

+ Here is the call graph for this function:

◆ GetActionMapsForContext()

std::vector< ActionMap * > InputDeviceManager::GetActionMapsForContext ( ActionMapContext  context)

Definition at line 356 of file InputDevice.cpp.

References GetComponentTypeID_Static(), and m_actionMaps.

+ Here is the call graph for this function:

◆ GetAllDevices()

std::vector< InputDeviceSlot * > InputDeviceManager::GetAllDevices ( )

Definition at line 306 of file InputDevice.cpp.

References GetComponentTypeID_Static(), and m_deviceSlots.

+ Here is the call graph for this function:

◆ GetAvailableDevices()

std::vector< InputDeviceSlot * > InputDeviceManager::GetAvailableDevices ( )

Definition at line 295 of file InputDevice.cpp.

References GetComponentTypeID_Static(), and m_deviceSlots.

+ Here is the call graph for this function:

◆ GetDeviceForPlayer() [1/2]

InputDeviceSlot * InputDeviceManager::GetDeviceForPlayer ( short  playerID)

Definition at line 273 of file InputDevice.cpp.

References GetComponentTypeID_Static(), m_deviceSlots, and m_playerAssignments.

Referenced by InputMappingSystem::Process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetDeviceForPlayer() [2/2]

const InputDeviceSlot * InputDeviceManager::GetDeviceForPlayer ( short  playerID) const

Definition at line 284 of file InputDevice.cpp.

References GetComponentTypeID_Static(), m_deviceSlots, and m_playerAssignments.

+ Here is the call graph for this function:

◆ GetProfile()

std::shared_ptr< InputProfile > InputDeviceManager::GetProfile ( const std::string &  profileName)

Definition at line 322 of file InputDevice.cpp.

References GetComponentTypeID_Static(), and m_profiles.

Referenced by InputConfigLoader::LoadProfileOverride(), and RegisterDevice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LogDeviceStatus()

void InputDeviceManager::LogDeviceStatus ( ) const

Definition at line 381 of file InputDevice.cpp.

References GetComponentTypeID_Static(), Joystick, m_deviceSlots, and SYSTEM_LOG.

Referenced by InputsManager::InitializeInputSystem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RegisterDevice()

void InputDeviceManager::RegisterDevice ( const InputDeviceSlot slot)

Definition at line 132 of file InputDevice.cpp.

References GetComponentTypeID_Static(), GetProfile(), Joystick, m_defaultProfiles, m_deviceSlots, m_logLevel, and SYSTEM_LOG.

Referenced by InputsManager::HandleEvent(), and InputsManager::InitializeInputSystem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDefaultProfile()

void InputDeviceManager::SetDefaultProfile ( InputDeviceType  deviceType,
const std::string &  profileName 
)

Definition at line 330 of file InputDevice.cpp.

References Joystick, m_defaultProfiles, m_logLevel, and SYSTEM_LOG.

Referenced by InputsManager::InitializeInputSystem(), and InputConfigLoader::ParseDefaultAssignments().

+ Here is the caller graph for this function:

◆ SetLogLevel()

void InputDeviceManager::SetLogLevel ( const std::string &  level)

Definition at line 372 of file InputDevice.cpp.

References GetComponentTypeID_Static(), m_logLevel, and SYSTEM_LOG.

Referenced by InputConfigLoader::LoadEngineConfig(), and InputConfigLoader::ParseGlobalSettings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnassignDevice()

bool InputDeviceManager::UnassignDevice ( short  playerID)

Definition at line 249 of file InputDevice.cpp.

References GetComponentTypeID_Static(), m_deviceSlots, m_logLevel, m_playerAssignments, and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ UnregisterDevice()

void InputDeviceManager::UnregisterDevice ( int  deviceIndex)

Definition at line 155 of file InputDevice.cpp.

References GetComponentTypeID_Static(), m_deviceSlots, m_logLevel, m_playerAssignments, and SYSTEM_LOG.

Referenced by InputsManager::HandleEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_actionMaps

std::vector<ActionMap> InputDeviceManager::m_actionMaps
private

Definition at line 233 of file InputDevice.h.

Referenced by AddActionMap(), GetActionMap(), and GetActionMapsForContext().

◆ m_defaultProfiles

std::unordered_map<InputDeviceType, std::string> InputDeviceManager::m_defaultProfiles
private

Definition at line 230 of file InputDevice.h.

Referenced by RegisterDevice(), and SetDefaultProfile().

◆ m_deviceSlots

std::unordered_map<int, InputDeviceSlot> InputDeviceManager::m_deviceSlots
private

◆ m_logLevel

int InputDeviceManager::m_logLevel = 2
private

◆ m_playerAssignments

std::unordered_map<short, int> InputDeviceManager::m_playerAssignments
private

◆ m_profiles

std::unordered_map<std::string, std::shared_ptr<InputProfile> > InputDeviceManager::m_profiles
private

Definition at line 227 of file InputDevice.h.

Referenced by AddProfile(), and GetProfile().


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