mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
TouchControls: touch_use_crosshair, dig/place simulation refactoring (#15800)
- get rid of simulated mouse events for digging/placing, use keyboard events instead - consistent with other simulated events, less code, no need for a pointer position - more correct: touch controls no longer break if you have custom dig/place keybindings set - move reading of "touch_use_crosshair" setting from Game to TouchControls
This commit is contained in:
parent
abcd2e0b81
commit
5e89371ecd
5 changed files with 53 additions and 63 deletions
|
@ -14,6 +14,9 @@
|
|||
#include "IGUIStaticText.h"
|
||||
|
||||
const char *button_names[] = {
|
||||
"dig",
|
||||
"place",
|
||||
|
||||
"jump",
|
||||
"sneak",
|
||||
"zoom",
|
||||
|
@ -41,6 +44,9 @@ const char *button_names[] = {
|
|||
|
||||
// compare with GUIKeyChangeMenu::init_keys
|
||||
const char *button_titles[] = {
|
||||
N_("Dig/punch/use"),
|
||||
N_("Place/use"),
|
||||
|
||||
N_("Jump"),
|
||||
N_("Sneak"),
|
||||
N_("Zoom"),
|
||||
|
@ -67,6 +73,9 @@ const char *button_titles[] = {
|
|||
};
|
||||
|
||||
const char *button_image_names[] = {
|
||||
"",
|
||||
"",
|
||||
|
||||
"jump_btn.png",
|
||||
"down.png",
|
||||
"zoom.png",
|
||||
|
@ -123,7 +132,8 @@ void ButtonMeta::setPos(v2s32 pos, v2u32 screensize, s32 button_size)
|
|||
|
||||
bool ButtonLayout::isButtonAllowed(touch_gui_button_id id)
|
||||
{
|
||||
return id != joystick_off_id && id != joystick_bg_id && id != joystick_center_id &&
|
||||
return id != dig_id && id != place_id &&
|
||||
id != joystick_off_id && id != joystick_bg_id && id != joystick_center_id &&
|
||||
id != touch_gui_button_id_END;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue