Skip to content

Commit

Permalink
try some steam deck haptics
Browse files Browse the repository at this point in the history
  • Loading branch information
trevyn committed Jun 20, 2024
1 parent 2d5c1fa commit 4a57880
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var bananas: int = 0

func _ready() -> void:
var initialize_response: Dictionary = Steam.steamInitEx()
$SteamStatus.text=str(initialize_response)
var inputType = Steam.getInputTypeForHandle(Steam.getControllerForGamepadIndex(0))
$SteamStatus.text=str(inputType)+" "+str(initialize_response)
print("Did Steam initialize?: %s " % initialize_response)

$Button.connect("pressed", Callable(self, "_on_button_pressed"))
Expand All @@ -29,10 +30,11 @@ func _process(_delta: float) -> void:

func _on_button_2_pressed() -> void:
print ("button pressed")
var device := 0 # The joystick device index, change as needed
var weak_magnitude := float($Weak.text) # Weak vibration strength (0 to 1)
var strong_magnitude := float($Strong.text) # Strong vibration strength (0 to 1)
var duration := float($Duration.text) # Duration in seconds

# Trigger joystick vibration
Input.start_joy_vibration(device, weak_magnitude, strong_magnitude, duration)
Steam.triggerRepeatedHapticPulse(Steam.getControllerForGamepadIndex(0), 0, 5000,5000,50,0)
#var device := 0 # The joystick device index, change as needed
#var weak_magnitude := float($Weak.text) # Weak vibration strength (0 to 1)
#var strong_magnitude := float($Strong.text) # Strong vibration strength (0 to 1)
#var duration := float($Duration.text) # Duration in seconds
#
## Trigger joystick vibration
#Input.start_joy_vibration(device, weak_magnitude, strong_magnitude, duration)

0 comments on commit 4a57880

Please sign in to comment.