Updated to 4.6 and some small visual changes to the joystick for better visibility
parent
9e63e85a33
commit
b3509f2c0e
|
|
@ -4,3 +4,4 @@
|
|||
builds/
|
||||
export_templates/
|
||||
**/logs
|
||||
.vscode/
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "godot",
|
||||
"request": "launch",
|
||||
"project": "${workspaceFolder}",
|
||||
"debug_collisions": false,
|
||||
"debug_paths": false,
|
||||
"debug_navigation": false,
|
||||
"additional_options": "",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
// The following will hide the js and map files in the editor
|
||||
"files.exclude": {
|
||||
"**/*.uid": true,
|
||||
"**/*.tscn": true,
|
||||
},
|
||||
"godotTools.editorPath.godot4": "/home/wynd/.local/bin/godot4.5.1"
|
||||
}
|
||||
75
Main.tscn
75
Main.tscn
|
|
@ -1,11 +1,11 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://c7bwo3h0leip4"]
|
||||
[gd_scene format=3 uid="uid://c7bwo3h0leip4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bu2nrvyk2k8ib" path="res://controller/controller.gd" id="1_uu6xs"]
|
||||
[ext_resource type="PackedScene" uid="uid://bkw6xqubudrtw" path="res://controller/button/controller_button.tscn" id="2_uu6xs"]
|
||||
[ext_resource type="PackedScene" uid="uid://c1dixxyohl131" path="res://controller/trigger/trigger_button.tscn" id="3_r0du0"]
|
||||
[ext_resource type="PackedScene" uid="uid://dmbbgdsoioadd" path="res://controller/joystick/joystick.tscn" id="4_cm0pq"]
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
[node name="Main" type="Control" unique_id=383427640]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
|
@ -14,30 +14,31 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
script = ExtResource("1_uu6xs")
|
||||
|
||||
[node name="Device" type="RichTextLabel" parent="."]
|
||||
[node name="Device" type="RichTextLabel" parent="." unique_id=809964945]
|
||||
layout_mode = 1
|
||||
anchors_preset = 10
|
||||
anchor_right = 1.0
|
||||
offset_left = 16.0
|
||||
offset_top = 19.0
|
||||
offset_top = 8.0
|
||||
offset_right = -26.0
|
||||
offset_bottom = 67.0
|
||||
offset_bottom = 56.0
|
||||
grow_horizontal = 2
|
||||
theme_override_font_sizes/normal_font_size = 24
|
||||
text = "No Active Device"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="DPad" type="Control" parent="."]
|
||||
[node name="DPad" type="Control" parent="." unique_id=1423843832]
|
||||
layout_mode = 1
|
||||
anchors_preset = 4
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 191.0
|
||||
offset_top = -20.0
|
||||
offset_top = -36.0
|
||||
offset_right = 191.0
|
||||
offset_bottom = -20.0
|
||||
offset_bottom = -36.0
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Up" parent="DPad" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Up" parent="DPad" unique_id=1761309990 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = 1.0
|
||||
offset_top = -128.0
|
||||
|
|
@ -46,7 +47,7 @@ offset_bottom = -32.0
|
|||
input_code = "ui_up"
|
||||
label = "Up"
|
||||
|
||||
[node name="Left" parent="DPad" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Left" parent="DPad" unique_id=1361916211 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = -95.0
|
||||
offset_top = -32.0
|
||||
|
|
@ -55,7 +56,7 @@ offset_bottom = 64.0
|
|||
input_code = "ui_left"
|
||||
label = "Left"
|
||||
|
||||
[node name="Right" parent="DPad" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Right" parent="DPad" unique_id=1409257767 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = 97.0
|
||||
offset_top = -32.0
|
||||
|
|
@ -64,7 +65,7 @@ offset_bottom = 64.0
|
|||
input_code = "ui_right"
|
||||
label = "Right"
|
||||
|
||||
[node name="Down" parent="DPad" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Down" parent="DPad" unique_id=1438894499 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = 1.0
|
||||
offset_top = 64.0
|
||||
|
|
@ -73,7 +74,7 @@ offset_bottom = 160.0
|
|||
input_code = "ui_down"
|
||||
label = "Down"
|
||||
|
||||
[node name="Actions" type="Control" parent="."]
|
||||
[node name="Actions" type="Control" parent="." unique_id=1246559461]
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
|
|
@ -81,20 +82,20 @@ anchor_top = 0.5
|
|||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -288.0
|
||||
offset_top = -20.0
|
||||
offset_top = -36.0
|
||||
offset_right = -288.0
|
||||
offset_bottom = -20.0
|
||||
offset_bottom = -36.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Action4" parent="Actions" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Action4" parent="Actions" unique_id=178918588 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_top = -128.0
|
||||
offset_bottom = -32.0
|
||||
input_code = "action_4"
|
||||
label = "[img]uid://dd8f8gmpc0era[/img]"
|
||||
|
||||
[node name="Action3" parent="Actions" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Action3" parent="Actions" unique_id=263249942 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = -96.0
|
||||
offset_top = -32.0
|
||||
|
|
@ -103,7 +104,7 @@ offset_bottom = 64.0
|
|||
input_code = "action_3"
|
||||
label = "[img]uid://c3cwld6imdmxo[/img]"
|
||||
|
||||
[node name="Action2" parent="Actions" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Action2" parent="Actions" unique_id=2082637160 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = 96.0
|
||||
offset_top = -32.0
|
||||
|
|
@ -112,14 +113,14 @@ offset_bottom = 64.0
|
|||
input_code = "action_2"
|
||||
label = "[img]uid://dgmruo36vderr[/img]"
|
||||
|
||||
[node name="Action1" parent="Actions" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Action1" parent="Actions" unique_id=172764084 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_top = 64.0
|
||||
offset_bottom = 160.0
|
||||
input_code = "action_1"
|
||||
label = "[img]uid://d23pu1ionxes1[/img]"
|
||||
|
||||
[node name="MidButtons" type="Control" parent="."]
|
||||
[node name="MidButtons" type="Control" parent="." unique_id=1126578940]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
|
|
@ -127,13 +128,13 @@ anchor_top = 0.5
|
|||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_top = -36.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
offset_bottom = 4.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Select" parent="MidButtons" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Select" parent="MidButtons" unique_id=1297320243 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = -140.0
|
||||
offset_top = -32.0
|
||||
|
|
@ -143,7 +144,7 @@ pivot_offset = Vector2(48, 24)
|
|||
input_code = "select"
|
||||
label = "[img width=48]uid://kq8unss5dfnf[/img]"
|
||||
|
||||
[node name="Start" parent="MidButtons" instance=ExtResource("2_uu6xs")]
|
||||
[node name="Start" parent="MidButtons" unique_id=769928574 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = 84.0
|
||||
offset_top = -32.0
|
||||
|
|
@ -153,7 +154,7 @@ pivot_offset = Vector2(48, 24)
|
|||
input_code = "start"
|
||||
label = "[img width=48]uid://03m3ethxsomd[/img]"
|
||||
|
||||
[node name="ShoulderButtons" type="Control" parent="."]
|
||||
[node name="ShoulderButtons" type="Control" parent="." unique_id=1966522733]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
|
|
@ -161,13 +162,13 @@ anchor_top = 0.5
|
|||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_top = -36.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
offset_bottom = 4.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="R1" parent="ShoulderButtons" instance=ExtResource("2_uu6xs")]
|
||||
[node name="R1" parent="ShoulderButtons" unique_id=80114877 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = 84.0
|
||||
offset_top = -231.0
|
||||
|
|
@ -176,7 +177,7 @@ offset_bottom = -167.0
|
|||
input_code = "r1"
|
||||
label = "[img]uid://wqltrinwradw[/img]"
|
||||
|
||||
[node name="R2" parent="ShoulderButtons" instance=ExtResource("3_r0du0")]
|
||||
[node name="R2" parent="ShoulderButtons" unique_id=1470410463 instance=ExtResource("3_r0du0")]
|
||||
layout_mode = 0
|
||||
offset_left = 276.0
|
||||
offset_top = -261.0
|
||||
|
|
@ -185,7 +186,7 @@ offset_bottom = -133.0
|
|||
input_axis = 5
|
||||
label = "[img width=48]uid://wrst4mxi4mdc[/img]"
|
||||
|
||||
[node name="L1" parent="ShoulderButtons" instance=ExtResource("2_uu6xs")]
|
||||
[node name="L1" parent="ShoulderButtons" unique_id=855316651 instance=ExtResource("2_uu6xs")]
|
||||
layout_mode = 0
|
||||
offset_left = -172.0
|
||||
offset_top = -233.0
|
||||
|
|
@ -194,7 +195,7 @@ offset_bottom = -169.0
|
|||
input_code = "l1"
|
||||
label = "[img]uid://crjyakxa6idyd[/img]"
|
||||
|
||||
[node name="L2" parent="ShoulderButtons" instance=ExtResource("3_r0du0")]
|
||||
[node name="L2" parent="ShoulderButtons" unique_id=1357656382 instance=ExtResource("3_r0du0")]
|
||||
layout_mode = 0
|
||||
offset_left = -300.0
|
||||
offset_top = -261.0
|
||||
|
|
@ -203,7 +204,7 @@ offset_bottom = -133.0
|
|||
input_axis = 4
|
||||
label = "[img width=48]uid://xl1fiv1qi2sx[/img]"
|
||||
|
||||
[node name="LeftJoystick" parent="." instance=ExtResource("4_cm0pq")]
|
||||
[node name="LeftJoystick" parent="." unique_id=169846338 instance=ExtResource("4_cm0pq")]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
|
|
@ -211,14 +212,14 @@ anchor_top = 1.0
|
|||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -320.0
|
||||
offset_top = -293.0
|
||||
offset_top = -309.0
|
||||
offset_right = -64.0
|
||||
offset_bottom = -37.0
|
||||
offset_bottom = -53.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
axis_y = 1
|
||||
|
||||
[node name="RightJoystick" parent="." instance=ExtResource("4_cm0pq")]
|
||||
[node name="RightJoystick" parent="." unique_id=911300384 instance=ExtResource("4_cm0pq")]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
|
|
@ -226,9 +227,9 @@ anchor_top = 1.0
|
|||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 64.0
|
||||
offset_top = -293.0
|
||||
offset_top = -309.0
|
||||
offset_right = 320.0
|
||||
offset_bottom = -37.0
|
||||
offset_bottom = -53.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
axis_x = 2
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ there's nothing particularly fancy about this and it does what it says, allows t
|
|||
made with godot because I couldn't be bothered with any GUI toolkits out there
|
||||
it uses a custom exporting template (built script only works on linux at the moment) to cut down its size by more than half
|
||||
|
||||
compared with the original TUI version it is huge coming at around 21MB (about 11 times more) and it consumes about 26 times more RAM (~130MB)
|
||||
compared with the original TUI version it is huge coming at around 21MB (about 11 times more) and it consumes ~130MB of RAM (about 26 times more)
|
||||
however it comes with a bunch of benefits such as a much nicer layout, button images, transparency and an overall (very subjecitve) nicer UX/DX
|
||||
|
||||
## controls
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ extends Panel
|
|||
@export var axis_x: JoyAxis
|
||||
@export var axis_y: JoyAxis
|
||||
|
||||
const DOT_OFFSET: float = 80.0
|
||||
|
||||
var _dot_style: StyleBoxFlat
|
||||
var _last_x := 0.0
|
||||
var _last_y := 0.0
|
||||
|
|
@ -23,8 +25,8 @@ func _process(_delta: float) -> void:
|
|||
var x := Input.get_joy_axis(0, self.axis_x)
|
||||
var y := Input.get_joy_axis(0, self.axis_y)
|
||||
|
||||
self.pos.position.x = (x * 128.0) + 104.0
|
||||
self.pos.position.y = (y * 128.0) + 104.0
|
||||
self.pos.position.x = (x * 128.0) + DOT_OFFSET
|
||||
self.pos.position.y = (y * 128.0) + DOT_OFFSET
|
||||
|
||||
var speed_x: float = abs(x - self._last_x)
|
||||
var speed_y: float = abs(y - self._last_y)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dmbbgdsoioadd"]
|
||||
[gd_scene format=3 uid="uid://dmbbgdsoioadd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d0uk2qtgrsvhg" path="res://controller/joystick/joystick.gd" id="1_vr4b3"]
|
||||
[ext_resource type="StyleBox" uid="uid://bgb7rlf1chjnd" path="res://controller/joystick/joystick_theme.tres" id="2_crwtg"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2jarx"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
|
|
@ -16,29 +17,30 @@ corner_radius_bottom_right = 100
|
|||
corner_radius_bottom_left = 100
|
||||
corner_detail = 16
|
||||
|
||||
[node name="JoystickArea" type="Panel"]
|
||||
[node name="JoystickArea" type="Panel" unique_id=1948391394]
|
||||
offset_right = 256.0
|
||||
offset_bottom = 256.0
|
||||
pivot_offset = Vector2(128, 128)
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_2jarx")
|
||||
script = ExtResource("1_vr4b3")
|
||||
|
||||
[node name="Pos" type="Panel" parent="."]
|
||||
[node name="Pos" type="Panel" parent="." unique_id=1096340521]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -24.0
|
||||
offset_top = -24.0
|
||||
offset_right = 24.0
|
||||
offset_bottom = 24.0
|
||||
offset_left = -48.0
|
||||
offset_top = -48.0
|
||||
offset_right = 48.0
|
||||
offset_bottom = 48.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
pivot_offset = Vector2(24, 24)
|
||||
pivot_offset = Vector2(48, 48)
|
||||
theme_override_styles/panel = ExtResource("2_crwtg")
|
||||
|
||||
[node name="Label" type="RichTextLabel" parent="."]
|
||||
[node name="Label" type="RichTextLabel" parent="." unique_id=1954656287]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://crnhvx5xfqmj7"]
|
||||
[gd_resource type="ShaderMaterial" format=3 uid="uid://crnhvx5xfqmj7"]
|
||||
|
||||
[sub_resource type="VisualShaderNodeColorParameter" id="VisualShaderNodeColorParameter_i05ah"]
|
||||
parameter_name = "TextColor"
|
||||
|
|
@ -6,24 +6,6 @@ qualifier = 2
|
|||
default_value_enabled = true
|
||||
|
||||
[sub_resource type="VisualShader" id="VisualShader_6fe4d"]
|
||||
code = "shader_type canvas_item;
|
||||
render_mode blend_mix;
|
||||
|
||||
instance uniform vec4 TextColor : source_color = vec4(1.000000, 1.000000, 1.000000, 1.000000);
|
||||
|
||||
|
||||
|
||||
void vertex() {
|
||||
// ColorParameter:2
|
||||
vec4 n_out2p0 = TextColor;
|
||||
|
||||
|
||||
// Output:0
|
||||
COLOR.rgb = vec3(n_out2p0.xyz);
|
||||
|
||||
|
||||
}
|
||||
"
|
||||
mode = 1
|
||||
flags/light_only = false
|
||||
nodes/vertex/2/node = SubResource("VisualShaderNodeColorParameter_i05ah")
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
|
||||
config_version=5
|
||||
|
||||
[animation]
|
||||
|
||||
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
||||
|
||||
[application]
|
||||
|
||||
config/name="gamo"
|
||||
|
|
@ -15,11 +19,11 @@ config/description="local gamepad tester"
|
|||
config/version="1.0.0"
|
||||
run/main_scene="uid://c7bwo3h0leip4"
|
||||
config/use_custom_user_dir=true
|
||||
config/features=PackedStringArray("4.5", "GL Compatibility")
|
||||
config/features=PackedStringArray("4.6", "GL Compatibility")
|
||||
run/max_fps=24
|
||||
run/low_processor_mode=true
|
||||
boot_splash/show_image=false
|
||||
boot_splash/fullsize=false
|
||||
boot_splash/stretch_mode=0
|
||||
boot_splash/use_filter=false
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue