Minetest  5.4.0
JoystickController Class Reference

#include <joystick_controller.h>

+ Collaboration diagram for JoystickController:

Public Member Functions

 JoystickController ()
 
void onJoystickConnect (const std::vector< irr::SJoystickInfo > &joystick_infos)
 
bool handleEvent (const irr::SEvent::SJoystickEvent &ev)
 
void clear ()
 
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)
 
s16 getAxisWithoutDead (JoystickAxis axis)
 

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_COUNTm_keys_down
 
std::bitset< KeyType::INTERNAL_ENUM_COUNTm_keys_pressed
 
f32 m_internal_time
 
f32 m_past_pressed_time [KeyType::INTERNAL_ENUM_COUNT]
 
std::bitset< KeyType::INTERNAL_ENUM_COUNTm_past_keys_pressed
 
std::bitset< KeyType::INTERNAL_ENUM_COUNTm_keys_released
 

Constructor & Destructor Documentation

◆ JoystickController()

JoystickController::JoystickController ( )

References clear(), and m_past_pressed_time.

+ Here is the call graph for this function:

Member Function Documentation

◆ clear()

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().

+ Here is the caller graph for this function:

◆ clearWasKeyPressed()

void JoystickController::clearWasKeyPressed ( GameKeyType  b)
inline

References m_keys_pressed.

Referenced by Game::processPlayerInteraction().

+ Here is the caller graph for this function:

◆ clearWasKeyReleased()

void JoystickController::clearWasKeyReleased ( GameKeyType  b)
inline

References m_keys_released.

Referenced by Game::processPlayerInteraction().

+ Here is the caller graph for this function:

◆ getAxis()

s16 JoystickController::getAxis ( JoystickAxis  axis)
inline

References m_axes_vals.

◆ getAxisWithoutDead()

s16 JoystickController::getAxisWithoutDead ( JoystickAxis  axis)

References JoystickLayout::axes_deadzone, m_axes_vals, and m_layout.

Referenced by Game::updateCameraOrientation(), and Game::updatePlayerControl().

+ Here is the caller graph for this function:

◆ handleEvent()

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().

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

◆ isKeyDown()

bool JoystickController::isKeyDown ( GameKeyType  b)
inline

References m_keys_down.

Referenced by RealInputHandler::isKeyDown().

+ Here is the caller graph for this function:

◆ onJoystickConnect()

void JoystickController::onJoystickConnect ( const std::vector< irr::SJoystickInfo > &  joystick_infos)

References g_settings, Settings::get(), Settings::getS32(), m_joystick_id, and setLayoutFromControllerName().

Referenced by ClientLauncher::init_input().

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

◆ setLayoutFromControllerName()

void JoystickController::setLayoutFromControllerName ( const std::string &  name)
private

References create_default_layout(), create_xbox_layout(), lowercase(), and m_layout.

Referenced by onJoystickConnect().

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

◆ wasKeyDown()

bool JoystickController::wasKeyDown ( GameKeyType  b)
inline

References m_past_keys_pressed.

Referenced by GUIFormSpecMenu::preprocessEvent(), and RealInputHandler::wasKeyDown().

+ Here is the caller graph for this function:

◆ wasKeyPressed()

bool JoystickController::wasKeyPressed ( GameKeyType  b)
inline

References m_keys_pressed.

Referenced by RealInputHandler::wasKeyPressed().

+ Here is the caller graph for this function:

◆ wasKeyReleased()

bool JoystickController::wasKeyReleased ( GameKeyType  b)
inline

References m_keys_released.

Referenced by RealInputHandler::wasKeyReleased().

+ Here is the caller graph for this function:

Member Data Documentation

◆ doubling_dtime

f32 JoystickController::doubling_dtime

Referenced by handleEvent().

◆ m_axes_vals

s16 JoystickController::m_axes_vals[JA_COUNT]
private

◆ m_internal_time

f32 JoystickController::m_internal_time
private

Referenced by handleEvent().

◆ m_joystick_id

u8 JoystickController::m_joystick_id = 0
private

Referenced by handleEvent(), and onJoystickConnect().

◆ m_keys_down

std::bitset<KeyType::INTERNAL_ENUM_COUNT> JoystickController::m_keys_down
private

Referenced by clear(), handleEvent(), and isKeyDown().

◆ m_keys_pressed

std::bitset<KeyType::INTERNAL_ENUM_COUNT> JoystickController::m_keys_pressed
private

◆ m_keys_released

std::bitset<KeyType::INTERNAL_ENUM_COUNT> JoystickController::m_keys_released
private

◆ m_layout

JoystickLayout JoystickController::m_layout
private

◆ m_past_keys_pressed

std::bitset<KeyType::INTERNAL_ENUM_COUNT> JoystickController::m_past_keys_pressed
private

Referenced by clear(), handleEvent(), and wasKeyDown().

◆ m_past_pressed_time

f32 JoystickController::m_past_pressed_time[KeyType::INTERNAL_ENUM_COUNT]
private

Referenced by JoystickController(), and handleEvent().


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