gamepad detect

This commit is contained in:
Page Asgardius 2024-09-07 09:25:58 -07:00
parent 9ceb77e2f9
commit 4cd9cd4925
21 changed files with 144 additions and 13 deletions

View file

@ -1,4 +1,5 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
var bgsound := AudioStreamPlayer.new()
var fl
var fr
@ -27,6 +28,7 @@ func _ready() -> void:
bgsound.play(0)
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
get_tree().change_scene_to_file("res://levels/ui/soundtest.tscn")

View file

@ -1,6 +1,7 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$VBoxContainer/L20.grab_focus()
# Called every frame. 'delta' is the elapsed time since the previous frame.
@ -24,6 +25,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -1,6 +1,7 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$"VBoxContainer/Disclaimer".grab_focus()
# Called every frame. 'delta' is the elapsed time since the previous frame.
@ -24,6 +25,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -1,7 +1,8 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
func _ready():
_statrebase()
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
Global.debug = true
$"VBoxContainer/Gamepad Test".grab_focus()
@ -26,6 +27,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -0,0 +1,27 @@
[gd_scene format=3 uid="uid://cbeya2ihapatq"]
[node name="Missinggamepad" type="Node2D"]
[node name="ColorRect" type="ColorRect" parent="."]
offset_left = 105.0
offset_top = 211.0
offset_right = 1177.0
offset_bottom = 511.0
color = Color(0, 0, 0, 1)
[node name="Label" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 105.0
offset_top = 211.0
offset_right = 1177.0
offset_bottom = 511.0
grow_horizontal = 2
grow_vertical = 2
theme_override_font_sizes/font_size = 40
text = "TEXT_GAMEPAD_DISCONNECTED"
horizontal_alignment = 1
vertical_alignment = 1

View file

@ -1,10 +1,11 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
var player := AudioStreamPlayer.new()
var infobox
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
add_child(player)
player.mix_target = 1
player.bus = &"Music"
@ -33,6 +34,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -1,6 +1,7 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$VBoxContainer/Thisfirst.grab_focus()
# Called every frame. 'delta' is the elapsed time since the previous frame.
@ -24,6 +25,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
if Input.is_action_just_pressed("ui_cancel"):
get_tree().change_scene_to_file("res://levels/ui/tmenu.tscn")
# Mouse in viewport coordinates.

View file

@ -1,4 +1,5 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$"VBoxContainer/Disclaimer".grab_focus()
@ -24,6 +25,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -1,4 +1,5 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
var player := AudioStreamPlayer.new()
@ -31,6 +32,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -1,7 +1,8 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
var alsatest
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
alsatest = $VBoxContainer/ALSA
$"VBoxContainer/Music".grab_focus()
if OS.get_name() == "Linux":
@ -13,6 +14,7 @@ func _process(delta):
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -1,6 +1,7 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
#Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$"VBoxContainer/Testspawn".grab_focus()
# Called every frame. 'delta' is the elapsed time since the previous frame.
@ -24,6 +25,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
# Mouse in viewport coordinates.
if Input.is_action_just_pressed("ui_cancel"):
_on_back_pressed()

View file

@ -1,4 +1,5 @@
extends Control
const gamepadtest = preload("res://gamepad.gd")
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
$VBoxContainer/Start.grab_focus()
@ -24,6 +25,7 @@ func _level():
#boot.queue_free()
func _input(event):
gamepadtest.new(event)
if Input.is_action_just_pressed("ui_cancel"):
get_tree().change_scene_to_file("res://title.tscn")
# Mouse in viewport coordinates.

View file

@ -4,6 +4,7 @@ var stage = 0
var bg
# Called when the node enters the scene tree for the first time.
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
bg = $TextureRect
bg.texture = load(backgrounds[stage])
#pass # Replace with function body.