Touch Screen, ALWAYS or TOGGLE

using last input to check, similar to Tiny Crate
This commit is contained in:
Harmony Honey Monroe 2025-08-18 14:51:36 -04:00
parent 3645cbb682
commit 11d5191f93
4 changed files with 10 additions and 6 deletions

View file

@ -185,7 +185,6 @@ Steam="*res://addons/steam_api/steam.gd"
window/size/width=1280
window/size/height=720
window/size/fullscreen=true
window/size/test_width=1920
window/size/test_height=1080
window/stretch/mode="2d"

View file

@ -22,6 +22,12 @@ func _ready():
yield(Shared, "scene_changed")
visible = Shared.is_touch or ((OS.has_touchscreen_ui_hint() and OS.get_name() == "HTML5") or OS.get_name() == "Android")
func _input(event):
if event is InputEventScreenTouch or event is InputEventScreenDrag:
visible = true
elif event is InputEventKey or event is InputEventJoypadButton or event is InputEventJoypadMotion:
visible = Shared.is_touch
func show_keys(arg_arrows := true, arg_c := true, arg_x := true, arg_pause := false, arg_passby := false):
right.visible = arg_arrows
keys[0].visible = arg_c

View file

@ -12,8 +12,6 @@ func fill_items():
i.visible = Shared.light_enabled > 0
if i.is_in_group("shadow") and i.visible:
i.visible = Shared.shadow_enabled > 0
if i.is_in_group("touch"):
i.visible = TouchScreen.visible
.fill_items()

View file

@ -256,6 +256,7 @@ script = ExtResource( 24 )
__meta__ = {
"_edit_use_anchors_": false
}
list = PoolStringArray( "TOGGLE", "ALWAYS" )
is_refill = true
var_name = "is_touch"
@ -274,11 +275,11 @@ anchor_bottom = 1.0
margin_left = 25.0
size_flags_vertical = 6
custom_fonts/font = ExtResource( 2 )
text = "< OFF >"
text = "< TOGGLE >"
align = 2
valign = 1
[node name="X" type="Control" parent="Control/Menu/List" groups=["touch"]]
[node name="X" type="Control" parent="Control/Menu/List"]
margin_top = 510.0
margin_right = 640.0
margin_bottom = 580.0
@ -311,7 +312,7 @@ text = "< 2 >"
align = 2
valign = 1
[node name="Y" type="Control" parent="Control/Menu/List" groups=["touch"]]
[node name="Y" type="Control" parent="Control/Menu/List"]
margin_top = 580.0
margin_right = 640.0
margin_bottom = 650.0