command
Version:
v1.0.8
Opens a new window with list of versions in this module.
Published: Sep 14, 2022
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Gamepad Demo
What does it do?
It demonstrates how one use a gamepad.
What are important aspects of the code?
These lines are key in this demo:
-
Registering the Gamepad
err := engo.Input.RegisterGamepad("Player1")
if err != nil {
println("Unable to find suitable Gamepad. Error was: ", err.Error())
}
-
Retrieve the gamepad during Update of the InputSystem.
!!! Make sure to check if the gamepad is not nil before trying to use it !!!
// Retrieve the Gamepad
gamepad := engo.Input.Gamepad("Player1")
if gamepad == nil {
println("No gamepad found for Player1.")
return
}
if gamepad.A.Up() {
entity.Color = color.White
} else if gamepad.A.JustPressed() {
entity.Color = color.RGBA{0, 255, 0, 255}
} else if gamepad.A.Down() {
entity.Color = color.RGBA{255, 0, 0, 255}
}
gamepad.RightX.Value()
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.