touch_screen WIP

This commit is contained in:
Harmony Honey Monroe 2024-09-18 14:58:38 -04:00
parent 598413ed70
commit 5e7b0a525a
10 changed files with 521 additions and 51 deletions

View file

@ -4,6 +4,6 @@
[resource]
script = ExtResource( 1 )
disable = false
disable = true
app_id = "1993830"
sdk_dir = "C:\\Apps\\steamworks_sdk_160"

View file

@ -178,7 +178,8 @@ MenuRemap="*res://src/menu/options/MenuRemap.tscn"
MenuMakeover="*res://src/menu/MenuMakeover.tscn"
Audio="*res://src/autoload/Audio.tscn"
Clouds="*res://src/autoload/Clouds.tscn"
Steam="*res://addons/steam_api/steam.gd"
TouchScreen="*res://src/autoload/touch_screen.tscn"
Steam="*res://addons/steam_api/steam_i.gd"
[display]

View file

@ -123,6 +123,7 @@ var shadow_enabled := 1 setget set_shadow_enabled
var shadow_buffer := 2 setget set_shadow_buffer
var is_weather := true setget set_is_weather
var is_interpolate := true setget set_is_interpolate
var is_touch := false setget set_is_touch
var is_demo := false
@ -173,6 +174,7 @@ func _ready():
set_shadow_buffer()
set_is_weather()
set_is_interpolate()
set_is_touch()
func _input(event):
if event is InputEventKey and event.pressed and !event.is_echo():
@ -464,6 +466,10 @@ func set_is_weather(arg := is_weather):
func set_is_interpolate(arg := is_interpolate):
is_interpolate = bool(arg)
func set_is_touch(arg := is_touch):
is_touch = bool(arg)
TouchScreen.visible = is_touch
func set_clock_alpha(arg := clock_alpha):
clock_alpha = clamp(arg, 0, 1)
if is_instance_valid(UI.clock):

View file

@ -0,0 +1,40 @@
extends CanvasLayer
onready var right := $Control/HBoxRight
onready var top := $Control/HBoxTop
onready var keys := [$Control/HBoxRight/C, $Control/HBoxRight/X]
onready var buttons := [$Control/HBoxRight/C/Control/Button, $Control/HBoxRight/X/Control/Button]
onready var btns := $Control/HBoxLeft/DPad/Buttons.get_children()
func _ready():
connect("visibility_changed", self, "vis")
yield(get_tree(), "idle_frame")
visible = (OS.has_touchscreen_ui_hint() and OS.get_name() == "HTML5") or OS.get_name() == "Android"
vis()
func vis():
pass
# if is_instance_valid(UI.keys_node):
# UI.keys_node.visible = !visible
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
keys[1].visible = arg_x
top.visible = arg_pause
func set_game(arg := false):
var i = "" if arg else "ui_"
set_actions(i + "up", i + "down", i + "left", i + "right")
buttons[0].action = "action" if arg else "ui_no"
buttons[1].action = "jump" if arg else "ui_yes"
for f in buttons:
f.passby_press = arg
func set_actions(_up, _down, _left, _right):
for i in 4:
btns[i].action = [_right, _down, _left, _up][i]
btns[i].passby_press = !("ui_" in _up)

View file

@ -0,0 +1,297 @@
[gd_scene load_steps=14 format=2]
[ext_resource path="res://src/autoload/touch_screen.gd" type="Script" id=1]
[ext_resource path="res://src/menu/round_button.gd" type="Script" id=3]
[ext_resource path="res://src/menu/button_modulate.gd" type="Script" id=4]
[ext_resource path="res://media/font/mini-wakuwaku.otf" type="DynamicFontData" id=5]
[ext_resource path="res://src/class/shape/Circle.gd" type="Script" id=8]
[sub_resource type="ConvexPolygonShape2D" id=7]
points = PoolVector2Array( 2.12132, 2.12132, 3, 0, 2.12132, -2.12132, 353.553, -353.553, 461.94, -191.342, 500, 0, 461.94, 191.342, 353.553, 353.553 )
[sub_resource type="ConvexPolygonShape2D" id=8]
points = PoolVector2Array( -2.12132, 2.12132, -1.31134e-07, 3, 2.12132, 2.12132, 353.553, 353.553, 191.342, 461.94, -2.18557e-05, 500, -191.342, 461.94, -353.553, 353.553 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( -2.12132, -2.12132, -3, -2.62268e-07, -2.12132, 2.12132, -353.553, 353.553, -461.94, 191.342, -500, -4.37114e-05, -461.94, -191.342, -353.553, -353.553 )
[sub_resource type="ConvexPolygonShape2D" id=10]
points = PoolVector2Array( 2.12132, -2.12132, 3.57746e-08, -3, -2.12132, -2.12132, -353.553, -353.553, -191.342, -461.94, 5.96244e-06, -500, 191.342, -461.94, 353.553, -353.553 )
[sub_resource type="CircleShape2D" id=3]
radius = 75.0
[sub_resource type="DynamicFont" id=6]
size = 64
outline_size = 1
outline_color = Color( 0, 0, 0, 1 )
extra_spacing_bottom = -4
font_data = ExtResource( 5 )
[sub_resource type="CircleShape2D" id=4]
radius = 75.0
[sub_resource type="CircleShape2D" id=5]
radius = 15.0
[node name="TouchScreen" type="CanvasLayer"]
pause_mode = 2
layer = 19
script = ExtResource( 1 )
[node name="Control" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 20.0
margin_top = 20.0
margin_right = -20.0
margin_bottom = -20.0
[node name="HBoxLeft" type="HBoxContainer" parent="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/separation = 0
[node name="DPad" type="Control" parent="Control/HBoxLeft"]
margin_top = 380.0
margin_right = 300.0
margin_bottom = 680.0
rect_min_size = Vector2( 300, 300 )
size_flags_vertical = 8
[node name="Buttons" type="Control" parent="Control/HBoxLeft/DPad"]
margin_left = 150.0
margin_top = 150.0
margin_right = 150.0
margin_bottom = 150.0
[node name="0" type="TouchScreenButton" parent="Control/HBoxLeft/DPad/Buttons"]
shape = SubResource( 7 )
shape_centered = false
action = "ui_right"
script = ExtResource( 3 )
radius = 500.0
poly_path = NodePath("Polygon2D")
inner_radius = 140.0
inner_offset = 6.0
[node name="Polygon2D" type="Polygon2D" parent="Control/HBoxLeft/DPad/Buttons/0"]
modulate = Color( 1, 1, 1, 0.5 )
position = Vector2( 6, 0 )
polygon = PoolVector2Array( 2.12132, 2.12132, 3, 0, 2.12132, -2.12132, 98.9949, -98.9949, 129.343, -53.5757, 140, 0, 129.343, 53.5757, 98.9949, 98.9949 )
script = ExtResource( 4 )
button_path = NodePath("..")
idle_color = Color( 1, 1, 1, 0.501961 )
[node name="1" type="TouchScreenButton" parent="Control/HBoxLeft/DPad/Buttons"]
shape = SubResource( 8 )
shape_centered = false
action = "ui_down"
script = ExtResource( 3 )
radius = 500.0
angle = 90.0
poly_path = NodePath("Polygon2D")
inner_radius = 140.0
inner_offset = 6.0
[node name="Polygon2D" type="Polygon2D" parent="Control/HBoxLeft/DPad/Buttons/1"]
modulate = Color( 1, 1, 1, 0.5 )
position = Vector2( -2.62268e-07, 6 )
polygon = PoolVector2Array( -2.12132, 2.12132, -1.31134e-07, 3, 2.12132, 2.12132, 98.9949, 98.9949, 53.5757, 129.343, -6.11959e-06, 140, -53.5757, 129.343, -98.9949, 98.9949 )
script = ExtResource( 4 )
button_path = NodePath("..")
idle_color = Color( 1, 1, 1, 0.501961 )
[node name="2" type="TouchScreenButton" parent="Control/HBoxLeft/DPad/Buttons"]
shape = SubResource( 9 )
shape_centered = false
action = "ui_left"
script = ExtResource( 3 )
radius = 500.0
angle = 180.0
poly_path = NodePath("Polygon2D")
inner_radius = 140.0
inner_offset = 6.0
[node name="Polygon2D" type="Polygon2D" parent="Control/HBoxLeft/DPad/Buttons/2"]
modulate = Color( 1, 1, 1, 0.5 )
position = Vector2( -6, -5.24537e-07 )
polygon = PoolVector2Array( -2.12132, -2.12132, -3, -2.62268e-07, -2.12132, 2.12132, -98.9949, 98.9949, -129.343, 53.5757, -140, -1.22392e-05, -129.343, -53.5757, -98.995, -98.9949 )
script = ExtResource( 4 )
button_path = NodePath("..")
idle_color = Color( 1, 1, 1, 0.501961 )
[node name="3" type="TouchScreenButton" parent="Control/HBoxLeft/DPad/Buttons"]
shape = SubResource( 10 )
shape_centered = false
action = "ui_up"
script = ExtResource( 3 )
radius = 500.0
angle = 270.0
poly_path = NodePath("Polygon2D")
inner_radius = 140.0
inner_offset = 6.0
[node name="Polygon2D" type="Polygon2D" parent="Control/HBoxLeft/DPad/Buttons/3"]
modulate = Color( 1, 1, 1, 0.5 )
position = Vector2( 7.15493e-08, -6 )
polygon = PoolVector2Array( 2.12132, -2.12132, 3.57746e-08, -3, -2.12132, -2.12132, -98.995, -98.9949, -53.5757, -129.343, 1.66948e-06, -140, 53.5757, -129.343, 98.9949, -98.995 )
script = ExtResource( 4 )
button_path = NodePath("..")
idle_color = Color( 1, 1, 1, 0.501961 )
[node name="HBoxRight" type="HBoxContainer" parent="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/separation = 0
alignment = 2
[node name="C" type="CenterContainer" parent="Control/HBoxRight"]
margin_left = 940.0
margin_top = 530.0
margin_right = 1090.0
margin_bottom = 680.0
rect_min_size = Vector2( 150, 150 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxRight/C"]
margin_left = 75.0
margin_top = 75.0
margin_right = 75.0
margin_bottom = 75.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxRight/C/Control"]
physics_interpolation_mode = 1
modulate = Color( 1, 1, 1, 0.156863 )
shape = SubResource( 3 )
shape_centered = false
action = "ui_no"
visibility_mode = 1
script = ExtResource( 4 )
__meta__ = {
"_editor_description_": ""
}
button_path = NodePath(".")
color_path = NodePath("../Poly")
idle_color = Color( 1, 1, 1, 0.156863 )
[node name="Poly" type="Polygon2D" parent="Control/HBoxRight/C/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
polygon = PoolVector2Array( 70, 0, 64.6716, 26.7878, 49.4975, 49.4975, 26.7878, 64.6716, -3.0598e-06, 70, -26.7878, 64.6716, -49.4975, 49.4975, -64.6716, 26.7878, -70, -6.11959e-06, -64.6716, -26.7878, -49.4975, -49.4975, -26.7878, -64.6716, 8.34742e-07, -70, 26.7879, -64.6716, 49.4975, -49.4975, 64.6716, -26.7878 )
script = ExtResource( 8 )
is_baked = false
radius = 70.0
[node name="Key" type="Label" parent="Control/HBoxRight/C/Control"]
modulate = Color( 1, 0, 0.301961, 1 )
margin_left = -75.0
margin_top = -75.0
margin_right = 75.0
margin_bottom = 75.0
custom_fonts/font = SubResource( 6 )
text = "c"
align = 1
valign = 1
uppercase = true
[node name="X" type="CenterContainer" parent="Control/HBoxRight"]
margin_left = 1090.0
margin_top = 530.0
margin_right = 1240.0
margin_bottom = 680.0
rect_min_size = Vector2( 150, 150 )
size_flags_vertical = 8
[node name="Control" type="Control" parent="Control/HBoxRight/X"]
margin_left = 75.0
margin_top = 75.0
margin_right = 75.0
margin_bottom = 75.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxRight/X/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
shape = SubResource( 4 )
shape_centered = false
action = "ui_yes"
visibility_mode = 1
script = ExtResource( 4 )
__meta__ = {
"_editor_description_": ""
}
button_path = NodePath(".")
color_path = NodePath("../Poly")
idle_color = Color( 1, 1, 1, 0.156863 )
[node name="Poly" type="Polygon2D" parent="Control/HBoxRight/X/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
polygon = PoolVector2Array( 70, 0, 64.6716, 26.7878, 49.4975, 49.4975, 26.7878, 64.6716, -3.0598e-06, 70, -26.7878, 64.6716, -49.4975, 49.4975, -64.6716, 26.7878, -70, -6.11959e-06, -64.6716, -26.7878, -49.4975, -49.4975, -26.7878, -64.6716, 8.34742e-07, -70, 26.7879, -64.6716, 49.4975, -49.4975, 64.6716, -26.7878 )
script = ExtResource( 8 )
is_baked = false
radius = 70.0
[node name="Key" type="Label" parent="Control/HBoxRight/X/Control"]
modulate = Color( 0, 0.894118, 0.211765, 1 )
margin_left = -75.0
margin_top = -75.0
margin_right = 75.0
margin_bottom = 75.0
custom_fonts/font = SubResource( 6 )
text = "x"
align = 1
valign = 1
uppercase = true
[node name="HBoxTop" type="HBoxContainer" parent="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/separation = 0
alignment = 2
[node name="Pause" type="CenterContainer" parent="Control/HBoxTop"]
margin_left = 1090.0
margin_right = 1240.0
margin_bottom = 150.0
rect_min_size = Vector2( 150, 150 )
size_flags_vertical = 0
[node name="Control" type="Control" parent="Control/HBoxTop/Pause"]
margin_left = 75.0
margin_top = 75.0
margin_right = 75.0
margin_bottom = 75.0
[node name="Button" type="TouchScreenButton" parent="Control/HBoxTop/Pause/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
shape = SubResource( 5 )
shape_centered = false
action = "ui_pause"
visibility_mode = 1
script = ExtResource( 4 )
__meta__ = {
"_editor_description_": ""
}
button_path = NodePath(".")
color_path = NodePath("../Poly")
idle_color = Color( 1, 1, 1, 0.156863 )
[node name="Poly" type="Polygon2D" parent="Control/HBoxTop/Pause/Control"]
modulate = Color( 1, 1, 1, 0.156863 )
polygon = PoolVector2Array( 70, 0, 64.6716, 26.7878, 49.4975, 49.4975, 26.7878, 64.6716, -3.0598e-06, 70, -26.7878, 64.6716, -49.4975, 49.4975, -64.6716, 26.7878, -70, -6.11959e-06, -64.6716, -26.7878, -49.4975, -49.4975, -26.7878, -64.6716, 8.34742e-07, -70, 26.7879, -64.6716, 49.4975, -49.4975, 64.6716, -26.7878 )
script = ExtResource( 8 )
is_baked = false
radius = 70.0
[node name="Control" type="Control" parent="Control/HBoxTop/Pause/Control"]
rect_scale = Vector2( 7, 7 )
[node name="ColorRect" type="ColorRect" parent="Control/HBoxTop/Pause/Control/Control"]
margin_left = -5.0
margin_top = -6.0
margin_right = -1.0
margin_bottom = 6.0
[node name="ColorRect2" type="ColorRect" parent="Control/HBoxTop/Pause/Control/Control"]
margin_left = 1.0
margin_top = -6.0
margin_right = 5.0
margin_bottom = 6.0

View file

@ -0,0 +1,16 @@
tool
extends Node2D
export var is_var := false setget set_is_var
export var circle_size := 10.0 setget set_circle
func set_is_var(arg):
is_var = arg
update()
func set_circle(arg):
circle_size = arg
update()
func _draw():
draw_circle(Vector2.ZERO, circle_size, Color.white)

View file

@ -0,0 +1,22 @@
extends Node
export var button_path : NodePath = ""
onready var button : TouchScreenButton = get_node_or_null(button_path)
export var color_path : NodePath = ""
onready var color_node : CanvasItem = get_node_or_null(color_path)
export var press_color := Color(1,0,1, 1.0)
export var idle_color := Color(1,1,1, 0.5)
func _ready():
if is_instance_valid(button):
button.connect("pressed", self, "interact")
button.connect("released", self, "interact")
if is_instance_valid(color_node):
color_node.modulate = idle_color
func interact():
if is_instance_valid(button) and is_instance_valid(color_node):
color_node.modulate = press_color if button.is_pressed() else idle_color

View file

@ -16,7 +16,7 @@ func fill_items():
.fill_items()
func row():
is_audio_joy = cursor > 4
is_audio_joy = cursor == 2 or cursor > 5
func close():
Shared.save_options()

View file

@ -246,23 +246,53 @@ size_flags_vertical = 6
custom_fonts/font = ExtResource( 2 )
text = "Controller Setup"
valign = 1
[node name="Touch" type="Control" parent="Control/Menu/List" groups=["light", "shadow"]]
margin_top = 440.0
margin_right = 640.0
margin_bottom = 510.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
"_edit_use_anchors_": false
}
var_name = "is_touch"
[node name="Label" type="Label" parent="Control/Menu/List/Touch"]
anchor_right = 0.5
anchor_bottom = 1.0
size_flags_vertical = 6
custom_fonts/font = ExtResource( 2 )
text = "Touch Screen"
valign = 1
[node name="Label2" type="Label" parent="Control/Menu/List/Touch"]
anchor_left = 0.5
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 25.0
size_flags_vertical = 6
custom_fonts/font = ExtResource( 2 )
text = "< OFF >"
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Spacer2" type="Control" parent="Control/Menu/List" groups=["no_item"]]
margin_top = 440.0
margin_top = 510.0
margin_right = 640.0
margin_bottom = 470.0
margin_bottom = 540.0
rect_min_size = Vector2( 0, 30 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HeaderAudio" type="Control" parent="Control/Menu/List" groups=["no_item"]]
margin_top = 470.0
margin_top = 540.0
margin_right = 640.0
margin_bottom = 540.0
margin_bottom = 610.0
rect_min_size = Vector2( 0, 70 )
[node name="Tex" type="TextureRect" parent="Control/Menu/List/HeaderAudio"]
@ -289,9 +319,9 @@ __meta__ = {
}
[node name="Music" parent="Control/Menu/List" instance=ExtResource( 13 )]
margin_top = 540.0
margin_top = 610.0
margin_right = 640.0
margin_bottom = 610.0
margin_bottom = 680.0
rect_min_size = Vector2( 0, 70 )
bus = 2
@ -303,9 +333,9 @@ stream = ExtResource( 11 )
bus = "Music"
[node name="SFX" parent="Control/Menu/List" instance=ExtResource( 13 )]
margin_top = 610.0
margin_top = 680.0
margin_right = 640.0
margin_bottom = 680.0
margin_bottom = 750.0
rect_min_size = Vector2( 0, 70 )
bus = 1
@ -318,9 +348,9 @@ volume_db = -5.0
bus = "SFX"
[node name="Weather2" parent="Control/Menu/List" instance=ExtResource( 13 )]
margin_top = 680.0
margin_top = 750.0
margin_right = 640.0
margin_bottom = 750.0
margin_bottom = 820.0
rect_min_size = Vector2( 0, 70 )
bus = 3
@ -332,18 +362,18 @@ volume_db = -5.0
bus = "SFX"
[node name="Spacer" type="Control" parent="Control/Menu/List" groups=["no_item"]]
margin_top = 750.0
margin_top = 820.0
margin_right = 640.0
margin_bottom = 780.0
margin_bottom = 850.0
rect_min_size = Vector2( 0, 30 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HeaderVideo" type="Control" parent="Control/Menu/List" groups=["no_item"]]
margin_top = 780.0
margin_top = 850.0
margin_right = 640.0
margin_bottom = 850.0
margin_bottom = 920.0
rect_min_size = Vector2( 0, 70 )
[node name="Tex" type="TextureRect" parent="Control/Menu/List/HeaderVideo"]
@ -367,9 +397,9 @@ __meta__ = {
}
[node name="Fullscreen" type="Control" parent="Control/Menu/List"]
margin_top = 850.0
margin_top = 920.0
margin_right = 640.0
margin_bottom = 920.0
margin_bottom = 990.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 14 )
__meta__ = {
@ -397,9 +427,9 @@ align = 2
valign = 1
[node name="Borderless" type="Control" parent="Control/Menu/List" groups=["window"]]
margin_top = 920.0
margin_top = 990.0
margin_right = 640.0
margin_bottom = 990.0
margin_bottom = 1060.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 19 )
__meta__ = {
@ -429,9 +459,9 @@ __meta__ = {
}
[node name="Resolution" type="Control" parent="Control/Menu/List" groups=["window"]]
margin_top = 990.0
margin_top = 1060.0
margin_right = 640.0
margin_bottom = 1060.0
margin_bottom = 1130.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 6 )
__meta__ = {
@ -458,9 +488,9 @@ align = 2
valign = 1
[node name="Mouse" type="Control" parent="Control/Menu/List" groups=["window"]]
margin_top = 1060.0
margin_top = 1130.0
margin_right = 640.0
margin_bottom = 1130.0
margin_bottom = 1200.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 18 )
__meta__ = {
@ -490,9 +520,9 @@ __meta__ = {
}
[node name="Vsync" type="Control" parent="Control/Menu/List"]
margin_top = 1130.0
margin_top = 1200.0
margin_right = 640.0
margin_bottom = 1200.0
margin_bottom = 1270.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 17 )
__meta__ = {
@ -522,9 +552,9 @@ __meta__ = {
}
[node name="Interpolate" type="Control" parent="Control/Menu/List"]
margin_top = 1200.0
margin_top = 1270.0
margin_right = 640.0
margin_bottom = 1270.0
margin_bottom = 1340.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -555,9 +585,9 @@ __meta__ = {
}
[node name="TargetFPS" type="Control" parent="Control/Menu/List"]
margin_top = 1270.0
margin_top = 1340.0
margin_right = 640.0
margin_bottom = 1340.0
margin_bottom = 1410.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -626,9 +656,9 @@ __meta__ = {
}
[node name="RadialBlur" type="Control" parent="Control/Menu/List"]
margin_top = 1340.0
margin_top = 1410.0
margin_right = 640.0
margin_bottom = 1410.0
margin_bottom = 1480.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -660,9 +690,9 @@ __meta__ = {
}
[node name="Light" type="Control" parent="Control/Menu/List"]
margin_top = 1410.0
margin_top = 1480.0
margin_right = 640.0
margin_bottom = 1480.0
margin_bottom = 1550.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -694,9 +724,9 @@ __meta__ = {
}
[node name="Shadows" type="Control" parent="Control/Menu/List" groups=["light"]]
margin_top = 1480.0
margin_top = 1550.0
margin_right = 640.0
margin_bottom = 1550.0
margin_bottom = 1620.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -727,9 +757,9 @@ __meta__ = {
}
[node name="ShadowBuffer" type="Control" parent="Control/Menu/List" groups=["light", "shadow"]]
margin_top = 1550.0
margin_top = 1620.0
margin_right = 640.0
margin_bottom = 1620.0
margin_bottom = 1690.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -761,9 +791,9 @@ __meta__ = {
}
[node name="Weather" type="Control" parent="Control/Menu/List" groups=["light", "shadow"]]
margin_top = 1620.0
margin_top = 1690.0
margin_right = 640.0
margin_bottom = 1690.0
margin_bottom = 1760.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -794,18 +824,18 @@ __meta__ = {
}
[node name="Spacer4" type="Control" parent="Control/Menu/List" groups=["no_item"]]
margin_top = 1690.0
margin_top = 1760.0
margin_right = 640.0
margin_bottom = 1720.0
margin_bottom = 1790.0
rect_min_size = Vector2( 0, 30 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HeaderSpeed" type="Control" parent="Control/Menu/List" groups=["no_item"]]
margin_top = 1720.0
margin_top = 1790.0
margin_right = 640.0
margin_bottom = 1790.0
margin_bottom = 1860.0
rect_min_size = Vector2( 0, 70 )
[node name="Tex" type="TextureRect" parent="Control/Menu/List/HeaderSpeed"]
@ -826,9 +856,9 @@ text = "Speedrun"
valign = 1
[node name="Speedrun" type="Control" parent="Control/Menu/List"]
margin_top = 1790.0
margin_top = 1860.0
margin_right = 640.0
margin_bottom = 1860.0
margin_bottom = 1930.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -863,9 +893,9 @@ __meta__ = {
}
[node name="Speedrun2" type="Control" parent="Control/Menu/List" groups=["speed"]]
margin_top = 1860.0
margin_top = 1930.0
margin_right = 640.0
margin_bottom = 1930.0
margin_bottom = 2000.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {
@ -897,9 +927,9 @@ align = 2
valign = 1
[node name="Decimals" type="Control" parent="Control/Menu/List" groups=["speed"]]
margin_top = 1930.0
margin_top = 2000.0
margin_right = 640.0
margin_bottom = 2000.0
margin_bottom = 2070.0
rect_min_size = Vector2( 0, 70 )
script = ExtResource( 24 )
__meta__ = {

58
src/menu/round_button.gd Normal file
View file

@ -0,0 +1,58 @@
tool
extends TouchScreenButton
export var radius := 60.0 setget set_radius
export var points := 5 setget set_points
export var angle := 0.0 setget set_angle
export var deadzone := 3.0 setget set_deadzone
export var poly_path : NodePath = ""
onready var poly : Polygon2D = get_node_or_null(poly_path)
export var inner_radius := 50.0 setget set_inner_radius
export var inner_offset := 5.0 setget set_inner_offset
func set_radius(arg := radius):
radius = arg
act()
func set_points(arg := points):
points = arg
act()
func set_angle(arg := angle):
angle = arg
act()
func set_deadzone(arg := deadzone):
deadzone = arg
act()
func set_inner_radius(arg := inner_radius):
inner_radius = arg
inner_act()
func set_inner_offset(arg := inner_offset):
inner_offset = arg
inner_act()
func act():
shape = ConvexPolygonShape2D.new()
shape.points = make_shape()
func inner_act():
if is_instance_valid(poly):
poly.polygon = make_shape(inner_radius)
poly.position = Vector2(inner_offset, 0).rotated(deg2rad(angle))
func make_shape(_radius := radius, _points := points, _angle := angle, _deadzone := deadzone):
var r = Vector2(_radius, 0)
var vec = PoolVector2Array()
for i in [1, 0, -1]:
vec.append(Vector2(_deadzone, 0).rotated(deg2rad(_angle + (i * 45))))
for i in _points:
var f = i / float(_points - 1)
vec.append(r.rotated(deg2rad(_angle + lerp(-45, 45, f))))
return vec