9#include "IEventReceiver.h"
13#include <unordered_map>
25 class IGUIEnvironment;
48#define BUTTON_REPEAT_DELAY 0.5f
49#define BUTTON_REPEAT_INTERVAL 0.333f
54#define SIMULATED_CLICK_DURATION_MS 50
71 void emitAction(
bool action, video::IVideoDriver *driver,
112 void step(
float dtime);
195 void addButton(std::vector<button_info> &buttons,
197 const recti &rect,
bool visible);
200 const std::string &image_1,
const std::string &image_2,
201 const recti &rect,
bool visible);
204 const recti &rect,
bool visible);
Definition texturesource.h:25
Definition touchcontrols.h:77
bool m_has_joystick_id
Definition touchcontrols.h:165
void registerHotbarRect(u16 index, const recti &rect)
Definition touchcontrols.cpp:679
void addButton(std::vector< button_info > &buttons, touch_gui_button_id id, const std::string &image, const recti &rect, bool visible)
Definition touchcontrols.cpp:338
bool m_dig_pressed
Definition touchcontrols.h:225
DISABLE_CLASS_COPY(TouchControls)
void applyContextControls(const TouchInteractionMode &mode)
Definition touchcontrols.cpp:776
IGUIImage * makeButtonDirect(touch_gui_button_id id, const recti &rect, bool visible)
Definition touchcontrols.cpp:361
v2s32 m_move_pos
Definition touchcontrols.h:159
void show()
Definition touchcontrols.cpp:746
bool m_visible
Definition touchcontrols.h:138
void updateVisibility()
Definition touchcontrols.cpp:705
TapState m_tap_state
Definition touchcontrols.h:223
double m_camera_pitch_change
Definition touchcontrols.h:145
~TouchControls()
Definition touchcontrols.cpp:322
bool mayAddButton(touch_gui_button_id id)
Definition touchcontrols.cpp:327
u64 m_move_downtime
Definition touchcontrols.h:157
IGUIStaticText * getStatusText()
Definition touchcontrols.h:124
u64 m_place_pressed_until
Definition touchcontrols.h:229
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)
Definition touchcontrols.cpp:351
TouchControls(IrrlichtDevice *device, ISimpleTextureSource *tsrc)
Definition touchcontrols.cpp:211
bool m_fixed_joystick
Definition touchcontrols.h:171
v2u32 m_screensize
Definition touchcontrols.h:134
void resetHotbarRects()
Definition touchcontrols.cpp:674
std::optional< u16 > getHotbarSelection()
Definition touchcontrols.cpp:387
bool m_overflow_open
Definition touchcontrols.h:181
double getYawChange()
Definition touchcontrols.h:86
line3d< f32 > m_shootline
A line starting at the camera and pointing towards the selected object.
Definition touchcontrols.h:152
std::vector< button_info > m_overflow_buttons
Definition touchcontrols.h:183
float m_joystick_speed
Definition touchcontrols.h:169
u16 m_long_tap_delay
Definition touchcontrols.h:137
std::shared_ptr< IGUIStaticText > m_overflow_bg
Definition touchcontrols.h:182
std::vector< recti > m_overflow_button_rects
Definition touchcontrols.h:185
v2s32 getPointerPos()
Definition touchcontrols.cpp:751
ISimpleTextureSource * m_texturesource
Definition touchcontrols.h:133
void releaseAll()
Definition touchcontrols.cpp:724
std::vector< std::shared_ptr< IGUIStaticText > > m_overflow_button_titles
Definition touchcontrols.h:184
bool m_move_prevent_short_tap
Definition touchcontrols.h:163
void emitMouseEvent(EMOUSE_INPUT_EVENT type)
Definition touchcontrols.cpp:760
std::unordered_map< size_t, v2s32 > m_pointer_pos
Definition touchcontrols.h:218
size_t m_joystick_id
Definition touchcontrols.h:166
ButtonLayout getLayout()
Definition touchcontrols.h:126
void applyLayout(const ButtonLayout &layout)
Definition touchcontrols.cpp:227
TouchInteractionMode m_last_mode
Definition touchcontrols.h:222
std::shared_ptr< IGUIImage > m_joystick_btn_center
Definition touchcontrols.h:176
IGUIEnvironment * m_guienv
Definition touchcontrols.h:131
std::optional< u16 > m_hotbar_selection
Definition touchcontrols.h:141
IEventReceiver * m_receiver
Definition touchcontrols.h:132
float getJoystickSpeed()
Definition touchcontrols.h:110
std::shared_ptr< IGUIImage > m_overflow_btn
Definition touchcontrols.h:179
void setUseCrosshair(bool use_crosshair)
Definition touchcontrols.h:113
void translateEvent(const SEvent &event)
Definition touchcontrols.cpp:441
s32 m_button_size
Definition touchcontrols.h:135
void setVisible(bool visible)
Definition touchcontrols.cpp:684
std::shared_ptr< IGUIImage > m_joystick_btn_bg
Definition touchcontrols.h:175
std::unordered_map< size_t, v2s32 > m_pointer_downpos
Definition touchcontrols.h:216
bool isHotbarButton(const SEvent &event)
Definition touchcontrols.cpp:372
IrrlichtDevice * m_device
Definition touchcontrols.h:130
void handleReleaseEvent(size_t pointer_id)
Definition touchcontrols.cpp:394
bool m_draw_crosshair
Definition touchcontrols.h:173
void applyJoystickStatus()
Definition touchcontrols.cpp:614
void toggleOverflowMenu()
Definition touchcontrols.cpp:697
bool m_had_move_id
Definition touchcontrols.h:162
size_t m_move_id
Definition touchcontrols.h:155
std::shared_ptr< IGUIStaticText > m_status_text
Definition touchcontrols.h:187
double m_touchscreen_threshold
Definition touchcontrols.h:136
std::shared_ptr< IGUIImage > m_joystick_btn_off
Definition touchcontrols.h:174
line3d< f32 > getShootline()
Returns a line which describes what the player is pointing at.
Definition touchcontrols.h:107
u64 m_dig_pressed_until
Definition touchcontrols.h:226
std::vector< button_info > m_buttons
Definition touchcontrols.h:178
void hide()
Definition touchcontrols.cpp:741
ButtonLayout m_layout
Definition touchcontrols.h:231
std::unordered_map< u16, recti > m_hotbar_rects
Definition touchcontrols.h:140
float m_joystick_direction
Definition touchcontrols.h:168
float getJoystickDirection()
Definition touchcontrols.h:109
bool isStatusTextOverriden()
Definition touchcontrols.h:123
bool m_joystick_status_aux1
Definition touchcontrols.h:170
bool m_move_has_really_moved
Definition touchcontrols.h:156
void step(float dtime)
Definition touchcontrols.cpp:630
double getPitchChange()
Definition touchcontrols.h:93
double m_camera_yaw_change
Definition touchcontrols.h:144
bool m_place_pressed
Definition touchcontrols.h:228
bool m_joystick_has_really_moved
Definition touchcontrols.h:167
bool m_joystick_triggers_aux1
Definition touchcontrols.h:172
bool m_has_move_id
Definition touchcontrols.h:154
core::vector2d< s32 > v2s32
Definition irr_v2d.h:13
core::vector2d< u32 > v2u32
Definition irr_v2d.h:14
TouchInteractionMode
Definition itemdef.h:43
@ TouchInteractionMode_END
Definition itemdef.h:47
Definition fontengine.h:14
Definition clientmap.h:30
TouchControls * g_touchcontrols
Definition touchcontrols.cpp:30
TapState
Definition touchcontrols.h:41
touch_gui_button_id
Definition touchscreenlayout.h:24