1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

TouchControls: Implement an option for dig/place buttons (#15845)

This commit is contained in:
grorp 2025-03-21 07:06:44 -04:00 committed by GitHub
parent 1f14b7cb1b
commit ead44a27ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 540 additions and 88 deletions

View file

@ -57,6 +57,7 @@ enum class TapState
struct button_info
{
touch_gui_button_id id;
float repeat_counter;
KeyPress keypress;
std::vector<size_t> pointer_ids;
@ -94,7 +95,7 @@ public:
return res;
}
bool isShootlineAvailable() { return !m_use_crosshair; }
bool isShootlineAvailable() { return m_interaction_style == TAP; }
/**
* Returns a line which describes what the player is pointing at.
@ -137,7 +138,7 @@ private:
s32 m_button_size;
// cached settings
bool m_use_crosshair;
TouchInteractionStyle m_interaction_style;
double m_touchscreen_threshold;
u16 m_long_tap_delay;
bool m_fixed_joystick;
@ -161,7 +162,7 @@ private:
* The line ends on the camera's far plane.
* The coordinates do not contain the camera offset.
*
* Only valid if !m_use_crosshair
* Only used for m_interaction_style == TAP
*/
line3d<f32> m_shootline;
@ -243,6 +244,8 @@ private:
// map to store the IDs and positions of currently pressed pointers
std::unordered_map<size_t, v2s32> m_pointer_pos;
// The following are not used if m_interaction_style == BUTTONS_CROSSHAIR
TouchInteractionMode m_last_mode = TouchInteractionMode_END;
TapState m_tap_state = TapState::None;