veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.17k stars 219 forks source link

Missing functions in gamecontroller.go #589

Closed Genio2003 closed 4 months ago

Genio2003 commented 4 months ago

Go version: 1.22.0 Go-SDL2 version: 0.4.38 SDL2 version: 2.30.0 OS: MacOS Architecture: arm64

Hi! Let me preface this by saying I'm a rookie in Go programming. I'm trying to use this library to work with game controllers. It seems like I'm missing some of the go-sdl2 gamecontroller functions, like HasLED(), SetLED(), HasSensor(), SetSensorEnabled(), IsSensorEnabled(), and SensorData(). I saw the TODO comment near them and that they are missing from the documentation, but they seem complete to me... Is this not the case?

Genio2003 commented 4 months ago

I'm also missing some gamecontroller related hints, like HINT_JOYSTICK_HIDAPI_PS4, HINT_JOYSTICK_HIDAPI_PS4_RUMBLE, HINT_JOYSTICK_HIDAPI_PS5, HINT_JOYSTICK_HIDAPI_PS5_RUMBLE, HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED.

veeableful commented 4 months ago

Hi @Genio2003, the TODO was to mark unavailable documentation page at the time. Could you try the master branch for the hints? It should have more up-to-date bindings.

Genio2003 commented 4 months ago

I have installed the library by specifying the import in my main.go file and by running go mod tidy. By doing so doesn't it pull from master?

Genio2003 commented 4 months ago

Hi @Genio2003, the TODO was to mark unavailable documentation page at the time. Could you try the master branch for the hints? It should have more up-to-date bindings.

If the documentation page exists, should the TODO comment be removed? If so, I would like to contribute with a pull request.

veeableful commented 4 months ago

Hi @Genio2003, by default I believe it pulls from the available stable tags such as 0.4.x. You should be able to specify it to use master by running go get github.com/veandco/go-sdl2@master.

And yes! The TODO should ideally be removed if the documentation page for specific function exists. Please feel free to open a pull request to update the markings!

Genio2003 commented 4 months ago

It worked! Now I have all the functions and hints. I have opened the pull request to update the markings (#590). Thank you so much for your help!