Minetest  5.4.0
TouchScreenGUI Class Reference

#include <touchscreengui.h>

+ Collaboration diagram for TouchScreenGUI:

Classes

struct  id_status
 
struct  key_event
 

Public Member Functions

 TouchScreenGUI (IrrlichtDevice *device, IEventReceiver *receiver)
 
 ~TouchScreenGUI ()
 
void translateEvent (const SEvent &event)
 
void init (ISimpleTextureSource *tsrc)
 
double getYawChange ()
 
double getPitch ()
 
line3d< f32 > getShootline ()
 
void step (float dtime)
 
void resetHud ()
 
void registerHudItem (int index, const rect< s32 > &rect)
 
void Toggle (bool visible)
 
void hide ()
 
void show ()
 

Private Member Functions

touch_gui_button_id getButtonID (s32 x, s32 y)
 
touch_gui_button_id getButtonID (size_t eventID)
 
void handleChangedButton (const SEvent &event)
 
void initButton (touch_gui_button_id id, const rect< s32 > &button_rect, const std::wstring &caption, bool immediate_release, float repeat_delay=BUTTON_REPEAT_DELAY)
 
button_infoinitJoystickButton (touch_gui_button_id id, const rect< s32 > &button_rect, int texture_id, bool visible=true)
 
void handleButtonEvent (touch_gui_button_id bID, size_t eventID, bool action)
 
bool isHUDButton (const SEvent &event)
 
bool doubleTapDetection ()
 
void handleReleaseEvent (size_t evt_id)
 
void applyJoystickStatus ()
 

Private Attributes

IrrlichtDevice * m_device
 
IGUIEnvironment * m_guienv
 
IEventReceiver * m_receiver
 
ISimpleTextureSourcem_texturesource
 
v2u32 m_screensize
 
s32 button_size
 
double m_touchscreen_threshold
 
std::map< int, rect< s32 > > m_hud_rects
 
std::map< size_t, irr::EKEY_CODE > m_hud_ids
 
bool m_visible
 
double m_camera_yaw_change = 0.0
 
double m_camera_pitch = 0.0
 
touch_gui_button_id m_joystick_names [5]
 
bool m_joystick_status [5] = {false, false, false, false, false}
 
line3d< f32 > m_shootline
 
int m_move_id = -1
 
bool m_move_has_really_moved = false
 
u64 m_move_downtime = 0
 
bool m_move_sent_as_mouse_event = false
 
v2s32 m_move_downlocation = v2s32(-10000, -10000)
 
int m_joystick_id = -1
 
bool m_joystick_has_really_moved = false
 
bool m_fixed_joystick = false
 
bool m_joystick_triggers_special1 = false
 
button_infom_joystick_btn_off = nullptr
 
button_infom_joystick_btn_bg = nullptr
 
button_infom_joystick_btn_center = nullptr
 
button_info m_buttons [after_last_element_id]
 
std::vector< id_statusm_known_ids
 
std::map< size_t, v2s32m_pointerpos
 
key_event m_key_events [2]
 
AutoHideButtonBar m_settingsbar
 
AutoHideButtonBar m_rarecontrolsbar
 

Constructor & Destructor Documentation

◆ TouchScreenGUI()

TouchScreenGUI::TouchScreenGUI ( IrrlichtDevice *  device,
IEventReceiver *  receiver 
)

References BUTTON_REPEAT_DELAY, button_size, g_settings, Settings::getBool(), porting::getDisplayDensity(), Settings::getFloat(), Settings::getU16(), m_buttons, m_device, m_fixed_joystick, m_joystick_triggers_special1, m_screensize, m_touchscreen_threshold, and MYMIN.

+ Here is the call graph for this function:

◆ ~TouchScreenGUI()

TouchScreenGUI::~TouchScreenGUI ( )

Member Function Documentation

◆ applyJoystickStatus()

void TouchScreenGUI::applyJoystickStatus ( )
private

References id2keycode(), m_joystick_names, m_joystick_status, m_joystick_triggers_special1, and m_receiver.

Referenced by handleReleaseEvent(), and step().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doubleTapDetection()

bool TouchScreenGUI::doubleTapDetection ( )
private

References TouchScreenGUI::key_event::down_time, porting::getDeltaMs(), porting::getTimeMs(), m_device, m_key_events, m_move_downlocation, m_move_downtime, m_receiver, m_shootline, m_touchscreen_threshold, verbosestream, TouchScreenGUI::key_event::x, and TouchScreenGUI::key_event::y.

Referenced by handleReleaseEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getButtonID() [1/2]

touch_gui_button_id TouchScreenGUI::getButtonID ( s32  x,
s32  y 
)
private

References after_last_element_id, m_buttons, and m_guienv.

Referenced by handleChangedButton(), handleReleaseEvent(), and translateEvent().

+ Here is the caller graph for this function:

◆ getButtonID() [2/2]

touch_gui_button_id TouchScreenGUI::getButtonID ( size_t  eventID)
private

◆ getPitch()

double TouchScreenGUI::getPitch ( )
inline

Referenced by Game::updateCameraOrientation().

+ Here is the caller graph for this function:

◆ getShootline()

line3d<f32> TouchScreenGUI::getShootline ( )
inline

Referenced by Game::processPlayerInteraction().

+ Here is the caller graph for this function:

◆ getYawChange()

double TouchScreenGUI::getYawChange ( )
inline

Referenced by Game::updateCameraOrientation().

+ Here is the caller graph for this function:

◆ handleButtonEvent()

void TouchScreenGUI::handleButtonEvent ( touch_gui_button_id  bID,
size_t  eventID,
bool  action 
)
private

References button_info::ids, button_info::immediate_release, button_info::keycode, m_buttons, m_receiver, and button_info::repeatcounter.

Referenced by handleChangedButton(), handleReleaseEvent(), and translateEvent().

+ Here is the caller graph for this function:

◆ handleChangedButton()

void TouchScreenGUI::handleChangedButton ( const SEvent &  event)
private

References after_last_element_id, getButtonID(), handleButtonEvent(), button_info::ids, and m_buttons.

Referenced by translateEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleReleaseEvent()

void TouchScreenGUI::handleReleaseEvent ( size_t  evt_id)
private

References after_last_element_id, applyJoystickStatus(), doubleTapDetection(), getButtonID(), button_info::guibutton, handleButtonEvent(), infostream, m_joystick_btn_bg, m_joystick_btn_center, m_joystick_btn_off, m_joystick_id, m_joystick_status, m_known_ids, m_move_downlocation, m_move_id, m_move_sent_as_mouse_event, and m_receiver.

Referenced by Toggle(), and translateEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hide()

void TouchScreenGUI::hide ( )

References m_visible, and Toggle().

Referenced by Game::createClient(), Game::processUserInput(), and Game::shutdown().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

void TouchScreenGUI::init ( ISimpleTextureSource tsrc)

◆ initButton()

void TouchScreenGUI::initButton ( touch_gui_button_id  id,
const rect< s32 > &  button_rect,
const std::wstring &  caption,
bool  immediate_release,
float  repeat_delay = BUTTON_REPEAT_DELAY 
)
private

References button_imagenames, button_info::guibutton, id2keycode(), button_info::ids, button_info::immediate_release, button_info::keycode, load_button_texture(), m_buttons, m_device, m_guienv, m_texturesource, button_info::repeatcounter, and button_info::repeatdelay.

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initJoystickButton()

button_info * TouchScreenGUI::initJoystickButton ( touch_gui_button_id  id,
const rect< s32 > &  button_rect,
int  texture_id,
bool  visible = true 
)
private

References joystick_imagenames, load_button_texture(), m_device, m_guienv, and m_texturesource.

Referenced by init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHUDButton()

bool TouchScreenGUI::isHUDButton ( const SEvent &  event)
private

References m_hud_ids, m_hud_rects, and m_receiver.

Referenced by translateEvent().

+ Here is the caller graph for this function:

◆ registerHudItem()

void TouchScreenGUI::registerHudItem ( int  index,
const rect< s32 > &  rect 
)

References m_hud_rects.

Referenced by Hud::drawItems().

+ Here is the caller graph for this function:

◆ resetHud()

void TouchScreenGUI::resetHud ( )

References m_hud_rects.

Referenced by Hud::drawItems().

+ Here is the caller graph for this function:

◆ show()

void TouchScreenGUI::show ( )

References m_visible, and Toggle().

Referenced by Game::initGui(), and GUIModalMenu::quitMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ step()

void TouchScreenGUI::step ( float  dtime)

References applyJoystickStatus(), porting::getDeltaMs(), porting::getTimeMs(), m_buttons, m_device, m_joystick_status, m_move_downlocation, m_move_downtime, m_move_has_really_moved, m_move_id, m_move_sent_as_mouse_event, m_rarecontrolsbar, m_receiver, m_settingsbar, m_shootline, MIN_DIG_TIME_MS, AutoHideButtonBar::step(), and verbosestream.

Referenced by Game::processUserInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Toggle()

void TouchScreenGUI::Toggle ( bool  visible)

References button_info::guibutton, handleReleaseEvent(), AutoHideButtonBar::hide(), m_buttons, m_joystick_btn_off, m_known_ids, m_rarecontrolsbar, m_settingsbar, m_visible, and AutoHideButtonBar::show().

Referenced by hide(), and show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translateEvent()

Member Data Documentation

◆ button_size

s32 TouchScreenGUI::button_size
private

◆ m_buttons

◆ m_camera_pitch

double TouchScreenGUI::m_camera_pitch = 0.0
private

Referenced by translateEvent().

◆ m_camera_yaw_change

double TouchScreenGUI::m_camera_yaw_change = 0.0
private

Referenced by translateEvent().

◆ m_device

IrrlichtDevice* TouchScreenGUI::m_device
private

◆ m_fixed_joystick

bool TouchScreenGUI::m_fixed_joystick = false
private

◆ m_guienv

IGUIEnvironment* TouchScreenGUI::m_guienv
private

◆ m_hud_ids

std::map<size_t, irr::EKEY_CODE> TouchScreenGUI::m_hud_ids
private

Referenced by isHUDButton().

◆ m_hud_rects

std::map<int, rect<s32> > TouchScreenGUI::m_hud_rects
private

◆ m_joystick_btn_bg

button_info* TouchScreenGUI::m_joystick_btn_bg = nullptr
private

◆ m_joystick_btn_center

button_info* TouchScreenGUI::m_joystick_btn_center = nullptr
private

◆ m_joystick_btn_off

button_info* TouchScreenGUI::m_joystick_btn_off = nullptr
private

◆ m_joystick_has_really_moved

bool TouchScreenGUI::m_joystick_has_really_moved = false
private

Referenced by translateEvent().

◆ m_joystick_id

int TouchScreenGUI::m_joystick_id = -1
private

◆ m_joystick_names

touch_gui_button_id TouchScreenGUI::m_joystick_names[5]
private
Initial value:
= {
@ special1_id
Definition: touchscreengui.h:42
@ forward_id
Definition: touchscreengui.h:57
@ right_id
Definition: touchscreengui.h:60
@ left_id
Definition: touchscreengui.h:59
@ backward_id
Definition: touchscreengui.h:58

Referenced by applyJoystickStatus().

◆ m_joystick_status

bool TouchScreenGUI::m_joystick_status[5] = {false, false, false, false, false}
private

◆ m_joystick_triggers_special1

bool TouchScreenGUI::m_joystick_triggers_special1 = false
private

◆ m_key_events

key_event TouchScreenGUI::m_key_events[2]
private

Referenced by doubleTapDetection().

◆ m_known_ids

std::vector<id_status> TouchScreenGUI::m_known_ids
private

◆ m_move_downlocation

v2s32 TouchScreenGUI::m_move_downlocation = v2s32(-10000, -10000)
private

◆ m_move_downtime

u64 TouchScreenGUI::m_move_downtime = 0
private

◆ m_move_has_really_moved

bool TouchScreenGUI::m_move_has_really_moved = false
private

Referenced by step(), and translateEvent().

◆ m_move_id

int TouchScreenGUI::m_move_id = -1
private

◆ m_move_sent_as_mouse_event

bool TouchScreenGUI::m_move_sent_as_mouse_event = false
private

◆ m_pointerpos

std::map<size_t, v2s32> TouchScreenGUI::m_pointerpos
private

Referenced by translateEvent().

◆ m_rarecontrolsbar

AutoHideButtonBar TouchScreenGUI::m_rarecontrolsbar
private

Referenced by init(), step(), Toggle(), and translateEvent().

◆ m_receiver

IEventReceiver* TouchScreenGUI::m_receiver
private

◆ m_screensize

v2u32 TouchScreenGUI::m_screensize
private

◆ m_settingsbar

AutoHideButtonBar TouchScreenGUI::m_settingsbar
private

Referenced by init(), step(), Toggle(), and translateEvent().

◆ m_shootline

line3d<f32> TouchScreenGUI::m_shootline
private

◆ m_texturesource

ISimpleTextureSource* TouchScreenGUI::m_texturesource
private

◆ m_touchscreen_threshold

double TouchScreenGUI::m_touchscreen_threshold
private

◆ m_visible

bool TouchScreenGUI::m_visible
private

Referenced by hide(), init(), show(), Toggle(), and translateEvent().


The documentation for this class was generated from the following files: