23#include "IGUIStaticText.h"
25#include <IEventReceiver.h>
27#include <IGUIEnvironment.h>
28#include <IrrlichtDevice.h>
32#include <unordered_map>
57 static_assert(std::is_base_of_v<IGUIElement, T>,
58 "grab_gui_element only works for IGUIElement");
59 return std::shared_ptr<T>(element, [](T *e) {
103#define BUTTON_REPEAT_DELAY 0.5f
104#define BUTTON_REPEAT_INTERVAL 0.333f
109#define SIMULATED_CLICK_DURATION_MS 50
126 void emitAction(
bool action, video::IVideoDriver *driver,
165 void step(
float dtime);
239 void addButton(std::vector<button_info> &buttons,
241 const recti &rect,
bool visible=
true);
244 const std::string &image_1,
const std::string &image_2,
245 const recti &rect,
bool visible=
true);
248 const recti &rect,
bool visible);
Definition texturesource.h:34
Definition touchscreengui.h:132
std::shared_ptr< IGUIImage > m_overflow_btn
Definition touchscreengui.h:226
double getYawChange()
Definition touchscreengui.h:139
std::shared_ptr< IGUIImage > m_joystick_btn_center
Definition touchscreengui.h:223
std::shared_ptr< IGUIStaticText > m_overflow_bg
Definition touchscreengui.h:229
TouchInteractionMode m_last_mode
Definition touchscreengui.h:266
v2s32 m_move_pos
Definition touchscreengui.h:206
bool m_had_move_id
Definition touchscreengui.h:209
bool isHotbarButton(const SEvent &event)
Definition touchscreengui.cpp:450
double m_camera_yaw_change
Definition touchscreengui.h:191
void applyJoystickStatus()
Definition touchscreengui.cpp:705
void handleReleaseEvent(size_t pointer_id)
Definition touchscreengui.cpp:472
TapState m_tap_state
Definition touchscreengui.h:267
bool m_has_move_id
Definition touchscreengui.h:201
bool m_draw_crosshair
Definition touchscreengui.h:220
size_t m_joystick_id
Definition touchscreengui.h:213
double m_touchscreen_threshold
Definition touchscreengui.h:183
bool m_overflow_open
Definition touchscreengui.h:228
double m_camera_pitch_change
Definition touchscreengui.h:192
u64 m_move_downtime
Definition touchscreengui.h:204
void step(float dtime)
Definition touchscreengui.cpp:721
void show()
Definition touchscreengui.cpp:829
ISimpleTextureSource * m_texturesource
Definition touchscreengui.h:180
line3d< f32 > getShootline()
Returns a line which describes what the player is pointing at.
Definition touchscreengui.h:160
bool m_fixed_joystick
Definition touchscreengui.h:218
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 touchscreengui.cpp:429
IEventReceiver * m_receiver
Definition touchscreengui.h:179
float getMovementSpeed()
Definition touchscreengui.h:163
std::vector< button_info > m_buttons
Definition touchscreengui.h:225
void addButton(std::vector< button_info > &buttons, touch_gui_button_id id, const std::string &image, const recti &rect, bool visible=true)
Definition touchscreengui.cpp:416
void hide()
Definition touchscreengui.cpp:824
void emitMouseEvent(EMOUSE_INPUT_EVENT type)
Definition touchscreengui.cpp:843
void releaseAll()
Definition touchscreengui.cpp:807
std::unordered_map< u16, recti > m_hotbar_rects
Definition touchscreengui.h:187
void resetHotbarRects()
Definition touchscreengui.cpp:760
std::shared_ptr< IGUIImage > m_joystick_btn_bg
Definition touchscreengui.h:222
bool m_place_pressed
Definition touchscreengui.h:272
void applyContextControls(const TouchInteractionMode &mode)
Definition touchscreengui.cpp:858
IrrlichtDevice * m_device
Definition touchscreengui.h:177
void updateVisibility()
Definition touchscreengui.cpp:791
IGUIEnvironment * m_guienv
Definition touchscreengui.h:178
void setVisible(bool visible)
Definition touchscreengui.cpp:770
float m_joystick_direction
Definition touchscreengui.h:215
void setUseCrosshair(bool use_crosshair)
Definition touchscreengui.h:166
bool m_move_prevent_short_tap
Definition touchscreengui.h:210
std::unordered_map< size_t, v2s32 > m_pointer_downpos
Definition touchscreengui.h:260
std::shared_ptr< IGUIImage > m_joystick_btn_off
Definition touchscreengui.h:221
v2u32 m_screensize
Definition touchscreengui.h:181
void translateEvent(const SEvent &event)
Definition touchscreengui.cpp:524
TouchScreenGUI(IrrlichtDevice *device, ISimpleTextureSource *tsrc)
Definition touchscreengui.cpp:276
double getPitchChange()
Definition touchscreengui.h:146
IGUIImage * makeButtonDirect(touch_gui_button_id id, const recti &rect, bool visible)
Definition touchscreengui.cpp:439
bool m_joystick_has_really_moved
Definition touchscreengui.h:214
void toggleOverflowMenu()
Definition touchscreengui.cpp:784
v2s32 getPointerPos()
Definition touchscreengui.cpp:834
bool m_visible
Definition touchscreengui.h:185
std::vector< std::shared_ptr< IGUIStaticText > > m_overflow_button_titles
Definition touchscreengui.h:231
bool m_joystick_triggers_aux1
Definition touchscreengui.h:219
std::vector< recti > m_overflow_button_rects
Definition touchscreengui.h:232
std::optional< u16 > m_hotbar_selection
Definition touchscreengui.h:188
bool m_move_has_really_moved
Definition touchscreengui.h:203
bool m_joystick_status_aux1
Definition touchscreengui.h:217
void registerHotbarRect(u16 index, const recti &rect)
Definition touchscreengui.cpp:765
u16 m_long_tap_delay
Definition touchscreengui.h:184
size_t m_move_id
Definition touchscreengui.h:202
std::unordered_map< size_t, v2s32 > m_pointer_pos
Definition touchscreengui.h:262
float getMovementDirection()
Definition touchscreengui.h:162
std::optional< u16 > getHotbarSelection()
Definition touchscreengui.cpp:465
line3d< f32 > m_shootline
A line starting at the camera and pointing towards the selected object.
Definition touchscreengui.h:199
bool m_dig_pressed
Definition touchscreengui.h:269
s32 m_button_size
Definition touchscreengui.h:182
bool m_has_joystick_id
Definition touchscreengui.h:212
u64 m_place_pressed_until
Definition touchscreengui.h:273
std::vector< button_info > m_overflow_buttons
Definition touchscreengui.h:230
float m_joystick_speed
Definition touchscreengui.h:216
u64 m_dig_pressed_until
Definition touchscreengui.h:270
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
touch_gui_button_id
Definition touchscreengui.h:73
@ joystick_center_id
Definition touchscreengui.h:99
@ fast_id
Definition touchscreengui.h:83
@ chat_id
Definition touchscreengui.h:91
@ inventory_id
Definition touchscreengui.h:92
@ debug_id
Definition touchscreengui.h:84
@ range_id
Definition touchscreengui.h:86
@ zoom_id
Definition touchscreengui.h:76
@ exit_id
Definition touchscreengui.h:94
@ aux1_id
Definition touchscreengui.h:77
@ fly_id
Definition touchscreengui.h:81
@ minimap_id
Definition touchscreengui.h:87
@ camera_id
Definition touchscreengui.h:85
@ drop_id
Definition touchscreengui.h:93
@ jump_id
Definition touchscreengui.h:74
@ joystick_off_id
Definition touchscreengui.h:97
@ toggle_chat_id
Definition touchscreengui.h:88
@ joystick_bg_id
Definition touchscreengui.h:98
@ sneak_id
Definition touchscreengui.h:75
@ noclip_id
Definition touchscreengui.h:82
@ overflow_id
Definition touchscreengui.h:78
TouchScreenGUI * g_touchscreengui
Definition touchscreengui.cpp:42
std::shared_ptr< T > grab_gui_element(T *element)
Definition touchscreengui.h:55
TapState
Definition touchscreengui.h:66