Initial commit with buttons, triggers and project settings

master
Wynd 2026-01-24 14:29:16 +02:00
commit 5d3ac7fa04
17 changed files with 624 additions and 0 deletions

2
.gitattributes vendored 100644
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

5
.gitignore vendored 100644
View File

@ -0,0 +1,5 @@
# Godot 4+ specific ignores
.godot/
/android/
builds/
export_templates/

18
.vscode/launch.json vendored 100644
View File

@ -0,0 +1,18 @@
{
// 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": "",
}
]
}

8
.vscode/settings.json vendored 100644
View File

@ -0,0 +1,8 @@
{
// 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"
}

203
Main.tscn 100644
View File

@ -0,0 +1,203 @@
[gd_scene load_steps=4 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"]
[node name="Main" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_uu6xs")
[node name="Device" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_left = 16.0
offset_top = 19.0
offset_right = -26.0
offset_bottom = 67.0
grow_horizontal = 2
theme_override_font_sizes/normal_font_size = 24
text = "No Active Device"
[node name="DPad" type="Control" parent="."]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 191.0
offset_top = -20.0
offset_right = 191.0
offset_bottom = -20.0
grow_vertical = 2
[node name="Up" parent="DPad" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = 1.0
offset_top = -128.0
offset_right = 97.0
offset_bottom = -32.0
input_code = "ui_up"
label = "Up"
[node name="Left" parent="DPad" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = -95.0
offset_top = -32.0
offset_right = 1.0
offset_bottom = 64.0
input_code = "ui_left"
label = "Left"
[node name="Right" parent="DPad" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = 97.0
offset_top = -32.0
offset_right = 193.0
offset_bottom = 64.0
input_code = "ui_right"
label = "Right"
[node name="Down" parent="DPad" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = 1.0
offset_top = 64.0
offset_right = 97.0
offset_bottom = 160.0
input_code = "ui_down"
label = "Down"
[node name="Actions" type="Control" parent="."]
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -288.0
offset_top = -20.0
offset_right = -288.0
offset_bottom = -20.0
grow_horizontal = 0
grow_vertical = 2
[node name="Action4" parent="Actions" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_top = -128.0
offset_bottom = -32.0
input_code = "action_4"
label = "Y"
[node name="Action3" parent="Actions" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = -96.0
offset_top = -32.0
offset_right = 0.0
offset_bottom = 64.0
input_code = "action_3"
label = "X"
[node name="Action2" parent="Actions" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = 96.0
offset_top = -32.0
offset_right = 192.0
offset_bottom = 64.0
input_code = "action_2"
label = "B"
[node name="Action1" parent="Actions" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_top = 64.0
offset_bottom = 160.0
input_code = "action_1"
label = "A"
[node name="MidButtons" type="Control" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
[node name="Select" parent="MidButtons" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = -140.0
offset_top = -32.0
offset_right = -44.0
offset_bottom = 16.0
pivot_offset = Vector2(48, 24)
input_code = "select"
label = "Select"
[node name="Start" parent="MidButtons" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = 84.0
offset_top = -32.0
offset_right = 180.0
offset_bottom = 16.0
pivot_offset = Vector2(48, 24)
input_code = "start"
label = "Start"
[node name="ShoulderButtons" type="Control" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -20.0
offset_top = -20.0
offset_right = 20.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
[node name="R1" parent="ShoulderButtons" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = 84.0
offset_top = -231.0
offset_right = 212.0
offset_bottom = -167.0
input_code = "r1"
label = "R1"
[node name="R2" parent="ShoulderButtons" instance=ExtResource("3_r0du0")]
layout_mode = 0
offset_left = 276.0
offset_top = -261.0
offset_right = 340.0
offset_bottom = -133.0
input_axis = 5
label = "R2"
[node name="L1" parent="ShoulderButtons" instance=ExtResource("2_uu6xs")]
layout_mode = 0
offset_left = -172.0
offset_top = -233.0
offset_right = -44.0
offset_bottom = -169.0
input_code = "l1"
label = "L1"
[node name="L2" parent="ShoulderButtons" instance=ExtResource("3_r0du0")]
layout_mode = 0
offset_left = -300.0
offset_top = -261.0
offset_right = -236.0
offset_bottom = -133.0
input_axis = 4
label = "L2"

View File

@ -0,0 +1,17 @@
@tool
class_name ControllerButton
extends ColorRect
@onready var label_node: RichTextLabel = $Label
@export var input_code: String
@export var label: String:
set(val):
label = val
if Engine.is_editor_hint() && self.label_node != null:
self.label_node.text = label
func _ready() -> void:
self.label_node.text = self.label
assert(self.input_code, "Missing input code for %s" % self.name)
assert(InputMap.has_action(self.input_code), "Invalid input code for %s" % self.name)

View File

@ -0,0 +1 @@
uid://5ud76wl43q3w

View File

@ -0,0 +1,24 @@
[gd_scene load_steps=2 format=3 uid="uid://bkw6xqubudrtw"]
[ext_resource type="Script" uid="uid://5ud76wl43q3w" path="res://controller/button/controller_button.gd" id="2_t8ak6"]
[node name="Button" type="ColorRect" groups=["buttons"]]
offset_right = 96.0
offset_bottom = 96.0
pivot_offset = Vector2(48, 48)
color = Color(0.164706, 0.164706, 0.164706, 1)
script = ExtResource("2_t8ak6")
input_code = null
[node name="Label" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/normal_font_size = 24
bbcode_enabled = true
text = "Up"
horizontal_alignment = 1
vertical_alignment = 1

View File

@ -0,0 +1,48 @@
extends Control
const NO_DEVICE := "No Active Device"
const DEFAULT_COLOR := Color(0x2a2a2aff)
const ACTIVE_COLOR := Color(0x4a8e53ff)
@onready var device_name: RichTextLabel = $Device
var _has_joy := false
var _buttons: Array[Node]
var _triggers: Array[Node]
func _ready() -> void:
self._buttons = self.get_tree().get_nodes_in_group("buttons")
self._triggers = self.get_tree().get_nodes_in_group("triggers")
if Input.get_connected_joypads().size() > 0:
self.device_name.text = Input.get_joy_name(0)
self._has_joy = true
func _process(_delta: float) -> void:
if !self._has_joy:
if Input.get_connected_joypads().size() > 0:
self.device_name.text = Input.get_joy_name(0)
self._has_joy = true
return
if Input.get_connected_joypads().size() <= 0:
self._has_joy = false
self.device_name.text = NO_DEVICE
return
for btn in self._buttons:
if not btn is ControllerButton:
continue
var cbtn := btn as ControllerButton
cbtn.color = DEFAULT_COLOR
if cbtn.input_code && Input.is_action_pressed(cbtn.input_code):
cbtn.color = ACTIVE_COLOR
for btn in self._triggers:
if not btn is ControllerTrigger:
continue
var cbtn := btn as ControllerTrigger
cbtn.value = Input.get_joy_axis(0, cbtn.input_axis)

View File

@ -0,0 +1 @@
uid://bu2nrvyk2k8ib

View File

@ -0,0 +1,19 @@
@tool
class_name ControllerTrigger
extends ProgressBar
@onready var label_node: RichTextLabel = $Label
@onready var progress_label: RichTextLabel = $ProgressLabel
@export var input_axis: JoyAxis
@export var label: String:
set(val):
label = val
if Engine.is_editor_hint() && self.label_node != null:
self.label_node.text = label
func _ready() -> void:
self.label_node.text = self.label
func _process(_delta: float) -> void:
self.progress_label.text = "%s%%" % str(self.value * 100.0)

View File

@ -0,0 +1 @@
uid://dyjkb4jlrolof

View File

@ -0,0 +1,67 @@
[gd_scene load_steps=4 format=3 uid="uid://c1dixxyohl131"]
[ext_resource type="Script" uid="uid://dyjkb4jlrolof" path="res://controller/trigger/trigger_button.gd" id="1_w0n5r"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_lt7ru"]
bg_color = Color(0.6, 0.6, 0.6, 0)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(0.16470589, 0.16470589, 0.16470589, 1)
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
expand_margin_left = 5.0
expand_margin_top = 5.0
expand_margin_right = 5.0
expand_margin_bottom = 5.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_w0n5r"]
bg_color = Color(0.2901961, 0.5568628, 0.3254902, 1)
corner_radius_top_left = 2
corner_radius_top_right = 2
corner_radius_bottom_right = 2
corner_radius_bottom_left = 2
[node name="Trigger" type="ProgressBar" groups=["triggers"]]
offset_top = -2.0
offset_right = 64.0
offset_bottom = 126.0
pivot_offset = Vector2(32, 64)
theme_override_font_sizes/font_size = 28
theme_override_styles/background = SubResource("StyleBoxFlat_lt7ru")
theme_override_styles/fill = SubResource("StyleBoxFlat_w0n5r")
max_value = 1.0
value = 0.5
fill_mode = 2
show_percentage = false
script = ExtResource("1_w0n5r")
[node name="Label" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 40.0
grow_horizontal = 2
theme_override_font_sizes/normal_font_size = 24
bbcode_enabled = true
horizontal_alignment = 1
vertical_alignment = 1
[node name="ProgressLabel" type="RichTextLabel" parent="."]
layout_mode = 1
anchors_preset = 12
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -42.0
grow_horizontal = 2
grow_vertical = 0
theme_override_font_sizes/normal_font_size = 16
bbcode_enabled = true
text = "100.0%"
autowrap_mode = 0
horizontal_alignment = 1
vertical_alignment = 1

42
export_presets.cfg 100644
View File

@ -0,0 +1,42 @@
[preset.0]
name="Linux"
platform="Linux"
runnable=true
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="builds/gamo-gd.x86_64"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release="./export_templates/linux_release.x86_64.x86_64"
debug/export_console_wrapper=1
binary_format/embed_pck=true
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
shader_baker/enabled=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""

1
icon.svg 100644
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import 100644
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bv3phr2jkyhql"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

130
project.godot 100644
View File

@ -0,0 +1,130 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="gamo-gd"
run/main_scene="uid://c7bwo3h0leip4"
config/features=PackedStringArray("4.5", "GL Compatibility")
run/max_fps=24
run/low_processor_mode=true
boot_splash/show_image=false
boot_splash/fullsize=false
boot_splash/use_filter=false
config/icon="res://icon.svg"
[debug]
gdscript/warnings/untyped_declaration=2
gdscript/warnings/unsafe_property_access=2
gdscript/warnings/unsafe_method_access=2
gdscript/warnings/unsafe_cast=1
gdscript/warnings/unsafe_call_argument=2
[display]
window/size/viewport_width=1280
window/size/viewport_height=720
window/size/borderless=true
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
window/vsync/vsync_mode=false
[global_group]
buttons=""
triggers=""
[input]
ui_left={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_right={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_up={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
]
}
ui_down={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
]
}
action_1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
}
action_2={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
]
}
action_3={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
]
}
action_4={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":false,"script":null)
]
}
select={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
]
}
start={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
]
}
r1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":false,"script":null)
]
}
r2={
"deadzone": 0.0,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
]
}
r3={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":8,"pressure":0.0,"pressed":false,"script":null)
]
}
l1={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null)
]
}
l2={
"deadzone": 0.2,
"events": []
}
l3={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"