![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
#include <JoystickManager.h>
Classes | |
| struct | JoystickInfo |
| struct | JoystickState |
Public Member Functions | |
| JoystickManager () | |
| virtual | ~JoystickManager () |
| void | Initialize () |
| void | Scan_Joysticks () |
| void | Shutdown () |
| void | Process (float dt) |
| void | HandleEvent (const SDL_Event *ev) |
| std::vector< SDL_JoystickID > | GetConnectedJoysticks () |
| bool | IsJoystickConnected (SDL_JoystickID id) |
| void | BeginFrame () |
| bool | GetButton (SDL_JoystickID id, int button) |
| bool | IsButtonPressed (SDL_JoystickID id, int button) |
| bool | IsButtonReleased (SDL_JoystickID id, int button) |
| float | GetAxis (SDL_JoystickID id, int axis) |
Static Public Member Functions | |
| static JoystickManager & | GetInstance () |
| static JoystickManager & | Get () |
Static Public Attributes | |
| static constexpr int | MAX_BUTTONS = 16 |
| static constexpr int | MAX_AXES = 6 |
Private Member Functions | |
| void | OpenJoystick (SDL_JoystickID instance_id) |
| void | CloseJoystick (SDL_JoystickID instance_id) |
| void | PostJoystickButtonEvent (SDL_JoystickID which, int button, bool down) |
| void | PostJoystickAxisEvent (SDL_JoystickID which, int axis, Sint16 value) |
| void | PostJoystickConnectedEvent (SDL_JoystickID which, bool bconnected) |
Private Attributes | |
| std::string | name |
| std::unordered_map< SDL_JoystickID, JoystickInfo > | m_joysticks |
| std::unordered_map< SDL_JoystickID, JoystickState > | m_joyStates |
| std::mutex | m_mutex |
Definition at line 13 of file JoystickManager.h.
|
inline |
Definition at line 19 of file JoystickManager.h.
References Initialize(), and name.
Referenced by GetInstance().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinevirtual |
Definition at line 24 of file JoystickManager.h.
References Shutdown().
Here is the call graph for this function:| void JoystickManager::BeginFrame | ( | ) |
Definition at line 18 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joyStates, and m_mutex.
Referenced by SDL_AppEvent(), and SDL_AppIterate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 335 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joyStates, m_joysticks, and m_mutex.
Referenced by HandleEvent().
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 30 of file JoystickManager.h.
References GetInstance().
Referenced by InputsManager::AutoBindControllerToPlayer(), InputsManager::BindControllerToPlayer(), InputsManager::GetAvailableJoystickCount(), InputsManager::GetConnectedJoysticksCount(), InputsManager::GetDevicesStatusUpdate(), InputsManager::HandleEvent(), InputMappingSystem::Process(), CameraSystem::ProcessJoystickInput(), SDL_AppEvent(), SDL_AppIterate(), and InputsManager::Shutdown().
Here is the call graph for this function:
Here is the caller graph for this function:| float JoystickManager::GetAxis | ( | SDL_JoystickID | id, |
| int | axis | ||
| ) |
Definition at line 56 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joyStates, m_mutex, and MAX_AXES.
Here is the call graph for this function:| bool JoystickManager::GetButton | ( | SDL_JoystickID | id, |
| int | button | ||
| ) |
Definition at line 29 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joyStates, m_mutex, and MAX_BUTTONS.
Here is the call graph for this function:| std::vector< SDL_JoystickID > JoystickManager::GetConnectedJoysticks | ( | ) |
Definition at line 283 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joysticks, and m_mutex.
Referenced by InputsManager::AutoBindControllerToPlayer(), InputsManager::GetAvailableJoystickCount(), InputsManager::GetConnectedJoysticksCount(), and InputsManager::GetDevicesStatusUpdate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 12 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), and JoystickManager().
Referenced by Get().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 111 of file JoystickManager.cpp.
References InputsManager::AddDisconnectedPlayer(), CloseJoystick(), Message::Create(), InputsManager::Get(), EventQueue::Get(), GetComponentTypeID_Static(), InputsManager::GetPlayerForController(), Input, m_joyStates, m_mutex, MAX_AXES, MAX_BUTTONS, Olympe_EventType_Joystick_Connected, Olympe_EventType_Joystick_Disconnected, OpenJoystick(), PostJoystickAxisEvent(), PostJoystickButtonEvent(), EventQueue::Push(), SYSTEM_LOG, and InputsManager::UnbindControllerFromPlayer().
Referenced by InputsManager::HandleEvent().
Here is the call graph for this function:
Here is the caller graph for this function:| void JoystickManager::Initialize | ( | ) |
Definition at line 65 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joysticks, Scan_Joysticks(), and SYSTEM_LOG.
Referenced by JoystickManager().
Here is the call graph for this function:
Here is the caller graph for this function:| bool JoystickManager::IsButtonPressed | ( | SDL_JoystickID | id, |
| int | button | ||
| ) |
Definition at line 38 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joyStates, m_mutex, and MAX_BUTTONS.
Here is the call graph for this function:| bool JoystickManager::IsButtonReleased | ( | SDL_JoystickID | id, |
| int | button | ||
| ) |
Definition at line 47 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joyStates, m_mutex, and MAX_BUTTONS.
Here is the call graph for this function:| bool JoystickManager::IsJoystickConnected | ( | SDL_JoystickID | id | ) |
Definition at line 292 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joysticks, and m_mutex.
Here is the call graph for this function:
|
private |
Definition at line 298 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), JoystickManager::JoystickInfo::joystick, m_joysticks, m_mutex, name, and SYSTEM_LOG.
Referenced by HandleEvent(), and Scan_Joysticks().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 367 of file JoystickManager.cpp.
References Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Input, Olympe_EventType_Joystick_AxisMotion, and EventQueue::Push().
Referenced by HandleEvent().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 353 of file JoystickManager.cpp.
References Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Input, Olympe_EventType_Joystick_ButtonDown, Olympe_EventType_Joystick_ButtonUp, and EventQueue::Push().
Referenced by HandleEvent().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 386 of file JoystickManager.cpp.
References Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Input, Olympe_EventType_Joystick_Connected, Olympe_EventType_Joystick_Disconnected, and EventQueue::Push().
Here is the call graph for this function:Definition at line 105 of file JoystickManager.cpp.
| void JoystickManager::Scan_Joysticks | ( | ) |
Definition at line 77 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), and OpenJoystick().
Referenced by Initialize().
Here is the call graph for this function:
Here is the caller graph for this function:| void JoystickManager::Shutdown | ( | ) |
Definition at line 91 of file JoystickManager.cpp.
References GetComponentTypeID_Static(), m_joysticks, m_mutex, and SYSTEM_LOG.
Referenced by InputsManager::Shutdown(), and ~JoystickManager().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 79 of file JoystickManager.h.
Referenced by BeginFrame(), CloseJoystick(), GetAxis(), GetButton(), HandleEvent(), IsButtonPressed(), and IsButtonReleased().
|
private |
Definition at line 78 of file JoystickManager.h.
Referenced by CloseJoystick(), GetConnectedJoysticks(), Initialize(), IsJoystickConnected(), OpenJoystick(), and Shutdown().
|
private |
Definition at line 80 of file JoystickManager.h.
Referenced by BeginFrame(), CloseJoystick(), GetAxis(), GetButton(), GetConnectedJoysticks(), HandleEvent(), IsButtonPressed(), IsButtonReleased(), IsJoystickConnected(), OpenJoystick(), and Shutdown().
Definition at line 17 of file JoystickManager.h.
Referenced by GetAxis(), and HandleEvent().
Definition at line 16 of file JoystickManager.h.
Referenced by GetButton(), HandleEvent(), IsButtonPressed(), and IsButtonReleased().
|
private |
Definition at line 55 of file JoystickManager.h.
Referenced by JoystickManager(), and OpenJoystick().