Luanti 5.17.0-dev
Loading...
Searching...
No Matches
MyEventReceiver Class Reference

#include <inputhandler.h>

Inheritance diagram for MyEventReceiver:
Collaboration diagram for MyEventReceiver:

Classes

struct  Keybinding
struct  PhysicalKeyState

Public Member Functions

virtual bool OnEvent (const SEvent &event)
float GetAxisValue (GameKeyType key) const
bool IsKeyDown (GameKeyType key) const
bool WasKeyDown (GameKeyType key)
bool WasKeyPressed (GameKeyType key) const
bool WasKeyReleased (GameKeyType key) const
void reloadKeybindings ()
s32 getMouseWheel ()
void clearInput ()
void releaseAllKeys ()
void clearWasKeyPressed ()
void clearWasKeyReleased ()
PointerType getLastPointerType ()

Private Member Functions

void listenForKey (KeyPress keyCode, GameKeyType action)
bool setKeyDown (KeyPress keyCode, float value)
void setKeyDown (GameKeyType action, std::pair< float, bool > new_state)
std::pair< float, bool > checkKeyDown (GameKeyType action) const

Private Attributes

std::array< Keybinding, KeyType::INTERNAL_ENUM_COUNTkeybindings
float repeat_joystick_button_time = 0.0f
s32 mouse_wheel = 0
std::map< KeyPress, PhysicalKeyStatephysicalKeyDown
std::array< float, GameKeyType::INTERNAL_ENUM_COUNT > axisValues
std::bitset< GameKeyType::INTERNAL_ENUM_COUNT > keyWasDown
std::bitset< GameKeyType::INTERNAL_ENUM_COUNT > keyWasPressed
std::bitset< GameKeyType::INTERNAL_ENUM_COUNT > keyWasReleased
std::unordered_map< KeyPress, GameKeyTypekeysListenedFor
bool fullscreen_is_down = false
bool close_world_down = false
bool esc_down = false
PointerType last_pointer_type = PointerType::Mouse

Member Function Documentation

◆ checkKeyDown()

std::pair< float, bool > MyEventReceiver::checkKeyDown ( GameKeyType action) const
private

References KeyPress::GAMEPAD, keybindings, p(), and physicalKeyDown.

Referenced by setKeyDown().

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

◆ clearInput()

void MyEventReceiver::clearInput ( )
inline

◆ clearWasKeyPressed()

void MyEventReceiver::clearWasKeyPressed ( )
inline

References keyWasPressed.

◆ clearWasKeyReleased()

void MyEventReceiver::clearWasKeyReleased ( )
inline

References keyWasReleased.

◆ GetAxisValue()

float MyEventReceiver::GetAxisValue ( GameKeyType key) const
inline

References axisValues.

Referenced by IsKeyDown().

Here is the caller graph for this function:

◆ getLastPointerType()

PointerType MyEventReceiver::getLastPointerType ( )
inline

References last_pointer_type.

◆ getMouseWheel()

s32 MyEventReceiver::getMouseWheel ( )
inline

References mouse_wheel.

◆ IsKeyDown()

bool MyEventReceiver::IsKeyDown ( GameKeyType key) const
inline

References GetAxisValue().

Referenced by setKeyDown(), and WasKeyDown().

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

◆ listenForKey()

void MyEventReceiver::listenForKey ( KeyPress keyCode,
GameKeyType action )
inlineprivate

References keysListenedFor.

Referenced by reloadKeybindings().

Here is the caller graph for this function:

◆ OnEvent()

bool MyEventReceiver::OnEvent ( const SEvent & event)
virtual

References ARRLEN, close_world_down, esc_down, EscapeKey, fullscreen_is_down, g_gamecallback, g_logger, g_menumgr, g_settings, g_touchcontrols, RenderingEngine::get_raw_device(), InputHandler::intToAnalog(), isMenuActive(), keySettingHasMatch(), last_pointer_type, LL_ERROR, LL_INFO, LL_NONE, LL_VERBOSE, LL_WARNING, Mouse, mouse_wheel, setKeyDown(), and Touch.

Here is the call graph for this function:

◆ releaseAllKeys()

void MyEventReceiver::releaseAllKeys ( )
inline

◆ reloadKeybindings()

◆ setKeyDown() [1/2]

void MyEventReceiver::setKeyDown ( GameKeyType action,
std::pair< float, bool > new_state )
private

References axisValues, IsKeyDown(), keyWasDown, keyWasPressed, and keyWasReleased.

Here is the call graph for this function:

◆ setKeyDown() [2/2]

bool MyEventReceiver::setKeyDown ( KeyPress keyCode,
float value )
private

References checkKeyDown(), porting::getTimeMs(), keysListenedFor, physicalKeyDown, and setKeyDown().

Referenced by OnEvent(), and setKeyDown().

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

◆ WasKeyDown()

bool MyEventReceiver::WasKeyDown ( GameKeyType key)

References KeyPress::GAMEPAD, porting::getTimeMs(), IsKeyDown(), keybindings, keyWasDown, physicalKeyDown, and repeat_joystick_button_time.

Here is the call graph for this function:

◆ WasKeyPressed()

bool MyEventReceiver::WasKeyPressed ( GameKeyType key) const
inline

References keyWasPressed.

◆ WasKeyReleased()

bool MyEventReceiver::WasKeyReleased ( GameKeyType key) const
inline

References keyWasReleased.

Member Data Documentation

◆ axisValues

std::array<float, GameKeyType::INTERNAL_ENUM_COUNT> MyEventReceiver::axisValues
private

◆ close_world_down

bool MyEventReceiver::close_world_down = false
private

Referenced by OnEvent().

◆ esc_down

bool MyEventReceiver::esc_down = false
private

Referenced by OnEvent().

◆ fullscreen_is_down

bool MyEventReceiver::fullscreen_is_down = false
private

Referenced by OnEvent().

◆ keybindings

std::array<Keybinding, KeyType::INTERNAL_ENUM_COUNT> MyEventReceiver::keybindings
private

◆ keysListenedFor

std::unordered_map<KeyPress, GameKeyType> MyEventReceiver::keysListenedFor
private

◆ keyWasDown

std::bitset<GameKeyType::INTERNAL_ENUM_COUNT> MyEventReceiver::keyWasDown
private

Referenced by clearInput(), setKeyDown(), and WasKeyDown().

◆ keyWasPressed

std::bitset<GameKeyType::INTERNAL_ENUM_COUNT> MyEventReceiver::keyWasPressed
private

◆ keyWasReleased

std::bitset<GameKeyType::INTERNAL_ENUM_COUNT> MyEventReceiver::keyWasReleased
private

◆ last_pointer_type

PointerType MyEventReceiver::last_pointer_type = PointerType::Mouse
private

Referenced by getLastPointerType(), and OnEvent().

◆ mouse_wheel

s32 MyEventReceiver::mouse_wheel = 0
private

Referenced by clearInput(), getMouseWheel(), and OnEvent().

◆ physicalKeyDown

std::map<KeyPress, PhysicalKeyState> MyEventReceiver::physicalKeyDown
private

◆ repeat_joystick_button_time

float MyEventReceiver::repeat_joystick_button_time = 0.0f
private

Referenced by reloadKeybindings(), and WasKeyDown().


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