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
109 void step(
float dtime);
195 bool buttonsHandlePress(std::vector<button_info> &buttons,
size_t pointer_id, IGUIElement *element);
197 bool buttonsStep(std::vector<button_info> &buttons,
float dtime);
205 void addButton(std::vector<button_info> &buttons,
207 const recti &rect,
bool visible);
210 const std::string &image_1,
const std::string &image_2,
211 const recti &rect,
bool visible);
214 const recti &rect,
bool visible);
Definition texturesource.h:25
Definition touchcontrols.h:74
bool m_has_joystick_id
Definition touchcontrols.h:162
void registerHotbarRect(u16 index, const recti &rect)
Definition touchcontrols.cpp:660
void addButton(std::vector< button_info > &buttons, touch_gui_button_id id, const std::string &image, const recti &rect, bool visible)
Definition touchcontrols.cpp:331
bool m_dig_pressed
Definition touchcontrols.h:235
DISABLE_CLASS_COPY(TouchControls)
void applyContextControls(const TouchInteractionMode &mode)
Definition touchcontrols.cpp:757
IGUIImage * makeButtonDirect(touch_gui_button_id id, const recti &rect, bool visible)
Definition touchcontrols.cpp:353
v2s32 m_move_pos
Definition touchcontrols.h:156
void show()
Definition touchcontrols.cpp:727
bool m_visible
Definition touchcontrols.h:135
void updateVisibility()
Definition touchcontrols.cpp:686
TapState m_tap_state
Definition touchcontrols.h:233
double m_camera_pitch_change
Definition touchcontrols.h:142
~TouchControls()
Definition touchcontrols.cpp:315
bool mayAddButton(touch_gui_button_id id)
Definition touchcontrols.cpp:320
u64 m_move_downtime
Definition touchcontrols.h:154
IGUIStaticText * getStatusText()
Definition touchcontrols.h:121
u64 m_place_pressed_until
Definition touchcontrols.h:239
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:343
TouchControls(IrrlichtDevice *device, ISimpleTextureSource *tsrc)
Definition touchcontrols.cpp:204
bool m_fixed_joystick
Definition touchcontrols.h:168
v2u32 m_screensize
Definition touchcontrols.h:131
void resetHotbarRects()
Definition touchcontrols.cpp:655
bool buttonsStep(std::vector< button_info > &buttons, float dtime)
Definition touchcontrols.cpp:113
std::optional< u16 > getHotbarSelection()
Definition touchcontrols.cpp:378
bool m_overflow_open
Definition touchcontrols.h:178
double getYawChange()
Definition touchcontrols.h:83
line3d< f32 > m_shootline
A line starting at the camera and pointing towards the selected object.
Definition touchcontrols.h:149
std::vector< button_info > m_overflow_buttons
Definition touchcontrols.h:180
float m_joystick_speed
Definition touchcontrols.h:166
u16 m_long_tap_delay
Definition touchcontrols.h:134
std::shared_ptr< IGUIStaticText > m_overflow_bg
Definition touchcontrols.h:179
std::vector< recti > m_overflow_button_rects
Definition touchcontrols.h:182
v2s32 getPointerPos()
Definition touchcontrols.cpp:732
ISimpleTextureSource * m_texturesource
Definition touchcontrols.h:130
void releaseAll()
Definition touchcontrols.cpp:705
std::vector< std::shared_ptr< IGUIStaticText > > m_overflow_button_titles
Definition touchcontrols.h:181
bool m_move_prevent_short_tap
Definition touchcontrols.h:160
void emitMouseEvent(EMOUSE_INPUT_EVENT type)
Definition touchcontrols.cpp:741
void buttonEmitAction(button_info &btn, bool action)
Definition touchcontrols.cpp:53
std::unordered_map< size_t, v2s32 > m_pointer_pos
Definition touchcontrols.h:228
size_t m_joystick_id
Definition touchcontrols.h:163
ButtonLayout getLayout()
Definition touchcontrols.h:123
void applyLayout(const ButtonLayout &layout)
Definition touchcontrols.cpp:220
TouchInteractionMode m_last_mode
Definition touchcontrols.h:232
std::shared_ptr< IGUIImage > m_joystick_btn_center
Definition touchcontrols.h:173
IGUIEnvironment * m_guienv
Definition touchcontrols.h:128
bool buttonsHandlePress(std::vector< button_info > &buttons, size_t pointer_id, IGUIElement *element)
Definition touchcontrols.cpp:72
std::optional< u16 > m_hotbar_selection
Definition touchcontrols.h:138
void loadButtonTexture(IGUIImage *gui_button, const std::string &path)
Definition touchcontrols.cpp:44
IEventReceiver * m_receiver
Definition touchcontrols.h:129
float getJoystickSpeed()
Definition touchcontrols.h:107
std::shared_ptr< IGUIImage > m_overflow_btn
Definition touchcontrols.h:176
void setUseCrosshair(bool use_crosshair)
Definition touchcontrols.h:110
void translateEvent(const SEvent &event)
Definition touchcontrols.cpp:430
s32 m_button_size
Definition touchcontrols.h:132
void setVisible(bool visible)
Definition touchcontrols.cpp:665
std::shared_ptr< IGUIImage > m_joystick_btn_bg
Definition touchcontrols.h:172
std::unordered_map< size_t, v2s32 > m_pointer_downpos
Definition touchcontrols.h:226
bool isHotbarButton(const SEvent &event)
Definition touchcontrols.cpp:363
IrrlichtDevice * m_device
Definition touchcontrols.h:127
void handleReleaseEvent(size_t pointer_id)
Definition touchcontrols.cpp:385
bool m_draw_crosshair
Definition touchcontrols.h:170
void applyJoystickStatus()
Definition touchcontrols.cpp:601
void toggleOverflowMenu()
Definition touchcontrols.cpp:678
bool m_had_move_id
Definition touchcontrols.h:159
size_t m_move_id
Definition touchcontrols.h:152
std::shared_ptr< IGUIStaticText > m_status_text
Definition touchcontrols.h:184
double m_touchscreen_threshold
Definition touchcontrols.h:133
std::shared_ptr< IGUIImage > m_joystick_btn_off
Definition touchcontrols.h:171
line3d< f32 > getShootline()
Returns a line which describes what the player is pointing at.
Definition touchcontrols.h:104
void emitKeyboardEvent(EKEY_CODE keycode, bool pressed)
Definition touchcontrols.cpp:32
u64 m_dig_pressed_until
Definition touchcontrols.h:236
std::vector< button_info > m_buttons
Definition touchcontrols.h:175
void hide()
Definition touchcontrols.cpp:722
ButtonLayout m_layout
Definition touchcontrols.h:241
std::unordered_map< u16, recti > m_hotbar_rects
Definition touchcontrols.h:137
float m_joystick_direction
Definition touchcontrols.h:165
float getJoystickDirection()
Definition touchcontrols.h:106
bool isStatusTextOverriden()
Definition touchcontrols.h:120
bool m_joystick_status_aux1
Definition touchcontrols.h:167
bool buttonsHandleRelease(std::vector< button_info > &buttons, size_t pointer_id)
Definition touchcontrols.cpp:95
bool m_move_has_really_moved
Definition touchcontrols.h:153
void step(float dtime)
Definition touchcontrols.cpp:611
double getPitchChange()
Definition touchcontrols.h:90
double m_camera_yaw_change
Definition touchcontrols.h:141
bool m_place_pressed
Definition touchcontrols.h:238
bool m_joystick_has_really_moved
Definition touchcontrols.h:164
bool m_joystick_triggers_aux1
Definition touchcontrols.h:169
bool m_has_move_id
Definition touchcontrols.h:151
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