23#include "IGUIStaticText.h"
25#include <IEventReceiver.h>
27#include <IGUIEnvironment.h>
31#include <unordered_map>
61 static_assert(std::is_base_of_v<IGUIElement, T>,
62 "grab_gui_element only works for IGUIElement");
63 return std::shared_ptr<T>(element, [](T *e) {
107#define BUTTON_REPEAT_DELAY 0.5f
108#define BUTTON_REPEAT_INTERVAL 0.333f
113#define SIMULATED_CLICK_DURATION_MS 50
130 void emitAction(
bool action, video::IVideoDriver *driver,
169 void step(
float dtime);
243 void addButton(std::vector<button_info> &buttons,
245 const recti &rect,
bool visible=
true);
248 const std::string &image_1,
const std::string &image_2,
249 const recti &rect,
bool visible=
true);
252 const recti &rect,
bool visible);
Definition texturesource.h:34
Definition touchcontrols.h:136
bool m_has_joystick_id
Definition touchcontrols.h:216
void registerHotbarRect(u16 index, const recti &rect)
Definition touchcontrols.cpp:766
bool m_dig_pressed
Definition touchcontrols.h:273
void applyContextControls(const TouchInteractionMode &mode)
Definition touchcontrols.cpp:859
IGUIImage * makeButtonDirect(touch_gui_button_id id, const recti &rect, bool visible)
Definition touchcontrols.cpp:440
v2s32 m_move_pos
Definition touchcontrols.h:210
void show()
Definition touchcontrols.cpp:830
bool m_visible
Definition touchcontrols.h:189
void updateVisibility()
Definition touchcontrols.cpp:792
TapState m_tap_state
Definition touchcontrols.h:271
double m_camera_pitch_change
Definition touchcontrols.h:196
u64 m_move_downtime
Definition touchcontrols.h:208
void addToggleButton(std::vector< button_info > &buttons, touch_gui_button_id id, const std::string &image_1, const std::string &image_2, const recti &rect, bool visible=true)
Definition touchcontrols.cpp:430
u64 m_place_pressed_until
Definition touchcontrols.h:277
TouchControls(IrrlichtDevice *device, ISimpleTextureSource *tsrc)
Definition touchcontrols.cpp:277
bool m_fixed_joystick
Definition touchcontrols.h:222
v2u32 m_screensize
Definition touchcontrols.h:185
void resetHotbarRects()
Definition touchcontrols.cpp:761
std::optional< u16 > getHotbarSelection()
Definition touchcontrols.cpp:466
bool m_overflow_open
Definition touchcontrols.h:232
double getYawChange()
Definition touchcontrols.h:143
line3d< f32 > m_shootline
A line starting at the camera and pointing towards the selected object.
Definition touchcontrols.h:203
std::vector< button_info > m_overflow_buttons
Definition touchcontrols.h:234
float m_joystick_speed
Definition touchcontrols.h:220
u16 m_long_tap_delay
Definition touchcontrols.h:188
std::shared_ptr< IGUIStaticText > m_overflow_bg
Definition touchcontrols.h:233
std::vector< recti > m_overflow_button_rects
Definition touchcontrols.h:236
v2s32 getPointerPos()
Definition touchcontrols.cpp:835
ISimpleTextureSource * m_texturesource
Definition touchcontrols.h:184
float getMovementSpeed()
Definition touchcontrols.h:167
void releaseAll()
Definition touchcontrols.cpp:808
std::vector< std::shared_ptr< IGUIStaticText > > m_overflow_button_titles
Definition touchcontrols.h:235
bool m_move_prevent_short_tap
Definition touchcontrols.h:214
void emitMouseEvent(EMOUSE_INPUT_EVENT type)
Definition touchcontrols.cpp:844
void addButton(std::vector< button_info > &buttons, touch_gui_button_id id, const std::string &image, const recti &rect, bool visible=true)
Definition touchcontrols.cpp:417
std::unordered_map< size_t, v2s32 > m_pointer_pos
Definition touchcontrols.h:266
size_t m_joystick_id
Definition touchcontrols.h:217
float getMovementDirection()
Definition touchcontrols.h:166
TouchInteractionMode m_last_mode
Definition touchcontrols.h:270
std::shared_ptr< IGUIImage > m_joystick_btn_center
Definition touchcontrols.h:227
IGUIEnvironment * m_guienv
Definition touchcontrols.h:182
std::optional< u16 > m_hotbar_selection
Definition touchcontrols.h:192
IEventReceiver * m_receiver
Definition touchcontrols.h:183
std::shared_ptr< IGUIImage > m_overflow_btn
Definition touchcontrols.h:230
void setUseCrosshair(bool use_crosshair)
Definition touchcontrols.h:170
void translateEvent(const SEvent &event)
Definition touchcontrols.cpp:525
s32 m_button_size
Definition touchcontrols.h:186
void setVisible(bool visible)
Definition touchcontrols.cpp:771
std::shared_ptr< IGUIImage > m_joystick_btn_bg
Definition touchcontrols.h:226
std::unordered_map< size_t, v2s32 > m_pointer_downpos
Definition touchcontrols.h:264
bool isHotbarButton(const SEvent &event)
Definition touchcontrols.cpp:451
IrrlichtDevice * m_device
Definition touchcontrols.h:181
void handleReleaseEvent(size_t pointer_id)
Definition touchcontrols.cpp:473
bool m_draw_crosshair
Definition touchcontrols.h:224
void applyJoystickStatus()
Definition touchcontrols.cpp:706
void toggleOverflowMenu()
Definition touchcontrols.cpp:785
bool m_had_move_id
Definition touchcontrols.h:213
size_t m_move_id
Definition touchcontrols.h:206
double m_touchscreen_threshold
Definition touchcontrols.h:187
std::shared_ptr< IGUIImage > m_joystick_btn_off
Definition touchcontrols.h:225
line3d< f32 > getShootline()
Returns a line which describes what the player is pointing at.
Definition touchcontrols.h:164
u64 m_dig_pressed_until
Definition touchcontrols.h:274
std::vector< button_info > m_buttons
Definition touchcontrols.h:229
void hide()
Definition touchcontrols.cpp:825
std::unordered_map< u16, recti > m_hotbar_rects
Definition touchcontrols.h:191
float m_joystick_direction
Definition touchcontrols.h:219
bool m_joystick_status_aux1
Definition touchcontrols.h:221
bool m_move_has_really_moved
Definition touchcontrols.h:207
void step(float dtime)
Definition touchcontrols.cpp:722
double getPitchChange()
Definition touchcontrols.h:150
double m_camera_yaw_change
Definition touchcontrols.h:195
bool m_place_pressed
Definition touchcontrols.h:276
bool m_joystick_has_really_moved
Definition touchcontrols.h:218
bool m_joystick_triggers_aux1
Definition touchcontrols.h:223
bool m_has_move_id
Definition touchcontrols.h:205
core::vector2d< s32 > v2s32
Definition irr_v2d.h:28
core::vector2d< u32 > v2u32
Definition irr_v2d.h:29
TouchInteractionMode
Definition itemdef.h:58
@ TouchInteractionMode_END
Definition itemdef.h:62
Definition guiSkin.cpp:18
TouchControls * g_touchcontrols
Definition touchcontrols.cpp:43
touch_gui_button_id
Definition touchcontrols.h:77
@ joystick_center_id
Definition touchcontrols.h:103
@ fast_id
Definition touchcontrols.h:87
@ chat_id
Definition touchcontrols.h:95
@ inventory_id
Definition touchcontrols.h:96
@ debug_id
Definition touchcontrols.h:88
@ range_id
Definition touchcontrols.h:90
@ zoom_id
Definition touchcontrols.h:80
@ exit_id
Definition touchcontrols.h:98
@ aux1_id
Definition touchcontrols.h:81
@ fly_id
Definition touchcontrols.h:85
@ minimap_id
Definition touchcontrols.h:91
@ camera_id
Definition touchcontrols.h:89
@ drop_id
Definition touchcontrols.h:97
@ jump_id
Definition touchcontrols.h:78
@ joystick_off_id
Definition touchcontrols.h:101
@ toggle_chat_id
Definition touchcontrols.h:92
@ joystick_bg_id
Definition touchcontrols.h:102
@ sneak_id
Definition touchcontrols.h:79
@ noclip_id
Definition touchcontrols.h:86
@ overflow_id
Definition touchcontrols.h:82
std::shared_ptr< T > grab_gui_element(T *element)
Definition touchcontrols.h:59
TapState
Definition touchcontrols.h:70