#include <touchcontrols.h>
 | 
| void  | readSettings () | 
|   | 
| void  | applyLayout (const ButtonLayout &layout) | 
|   | 
| void  | emitKeyboardEvent (EKEY_CODE keycode, bool pressed) | 
|   | 
| void  | loadButtonTexture (IGUIImage *gui_button, const std::string &path) | 
|   | 
| void  | buttonEmitAction (button_info &btn, bool action) | 
|   | 
| bool  | buttonsHandlePress (std::vector< button_info > &buttons, size_t pointer_id, IGUIElement *element) | 
|   | 
| bool  | buttonsHandleRelease (std::vector< button_info > &buttons, size_t pointer_id) | 
|   | 
| bool  | buttonsStep (std::vector< button_info > &buttons, float dtime) | 
|   | 
| void  | toggleOverflowMenu () | 
|   | 
| void  | updateVisibility () | 
|   | 
| void  | releaseAll () | 
|   | 
| bool  | mayAddButton (touch_gui_button_id id) | 
|   | 
| void  | addButton (std::vector< button_info > &buttons, touch_gui_button_id id, const std::string &image, const recti &rect, bool visible) | 
|   | 
| 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) | 
|   | 
| IGUIImage *  | makeButtonDirect (touch_gui_button_id id, const recti &rect, bool visible) | 
|   | 
| bool  | isHotbarButton (const SEvent &event) | 
|   | 
| void  | handleReleaseEvent (size_t pointer_id) | 
|   | 
| void  | applyJoystickStatus () | 
|   | 
| v2s32  | getPointerPos () | 
|   | 
| void  | emitMouseEvent (EMOUSE_INPUT_EVENT type) | 
|   | 
◆ TouchControls()
◆ ~TouchControls()
      
        
          | TouchControls::~TouchControls  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ addButton()
  
  
      
        
          | void TouchControls::addButton  | 
          ( | 
          std::vector< button_info > & |           buttons,  | 
         
        
           | 
           | 
          touch_gui_button_id |           id,  | 
         
        
           | 
           | 
          const std::string & |           image,  | 
         
        
           | 
           | 
          const recti & |           rect,  | 
         
        
           | 
           | 
          bool |           visible ) | 
         
       
   | 
  
private   | 
  
 
 
◆ addToggleButton()
  
  
      
        
          | void TouchControls::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 ) | 
         
       
   | 
  
private   | 
  
 
 
◆ applyContextControls()
References emitMouseEvent(), porting::getTimeMs(), LongTap, m_dig_pressed, m_dig_pressed_until, m_last_mode, m_place_pressed, m_place_pressed_until, m_tap_state, None, sanity_check, SHORT_DIG_LONG_PLACE, ShortTap, SIMULATED_CLICK_DURATION_MS, and TouchInteractionMode_USER.
Referenced by Game::processPlayerInteraction().
 
 
◆ applyJoystickStatus()
  
  
      
        
          | void TouchControls::applyJoystickStatus  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ applyLayout()
  
  
      
        
          | void TouchControls::applyLayout  | 
          ( | 
          const ButtonLayout & |           layout | ) | 
           | 
         
       
   | 
  
private   | 
  
 
References addButton(), addToggleButton(), button_image_names, ButtonLayout::getMissingButtons(), ButtonLayout::getRect(), grab_gui_element(), joystick_bg_id, joystick_center_id, joystick_off_id, ButtonLayout::layout, layout_button_grid(), m_button_size, m_buttons, m_fixed_joystick, m_guienv, m_joystick_btn_bg, m_joystick_btn_center, m_joystick_btn_off, m_layout, m_overflow_bg, m_overflow_btn, m_overflow_button_rects, m_overflow_button_titles, m_overflow_buttons, m_screensize, m_status_text, m_texturesource, make_button_grid_title(), makeButtonDirect(), mayAddButton(), overflow_id, toggle_chat_id, and updateVisibility().
Referenced by readSettings(), and step().
 
 
◆ buttonEmitAction()
  
  
      
        
          | void TouchControls::buttonEmitAction  | 
          ( | 
          button_info & |           btn,  | 
         
        
           | 
           | 
          bool |           action ) | 
         
       
   | 
  
private   | 
  
 
 
◆ buttonsHandlePress()
  
  
      
        
          | bool TouchControls::buttonsHandlePress  | 
          ( | 
          std::vector< button_info > & |           buttons,  | 
         
        
           | 
           | 
          size_t |           pointer_id,  | 
         
        
           | 
           | 
          IGUIElement * |           element ) | 
         
       
   | 
  
private   | 
  
 
 
◆ buttonsHandleRelease()
  
  
      
        
          | bool TouchControls::buttonsHandleRelease  | 
          ( | 
          std::vector< button_info > & |           buttons,  | 
         
        
           | 
           | 
          size_t |           pointer_id ) | 
         
       
   | 
  
private   | 
  
 
 
◆ buttonsStep()
  
  
      
        
          | bool TouchControls::buttonsStep  | 
          ( | 
          std::vector< button_info > & |           buttons,  | 
         
        
           | 
           | 
          float |           dtime ) | 
         
       
   | 
  
private   | 
  
 
 
◆ DISABLE_CLASS_COPY()
◆ emitKeyboardEvent()
  
  
      
        
          | void TouchControls::emitKeyboardEvent  | 
          ( | 
          EKEY_CODE |           keycode,  | 
         
        
           | 
           | 
          bool |           pressed ) | 
         
       
   | 
  
private   | 
  
 
 
◆ emitMouseEvent()
  
  
      
        
          | void TouchControls::emitMouseEvent  | 
          ( | 
          EMOUSE_INPUT_EVENT |           type | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ getHotbarSelection()
      
        
          | std::optional< u16 > TouchControls::getHotbarSelection  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ getJoystickDirection()
  
  
      
        
          | float TouchControls::getJoystickDirection  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ getJoystickSpeed()
  
  
      
        
          | float TouchControls::getJoystickSpeed  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ getPitchChange()
  
  
      
        
          | double TouchControls::getPitchChange  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ getPointerPos()
  
  
      
        
          | v2s32 TouchControls::getPointerPos  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ getShootline()
  
  
      
        
          | line3d< f32 > TouchControls::getShootline  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Returns a line which describes what the player is pointing at. 
The starting point and looking direction are significant, the line should be scaled to match its length to the actual distance the player can reach. The line starts at the camera and ends on the camera's far plane. The coordinates do not contain the camera offset. 
References m_shootline.
Referenced by Game::processPlayerInteraction().
 
 
◆ getStatusText()
  
  
      
        
          | IGUIStaticText * TouchControls::getStatusText  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ getYawChange()
  
  
      
        
          | double TouchControls::getYawChange  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ handleReleaseEvent()
  
  
      
        
          | void TouchControls::handleReleaseEvent  | 
          ( | 
          size_t |           pointer_id | ) | 
           | 
         
       
   | 
  
private   | 
  
 
References applyJoystickStatus(), buttonsHandleRelease(), infostream, LongTap, m_buttons, m_has_joystick_id, m_has_move_id, m_joystick_direction, m_joystick_id, m_joystick_speed, m_joystick_status_aux1, m_move_has_really_moved, m_move_id, m_move_prevent_short_tap, m_overflow_buttons, m_pointer_downpos, m_pointer_pos, m_tap_state, None, ShortTap, and updateVisibility().
Referenced by releaseAll(), and translateEvent().
 
 
◆ hide()
      
        
          | void TouchControls::hide  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ isHotbarButton()
  
  
      
        
          | bool TouchControls::isHotbarButton  | 
          ( | 
          const SEvent & |           event | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ isStatusTextOverriden()
  
  
      
        
          | bool TouchControls::isStatusTextOverriden  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ loadButtonTexture()
  
  
      
        
          | void TouchControls::loadButtonTexture  | 
          ( | 
          IGUIImage * |           gui_button,  | 
         
        
           | 
           | 
          const std::string & |           path ) | 
         
       
   | 
  
private   | 
  
 
 
◆ makeButtonDirect()
  
  
      
        
          | IGUIImage * TouchControls::makeButtonDirect  | 
          ( | 
          touch_gui_button_id |           id,  | 
         
        
           | 
           | 
          const recti & |           rect,  | 
         
        
           | 
           | 
          bool |           visible ) | 
         
       
   | 
  
private   | 
  
 
 
◆ mayAddButton()
◆ readSettings()
  
  
      
        
          | void TouchControls::readSettings  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ registerHotbarRect()
      
        
          | void TouchControls::registerHotbarRect  | 
          ( | 
          u16 |           index,  | 
        
        
           | 
           | 
          const recti & |           rect ) | 
        
      
 
 
◆ releaseAll()
  
  
      
        
          | void TouchControls::releaseAll  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ resetHotbarRects()
      
        
          | void TouchControls::resetHotbarRects  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ settingChangedCallback()
  
  
      
        
          | void TouchControls::settingChangedCallback  | 
          ( | 
          const std::string & |           name,  | 
         
        
           | 
           | 
          void * |           data ) | 
         
       
   | 
  
staticprivate   | 
  
 
 
◆ setUseCrosshair()
  
  
      
        
          | void TouchControls::setUseCrosshair  | 
          ( | 
          bool |           use_crosshair | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ setVisible()
      
        
          | void TouchControls::setVisible  | 
          ( | 
          bool |           visible | ) | 
           | 
        
      
 
 
◆ show()
      
        
          | void TouchControls::show  | 
          ( | 
           | ) | 
           | 
        
      
 
 
◆ step()
      
        
          | void TouchControls::step  | 
          ( | 
          float |           dtime | ) | 
           | 
        
      
 
References applyJoystickStatus(), applyLayout(), buttonsStep(), ButtonLayout::getButtonSize(), porting::getDeltaMs(), getPointerPos(), porting::getTimeMs(), LongTap, m_button_size, m_buttons, m_device, m_draw_crosshair, m_had_move_id, m_has_move_id, m_layout, m_long_tap_delay, m_move_downtime, m_move_has_really_moved, m_overflow_buttons, m_screensize, m_shootline, m_tap_state, and None.
Referenced by Game::processUserInput().
 
 
◆ toggleOverflowMenu()
  
  
      
        
          | void TouchControls::toggleOverflowMenu  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ translateEvent()
      
        
          | void TouchControls::translateEvent  | 
          ( | 
          const SEvent & |           event | ) | 
           | 
        
      
 
References buttonsHandlePress(), dir(), g_settings, RenderingEngine::getDisplayDensity(), Settings::getFloat(), porting::getTimeMs(), handleReleaseEvent(), infostream, isHotbarButton(), m_button_size, m_buttons, m_camera_pitch_change, m_camera_yaw_change, m_fixed_joystick, m_guienv, m_had_move_id, m_has_joystick_id, m_has_move_id, m_joystick_btn_bg, m_joystick_btn_center, m_joystick_direction, m_joystick_has_really_moved, m_joystick_id, m_joystick_speed, m_joystick_status_aux1, m_move_downtime, m_move_has_really_moved, m_move_id, m_move_pos, m_move_prevent_short_tap, m_overflow_btn, m_overflow_button_rects, m_overflow_buttons, m_overflow_open, m_pointer_downpos, m_pointer_pos, m_screensize, m_touchscreen_threshold, m_visible, toggleOverflowMenu(), updateVisibility(), and verbosestream.
Referenced by MyEventReceiver::OnEvent().
 
 
◆ updateVisibility()
  
  
      
        
          | void TouchControls::updateVisibility  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
References m_buttons, m_has_joystick_id, m_joystick_btn_bg, m_joystick_btn_center, m_joystick_btn_off, m_overflow_bg, m_overflow_btn, m_overflow_button_titles, m_overflow_buttons, m_overflow_open, and m_visible.
Referenced by applyLayout(), handleReleaseEvent(), setVisible(), toggleOverflowMenu(), and translateEvent().
 
 
◆ m_button_size
  
  
      
        
          | s32 TouchControls::m_button_size | 
         
       
   | 
  
private   | 
  
 
 
◆ m_buttons
◆ m_camera_pitch_change
  
  
      
        
          | double TouchControls::m_camera_pitch_change = 0.0 | 
         
       
   | 
  
private   | 
  
 
 
◆ m_camera_yaw_change
  
  
      
        
          | double TouchControls::m_camera_yaw_change = 0.0 | 
         
       
   | 
  
private   | 
  
 
 
◆ m_device
  
  
      
        
          | IrrlichtDevice* TouchControls::m_device = nullptr | 
         
       
   | 
  
private   | 
  
 
 
◆ m_dig_pressed
  
  
      
        
          | bool TouchControls::m_dig_pressed = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_dig_pressed_until
  
  
      
        
          | u64 TouchControls::m_dig_pressed_until = 0 | 
         
       
   | 
  
private   | 
  
 
 
◆ m_draw_crosshair
  
  
      
        
          | bool TouchControls::m_draw_crosshair = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_fixed_joystick
  
  
      
        
          | bool TouchControls::m_fixed_joystick | 
         
       
   | 
  
private   | 
  
 
 
◆ m_guienv
  
  
      
        
          | IGUIEnvironment* TouchControls::m_guienv = nullptr | 
         
       
   | 
  
private   | 
  
 
 
◆ m_had_move_id
  
  
      
        
          | bool TouchControls::m_had_move_id = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_has_joystick_id
  
  
      
        
          | bool TouchControls::m_has_joystick_id = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_has_move_id
  
  
      
        
          | bool TouchControls::m_has_move_id = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_hotbar_rects
  
  
      
        
          | std::unordered_map<u16, recti> TouchControls::m_hotbar_rects | 
         
       
   | 
  
private   | 
  
 
 
◆ m_hotbar_selection
  
  
      
        
          | std::optional<u16> TouchControls::m_hotbar_selection = std::nullopt | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_btn_bg
  
  
      
        
          | std::shared_ptr<IGUIImage> TouchControls::m_joystick_btn_bg | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_btn_center
  
  
      
        
          | std::shared_ptr<IGUIImage> TouchControls::m_joystick_btn_center | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_btn_off
  
  
      
        
          | std::shared_ptr<IGUIImage> TouchControls::m_joystick_btn_off | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_direction
  
  
      
        
          | float TouchControls::m_joystick_direction = 0.0f | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_has_really_moved
  
  
      
        
          | bool TouchControls::m_joystick_has_really_moved = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_id
  
  
      
        
          | size_t TouchControls::m_joystick_id | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_speed
  
  
      
        
          | float TouchControls::m_joystick_speed = 0.0f | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_status_aux1
  
  
      
        
          | bool TouchControls::m_joystick_status_aux1 = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_joystick_triggers_aux1
  
  
      
        
          | bool TouchControls::m_joystick_triggers_aux1 | 
         
       
   | 
  
private   | 
  
 
 
◆ m_last_mode
◆ m_layout
◆ m_long_tap_delay
  
  
      
        
          | u16 TouchControls::m_long_tap_delay | 
         
       
   | 
  
private   | 
  
 
 
◆ m_move_downtime
  
  
      
        
          | u64 TouchControls::m_move_downtime = 0 | 
         
       
   | 
  
private   | 
  
 
 
◆ m_move_has_really_moved
  
  
      
        
          | bool TouchControls::m_move_has_really_moved = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_move_id
  
  
      
        
          | size_t TouchControls::m_move_id | 
         
       
   | 
  
private   | 
  
 
 
◆ m_move_pos
  
  
      
        
          | v2s32 TouchControls::m_move_pos | 
         
       
   | 
  
private   | 
  
 
 
◆ m_move_prevent_short_tap
  
  
      
        
          | bool TouchControls::m_move_prevent_short_tap = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_overflow_bg
  
  
      
        
          | std::shared_ptr<IGUIStaticText> TouchControls::m_overflow_bg | 
         
       
   | 
  
private   | 
  
 
 
◆ m_overflow_btn
  
  
      
        
          | std::shared_ptr<IGUIImage> TouchControls::m_overflow_btn | 
         
       
   | 
  
private   | 
  
 
 
◆ m_overflow_button_rects
  
  
      
        
          | std::vector<recti> TouchControls::m_overflow_button_rects | 
         
       
   | 
  
private   | 
  
 
 
◆ m_overflow_button_titles
  
  
      
        
          | std::vector<std::shared_ptr<IGUIStaticText> > TouchControls::m_overflow_button_titles | 
         
       
   | 
  
private   | 
  
 
 
◆ m_overflow_buttons
  
  
      
        
          | std::vector<button_info> TouchControls::m_overflow_buttons | 
         
       
   | 
  
private   | 
  
 
 
◆ m_overflow_open
  
  
      
        
          | bool TouchControls::m_overflow_open = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_place_pressed
  
  
      
        
          | bool TouchControls::m_place_pressed = false | 
         
       
   | 
  
private   | 
  
 
 
◆ m_place_pressed_until
  
  
      
        
          | u64 TouchControls::m_place_pressed_until = 0 | 
         
       
   | 
  
private   | 
  
 
 
◆ m_pointer_downpos
  
  
      
        
          | std::unordered_map<size_t, v2s32> TouchControls::m_pointer_downpos | 
         
       
   | 
  
private   | 
  
 
 
◆ m_pointer_pos
  
  
      
        
          | std::unordered_map<size_t, v2s32> TouchControls::m_pointer_pos | 
         
       
   | 
  
private   | 
  
 
 
◆ m_receiver
  
  
      
        
          | IEventReceiver* TouchControls::m_receiver = nullptr | 
         
       
   | 
  
private   | 
  
 
 
◆ m_screensize
  
  
      
        
          | v2u32 TouchControls::m_screensize | 
         
       
   | 
  
private   | 
  
 
 
◆ m_shootline
  
  
      
        
          | line3d<f32> TouchControls::m_shootline | 
         
       
   | 
  
private   | 
  
 
A line starting at the camera and pointing towards the selected object. 
The line ends on the camera's far plane. The coordinates do not contain the camera offset. 
Referenced by getShootline(), and step().
 
 
◆ m_status_text
  
  
      
        
          | std::shared_ptr<IGUIStaticText> TouchControls::m_status_text | 
         
       
   | 
  
private   | 
  
 
 
◆ m_tap_state
◆ m_texturesource
◆ m_touchscreen_threshold
  
  
      
        
          | double TouchControls::m_touchscreen_threshold | 
         
       
   | 
  
private   | 
  
 
 
◆ m_visible
  
  
      
        
          | bool TouchControls::m_visible = true | 
         
       
   | 
  
private   | 
  
 
 
The documentation for this class was generated from the following files: