#include <joystick_controller.h>
Public Member Functions | |
JoystickController () | |
void | onJoystickConnect (const std::vector< irr::SJoystickInfo > &joystick_infos) |
bool | handleEvent (const irr::SEvent::SJoystickEvent &ev) |
void | clear () |
void | releaseAllKeys () |
bool | wasKeyDown (GameKeyType b) |
bool | wasKeyReleased (GameKeyType b) |
void | clearWasKeyReleased (GameKeyType b) |
bool | wasKeyPressed (GameKeyType b) |
void | clearWasKeyPressed (GameKeyType b) |
bool | isKeyDown (GameKeyType b) |
s16 | getAxis (JoystickAxis axis) |
float | getAxisWithoutDead (JoystickAxis axis) |
float | getMovementDirection () |
float | getMovementSpeed () |
u8 | getJoystickId () const |
Public Attributes | |
f32 | doubling_dtime |
Private Member Functions | |
void | setLayoutFromControllerName (const std::string &name) |
Private Attributes | |
JoystickLayout | m_layout |
s16 | m_axes_vals [JA_COUNT] |
u8 | m_joystick_id = 0 |
std::bitset< KeyType::INTERNAL_ENUM_COUNT > | m_keys_down |
std::bitset< KeyType::INTERNAL_ENUM_COUNT > | m_keys_pressed |
f32 | m_internal_time |
f32 | m_past_pressed_time [KeyType::INTERNAL_ENUM_COUNT] |
std::bitset< KeyType::INTERNAL_ENUM_COUNT > | m_past_keys_pressed |
std::bitset< KeyType::INTERNAL_ENUM_COUNT > | m_keys_released |
JoystickController::JoystickController | ( | ) |
References JoystickLayout::axes_deadzone, clear(), doubling_dtime, g_settings, Settings::getFloat(), m_layout, and m_past_pressed_time.
void JoystickController::clear | ( | ) |
References m_axes_vals, m_keys_down, m_keys_pressed, m_keys_released, and m_past_keys_pressed.
Referenced by JoystickController(), and RealInputHandler::clear().
|
inline |
References m_keys_pressed.
Referenced by Game::processPlayerInteraction().
|
inline |
References m_keys_released.
Referenced by Game::processPlayerInteraction().
|
inline |
References m_axes_vals.
float JoystickController::getAxisWithoutDead | ( | JoystickAxis | axis | ) |
References JoystickLayout::axes_deadzone, m_axes_vals, and m_layout.
Referenced by getMovementDirection(), getMovementSpeed(), and Game::updateCameraOrientation().
|
inline |
References m_joystick_id.
Referenced by GUIFormSpecMenu::preprocessEvent().
float JoystickController::getMovementDirection | ( | ) |
References getAxisWithoutDead(), JA_FORWARD_MOVE, and JA_SIDEWARD_MOVE.
Referenced by RealInputHandler::getJoystickDirection().
float JoystickController::getMovementSpeed | ( | ) |
References getAxisWithoutDead(), JA_FORWARD_MOVE, and JA_SIDEWARD_MOVE.
Referenced by RealInputHandler::getJoystickSpeed().
bool JoystickController::handleEvent | ( | const irr::SEvent::SJoystickEvent & | ev | ) |
References JoystickLayout::axes, JoystickAxisLayout::axis_id, JoystickLayout::axis_keys, JoystickLayout::button_keys, doubling_dtime, porting::getTimeMs(), KeyType::INTERNAL_ENUM_COUNT, JoystickAxisLayout::invert, JA_COUNT, m_axes_vals, m_internal_time, m_joystick_id, m_keys_down, m_keys_pressed, m_keys_released, m_layout, m_past_keys_pressed, and m_past_pressed_time.
Referenced by MyEventReceiver::OnEvent(), and GUIFormSpecMenu::preprocessEvent().
|
inline |
References m_keys_down.
Referenced by RealInputHandler::isKeyDown().
void JoystickController::onJoystickConnect | ( | const std::vector< irr::SJoystickInfo > & | joystick_infos | ) |
References g_settings, Settings::get(), Settings::getS32(), m_joystick_id, rangelim, and setLayoutFromControllerName().
Referenced by ClientLauncher::init_input().
|
inline |
References m_keys_down, and m_keys_released.
Referenced by RealInputHandler::releaseAllKeys().
|
private |
References create_default_layout(), create_dragonrise_gamecube_layout(), create_xbox_layout(), lowercase(), and m_layout.
Referenced by onJoystickConnect().
|
inline |
References m_past_keys_pressed.
Referenced by GUIFormSpecMenu::preprocessEvent(), and RealInputHandler::wasKeyDown().
|
inline |
References m_keys_pressed.
Referenced by RealInputHandler::wasKeyPressed().
|
inline |
References m_keys_released.
Referenced by RealInputHandler::wasKeyReleased().
f32 JoystickController::doubling_dtime |
Referenced by JoystickController(), and handleEvent().
|
private |
Referenced by clear(), getAxis(), getAxisWithoutDead(), and handleEvent().
|
private |
Referenced by handleEvent().
|
private |
Referenced by getJoystickId(), handleEvent(), and onJoystickConnect().
|
private |
Referenced by clear(), handleEvent(), isKeyDown(), and releaseAllKeys().
|
private |
Referenced by clear(), clearWasKeyPressed(), handleEvent(), and wasKeyPressed().
|
private |
Referenced by clear(), clearWasKeyReleased(), handleEvent(), releaseAllKeys(), and wasKeyReleased().
|
private |
Referenced by JoystickController(), getAxisWithoutDead(), handleEvent(), and setLayoutFromControllerName().
|
private |
Referenced by clear(), handleEvent(), and wasKeyDown().
|
private |
Referenced by JoystickController(), and handleEvent().