Skip to content

Commit

Permalink
sdl: Update documentation links to point to SDL2 specifically as they…
Browse files Browse the repository at this point in the history
… are now being redirected to SDL3

Signed-off-by: Lilis Iskandar <[email protected]>
  • Loading branch information
veeableful committed Feb 14, 2025
1 parent d23dfc5 commit d33fe82
Show file tree
Hide file tree
Showing 43 changed files with 798 additions and 798 deletions.
118 changes: 59 additions & 59 deletions sdl/audio.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions sdl/blendmode.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import "C"
import "unsafe"

// BlendMode is an enumeration of blend modes used in Render.Copy() and drawing operations.
// (https://wiki.libsdl.org/SDL_BlendMode)
// (https://wiki.libsdl.org/SDL2/SDL_BlendMode)
type BlendMode uint32

const (
Expand All @@ -88,7 +88,7 @@ func (bm *BlendMode) cptr() *C.SDL_BlendMode {
}

// BlendOperation is an enumeration of blend operations used when creating a custom blend mode with ComposeCustomBlendMode().
// (https://wiki.libsdl.org/SDL_BlendOperation)
// (https://wiki.libsdl.org/SDL2/SDL_BlendOperation)
type BlendOperation C.SDL_BlendOperation

const (
Expand All @@ -100,7 +100,7 @@ const (
)

// BlendFactor is an enumeration of blend factors used when creating a custom blend mode with ComposeCustomBlendMode().
// (https://wiki.libsdl.org/SDL_BlendFactor)
// (https://wiki.libsdl.org/SDL2/SDL_BlendFactor)
type BlendFactor C.SDL_BlendFactor

const (
Expand All @@ -121,7 +121,7 @@ const (
// dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
// and
// dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
// (https://wiki.libsdl.org/SDL_ComposeCustomBlendMode)
// (https://wiki.libsdl.org/SDL2/SDL_ComposeCustomBlendMode)
func ComposeCustomBlendMode(srcColorFactor, dstColorFactor BlendFactor, colorOperation BlendOperation, srcAlphaFactor, dstAlphaFactor BlendFactor, alphaOperation BlendOperation) BlendMode {
_srcColorFactor := C.SDL_BlendFactor(srcColorFactor)
_dstColorFactor := C.SDL_BlendFactor(dstColorFactor)
Expand Down
12 changes: 6 additions & 6 deletions sdl/clipboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import "C"
import "unsafe"

// SetClipboardText puts UTF-8 text into the clipboard.
// (https://wiki.libsdl.org/SDL_SetClipboardText)
// (https://wiki.libsdl.org/SDL2/SDL_SetClipboardText)
func SetClipboardText(text string) error {
_text := C.CString(text)
defer C.free(unsafe.Pointer(_text))
Expand All @@ -43,7 +43,7 @@ func SetClipboardText(text string) error {
}

// GetClipboardText returns UTF-8 text from the clipboard.
// (https://wiki.libsdl.org/SDL_GetClipboardText)
// (https://wiki.libsdl.org/SDL2/SDL_GetClipboardText)
func GetClipboardText() (string, error) {
text := C.SDL_GetClipboardText()
if text == nil {
Expand All @@ -55,13 +55,13 @@ func GetClipboardText() (string, error) {
}

// HasClipboardText reports whether the clipboard exists and contains a text string that is non-empty.
// (https://wiki.libsdl.org/SDL_HasClipboardText)
// (https://wiki.libsdl.org/SDL2/SDL_HasClipboardText)
func HasClipboardText() bool {
return C.SDL_HasClipboardText() > 0
}

// SetPrimarySelectionText puts UTF-8 text into the primary selection.
// (https://wiki.libsdl.org/SDL_SetPrimarySelectionText)
// (https://wiki.libsdl.org/SDL2/SDL_SetPrimarySelectionText)
func SetPrimarySelectionText(text string) error {
_text := C.CString(text)
defer C.free(unsafe.Pointer(_text))
Expand All @@ -72,7 +72,7 @@ func SetPrimarySelectionText(text string) error {
}

// GetPrimarySelectionText gets UTF-8 text from the primary selection.
// (https://wiki.libsdl.org/SDL_GetPrimarySelectionText)
// (https://wiki.libsdl.org/SDL2/SDL_GetPrimarySelectionText)
func GetPrimarySelectionText() (string, error) {
text := C.SDL_GetPrimarySelectionText()
if text == nil {
Expand All @@ -84,7 +84,7 @@ func GetPrimarySelectionText() (string, error) {
}

// HasPrimarySelectionText queries whether the primary selection exists and contains a non-empty text string.
// (https://wiki.libsdl.org/SDL_HasPrimarySelectionText)
// (https://wiki.libsdl.org/SDL2/SDL_HasPrimarySelectionText)
func HasPrimarySelectionText() bool {
return C.SDL_HasPrimarySelectionText() == C.SDL_TRUE
}
42 changes: 21 additions & 21 deletions sdl/cpuinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,127 +147,127 @@ import "unsafe"
const CACHELINE_SIZE = C.SDL_CACHELINE_SIZE

// GetCPUCount returns the number of CPU cores available.
// (https://wiki.libsdl.org/SDL_GetCPUCount)
// (https://wiki.libsdl.org/SDL2/SDL_GetCPUCount)
func GetCPUCount() int {
return int(C.SDL_GetCPUCount())
}

// GetCPUCacheLineSize returns the L1 cache line size of the CPU.
// (https://wiki.libsdl.org/SDL_GetCPUCacheLineSize)
// (https://wiki.libsdl.org/SDL2/SDL_GetCPUCacheLineSize)
func GetCPUCacheLineSize() int {
return int(C.SDL_GetCPUCacheLineSize())
}

// HasRDTSC reports whether the CPU has the RDTSC instruction.
// (https://wiki.libsdl.org/SDL_HasRDTSC)
// (https://wiki.libsdl.org/SDL2/SDL_HasRDTSC)
func HasRDTSC() bool {
return C.SDL_HasRDTSC() > 0
}

// HasAltiVec reports whether the CPU has AltiVec features.
// (https://wiki.libsdl.org/SDL_HasAltiVec)
// (https://wiki.libsdl.org/SDL2/SDL_HasAltiVec)
func HasAltiVec() bool {
return C.SDL_HasAltiVec() > 0
}

// HasMMX reports whether the CPU has MMX features.
// (https://wiki.libsdl.org/SDL_HasMMX)
// (https://wiki.libsdl.org/SDL2/SDL_HasMMX)
func HasMMX() bool {
return C.SDL_HasMMX() > 0
}

// Has3DNow reports whether the CPU has 3DNow! features.
// (https://wiki.libsdl.org/SDL_Has3DNow)
// (https://wiki.libsdl.org/SDL2/SDL_Has3DNow)
func Has3DNow() bool {
return C.SDL_Has3DNow() > 0
}

// HasSSE reports whether the CPU has SSE features.
// (https://wiki.libsdl.org/SDL_HasSSE)
// (https://wiki.libsdl.org/SDL2/SDL_HasSSE)
func HasSSE() bool {
return C.SDL_HasSSE() > 0
}

// HasSSE2 reports whether the CPU has SSE2 features.
// (https://wiki.libsdl.org/SDL_HasSSE2)
// (https://wiki.libsdl.org/SDL2/SDL_HasSSE2)
func HasSSE2() bool {
return C.SDL_HasSSE2() > 0
}

// HasSSE3 reports whether the CPU has SSE3 features.
// (https://wiki.libsdl.org/SDL_HasSSE3)
// (https://wiki.libsdl.org/SDL2/SDL_HasSSE3)
func HasSSE3() bool {
return C.SDL_HasSSE3() > 0
}

// HasSSE41 reports whether the CPU has SSE4.1 features.
// (https://wiki.libsdl.org/SDL_HasSSE41)
// (https://wiki.libsdl.org/SDL2/SDL_HasSSE41)
func HasSSE41() bool {
return C.SDL_HasSSE41() > 0
}

// HasSSE42 reports whether the CPU has SSE4.2 features.
// (https://wiki.libsdl.org/SDL_HasSSE42)
// (https://wiki.libsdl.org/SDL2/SDL_HasSSE42)
func HasSSE42() bool {
return C.SDL_HasSSE42() > 0
}

// GetSystemRAM returns the amount of RAM configured in the system.
// (https://wiki.libsdl.org/SDL_GetSystemRAM)
// (https://wiki.libsdl.org/SDL2/SDL_GetSystemRAM)
func GetSystemRAM() int {
return int(C.SDL_GetSystemRAM())
}

// HasAVX reports whether the CPU has AVX features.
// (https://wiki.libsdl.org/SDL_HasAVX)
// (https://wiki.libsdl.org/SDL2/SDL_HasAVX)
func HasAVX() bool {
return C.SDL_HasAVX() > 0
}

// HasAVX512F reports whether the CPU has AVX-512F (foundation) features.
// (https://wiki.libsdl.org/SDL_HasAVX512F)
// (https://wiki.libsdl.org/SDL2/SDL_HasAVX512F)
func HasAVX512F() bool {
return C.SDL_HasAVX512F() > 0
}

// HasAVX2 reports whether the CPU has AVX2 features.
// (https://wiki.libsdl.org/SDL_HasAVX2)
// (https://wiki.libsdl.org/SDL2/SDL_HasAVX2)
func HasAVX2() bool {
return C.SDL_HasAVX2() > 0
}

// HasARMSIMD reports whether the CPU has ARM SIMD (ARMv6) features.
// (https://wiki.libsdl.org/SDL_HasARMSIMD)
// (https://wiki.libsdl.org/SDL2/SDL_HasARMSIMD)
func HasARMSIMD() bool {
return C.SDL_HasARMSIMD() > 0
}

// HasNEON reports whether the CPU has NEON features.
// (https://wiki.libsdl.org/SDL_HasNEON)
// (https://wiki.libsdl.org/SDL2/SDL_HasNEON)
func HasNEON() bool {
return C.SDL_HasNEON() > 0
}

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

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

// SIMDRealloc reallocates memory obtained from SDL_SIMDAlloc.
// (https://wiki.libsdl.org/SDL_SIMDRealloc)
// (https://wiki.libsdl.org/SDL2/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.
// (https://wiki.libsdl.org/SDL_SIMDFree)
// (https://wiki.libsdl.org/SDL2/SDL_SIMDFree)
func SIMDFree(p unsafe.Pointer) {
C.SDL_SIMDFree(p)
}
8 changes: 4 additions & 4 deletions sdl/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (ec ErrorCode) c() C.SDL_errorcode {
}

// GetError returns the last error that occurred, or an empty string if there hasn't been an error message set since the last call to ClearError().
// (https://wiki.libsdl.org/SDL_GetError)
// (https://wiki.libsdl.org/SDL2/SDL_GetError)
func GetError() error {
if err := C.SDL_GetError(); err != nil {
gostr := C.GoString(err)
Expand All @@ -62,7 +62,7 @@ func GetError() error {
}

// GetErrorMsg returns the last error message that was set for the current thread.
// (https://wiki.libsdl.org/SDL_GetErrorMsg)
// (https://wiki.libsdl.org/SDL2/SDL_GetErrorMsg)
func GetErrorMsg(maxlen int) error {
_buf := C.SDL_malloc(C.size_t(maxlen))
if err := C.SDL_GetErrorMsg((*C.char)(_buf), C.int(maxlen)); err != nil {
Expand All @@ -76,7 +76,7 @@ func GetErrorMsg(maxlen int) error {
}

// SetError set the SDL error message.
// (https://wiki.libsdl.org/SDL_SetError)
// (https://wiki.libsdl.org/SDL2/SDL_SetError)
func SetError(err error) {
if err != nil {
_err := C.CString(err.Error())
Expand All @@ -88,7 +88,7 @@ func SetError(err error) {
}

// ClearError clears any previous error message.
// (https://wiki.libsdl.org/SDL_ClearError)
// (https://wiki.libsdl.org/SDL2/SDL_ClearError)
func ClearError() {
C.SDL_ClearError()
}
Expand Down
Loading

0 comments on commit d33fe82

Please sign in to comment.