Skip to content

Commit

Permalink
sdl: updated TODO markings (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
Genio2003 authored Feb 27, 2024
1 parent 62457e6 commit 388934e
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 57 deletions.
8 changes: 4 additions & 4 deletions sdl/audio.go
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ func CloseAudioDevice(dev AudioDeviceID) {
}

// NewAudioStream creates a new audio stream
// TODO: (https://wiki.libsdl.org/SDL_NewAudioStream)
// (https://wiki.libsdl.org/SDL_NewAudioStream)
func NewAudioStream(srcFormat AudioFormat, srcChannels uint8, srcRate int, dstFormat AudioFormat, dstChannels uint8, dstRate int) (stream *AudioStream, err error) {
_srcFormat := C.SDL_AudioFormat(srcFormat)
_srcChannels := C.Uint8(srcChannels)
Expand All @@ -605,7 +605,7 @@ func NewAudioStream(srcFormat AudioFormat, srcChannels uint8, srcRate int, dstFo
}

// Put adds data to be converted/resampled to the stream
// TODO: (https://wiki.libsdl.org/SDL_AudioStreamPut)
// (https://wiki.libsdl.org/SDL_AudioStreamPut)
func (stream *AudioStream) Put(buf []byte) (err error) {
sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
_buf := unsafe.Pointer(sliceHeader.Data)
Expand Down Expand Up @@ -637,15 +637,15 @@ func (stream *AudioStream) Available() (n int) {

// Flush tells the stream that you're done sending data, and anything being buffered
// should be converted/resampled and made available immediately.
// TODO: (https://wiki.libsdl.org/SDL_AudioStreamFlush)
// (https://wiki.libsdl.org/SDL_AudioStreamFlush)
func (stream *AudioStream) Flush() (err error) {
ret := int(C.SDL_AudioStreamFlush(stream.cptr()))
err = errorFromInt(ret)
return
}

// Clear clears any pending data in the stream without converting it
// TODO: (https://wiki.libsdl.org/SDL_AudioStreamClear)
// (https://wiki.libsdl.org/SDL_AudioStreamClear)
func (stream *AudioStream) Clear() {
C.SDL_AudioStreamClear(stream.cptr())
}
Expand Down
12 changes: 6 additions & 6 deletions sdl/cpuinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func HasAVX() bool {
}

// HasAVX512F reports whether the CPU has AVX-512F (foundation) features.
// TODO: (https://wiki.libsdl.org/SDL_HasAVX512F)
// (https://wiki.libsdl.org/SDL_HasAVX512F)
func HasAVX512F() bool {
return C.SDL_HasAVX512F() > 0
}
Expand All @@ -237,7 +237,7 @@ func HasAVX2() bool {
}

// HasARMSIMD reports whether the CPU has ARM SIMD (ARMv6) features.
// TODO: (https://wiki.libsdl.org/SDL_HasARMSIMD)
// (https://wiki.libsdl.org/SDL_HasARMSIMD)
func HasARMSIMD() bool {
return C.SDL_HasARMSIMD() > 0
}
Expand All @@ -249,25 +249,25 @@ func HasNEON() bool {
}

// SIMDGetAlignment reports the alignment this system needs for SIMD allocations.
// TODO: (https://wiki.libsdl.org/SDL_SIMDGetAlignment)
// (https://wiki.libsdl.org/SDL_SIMDGetAlignment)
func SIMDGetAlignment() int {
return int(C.SDL_SIMDGetAlignment())
}

// SIMDAlloc allocates memory in a SIMD-friendly way.
// TODO: (https://wiki.libsdl.org/SDL_SIMDAlloc)
// (https://wiki.libsdl.org/SDL_SIMDAlloc)
func SIMDAlloc(_len int) unsafe.Pointer {
return C.SDL_SIMDAlloc(C.size_t(_len))
}

// SIMDRealloc reallocates memory obtained from SDL_SIMDAlloc.
// TODO: (https://wiki.libsdl.org/SDL_SIMDRealloc)
// (https://wiki.libsdl.org/SDL_SIMDRealloc)
func SIMDRealloc(mem unsafe.Pointer, _len int) unsafe.Pointer {
return C.SDL_SIMDRealloc(mem, C.size_t(_len))
}

// SIMDFree deallocates memory obtained from SDL_SIMDAlloc.
// TODO: (https://wiki.libsdl.org/SDL_SIMDFree)
// (https://wiki.libsdl.org/SDL_SIMDFree)
func SIMDFree(p unsafe.Pointer) {
C.SDL_SIMDFree(p)
}
30 changes: 15 additions & 15 deletions sdl/gamecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,13 @@ func (ctrl *GameController) Type() GameControllerType {
}

// PlayerIndex the player index of an opened game controller, or -1 if it's not available.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerGetPlayerIndex)
// (https://wiki.libsdl.org/SDL_GameControllerGetPlayerIndex)
func (ctrl *GameController) PlayerIndex() int {
return int(C.SDL_GameControllerGetPlayerIndex(ctrl.cptr()))
}

// SetPlayerIndex sets the player index of an opened game controller.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerSetPlayerIndex)
// (https://wiki.libsdl.org/SDL_GameControllerSetPlayerIndex)
func (ctrl *GameController) SetPlayerIndex(playerIndex int) {
C.SDL_GameControllerSetPlayerIndex(ctrl.cptr(), C.int(playerIndex))
}
Expand All @@ -526,7 +526,7 @@ func (ctrl *GameController) FirmwareVersion() uint16 {
}

// Serial returns the serial number of an opened controller, if available.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerGetSerial)
// (https://wiki.libsdl.org/SDL_GameControllerGetSerial)
func (ctrl *GameController) Serial() string {
return C.GoString(C.SDL_GameControllerGetSerial(ctrl.cptr()))
}
Expand Down Expand Up @@ -584,7 +584,7 @@ func (ctrl *GameController) BindForAxis(axis GameControllerAxis) GameControllerB
}

// HasAxis returns whether a game controller has a given axis.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerHasAxis)
// (https://wiki.libsdl.org/SDL_GameControllerHasAxis)
func (ctrl *GameController) HasAxis(axis GameControllerAxis) bool {
return C.SDL_GameControllerHasAxis(ctrl.cptr(), axis.c()) == C.SDL_TRUE
}
Expand Down Expand Up @@ -630,25 +630,25 @@ func (ctrl *GameController) HasButton(btn GameControllerButton) bool {
//
// Returns error if rumble isn't supported on this joystick.
//
// TODO: (https://wiki.libsdl.org/SDL_GameControllerRumble)
// (https://wiki.libsdl.org/SDL_GameControllerRumble)
func (ctrl *GameController) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error {
return errorFromInt(int(C.SDL_GameControllerRumble(ctrl.cptr(), C.Uint16(lowFrequencyRumble), C.Uint16(highFrequencyRumble), C.Uint32(durationMS))))
}

// RumbleTriggers starts a rumble effect in the game controller's triggers.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerRumbleTriggers)
// (https://wiki.libsdl.org/SDL_GameControllerRumbleTriggers)
func (ctrl *GameController) RumbleTriggers(leftRumble, rightRumble uint16, durationMS uint32) error {
return errorFromInt(int(C.SDL_GameControllerRumble(ctrl.cptr(), C.Uint16(leftRumble), C.Uint16(rightRumble), C.Uint32(durationMS))))
}

// HasLED returns whether a controller has an LED.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerHasLED)
// (https://wiki.libsdl.org/SDL_GameControllerHasLED)
func (ctrl *GameController) HasLED() bool {
return C.SDL_GameControllerHasLED(ctrl.cptr()) == C.SDL_TRUE
}

// SetLED updates a controller's LED color.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerSetLED)
// (https://wiki.libsdl.org/SDL_GameControllerSetLED)
func (ctrl *GameController) SetLED(red, green, blue uint8) error {
return errorFromInt(int(C.SDL_GameControllerSetLED(ctrl.cptr(), C.Uint8(red), C.Uint8(blue), C.Uint8(green))))
}
Expand All @@ -660,44 +660,44 @@ func (ctrl *GameController) Button(btn GameControllerButton) byte {
}

// NumTouchpads returns the number of touchpads on a game controller.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpads)
// (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpads)
func (ctrl *GameController) NumTouchpads() int {
return int(C.SDL_GameControllerGetNumTouchpads(ctrl.cptr()))
}

// NumTouchpadFingers returns the number of supported simultaneous fingers on a touchpad on a game controller.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpadFingers)
// (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpadFingers)
func (ctrl *GameController) NumTouchpadFingers(touchpad int) int {
return int(C.SDL_GameControllerGetNumTouchpadFingers(ctrl.cptr(), C.int(touchpad)))
}

// TouchpadFinger returns the current state of a finger on a touchpad on a game controller.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerGetTouchpadFinger)
// (https://wiki.libsdl.org/SDL_GameControllerGetTouchpadFinger)
func (ctrl *GameController) TouchpadFinger(touchpad, finger int) (state uint8, x, y, pressure float32) {
C.SDL_GameControllerGetTouchpadFinger(ctrl.cptr(), C.int(touchpad), C.int(finger), (*C.Uint8)(&state), (*C.float)(&x), (*C.float)(&y), (*C.float)(&pressure))
return
}

// HasSensor returns whether a game controller has a particular sensor.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerHasSensor)
// (https://wiki.libsdl.org/SDL_GameControllerHasSensor)
func (ctrl *GameController) HasSensor(typ SensorType) bool {
return C.SDL_GameControllerHasSensor(ctrl.cptr(), C.SDL_SensorType(typ)) == C.SDL_TRUE
}

// SetSensorEnabled sets whether data reporting for a game controller sensor is enabled.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerSetSensorEnabled)
// (https://wiki.libsdl.org/SDL_GameControllerSetSensorEnabled)
func (ctrl *GameController) SetSensorEnabled(typ SensorType, enabled bool) error {
return errorFromInt(int(C.SDL_GameControllerSetSensorEnabled(ctrl.cptr(), C.SDL_SensorType(typ), C.SDL_bool(Btoi(enabled)))))
}

// IsSensorEnabled queries whether sensor data reporting is enabled for a game controller.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerIsSensorEnabled)
// (https://wiki.libsdl.org/SDL_GameControllerIsSensorEnabled)
func (ctrl *GameController) IsSensorEnabled(typ SensorType) bool {
return C.SDL_GameControllerIsSensorEnabled(ctrl.cptr(), C.SDL_SensorType(typ)) == C.SDL_TRUE
}

// SensorData returns the current state of a game controller sensor.
// TODO: (https://wiki.libsdl.org/SDL_GameControllerGetSensorData)
// (https://wiki.libsdl.org/SDL_GameControllerGetSensorData)
func (ctrl *GameController) SensorData(typ SensorType, numValues int) (data []float32, err error) {
err = errorFromInt(int(C.SDL_GameControllerGetSensorData(ctrl.cptr(), C.SDL_SensorType(typ), (*C.float)(&data[0]), C.int(numValues))))
return
Expand Down
22 changes: 11 additions & 11 deletions sdl/joystick.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func JoystickPathForIndex(index int) string {
}

// JoystickGetDevicePlayerIndex returns the player index of a joystick, or -1 if it's not available
// TODO: (https://wiki.libsdl.org/SDL_JoystickGetDevicePlayerIndex)
// (https://wiki.libsdl.org/SDL_JoystickGetDevicePlayerIndex)
func JoystickGetDevicePlayerIndex(index int) int {
return int(C.SDL_JoystickGetDevicePlayerIndex(C.int(index)))
}
Expand Down Expand Up @@ -565,13 +565,13 @@ func JoystickFromInstanceID(joyid JoystickID) *Joystick {
}

// JoystickFromPlayerIndex returns the Joystick associated with a player index.
// TODO: (https://wiki.libsdl.org/SDL_JoystickFromPlayerIndex)
// (https://wiki.libsdl.org/SDL_JoystickFromPlayerIndex)
func JoystickFromPlayerIndex(playerIndex int) *Joystick {
return (*Joystick)(C.SDL_JoystickFromPlayerIndex(C.int(playerIndex)))
}

// JoystickAttachVirtual attaches a new virtual joystick.
// TODO: (https://wiki.libsdl.org/SDL_JoystickAttachVirtual)
// (https://wiki.libsdl.org/SDL_JoystickAttachVirtual)
func JoystickAttachVirtual(typ JoystickType, naxes, nbuttons, nhats int) (deviceIndex int, err error) {
deviceIndex = int(C.SDL_JoystickAttachVirtual(C.SDL_JoystickType(typ), C.int(naxes), C.int(nbuttons), C.int(nhats)))
err = errorFromInt(deviceIndex)
Expand All @@ -587,13 +587,13 @@ func JoystickAttachVirtualEx(desc *C.SDL_VirtualJoystickDesc) (deviceIndex int,
}

// JoystickDetachVirtual detaches a virtual joystick.
// TODO: (https://wiki.libsdl.org/SDL_JoystickDetachVirtual)
// (https://wiki.libsdl.org/SDL_JoystickDetachVirtual)
func JoystickDetachVirtual(deviceIndex int) error {
return errorFromInt(int(C.SDL_JoystickDetachVirtual(C.int(deviceIndex))))
}

// JoystickIsVirtual indicates whether or not a virtual-joystick is at a given device index.
// TODO: (https://wiki.libsdl.org/SDL_JoystickIsVirtual)
// (https://wiki.libsdl.org/SDL_JoystickIsVirtual)
func JoystickIsVirtual(deviceIndex int) bool {
return C.SDL_JoystickIsVirtual(C.int(deviceIndex)) == C.SDL_TRUE
}
Expand All @@ -604,7 +604,7 @@ func JoystickIsVirtual(deviceIndex int) bool {
// or can be called indirectly through various other SDL APIS,
// including, but not limited to the following: SDL_PollEvent,
// SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent..
// TODO: (https://wiki.libsdl.org/SDL_JoystickSetVirtualAxis)
// (https://wiki.libsdl.org/SDL_JoystickSetVirtualAxis)
func (joy *Joystick) SetVirtualAxis(axis int, value int16) error {
return errorFromInt(int(C.SDL_JoystickSetVirtualAxis(joy.cptr(), C.int(axis), C.Sint16(value))))
}
Expand All @@ -615,7 +615,7 @@ func (joy *Joystick) SetVirtualAxis(axis int, value int16) error {
// or can be called indirectly through various other SDL APIS,
// including, but not limited to the following: SDL_PollEvent,
// SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent..
// TODO: (https://wiki.libsdl.org/SDL_JoystickSetVirtualButton)
// (https://wiki.libsdl.org/SDL_JoystickSetVirtualButton)
func (joy *Joystick) SetVirtualButton(button int, value uint8) error {
return errorFromInt(int(C.SDL_JoystickSetVirtualButton(joy.cptr(), C.int(button), C.Uint8(value))))
}
Expand All @@ -626,19 +626,19 @@ func (joy *Joystick) SetVirtualButton(button int, value uint8) error {
// or can be called indirectly through various other SDL APIS,
// including, but not limited to the following: SDL_PollEvent,
// SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent..
// TODO: (https://wiki.libsdl.org/SDL_JoystickSetVirtualHat)
// (https://wiki.libsdl.org/SDL_JoystickSetVirtualHat)
func (joy *Joystick) SetVirtualHat(hat int, value uint8) error {
return errorFromInt(int(C.SDL_JoystickSetVirtualHat(joy.cptr(), C.int(hat), C.Uint8(value))))
}

// LockJoysticks locks joysticks for multi-threaded access to the joystick API
// TODO: (https://wiki.libsdl.org/SDL_LockJoysticks)
// (https://wiki.libsdl.org/SDL_LockJoysticks)
func LockJoysticks() {
C.SDL_LockJoysticks()
}

// UnlockJoysticks unlocks joysticks for multi-threaded access to the joystick API
// TODO: (https://wiki.libsdl.org/SDL_UnlockJoysticks)
// (https://wiki.libsdl.org/SDL_UnlockJoysticks)
func UnlockJoysticks() {
C.SDL_UnlockJoysticks()
}
Expand Down Expand Up @@ -782,7 +782,7 @@ func (joy *Joystick) Button(button int) byte {
//
// Returns error if rumble isn't supported on this joystick.
//
// TODO: (https://wiki.libsdl.org/SDL_JoystickRumble)
// (https://wiki.libsdl.org/SDL_JoystickRumble)
func (joy *Joystick) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error {
return errorFromInt(int(C.SDL_JoystickRumble(joy.cptr(), C.Uint16(lowFrequencyRumble), C.Uint16(highFrequencyRumble), C.Uint32(durationMS))))
}
Expand Down
4 changes: 2 additions & 2 deletions sdl/rect.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ type Rect struct {
}

// FPoint defines a two dimensional point.
// TODO: (https://wiki.libsdl.org/SDL_FPoint)
// (https://wiki.libsdl.org/SDL_FPoint)
type FPoint struct {
X float32 // the x coordinate of the point
Y float32 // the y coordinate of the point
}

// FRect contains the definition of a rectangle, with the origin at the upper left.
// TODO: (https://wiki.libsdl.org/SDL_FRect)
// (https://wiki.libsdl.org/SDL_FRect)
type FRect struct {
X float32 // the x location of the rectangle's upper left corner
Y float32 // the y location of the rectangle's upper left corner
Expand Down
Loading

0 comments on commit 388934e

Please sign in to comment.