diff --git a/README.md b/README.md new file mode 100644 index 0000000..cc744ca --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# gamo + +local gamepad tester + +original TUI app here: [https://git.pixelatedw.xyz/wynd/gamo](https://git.pixelatedw.xyz/wynd/gamo) + +## why ? + +there's nothing particularly fancy about this and it does what it says, allows the user to test their gamepad + +made with godot because I couldn't be bothered with any GUI toolkits out there +it uses a custom exporting template to cut down its size by more than half + +compared with the original TUI version it is huge coming at around 32MB (about 17 times more) and it consumes about 26 times more RAM (~130MB) +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 + +- `v` to start a rumble test (weak default) +- `shift` toggle between rumble modes (weak/strong) + +## config + +this app comes with a config found in: +- Linux: `~/.local/share/gamo/config.cfg` + +## credits + +icons are from kenney's input prompt collection: [https://www.kenney.nl/assets/input-prompts](https://www.kenney.nl/assets/input-prompts) diff --git a/controller/controller.gd b/controller/controller.gd index 3c2eb07..5eaf1d2 100644 --- a/controller/controller.gd +++ b/controller/controller.gd @@ -3,6 +3,7 @@ extends Control @onready var device_name: RichTextLabel = $Device var _has_joy := false +var _weak_rumble := true func _ready() -> void: if Input.get_connected_joypads().size() > 0: @@ -18,3 +19,9 @@ func _process(_delta: float) -> void: if Input.get_connected_joypads().size() <= 0: self.device_name.text = WyHelper.NO_DEVICE self._has_joy = false + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("toggle_rumble_mode"): + self._weak_rumble = !self._weak_rumble + elif event.is_action_pressed("rumble_test"): + Input.start_joy_vibration(0, 1.0 if self._weak_rumble else 0.0, 1.0 if !self._weak_rumble else 0.0, 1) diff --git a/project.godot b/project.godot index 3f4aa36..e57c7c6 100644 --- a/project.godot +++ b/project.godot @@ -116,6 +116,16 @@ l1={ "events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":false,"script":null) ] } +rumble_test={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":86,"physical_keycode":0,"key_label":0,"unicode":118,"location":0,"echo":false,"script":null) +] +} +toggle_rumble_mode={ +"deadzone": 0.5, +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194325,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) +] +} [rendering]