code upload

This commit is contained in:
Page Asgardius 2024-01-27 17:37:29 -07:00
parent a90e83eaa2
commit 3c1d6ac036
9 changed files with 325 additions and 15 deletions

2
.gitattributes vendored Normal file
View file

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

15
.gitignore vendored
View file

@ -1,17 +1,2 @@
# ---> Godot
# Godot 4+ specific ignores
.godot/
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation
# Mono-specific ignores
.mono/
data_*/
mono_crash.*.json

27
bottomhud.tscn Normal file
View file

@ -0,0 +1,27 @@
[gd_scene load_steps=2 format=3 uid="uid://d31udhuuwrajn"]
[ext_resource type="Script" path="res://fps.gd" id="1_15gcj"]
[node name="Bottomhud" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="fps" type="Label" parent="."]
layout_mode = 0
offset_left = 5.0
offset_top = 697.0
offset_right = 45.0
offset_bottom = 720.0
script = ExtResource("1_15gcj")
[node name="Version" type="Label" parent="."]
layout_mode = 0
offset_left = 1066.0
offset_top = 693.0
offset_right = 1272.0
offset_bottom = 716.0
text = "Created by Page Asgardius"

4
fps.gd Normal file
View file

@ -0,0 +1,4 @@
extends Label
func _process(delta: float) -> void:
set_text("FPS: " + str(Engine.get_frames_per_second()));

79
gamepadtest.gd Normal file
View file

@ -0,0 +1,79 @@
extends Control
var joyname
var lxaxis
var lyaxis
var rxaxis
var ryaxis
var dpadup
var dpaddown
var dpadleft
var dpadright
var lt
var rt
var ls
var rs
var l3
var r3
var view
var menu
var xb
var yb
var ab
var bb
# Called when the node enters the scene tree for the first time.
func _ready():
joyname = $Info
lxaxis = $"BoxContainer/VBoxContainer/Left X Axis"
lyaxis = $"BoxContainer/VBoxContainer/Left Y Axis"
rxaxis = $"BoxContainer/VBoxContainer2/Right X Axis"
ryaxis = $"BoxContainer/VBoxContainer2/Right Y Axis"
dpadup = $"BoxContainer/VBoxContainer/DPAD Up"
dpaddown = $"BoxContainer/VBoxContainer2/DPAD Down"
dpadleft = $"BoxContainer/VBoxContainer/DPAD Left"
dpadright = $"BoxContainer/VBoxContainer2/DPAD Right"
lt = $"BoxContainer/VBoxContainer/Left Trigger"
rt = $"BoxContainer/VBoxContainer2/Right Trigger"
ls = $"BoxContainer/VBoxContainer/Left Shoulder"
rs = $"BoxContainer/VBoxContainer2/Right Shoulder"
l3 = $"BoxContainer/VBoxContainer/Left Stick"
r3 = $"BoxContainer/VBoxContainer2/Right Stick"
view = $BoxContainer/VBoxContainer/View
menu = $BoxContainer/VBoxContainer2/Menu
xb = $BoxContainer/VBoxContainer/X
yb = $BoxContainer/VBoxContainer2/Y
ab = $BoxContainer/VBoxContainer/A
bb = $BoxContainer/VBoxContainer2/B
#pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _input(event):
if Input.is_key_pressed(KEY_ESCAPE) || (Input.is_joy_button_pressed(0,JOY_BUTTON_A) && (Input.is_joy_button_pressed(0,JOY_BUTTON_B))):
get_tree().quit()
joyname.set_text("Current Device: "+str(Input.get_joy_name(0))+"\nIf drift threshold is 0.2 or higher, your gamepad need new sticks")
lxaxis.set_text("Left X Axis "+str(Input.get_joy_axis(0,JOY_AXIS_LEFT_X)))
lyaxis.set_text("Left Y Axis "+str(Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)))
rxaxis.set_text("Right X Axis "+str(Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)))
ryaxis.set_text("Right Y Axis "+str(Input.get_joy_axis(0,JOY_AXIS_RIGHT_Y)))
dpadup.set_text("DPAD Up "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_DPAD_UP)))
dpaddown.set_text("DPAD Down "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_DPAD_DOWN)))
dpadleft.set_text("DPAD Left "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_DPAD_LEFT)))
dpadright.set_text("DPAD Right "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_DPAD_RIGHT)))
lt.set_text("Left Trigger "+str(Input.get_joy_axis(0,JOY_AXIS_TRIGGER_LEFT)))
rt.set_text("Right Trigger "+str(Input.get_joy_axis(0,JOY_AXIS_TRIGGER_RIGHT)))
ls.set_text("Left Shoulder "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)))
rs.set_text("Right Shoulder "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER)))
l3.set_text("Left Stick "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_STICK)))
r3.set_text("Right Stick "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_STICK)))
view.set_text("View "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_BACK)))
menu.set_text("Menu "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_START)))
xb.set_text("X "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_X)))
yb.set_text("Y "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_Y)))
ab.set_text("A "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_A)))
bb.set_text("B "+str(Input.is_joy_button_pressed(0,JOY_BUTTON_B)))

146
gamepadtest.tscn Normal file
View file

@ -0,0 +1,146 @@
[gd_scene load_steps=3 format=3 uid="uid://qun4scsrsp00"]
[ext_resource type="Script" path="res://gamepadtest.gd" id="1_w4qrm"]
[ext_resource type="PackedScene" uid="uid://d31udhuuwrajn" path="res://bottomhud.tscn" id="4_88ejd"]
[node name="Gamepadtest" 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_w4qrm")
[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
[node name="Game name" type="Label" parent="."]
layout_mode = 0
offset_left = 496.0
offset_top = 3.0
offset_right = 790.0
offset_bottom = 73.0
theme_override_font_sizes/font_size = 40
text = "Gamepad Test"
[node name="Info" type="Label" parent="."]
layout_mode = 0
offset_left = 28.0
offset_top = 94.0
offset_right = 322.0
offset_bottom = 164.0
theme_override_font_sizes/font_size = 20
[node name="Stop" type="Label" parent="."]
layout_mode = 0
offset_left = 5.0
offset_top = 672.0
offset_right = 444.0
offset_bottom = 708.0
theme_override_font_sizes/font_size = 22
text = "Press Escape or A + B to quit"
[node name="BoxContainer" type="BoxContainer" parent="."]
layout_mode = 1
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -640.0
offset_top = -419.0
grow_horizontal = 0
grow_vertical = 0
[node name="VBoxContainer" type="VBoxContainer" parent="BoxContainer"]
layout_mode = 2
[node name="Left X Axis" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "Left X Axis"
[node name="Left Y Axis" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "Left Y Axis"
[node name="DPAD Up" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "DPAD Up"
[node name="DPAD Left" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "DPAD Left"
[node name="Left Trigger" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "Left Trigger"
[node name="Left Shoulder" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "Left Shoulder"
[node name="Left Stick" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "Left Stick"
[node name="View" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "View"
[node name="X" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "X"
[node name="A" type="Label" parent="BoxContainer/VBoxContainer"]
layout_mode = 2
text = "A"
[node name="VBoxContainer2" type="VBoxContainer" parent="BoxContainer"]
layout_mode = 2
[node name="Right X Axis" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Right X Axis"
[node name="Right Y Axis" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Right Y Axis"
[node name="DPAD Down" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "DPAD Down
"
[node name="DPAD Right" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "DPAD Right"
[node name="Right Trigger" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Right Trigger"
[node name="Right Shoulder" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Right Shoulder"
[node name="Right Stick" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Right Stick"
[node name="Menu" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Menu"
[node name="Y" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "Y"
[node name="B" type="Label" parent="BoxContainer/VBoxContainer2"]
layout_mode = 2
text = "B"
[node name="Bottomhud" parent="." instance=ExtResource("4_88ejd")]
layout_mode = 1

1
icon.svg Normal file
View file

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><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 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4jsgurlrrwe2"
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

29
project.godot Normal file
View file

@ -0,0 +1,29 @@
; 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="Gamepad Test"
run/main_scene="res://gamepadtest.tscn"
config/features=PackedStringArray("4.2", "GL Compatibility")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1280
window/size/viewport_height=720
window/stretch/mode="viewport"
window/defaults/default_clear_color=Color(0.3, 0.3, 0.3, 1)
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
environment/defaults/default_clear_color=Color(0, 0, 0, 1)