From d33fe82dbaa64052967f0f021e39cfb80c031d70 Mon Sep 17 00:00:00 2001 From: Lilis Iskandar Date: Fri, 14 Feb 2025 11:16:13 +0800 Subject: [PATCH] sdl: Update documentation links to point to SDL2 specifically as they are now being redirected to SDL3 Signed-off-by: Lilis Iskandar --- sdl/audio.go | 118 ++++++++++++------------ sdl/blendmode.go | 8 +- sdl/clipboard.go | 12 +-- sdl/cpuinfo.go | 42 ++++----- sdl/error.go | 8 +- sdl/events.go | 124 ++++++++++++------------- sdl/filesystem.go | 4 +- sdl/gamecontroller.go | 110 +++++++++++----------- sdl/gesture.go | 8 +- sdl/haptic.go | 80 ++++++++-------- sdl/hidapi.go | 38 ++++---- sdl/hints.go | 18 ++-- sdl/joystick.go | 98 ++++++++++---------- sdl/keyboard.go | 38 ++++---- sdl/keycode.go | 4 +- sdl/loadso.go | 6 +- sdl/log.go | 32 +++---- sdl/metal.go | 8 +- sdl/misc.go | 2 +- sdl/mouse.go | 36 ++++---- sdl/mutex.go | 36 ++++---- sdl/pixels.go | 40 ++++---- sdl/power.go | 4 +- sdl/rect.go | 42 ++++----- sdl/render.go | 174 +++++++++++++++++------------------ sdl/rwops.go | 62 ++++++------- sdl/scancode.go | 2 +- sdl/sdl.go | 14 +-- sdl/sensor.go | 34 +++---- sdl/shape.go | 8 +- sdl/surface.go | 90 +++++++++--------- sdl/sysrender.go | 4 +- sdl/system.go | 2 +- sdl/system_android.go | 18 ++-- sdl/system_linux.go | 4 +- sdl/system_windows.go | 4 +- sdl/syswm.go | 8 +- sdl/thread.go | 2 +- sdl/timer.go | 10 +- sdl/touch.go | 10 +- sdl/version.go | 14 +-- sdl/video.go | 208 +++++++++++++++++++++--------------------- sdl/vulkan.go | 12 +-- 43 files changed, 798 insertions(+), 798 deletions(-) diff --git a/sdl/audio.go b/sdl/audio.go index b7bb2a77..0d053653 100644 --- a/sdl/audio.go +++ b/sdl/audio.go @@ -143,7 +143,7 @@ import ( ) // Audio format masks. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) const ( AUDIO_MASK_BITSIZE AudioFormat = C.SDL_AUDIO_MASK_BITSIZE // (0xFF) AUDIO_MASK_DATATYPE AudioFormat = C.SDL_AUDIO_MASK_DATATYPE // (1<<8) @@ -152,7 +152,7 @@ const ( ) // Audio format values. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) const ( AUDIO_S8 AudioFormat = C.AUDIO_S8 // signed 8-bit samples AUDIO_U8 AudioFormat = C.AUDIO_U8 // unsigned 8-bit samples @@ -178,7 +178,7 @@ const ( ) // AllowedChanges flags specify how SDL should behave when a device cannot offer a specific feature. If the application requests a feature that the hardware doesn't offer, SDL will always try to get the closest equivalent. Used in OpenAudioDevice(). -// (https://wiki.libsdl.org/SDL_OpenAudioDevice) +// (https://wiki.libsdl.org/SDL2/SDL_OpenAudioDevice) type AudioDeviceAllowFlags int const ( @@ -189,7 +189,7 @@ const ( ) // An enumeration of audio device states used in GetAudioDeviceStatus() and GetAudioStatus(). -// (https://wiki.libsdl.org/SDL_AudioStatus) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStatus) const ( AUDIO_STOPPED AudioStatus = C.SDL_AUDIO_STOPPED // audio device is stopped AUDIO_PLAYING AudioStatus = C.SDL_AUDIO_PLAYING // audio device is playing @@ -197,32 +197,32 @@ const ( ) // MIX_MAXVOLUME is the full audio volume value used in MixAudioFormat() and AudioFormat(). -// (https://wiki.libsdl.org/SDL_MixAudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_MixAudioFormat) const MIX_MAXVOLUME = C.SDL_MIX_MAXVOLUME // full audio volume // AudioFormat is an enumeration of audio formats. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) type AudioFormat uint16 // AudioCallback is a function to call when the audio device needs more data.` -// (https://wiki.libsdl.org/SDL_AudioSpec) +// (https://wiki.libsdl.org/SDL2/SDL_AudioSpec) type AudioCallback C.SDL_AudioCallback // AudioFilter is the filter list used in AudioCVT() (internal use) -// (https://wiki.libsdl.org/SDL_AudioCVT) +// (https://wiki.libsdl.org/SDL2/SDL_AudioCVT) type AudioFilter C.SDL_AudioFilter // AudioDeviceID is ID of an audio device previously opened with OpenAudioDevice(). -// (https://wiki.libsdl.org/SDL_OpenAudioDevice) +// (https://wiki.libsdl.org/SDL2/SDL_OpenAudioDevice) type AudioDeviceID uint32 // AudioStatus is an enumeration of audio device states. -// (https://wiki.libsdl.org/SDL_AudioStatus) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStatus) type AudioStatus uint32 type cAudioStatus C.SDL_AudioStatus // AudioSpec contains the audio output format. It also contains a callback that is called when the audio device needs more data. -// (https://wiki.libsdl.org/SDL_AudioSpec) +// (https://wiki.libsdl.org/SDL2/SDL_AudioSpec) type AudioSpec struct { Freq int32 // DSP frequency (samples per second) Format AudioFormat // audio data format @@ -237,7 +237,7 @@ type AudioSpec struct { type cAudioSpec C.SDL_AudioSpec // AudioCVT contains audio data conversion information. -// (https://wiki.libsdl.org/SDL_AudioCVT) +// (https://wiki.libsdl.org/SDL2/SDL_AudioCVT) type AudioCVT struct { Needed int32 // set to 1 if conversion possible SrcFormat AudioFormat // source audio format @@ -254,7 +254,7 @@ type AudioCVT struct { type cAudioCVT C.SDL_AudioCVT // AudioStream is a new audio conversion interface. -// (https://wiki.libsdl.org/SDL_AudioStream) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStream) type AudioStream C.SDL_AudioStream func (fmt AudioFormat) c() C.SDL_AudioFormat { @@ -278,43 +278,43 @@ func (stream *AudioStream) cptr() *C.SDL_AudioStream { } // BitSize returns audio formats bit size. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) func (fmt AudioFormat) BitSize() uint8 { return uint8(fmt & AUDIO_MASK_BITSIZE) } // IsFloat reports whether audio format is float. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) func (fmt AudioFormat) IsFloat() bool { return (fmt & AUDIO_MASK_DATATYPE) > 0 } // IsBigEndian reports whether audio format is big-endian. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) func (fmt AudioFormat) IsBigEndian() bool { return (fmt & AUDIO_MASK_ENDIAN) > 0 } // IsSigned reports whether audio format is signed. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) func (fmt AudioFormat) IsSigned() bool { return (fmt & AUDIO_MASK_SIGNED) > 0 } // IsInt reports whether audio format is integer. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) func (fmt AudioFormat) IsInt() bool { return !fmt.IsFloat() } // IsLittleEndian reports whether audio format is little-endian. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) func (fmt AudioFormat) IsLittleEndian() bool { return !fmt.IsBigEndian() } // IsUnsigned reports whether audio format is unsigned. -// (https://wiki.libsdl.org/SDL_AudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AudioFormat) func (fmt AudioFormat) IsUnsigned() bool { return !fmt.IsSigned() } @@ -341,19 +341,19 @@ func (cvt AudioCVT) BufAsSlice() []byte { } // GetNumAudioDrivers returns the number of built-in audio drivers. -// (https://wiki.libsdl.org/SDL_GetNumAudioDrivers) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumAudioDrivers) func GetNumAudioDrivers() int { return int(C.SDL_GetNumAudioDrivers()) } // GetAudioDriver returns the name of a built in audio driver. -// (https://wiki.libsdl.org/SDL_GetAudioDriver) +// (https://wiki.libsdl.org/SDL2/SDL_GetAudioDriver) func GetAudioDriver(index int) string { return string(C.GoString(C.SDL_GetAudioDriver(C.int(index)))) } // AudioInit initializes a particular audio driver. -// (https://wiki.libsdl.org/SDL_AudioInit) +// (https://wiki.libsdl.org/SDL2/SDL_AudioInit) func AudioInit(driverName string) error { _driverName := C.CString(driverName) defer C.free(unsafe.Pointer(_driverName)) @@ -364,19 +364,19 @@ func AudioInit(driverName string) error { } // AudioQuit shuts down audio if you initialized it with AudioInit(). -// (https://wiki.libsdl.org/SDL_AudioQuit) +// (https://wiki.libsdl.org/SDL2/SDL_AudioQuit) func AudioQuit() { C.SDL_AudioQuit() } // GetCurrentAudioDriver returns the name of the current audio driver. -// (https://wiki.libsdl.org/SDL_GetCurrentAudioDriver) +// (https://wiki.libsdl.org/SDL2/SDL_GetCurrentAudioDriver) func GetCurrentAudioDriver() string { return string(C.GoString(C.SDL_GetCurrentAudioDriver())) } // OpenAudio opens the audio device. New programs might want to use OpenAudioDevice() instead. -// (https://wiki.libsdl.org/SDL_OpenAudio) +// (https://wiki.libsdl.org/SDL2/SDL_OpenAudio) func OpenAudio(desired, obtained *AudioSpec) error { if C.SDL_OpenAudio(desired.cptr(), obtained.cptr()) != 0 { return GetError() @@ -385,19 +385,19 @@ func OpenAudio(desired, obtained *AudioSpec) error { } // GetNumAudioDevices returns the number of built-in audio devices. -// (https://wiki.libsdl.org/SDL_GetNumAudioDevices) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumAudioDevices) func GetNumAudioDevices(isCapture bool) int { return int(C.SDL_GetNumAudioDevices(C.int(Btoi(isCapture)))) } // GetAudioDeviceName returns the name of a specific audio device. -// (https://wiki.libsdl.org/SDL_GetAudioDeviceName) +// (https://wiki.libsdl.org/SDL2/SDL_GetAudioDeviceName) func GetAudioDeviceName(index int, isCapture bool) string { return string(C.GoString(C.SDL_GetAudioDeviceName(C.int(index), C.int(Btoi(isCapture))))) } // OpenAudioDevice opens a specific audio device. -// (https://wiki.libsdl.org/SDL_OpenAudioDevice) +// (https://wiki.libsdl.org/SDL2/SDL_OpenAudioDevice) func OpenAudioDevice(device string, isCapture bool, desired, obtained *AudioSpec, allowedChanges AudioDeviceAllowFlags) (AudioDeviceID, error) { var _device *C.char = nil if device != "" { @@ -411,31 +411,31 @@ func OpenAudioDevice(device string, isCapture bool, desired, obtained *AudioSpec } // GetAudioStatus returns the current audio state of the audio device. New programs might want to use GetAudioDeviceStatus() instead. -// (https://wiki.libsdl.org/SDL_GetAudioStatus) +// (https://wiki.libsdl.org/SDL2/SDL_GetAudioStatus) func GetAudioStatus() AudioStatus { return (AudioStatus)(C.SDL_GetAudioStatus()) } // GetAudioDeviceStatus returns the current audio state of an audio device. -// (https://wiki.libsdl.org/SDL_GetAudioDeviceStatus) +// (https://wiki.libsdl.org/SDL2/SDL_GetAudioDeviceStatus) func GetAudioDeviceStatus(dev AudioDeviceID) AudioStatus { return (AudioStatus)(C.SDL_GetAudioDeviceStatus(dev.c())) } // PauseAudio pauses and unpauses the audio device. New programs might want to use SDL_PauseAudioDevice() instead. -// (https://wiki.libsdl.org/SDL_PauseAudio) +// (https://wiki.libsdl.org/SDL2/SDL_PauseAudio) func PauseAudio(pauseOn bool) { C.SDL_PauseAudio(C.int(Btoi(pauseOn))) } // PauseAudioDevice pauses and unpauses audio playback on a specified device. -// (https://wiki.libsdl.org/SDL_PauseAudioDevice) +// (https://wiki.libsdl.org/SDL2/SDL_PauseAudioDevice) func PauseAudioDevice(dev AudioDeviceID, pauseOn bool) { C.SDL_PauseAudioDevice(dev.c(), C.int(Btoi(pauseOn))) } // LoadWAVRW loads a WAVE from the data source, automatically freeing that source if freeSrc is true. -// (https://wiki.libsdl.org/SDL_LoadWAV_RW) +// (https://wiki.libsdl.org/SDL2/SDL_LoadWAV_RW) func LoadWAVRW(src *RWops, freeSrc bool) ([]byte, *AudioSpec) { var _audioBuf *C.Uint8 var _audioLen C.Uint32 @@ -450,7 +450,7 @@ func LoadWAVRW(src *RWops, freeSrc bool) ([]byte, *AudioSpec) { } // LoadWAV loads a WAVE from a file. -// (https://wiki.libsdl.org/SDL_LoadWAV) +// (https://wiki.libsdl.org/SDL2/SDL_LoadWAV) func LoadWAV(file string) ([]byte, *AudioSpec) { _file := C.CString(file) _rb := C.CString("rb") @@ -470,7 +470,7 @@ func LoadWAV(file string) ([]byte, *AudioSpec) { } // FreeWAV frees data previously allocated with LoadWAV() or LoadWAVRW(). -// (https://wiki.libsdl.org/SDL_FreeWAV) +// (https://wiki.libsdl.org/SDL2/SDL_FreeWAV) func FreeWAV(audioBuf []uint8) { sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&audioBuf)) _audioBuf := (*C.Uint8)(unsafe.Pointer(sliceHeader.Data)) @@ -478,7 +478,7 @@ func FreeWAV(audioBuf []uint8) { } // BuildAudioCVT initializes an AudioCVT structure for conversion. -// (https://wiki.libsdl.org/SDL_BuildAudioCVT) +// (https://wiki.libsdl.org/SDL2/SDL_BuildAudioCVT) func BuildAudioCVT(cvt *AudioCVT, srcFormat AudioFormat, srcChannels uint8, srcRate int, dstFormat AudioFormat, dstChannels uint8, dstRate int) (converted bool, err error) { switch int(C.SDL_BuildAudioCVT(cvt.cptr(), srcFormat.c(), C.Uint8(srcChannels), C.int(srcRate), dstFormat.c(), C.Uint8(dstChannels), C.int(dstRate))) { case 1: @@ -490,7 +490,7 @@ func BuildAudioCVT(cvt *AudioCVT, srcFormat AudioFormat, srcChannels uint8, srcR } // ConvertAudio converts audio data to a desired audio format. -// (https://wiki.libsdl.org/SDL_ConvertAudio) +// (https://wiki.libsdl.org/SDL2/SDL_ConvertAudio) func ConvertAudio(cvt *AudioCVT) error { _cvt := (*C.SDL_AudioCVT)(unsafe.Pointer(cvt)) if C.SDL_ConvertAudio(_cvt) != 0 { @@ -500,7 +500,7 @@ func ConvertAudio(cvt *AudioCVT) error { } // QueueAudio queues more audio on non-callback devices. -// (https://wiki.libsdl.org/SDL_QueueAudio) +// (https://wiki.libsdl.org/SDL2/SDL_QueueAudio) func QueueAudio(dev AudioDeviceID, data []byte) error { sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&data)) _data := unsafe.Pointer(sliceHeader.Data) @@ -512,7 +512,7 @@ func QueueAudio(dev AudioDeviceID, data []byte) error { } // DequeueAudio dequeues more audio on non-callback devices. Returns the number of bytes dequeued, which could be less than requested -// (https://wiki.libsdl.org/SDL_DequeueAudio) +// (https://wiki.libsdl.org/SDL2/SDL_DequeueAudio) func DequeueAudio(dev AudioDeviceID, data []byte) (n int, err error) { sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&data)) _data := unsafe.Pointer(sliceHeader.Data) @@ -524,19 +524,19 @@ func DequeueAudio(dev AudioDeviceID, data []byte) (n int, err error) { } // GetQueuedAudioSize returns the number of bytes of still-queued audio. -// (https://wiki.libsdl.org/SDL_GetQueuedAudioSize) +// (https://wiki.libsdl.org/SDL2/SDL_GetQueuedAudioSize) func GetQueuedAudioSize(dev AudioDeviceID) uint32 { return uint32(C.SDL_GetQueuedAudioSize(dev.c())) } // ClearQueuedAudio drops any queued audio data waiting to be sent to the hardware. -// (https://wiki.libsdl.org/SDL_ClearQueuedAudio) +// (https://wiki.libsdl.org/SDL2/SDL_ClearQueuedAudio) func ClearQueuedAudio(dev AudioDeviceID) { C.SDL_ClearQueuedAudio(dev.c()) } // MixAudio mixes audio data. New programs might want to use MixAudioFormat() instead. -// (https://wiki.libsdl.org/SDL_MixAudio) +// (https://wiki.libsdl.org/SDL2/SDL_MixAudio) func MixAudio(dst, src *uint8, len uint32, volume int) { _dst := (*C.Uint8)(unsafe.Pointer(dst)) _src := (*C.Uint8)(unsafe.Pointer(src)) @@ -544,7 +544,7 @@ func MixAudio(dst, src *uint8, len uint32, volume int) { } // MixAudioFormat mixes audio data in a specified format. -// (https://wiki.libsdl.org/SDL_MixAudioFormat) +// (https://wiki.libsdl.org/SDL2/SDL_MixAudioFormat) func MixAudioFormat(dst, src *uint8, format AudioFormat, len uint32, volume int) { _dst := (*C.Uint8)(unsafe.Pointer(dst)) _src := (*C.Uint8)(unsafe.Pointer(src)) @@ -552,43 +552,43 @@ func MixAudioFormat(dst, src *uint8, format AudioFormat, len uint32, volume int) } // LockAudio locks the audio device. New programs might want to use LockAudioDevice() instead. -// (https://wiki.libsdl.org/SDL_LockAudio) +// (https://wiki.libsdl.org/SDL2/SDL_LockAudio) func LockAudio() { C.SDL_LockAudio() } // LockAudioDevice locks out the audio callback function for a specified device. -// (https://wiki.libsdl.org/SDL_LockAudioDevice) +// (https://wiki.libsdl.org/SDL2/SDL_LockAudioDevice) func LockAudioDevice(dev AudioDeviceID) { C.SDL_LockAudioDevice(dev.c()) } // UnlockAudio unlocks the audio device. New programs might want to use UnlockAudioDevice() instead. -// (https://wiki.libsdl.org/SDL_UnlockAudio) +// (https://wiki.libsdl.org/SDL2/SDL_UnlockAudio) func UnlockAudio() { C.SDL_UnlockAudio() } // UnlockAudioDevice unlocks the audio callback function for a specified device. -// (https://wiki.libsdl.org/SDL_UnlockAudioDevice) +// (https://wiki.libsdl.org/SDL2/SDL_UnlockAudioDevice) func UnlockAudioDevice(dev AudioDeviceID) { C.SDL_UnlockAudioDevice(dev.c()) } // CloseAudio closes the audio device. New programs might want to use CloseAudioDevice() instead. -// (https://wiki.libsdl.org/SDL_CloseAudio) +// (https://wiki.libsdl.org/SDL2/SDL_CloseAudio) func CloseAudio() { C.SDL_CloseAudio() } // CloseAudioDevice shuts down audio processing and closes the audio device. -// (https://wiki.libsdl.org/SDL_CloseAudioDevice) +// (https://wiki.libsdl.org/SDL2/SDL_CloseAudioDevice) func CloseAudioDevice(dev AudioDeviceID) { C.SDL_CloseAudioDevice(dev.c()) } // NewAudioStream creates a new audio stream -// (https://wiki.libsdl.org/SDL_NewAudioStream) +// (https://wiki.libsdl.org/SDL2/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) @@ -605,7 +605,7 @@ func NewAudioStream(srcFormat AudioFormat, srcChannels uint8, srcRate int, dstFo } // Put adds data to be converted/resampled to the stream -// (https://wiki.libsdl.org/SDL_AudioStreamPut) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStreamPut) func (stream *AudioStream) Put(buf []byte) (err error) { sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) _buf := unsafe.Pointer(sliceHeader.Data) @@ -616,7 +616,7 @@ func (stream *AudioStream) Put(buf []byte) (err error) { } // Get gets converted/resampled data from the stream. Returns the number of bytes read from the stream. -// (https://wiki.libsdl.org/SDL_AudioStreamGet) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStreamGet) func (stream *AudioStream) Get(buf []byte) (n int, err error) { sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) _buf := unsafe.Pointer(sliceHeader.Data) @@ -629,7 +629,7 @@ func (stream *AudioStream) Get(buf []byte) (n int, err error) { } // Available gets the number of converted/resampled bytes available -// (https://wiki.libsdl.org/SDL_AudioStreamAvailable) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStreamAvailable) func (stream *AudioStream) Available() (n int) { n = int(C.SDL_AudioStreamAvailable(stream.cptr())) return @@ -637,7 +637,7 @@ 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. -// (https://wiki.libsdl.org/SDL_AudioStreamFlush) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStreamFlush) func (stream *AudioStream) Flush() (err error) { ret := int(C.SDL_AudioStreamFlush(stream.cptr())) err = errorFromInt(ret) @@ -645,19 +645,19 @@ func (stream *AudioStream) Flush() (err error) { } // Clear clears any pending data in the stream without converting it -// (https://wiki.libsdl.org/SDL_AudioStreamClear) +// (https://wiki.libsdl.org/SDL2/SDL_AudioStreamClear) func (stream *AudioStream) Clear() { C.SDL_AudioStreamClear(stream.cptr()) } // Free frees the audio stream -// TODO: (https://wiki.libsdl.org/SDL_AudioStreamFree) +// TODO: (https://wiki.libsdl.org/SDL2/SDL_AudioStreamFree) func (stream *AudioStream) Free() { C.SDL_FreeAudioStream(stream.cptr()) } // GetAudioDeviceSpec returns the preferred audio format of a specific audio device. -// (https://wiki.libsdl.org/SDL_GetAudioDeviceSpec) +// (https://wiki.libsdl.org/SDL2/SDL_GetAudioDeviceSpec) func GetAudioDeviceSpec(index int, isCapture bool) (spec *AudioSpec, err error) { spec = &AudioSpec{} err = errorFromInt(int(C.SDL_GetAudioDeviceSpec(C.int(index), C.int(Btoi(isCapture)), spec.cptr()))) @@ -665,7 +665,7 @@ func GetAudioDeviceSpec(index int, isCapture bool) (spec *AudioSpec, err error) } // GetDefaultAudioInfo returns the name and preferred format of the default audio device. -// (https://wiki.libsdl.org/SDL_GetDefaultAudioInfo) +// (https://wiki.libsdl.org/SDL2/SDL_GetDefaultAudioInfo) func GetDefaultAudioInfo(isCapture bool) (name string, spec *AudioSpec, err error) { var _name *C.char spec = &AudioSpec{} diff --git a/sdl/blendmode.go b/sdl/blendmode.go index 5c825129..4e6a9bfb 100644 --- a/sdl/blendmode.go +++ b/sdl/blendmode.go @@ -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 ( @@ -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 ( @@ -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 ( @@ -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) diff --git a/sdl/clipboard.go b/sdl/clipboard.go index 08a7a799..966b8c06 100644 --- a/sdl/clipboard.go +++ b/sdl/clipboard.go @@ -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)) @@ -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 { @@ -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)) @@ -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 { @@ -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 } diff --git a/sdl/cpuinfo.go b/sdl/cpuinfo.go index 1cce1552..60793bd3 100644 --- a/sdl/cpuinfo.go +++ b/sdl/cpuinfo.go @@ -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) } diff --git a/sdl/error.go b/sdl/error.go index 099055f2..b58e475d 100644 --- a/sdl/error.go +++ b/sdl/error.go @@ -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) @@ -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 { @@ -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()) @@ -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() } diff --git a/sdl/events.go b/sdl/events.go index 81aacef0..eb458ef6 100644 --- a/sdl/events.go +++ b/sdl/events.go @@ -226,7 +226,7 @@ var ( ) // Enumeration of the types of events that can be delivered. -// (https://wiki.libsdl.org/SDL_EventType) +// (https://wiki.libsdl.org/SDL2/SDL_EventType) type EventType uint32 const ( @@ -322,7 +322,7 @@ const ( ) // Actions for PeepEvents(). -// (https://wiki.libsdl.org/SDL_PeepEvents) +// (https://wiki.libsdl.org/SDL2/SDL_PeepEvents) type EventAction C.SDL_eventaction const ( @@ -332,7 +332,7 @@ const ( ) // Toggles for different event state functions. -// (https://wiki.libsdl.org/SDL_EventState) +// (https://wiki.libsdl.org/SDL2/SDL_EventState) type EventStateConstant int const ( @@ -343,21 +343,21 @@ const ( ) // Event is a union of all event structures used in SDL. -// (https://wiki.libsdl.org/SDL_Event) +// (https://wiki.libsdl.org/SDL2/SDL_Event) type Event interface { GetType() EventType // GetType returns the event type GetTimestamp() uint32 // GetTimestamp returns the timestamp of the event } // CEvent is a union of all event structures used in SDL. -// (https://wiki.libsdl.org/SDL_Event) +// (https://wiki.libsdl.org/SDL2/SDL_Event) type CEvent struct { Type EventType _ [52]byte // padding } // CommonEvent contains common event data. -// (https://wiki.libsdl.org/SDL_Event) +// (https://wiki.libsdl.org/SDL2/SDL_Event) type CommonEvent struct { Type EventType // the event type Timestamp uint32 // timestamp of the event @@ -376,12 +376,12 @@ func (e CommonEvent) GetTimestamp() uint32 { } // DisplayEvent contains common event data. -// (https://wiki.libsdl.org/SDL_Event) +// (https://wiki.libsdl.org/SDL2/SDL_Event) type DisplayEvent struct { Type EventType // the event type Timestamp uint32 // timestamp of the event Display uint32 // the associated display index - Event uint8 // event subtype for display events (https://wiki.libsdl.org/SDL_DisplayEventID) + Event uint8 // event subtype for display events (https://wiki.libsdl.org/SDL2/SDL_DisplayEventID) Data1 int32 // event dependent data } @@ -398,12 +398,12 @@ func (e DisplayEvent) GetTimestamp() uint32 { } // WindowEvent contains window state change event data. -// (https://wiki.libsdl.org/SDL_WindowEvent) +// (https://wiki.libsdl.org/SDL2/SDL_WindowEvent) type WindowEvent struct { Type EventType // WINDOWEVENT Timestamp uint32 // timestamp of the event WindowID uint32 // the associated window - Event WindowEventID // (https://wiki.libsdl.org/SDL_WindowEventID) + Event WindowEventID // (https://wiki.libsdl.org/SDL2/SDL_WindowEventID) Data1 int32 // event dependent data Data2 int32 // event dependent data } @@ -420,7 +420,7 @@ func (e WindowEvent) GetTimestamp() uint32 { } // KeyboardEvent contains keyboard key down event information. -// (https://wiki.libsdl.org/SDL_KeyboardEvent) +// (https://wiki.libsdl.org/SDL2/SDL_KeyboardEvent) type KeyboardEvent struct { Type EventType // KEYDOWN, KEYUP Timestamp uint32 // timestamp of the event @@ -442,7 +442,7 @@ func (e KeyboardEvent) GetTimestamp() uint32 { } // TextEditingEvent contains keyboard text editing event information. -// (https://wiki.libsdl.org/SDL_TextEditingEvent) +// (https://wiki.libsdl.org/SDL2/SDL_TextEditingEvent) type TextEditingEvent struct { Type EventType // TEXTEDITING Timestamp uint32 // timestamp of the event @@ -469,7 +469,7 @@ func (e TextEditingEvent) GetText() string { } // TextInputEvent contains keyboard text input event information. -// (https://wiki.libsdl.org/SDL_TextInputEvent) +// (https://wiki.libsdl.org/SDL2/SDL_TextInputEvent) type TextInputEvent struct { Type EventType // TEXTINPUT Timestamp uint32 // timestamp of the event @@ -494,7 +494,7 @@ func (e TextInputEvent) GetText() string { } // MouseMotionEvent contains mouse motion event information. -// (https://wiki.libsdl.org/SDL_MouseMotionEvent) +// (https://wiki.libsdl.org/SDL2/SDL_MouseMotionEvent) type MouseMotionEvent struct { Type EventType // MOUSEMOTION Timestamp uint32 // timestamp of the event @@ -519,7 +519,7 @@ func (e MouseMotionEvent) GetTimestamp() uint32 { } // MouseButtonEvent contains mouse button event information. -// (https://wiki.libsdl.org/SDL_MouseButtonEvent) +// (https://wiki.libsdl.org/SDL2/SDL_MouseButtonEvent) type MouseButtonEvent struct { Type EventType // MOUSEBUTTONDOWN, MOUSEBUTTONUP Timestamp uint32 // timestamp of the event @@ -544,7 +544,7 @@ func (e MouseButtonEvent) GetTimestamp() uint32 { } // MouseWheelEvent contains mouse wheel event information. -// (https://wiki.libsdl.org/SDL_MouseWheelEvent) +// (https://wiki.libsdl.org/SDL2/SDL_MouseWheelEvent) type MouseWheelEvent struct { Type EventType // MOUSEWHEEL Timestamp uint32 // timestamp of the event @@ -571,7 +571,7 @@ func (e MouseWheelEvent) GetTimestamp() uint32 { } // JoyAxisEvent contains joystick axis motion event information. -// (https://wiki.libsdl.org/SDL_JoyAxisEvent) +// (https://wiki.libsdl.org/SDL2/SDL_JoyAxisEvent) type JoyAxisEvent struct { Type EventType // JOYAXISMOTION Timestamp uint32 // timestamp of the event @@ -592,7 +592,7 @@ func (e JoyAxisEvent) GetTimestamp() uint32 { } // JoyBallEvent contains joystick trackball motion event information. -// (https://wiki.libsdl.org/SDL_JoyBallEvent) +// (https://wiki.libsdl.org/SDL2/SDL_JoyBallEvent) type JoyBallEvent struct { Type EventType // JOYBALLMOTION Timestamp uint32 // timestamp of the event @@ -614,7 +614,7 @@ func (e JoyBallEvent) GetTimestamp() uint32 { } // JoyHatEvent contains joystick hat position change event information. -// (https://wiki.libsdl.org/SDL_JoyHatEvent) +// (https://wiki.libsdl.org/SDL2/SDL_JoyHatEvent) type JoyHatEvent struct { Type EventType // JOYHATMOTION Timestamp uint32 // timestamp of the event @@ -635,7 +635,7 @@ func (e JoyHatEvent) GetTimestamp() uint32 { } // JoyButtonEvent contains joystick button event information. -// (https://wiki.libsdl.org/SDL_JoyButtonEvent) +// (https://wiki.libsdl.org/SDL2/SDL_JoyButtonEvent) type JoyButtonEvent struct { Type EventType // JOYBUTTONDOWN, JOYBUTTONUP Timestamp uint32 // timestamp of the event @@ -656,7 +656,7 @@ func (e JoyButtonEvent) GetTimestamp() uint32 { } // JoyDeviceAddedEvent contains joystick device event information. -// (https://wiki.libsdl.org/SDL_JoyDeviceEvent) +// (https://wiki.libsdl.org/SDL2/SDL_JoyDeviceEvent) type JoyDeviceAddedEvent struct { Type EventType // JOYDEVICEADDED Timestamp uint32 // the timestamp of the event @@ -676,7 +676,7 @@ func (e JoyDeviceAddedEvent) GetTimestamp() uint32 { } // JoyDeviceRemovedEvent contains joystick device event information. -// (https://wiki.libsdl.org/SDL_JoyDeviceEvent) +// (https://wiki.libsdl.org/SDL2/SDL_JoyDeviceEvent) type JoyDeviceRemovedEvent struct { Type EventType // JOYDEVICEREMOVED Timestamp uint32 // the timestamp of the event @@ -694,7 +694,7 @@ func (e JoyDeviceRemovedEvent) GetTimestamp() uint32 { } // JoyBatteryEvent contains joystick button event information. -// (https://wiki.libsdl.org/SDL_JoyBatteryEvent) +// (https://wiki.libsdl.org/SDL2/SDL_JoyBatteryEvent) type JoyBatteryEvent struct { Type EventType // JOYBATTERYUPDATED Timestamp uint32 // timestamp of the event @@ -714,12 +714,12 @@ func (e JoyBatteryEvent) GetTimestamp() uint32 { } // ControllerAxisEvent contains game controller axis motion event information. -// (https://wiki.libsdl.org/SDL_ControllerAxisEvent) +// (https://wiki.libsdl.org/SDL2/SDL_ControllerAxisEvent) type ControllerAxisEvent struct { Type EventType // CONTROLLERAXISMOTION Timestamp uint32 // the timestamp of the event Which JoystickID // the joystick instance id - Axis GameControllerAxis // the controller axis (https://wiki.libsdl.org/SDL_GameControllerAxis) + Axis GameControllerAxis // the controller axis (https://wiki.libsdl.org/SDL2/SDL_GameControllerAxis) Value int16 // the axis value (range: -32768 to 32767) } type cControllerAxisEvent C.SDL_ControllerAxisEvent @@ -735,12 +735,12 @@ func (e ControllerAxisEvent) GetTimestamp() uint32 { } // ControllerButtonEvent contains game controller button event information. -// (https://wiki.libsdl.org/SDL_ControllerButtonEvent) +// (https://wiki.libsdl.org/SDL2/SDL_ControllerButtonEvent) type ControllerButtonEvent struct { Type EventType // CONTROLLERBUTTONDOWN, CONTROLLERBUTTONUP Timestamp uint32 // the timestamp of the event Which JoystickID // the joystick instance id - Button GameControllerButton // the controller button (https://wiki.libsdl.org/SDL_GameControllerButton) + Button GameControllerButton // the controller button (https://wiki.libsdl.org/SDL2/SDL_GameControllerButton) State ButtonState // PRESSED, RELEASED } type cControllerButtonEvent C.SDL_ControllerButtonEvent @@ -756,7 +756,7 @@ func (e ControllerButtonEvent) GetTimestamp() uint32 { } // ControllerDeviceEvent contains controller device event information. -// (https://wiki.libsdl.org/SDL_ControllerDeviceEvent) +// (https://wiki.libsdl.org/SDL2/SDL_ControllerDeviceEvent) type ControllerDeviceEvent struct { Type EventType // CONTROLLERDEVICEADDED, CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED Timestamp uint32 // the timestamp of the event @@ -775,7 +775,7 @@ func (e ControllerDeviceEvent) GetTimestamp() uint32 { } // ControllerSensorEvent contains data from sensors such as accelerometer and gyroscope -// (https://wiki.libsdl.org/SDL_ControllerSensorEvent) +// (https://wiki.libsdl.org/SDL2/SDL_ControllerSensorEvent) type ControllerSensorEvent struct { Type EventType // SDL_CONTROLLERSENSORUPDATE Timestamp uint32 // In milliseconds, populated using SDL_GetTicks() @@ -797,7 +797,7 @@ func (e ControllerSensorEvent) GetTimestamp() uint32 { } // AudioDeviceEvent contains audio device event information. -// (https://wiki.libsdl.org/SDL_AudioDeviceEvent) +// (https://wiki.libsdl.org/SDL2/SDL_AudioDeviceEvent) type AudioDeviceEvent struct { Type EventType // AUDIODEVICEADDED, AUDIODEVICEREMOVED Timestamp uint32 // the timestamp of the event @@ -817,7 +817,7 @@ func (e AudioDeviceEvent) GetTimestamp() uint32 { } // TouchFingerEvent contains finger touch event information. -// (https://wiki.libsdl.org/SDL_TouchFingerEvent) +// (https://wiki.libsdl.org/SDL2/SDL_TouchFingerEvent) type TouchFingerEvent struct { Type EventType // FINGERMOTION, FINGERDOWN, FINGERUP Timestamp uint32 // timestamp of the event @@ -843,7 +843,7 @@ func (e TouchFingerEvent) GetTimestamp() uint32 { } // MultiGestureEvent contains multiple finger gesture event information. -// (https://wiki.libsdl.org/SDL_MultiGestureEvent) +// (https://wiki.libsdl.org/SDL2/SDL_MultiGestureEvent) type MultiGestureEvent struct { Type EventType // MULTIGESTURE Timestamp uint32 // timestamp of the event @@ -867,7 +867,7 @@ func (e MultiGestureEvent) GetTimestamp() uint32 { } // DollarGestureEvent contains complex gesture event information. -// (https://wiki.libsdl.org/SDL_DollarGestureEvent) +// (https://wiki.libsdl.org/SDL2/SDL_DollarGestureEvent) type DollarGestureEvent struct { Type EventType // DOLLARGESTURE, DOLLARRECORD Timestamp uint32 // timestamp of the event @@ -891,7 +891,7 @@ func (e DollarGestureEvent) GetTimestamp() uint32 { } // DropEvent contains an event used to request a file open by the system. -// (https://wiki.libsdl.org/SDL_DropEvent) +// (https://wiki.libsdl.org/SDL2/SDL_DropEvent) type DropEvent struct { Type EventType // DROPFILE, DROPTEXT, DROPBEGIN, DROPCOMPLETE Timestamp uint32 // timestamp of the event @@ -911,7 +911,7 @@ func (e DropEvent) GetTimestamp() uint32 { } // SensorEvent contains data from sensors such as accelerometer and gyroscope -// (https://wiki.libsdl.org/SDL_SensorEvent) +// (https://wiki.libsdl.org/SDL2/SDL_SensorEvent) type SensorEvent struct { Type EventType // SDL_SENSORUPDATE Timestamp uint32 // In milliseconds, populated using SDL_GetTicks() @@ -932,7 +932,7 @@ func (e SensorEvent) GetTimestamp() uint32 { } // RenderEvent contains render event information. -// (https://wiki.libsdl.org/SDL_EventType) +// (https://wiki.libsdl.org/SDL2/SDL_EventType) type RenderEvent struct { Type EventType // the event type Timestamp uint32 // timestamp of the event @@ -949,7 +949,7 @@ func (e RenderEvent) GetTimestamp() uint32 { } // QuitEvent contains the "quit requested" event. -// (https://wiki.libsdl.org/SDL_QuitEvent) +// (https://wiki.libsdl.org/SDL2/SDL_QuitEvent) type QuitEvent struct { Type EventType // QUIT Timestamp uint32 // timestamp of the event @@ -982,7 +982,7 @@ func (e OSEvent) GetTimestamp() uint32 { } // ClipboardEvent contains clipboard event information. -// (https://wiki.libsdl.org/SDL_EventType) +// (https://wiki.libsdl.org/SDL2/SDL_EventType) type ClipboardEvent struct { Type EventType // CLIPBOARDUPDATE Timestamp uint32 // timestamp of the event @@ -999,7 +999,7 @@ func (e ClipboardEvent) GetTimestamp() uint32 { } // UserEvent contains an application-defined event type. -// (https://wiki.libsdl.org/SDL_UserEvent) +// (https://wiki.libsdl.org/SDL2/SDL_UserEvent) type UserEvent struct { Type EventType // value obtained from RegisterEvents() Timestamp uint32 // timestamp of the event @@ -1021,7 +1021,7 @@ func (e UserEvent) GetTimestamp() uint32 { } // SysWMEvent contains a video driver dependent system event. -// (https://wiki.libsdl.org/SDL_SysWMEvent) +// (https://wiki.libsdl.org/SDL2/SDL_SysWMEvent) type SysWMEvent struct { Type EventType // SYSWMEVENT Timestamp uint32 // timestamp of the event @@ -1040,7 +1040,7 @@ func (e SysWMEvent) GetTimestamp() uint32 { } // EventFilter is the function to call when an event happens. -// (https://wiki.libsdl.org/SDL_SetEventFilter) +// (https://wiki.libsdl.org/SDL2/SDL_SetEventFilter) type EventFilter interface { FilterEvent(e Event, userdata interface{}) bool } @@ -1061,13 +1061,13 @@ func (action EventAction) c() C.SDL_eventaction { } // PumpEvents pumps the event loop, gathering events from the input devices. -// (https://wiki.libsdl.org/SDL_PumpEvents) +// (https://wiki.libsdl.org/SDL2/SDL_PumpEvents) func PumpEvents() { C.SDL_PumpEvents() } // PeepEvents checks the event queue for messages and optionally return them. -// (https://wiki.libsdl.org/SDL_PeepEvents) +// (https://wiki.libsdl.org/SDL2/SDL_PeepEvents) func PeepEvents(events []Event, action EventAction, minType, maxType EventType) (storedEvents int, err error) { if events == nil { return 0, nil @@ -1098,31 +1098,31 @@ func PeepEvents(events []Event, action EventAction, minType, maxType EventType) } // HasEvent checks for the existence of certain event types in the event queue. -// (https://wiki.libsdl.org/SDL_HasEvent) +// (https://wiki.libsdl.org/SDL2/SDL_HasEvent) func HasEvent(type_ EventType) bool { return C.SDL_HasEvent(C.Uint32(type_)) != 0 } // HasEvents checks for the existence of a range of event types in the event queue. -// (https://wiki.libsdl.org/SDL_HasEvents) +// (https://wiki.libsdl.org/SDL2/SDL_HasEvents) func HasEvents(minType, maxType EventType) bool { return C.SDL_HasEvents(C.Uint32(minType), C.Uint32(maxType)) != 0 } // FlushEvent clears events from the event queue. -// (https://wiki.libsdl.org/SDL_FlushEvent) +// (https://wiki.libsdl.org/SDL2/SDL_FlushEvent) func FlushEvent(type_ uint32) { C.SDL_FlushEvent(C.Uint32(type_)) } // FlushEvents clears events from the event queue. -// (https://wiki.libsdl.org/SDL_FlushEvents) +// (https://wiki.libsdl.org/SDL2/SDL_FlushEvents) func FlushEvents(minType, maxType EventType) { C.SDL_FlushEvents(C.Uint32(minType), C.Uint32(maxType)) } // PollEvent polls for currently pending events. -// (https://wiki.libsdl.org/SDL_PollEvent) +// (https://wiki.libsdl.org/SDL2/SDL_PollEvent) func PollEvent() Event { ret := C.PollEvent() if ret == 0 { @@ -1455,7 +1455,7 @@ func cEvent(event Event) *CEvent { } // WaitEventTimeout waits until the specified timeout (in milliseconds) for the next available event. -// (https://wiki.libsdl.org/SDL_WaitEventTimeout) +// (https://wiki.libsdl.org/SDL2/SDL_WaitEventTimeout) func WaitEventTimeout(timeout int) Event { var cevent CEvent _event := (*C.SDL_Event)(unsafe.Pointer(&cevent)) @@ -1467,7 +1467,7 @@ func WaitEventTimeout(timeout int) Event { } // WaitEvent waits indefinitely for the next available event. -// (https://wiki.libsdl.org/SDL_WaitEvent) +// (https://wiki.libsdl.org/SDL2/SDL_WaitEvent) func WaitEvent() Event { var cevent CEvent _event := (*C.SDL_Event)(unsafe.Pointer(&cevent)) @@ -1479,7 +1479,7 @@ func WaitEvent() Event { } // PushEvent adds an event to the event queue. -// (https://wiki.libsdl.org/SDL_PushEvent) +// (https://wiki.libsdl.org/SDL2/SDL_PushEvent) func PushEvent(event Event) (filtered bool, err error) { _event := (*C.SDL_Event)(unsafe.Pointer(cEvent(event))) if ok := int(C.SDL_PushEvent(_event)); ok < 0 { @@ -1547,7 +1547,7 @@ func wrapEventFilterCallback(filter EventFilter, e *C.SDL_Event, userdata interf } // SetEventFilter sets up a filter to process all events before they change internal state and are posted to the internal event queue. -// (https://wiki.libsdl.org/SDL_SetEventFilter) +// (https://wiki.libsdl.org/SDL2/SDL_SetEventFilter) func SetEventFilter(filter EventFilter, userdata interface{}) { if eventFilterCache == nil && filter == nil { // nothing to do... @@ -1568,13 +1568,13 @@ func SetEventFilter(filter EventFilter, userdata interface{}) { } // SetEventFilterFunc sets up a function to process all events before they change internal state and are posted to the internal event queue. -// (https://wiki.libsdl.org/SDL_SetEventFilter) +// (https://wiki.libsdl.org/SDL2/SDL_SetEventFilter) func SetEventFilterFunc(filterFunc eventFilterFunc, userdata interface{}) { SetEventFilter(filterFunc, userdata) } // GetEventFilter queries the current event filter. -// (https://wiki.libsdl.org/SDL_GetEventFilter) +// (https://wiki.libsdl.org/SDL2/SDL_GetEventFilter) func GetEventFilter() EventFilter { return eventFilterCache } @@ -1584,20 +1584,20 @@ func isCEventFilterSet() bool { } // FilterEvents run a specific filter function on the current event queue, removing any events for which the filter returns 0. -// (https://wiki.libsdl.org/SDL_FilterEvents) +// (https://wiki.libsdl.org/SDL2/SDL_FilterEvents) func FilterEvents(filter EventFilter, userdata interface{}) { context := newEventFilterCallbackContext(filter, userdata) C.filterEvents(context.cptr()) } // FilterEventsFunc run a specific function on the current event queue, removing any events for which the filter returns 0. -// (https://wiki.libsdl.org/SDL_FilterEvents) +// (https://wiki.libsdl.org/SDL2/SDL_FilterEvents) func FilterEventsFunc(filter eventFilterFunc, userdata interface{}) { FilterEvents(filter, userdata) } // AddEventWatch adds a callback to be triggered when an event is added to the event queue. -// (https://wiki.libsdl.org/SDL_AddEventWatch) +// (https://wiki.libsdl.org/SDL2/SDL_AddEventWatch) func AddEventWatch(filter EventFilter, userdata interface{}) EventWatchHandle { context := newEventFilterCallbackContext(filter, userdata) C.addEventWatch(context.cptr()) @@ -1605,13 +1605,13 @@ func AddEventWatch(filter EventFilter, userdata interface{}) EventWatchHandle { } // AddEventWatchFunc adds a callback function to be triggered when an event is added to the event queue. -// (https://wiki.libsdl.org/SDL_AddEventWatch) +// (https://wiki.libsdl.org/SDL2/SDL_AddEventWatch) func AddEventWatchFunc(filterFunc eventFilterFunc, userdata interface{}) EventWatchHandle { return AddEventWatch(filterFunc, userdata) } // DelEventWatch removes an event watch callback added with AddEventWatch(). -// (https://wiki.libsdl.org/SDL_DelEventWatch) +// (https://wiki.libsdl.org/SDL2/SDL_DelEventWatch) func DelEventWatch(handle EventWatchHandle) { context, ok := eventWatches[handle] if !ok { @@ -1622,19 +1622,19 @@ func DelEventWatch(handle EventWatchHandle) { } // EventState sets the state of processing events by type. -// (https://wiki.libsdl.org/SDL_EventState) +// (https://wiki.libsdl.org/SDL2/SDL_EventState) func EventState(type_ EventType, state EventStateConstant) uint8 { return uint8(C.SDL_EventState(C.Uint32(type_), C.int(state))) } // GetEventState returns the current processing state of the specified event -// (https://wiki.libsdl.org/SDL_EventState) +// (https://wiki.libsdl.org/SDL2/SDL_EventState) func GetEventState(type_ EventType) uint8 { return uint8(C.SDL_EventState(C.Uint32(type_), C.int(QUERY))) } // RegisterEvents allocates a set of user-defined events, and return the beginning event number for that set of events. -// (https://wiki.libsdl.org/SDL_RegisterEvents) +// (https://wiki.libsdl.org/SDL2/SDL_RegisterEvents) func RegisterEvents(numEvents int) uint32 { return uint32(C.SDL_RegisterEvents(C.int(numEvents))) } diff --git a/sdl/filesystem.go b/sdl/filesystem.go index 1f724b2e..b47ccd56 100644 --- a/sdl/filesystem.go +++ b/sdl/filesystem.go @@ -30,7 +30,7 @@ import "C" import "unsafe" // GetBasePath returns the directory where the application was run from. This is where the application data directory is. -// (https://wiki.libsdl.org/SDL_GetBasePath) +// (https://wiki.libsdl.org/SDL2/SDL_GetBasePath) func GetBasePath() string { _val := C.SDL_GetBasePath() defer C.SDL_free(unsafe.Pointer(_val)) @@ -38,7 +38,7 @@ func GetBasePath() string { } // GetPrefPath returns the "pref dir". This is meant to be where the application can write personal files (Preferences and save games, etc.) that are specific to the application. This directory is unique per user and per application. -// (https://wiki.libsdl.org/SDL_GetPrefPath) +// (https://wiki.libsdl.org/SDL2/SDL_GetPrefPath) func GetPrefPath(org, app string) string { _org := C.CString(org) _app := C.CString(app) diff --git a/sdl/gamecontroller.go b/sdl/gamecontroller.go index 50ae292e..39fd40d5 100644 --- a/sdl/gamecontroller.go +++ b/sdl/gamecontroller.go @@ -338,7 +338,7 @@ const ( // An enumeration of axes available from a controller. // GameControllerAxis is an axis on a game controller. -// (https://wiki.libsdl.org/SDL_GameControllerAxis) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerAxis) type GameControllerAxis C.SDL_GameControllerAxis const ( @@ -354,7 +354,7 @@ const ( // An enumeration of buttons available from a controller. // GameControllerButton is a button on a game controller. -// (https://wiki.libsdl.org/SDL_GameControllerButton) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerButton) type GameControllerButton C.SDL_GameControllerButton const ( @@ -410,7 +410,7 @@ func (btn GameControllerButton) c() C.SDL_GameControllerButton { } // GameControllerAddMapping adds support for controllers that SDL is unaware of or to cause an existing controller to have a different binding. -// (https://wiki.libsdl.org/SDL_GameControllerAddMapping) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerAddMapping) func GameControllerAddMapping(mappingString string) int { _mappingString := C.CString(mappingString) defer C.free(unsafe.Pointer(_mappingString)) @@ -430,7 +430,7 @@ func GameControllerMappingForIndex(index int) string { } // GameControllerMappingForGUID returns the game controller mapping string for a given GUID. -// (https://wiki.libsdl.org/SDL_GameControllerMappingForGUID) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerMappingForGUID) func GameControllerMappingForGUID(guid JoystickGUID) string { mappingString := C.SDL_GameControllerMappingForGUID(guid.c()) defer C.SDL_free(unsafe.Pointer(mappingString)) @@ -438,25 +438,25 @@ func GameControllerMappingForGUID(guid JoystickGUID) string { } // IsGameController reports whether the given joystick is supported by the game controller interface. -// (https://wiki.libsdl.org/SDL_IsGameController) +// (https://wiki.libsdl.org/SDL2/SDL_IsGameController) func IsGameController(index int) bool { return C.SDL_IsGameController(C.int(index)) == C.SDL_TRUE } // GameControllerNameForIndex returns the implementation dependent name for the game controller. -// (https://wiki.libsdl.org/SDL_GameControllerNameForIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerNameForIndex) func GameControllerNameForIndex(index int) string { return C.GoString(C.SDL_GameControllerNameForIndex(C.int(index))) } // GameControllerPathForIndex returns the implementation dependent path for the game controller. -// (https://wiki.libsdl.org/SDL_GameControllerPathForIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerPathForIndex) func GameControllerPathForIndex(index int) string { return (C.GoString)(C.SDL_GameControllerPathForIndex(C.int(index))) } // GameControllerTypeForIndex the type of a game controller. -// (https://wiki.libsdl.org/SDL_GameControllerTypeForIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerTypeForIndex) func GameControllerTypeForIndex(index int) GameControllerType { return GameControllerType(C.SDL_GameControllerTypeForIndex(C.int(index))) } @@ -469,49 +469,49 @@ func GameControllerMappingForDeviceIndex(index int) string { } // GameControllerOpen opens a gamecontroller for use. -// (https://wiki.libsdl.org/SDL_GameControllerOpen) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerOpen) func GameControllerOpen(index int) *GameController { return (*GameController)(C.SDL_GameControllerOpen(C.int(index))) } // GameControllerFromInstanceID returns the GameController associated with an instance id. -// (https://wiki.libsdl.org/SDL_GameControllerFromInstanceID) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerFromInstanceID) func GameControllerFromInstanceID(joyid JoystickID) *GameController { return (*GameController)(C.SDL_GameControllerFromInstanceID(joyid.c())) } // GameControllerFromPlayerIndex returns associated with a player index. -// (https://wiki.libsdl.org/SDL_GameControllerFromPlayerIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerFromPlayerIndex) func GameControllerFromPlayerIndex(playerIndex int) *GameController { return (*GameController)(C.SDL_GameControllerFromPlayerIndex(C.int(playerIndex))) } // Name returns the implementation dependent name for an opened game controller. -// (https://wiki.libsdl.org/SDL_GameControllerName) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerName) func (ctrl *GameController) Name() string { return C.GoString(C.SDL_GameControllerName(ctrl.cptr())) } // Path returns the implementation dependent path of an opened game controller. -// (https://wiki.libsdl.org/SDL_GameControllerPath) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerPath) func (ctrl *GameController) Path() string { return (C.GoString)(C.SDL_GameControllerPath(ctrl.cptr())) } // Type returns the type of this currently opened controller -// TODO: (https://wiki.libsdl.org/SDL_GameControllerType) +// TODO: (https://wiki.libsdl.org/SDL2/SDL_GameControllerType) func (ctrl *GameController) Type() GameControllerType { return GameControllerType(C.SDL_GameControllerGetType(ctrl.cptr())) } // PlayerIndex the player index of an opened game controller, or -1 if it's not available. -// (https://wiki.libsdl.org/SDL_GameControllerGetPlayerIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetPlayerIndex) func (ctrl *GameController) PlayerIndex() int { return int(C.SDL_GameControllerGetPlayerIndex(ctrl.cptr())) } // SetPlayerIndex sets the player index of an opened game controller. -// (https://wiki.libsdl.org/SDL_GameControllerSetPlayerIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerSetPlayerIndex) func (ctrl *GameController) SetPlayerIndex(playerIndex int) { C.SDL_GameControllerSetPlayerIndex(ctrl.cptr(), C.int(playerIndex)) } @@ -532,31 +532,31 @@ func (ctrl *GameController) ProductVersion() int { } // FirmwareVersion returns the firmware version of an opened controller, if available. -// (https://wiki.libsdl.org/SDL_GameControllerGetFirmwareVersion) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetFirmwareVersion) func (ctrl *GameController) FirmwareVersion() uint16 { return uint16(C.SDL_GameControllerGetFirmwareVersion(ctrl.cptr())) } // Serial returns the serial number of an opened controller, if available. -// (https://wiki.libsdl.org/SDL_GameControllerGetSerial) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetSerial) func (ctrl *GameController) Serial() string { return C.GoString(C.SDL_GameControllerGetSerial(ctrl.cptr())) } // SteamHandle returns the Steam Input handle of an opened controller, if available. -// (https://wiki.libsdl.org/SDL_GameControllerGetSteamHandle) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetSteamHandle) func (ctrl *GameController) SteamHandle() uint64 { return uint64(C.SDL_GameControllerGetSteamHandle(ctrl.cptr())) } // Attached reports whether a controller has been opened and is currently connected. -// (https://wiki.libsdl.org/SDL_GameControllerGetAttached) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetAttached) func (ctrl *GameController) Attached() bool { return C.SDL_GameControllerGetAttached(ctrl.cptr()) == C.SDL_TRUE } // Mapping returns the current mapping of a Game Controller. -// (https://wiki.libsdl.org/SDL_GameControllerMapping) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerMapping) func (ctrl *GameController) Mapping() string { mappingString := C.SDL_GameControllerMapping(ctrl.cptr()) defer C.SDL_free(unsafe.Pointer(mappingString)) @@ -564,25 +564,25 @@ func (ctrl *GameController) Mapping() string { } // Joystick returns the Joystick ID from a Game Controller. The game controller builds on the Joystick API, but to be able to use the Joystick's functions with a gamepad, you need to use this first to get the joystick object. -// (https://wiki.libsdl.org/SDL_GameControllerGetJoystick) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetJoystick) func (ctrl *GameController) Joystick() *Joystick { return (*Joystick)(unsafe.Pointer(C.SDL_GameControllerGetJoystick(ctrl.cptr()))) } -// GameControllerEventState returns the current state of, enable, or disable events dealing with Game Controllers. This will not disable Joystick events, which can also be fired by a controller (see https://wiki.libsdl.org/SDL_JoystickEventState). -// (https://wiki.libsdl.org/SDL_GameControllerEventState) +// GameControllerEventState returns the current state of, enable, or disable events dealing with Game Controllers. This will not disable Joystick events, which can also be fired by a controller (see https://wiki.libsdl.org/SDL2/SDL_JoystickEventState). +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerEventState) func GameControllerEventState(state int) int { return int(C.SDL_GameControllerEventState(C.int(state))) } // GameControllerUpdate manually pumps game controller updates if not using the loop. -// (https://wiki.libsdl.org/SDL_GameControllerUpdate) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerUpdate) func GameControllerUpdate() { C.SDL_GameControllerUpdate() } // GameControllerGetAxisFromString converts a string into an enum representation for a GameControllerAxis. -// (https://wiki.libsdl.org/SDL_GameControllerGetAxisFromString) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetAxisFromString) func GameControllerGetAxisFromString(pchString string) GameControllerAxis { _pchString := C.CString(pchString) defer C.free(unsafe.Pointer(_pchString)) @@ -590,31 +590,31 @@ func GameControllerGetAxisFromString(pchString string) GameControllerAxis { } // GameControllerGetStringForAxis converts from an axis enum to a string. -// (https://wiki.libsdl.org/SDL_GameControllerGetStringForAxis) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetStringForAxis) func GameControllerGetStringForAxis(axis GameControllerAxis) string { return C.GoString(C.SDL_GameControllerGetStringForAxis(axis.c())) } // BindForAxis returns the SDL joystick layer binding for a controller button mapping. -// (https://wiki.libsdl.org/SDL_GameControllerGetBindForAxis) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetBindForAxis) func (ctrl *GameController) BindForAxis(axis GameControllerAxis) GameControllerButtonBind { return GameControllerButtonBind(C.SDL_GameControllerGetBindForAxis(ctrl.cptr(), axis.c())) } // HasAxis returns whether a game controller has a given axis. -// (https://wiki.libsdl.org/SDL_GameControllerHasAxis) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerHasAxis) func (ctrl *GameController) HasAxis(axis GameControllerAxis) bool { return C.SDL_GameControllerHasAxis(ctrl.cptr(), axis.c()) == C.SDL_TRUE } // Axis returns the current state of an axis control on a game controller. -// (https://wiki.libsdl.org/SDL_GameControllerGetAxis) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetAxis) func (ctrl *GameController) Axis(axis GameControllerAxis) int16 { return int16(C.SDL_GameControllerGetAxis(ctrl.cptr(), axis.c())) } // GameControllerGetButtonFromString turns a string into a button mapping. -// (https://wiki.libsdl.org/SDL_GameControllerGetButtonFromString) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetButtonFromString) func GameControllerGetButtonFromString(pchString string) GameControllerButton { _pchString := C.CString(pchString) defer C.free(unsafe.Pointer(_pchString)) @@ -622,19 +622,19 @@ func GameControllerGetButtonFromString(pchString string) GameControllerButton { } // GameControllerGetStringForButton turns a button enum into a string mapping. -// (https://wiki.libsdl.org/SDL_GameControllerGetStringForButton) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetStringForButton) func GameControllerGetStringForButton(btn GameControllerButton) string { return C.GoString(C.SDL_GameControllerGetStringForButton(btn.c())) } // BindForButton returns the SDL joystick layer binding for this controller button mapping. -// (https://wiki.libsdl.org/SDL_GameControllerGetBindForButton) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetBindForButton) func (ctrl *GameController) BindForButton(btn GameControllerButton) GameControllerButtonBind { return GameControllerButtonBind(C.SDL_GameControllerGetBindForButton(ctrl.cptr(), btn.c())) } // HasButton returns whether a game controller has a given button. -// (https://wiki.libsdl.org/SDL_GameControllerHasButton) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerHasButton) func (ctrl *GameController) HasButton(btn GameControllerButton) bool { return C.SDL_GameControllerHasButton(ctrl.cptr(), btn.c()) == C.SDL_TRUE } @@ -648,81 +648,81 @@ func (ctrl *GameController) HasButton(btn GameControllerButton) bool { // // Returns error if rumble isn't supported on this joystick. // -// (https://wiki.libsdl.org/SDL_GameControllerRumble) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerRumbleTriggers) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerHasLED) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerHasLED) func (ctrl *GameController) HasLED() bool { return C.SDL_GameControllerHasLED(ctrl.cptr()) == C.SDL_TRUE } // SetLED updates a controller's LED color. -// (https://wiki.libsdl.org/SDL_GameControllerSetLED) +// (https://wiki.libsdl.org/SDL2/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)))) } // Button returns the current state of a button on a game controller. -// (https://wiki.libsdl.org/SDL_GameControllerGetButton) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetButton) func (ctrl *GameController) Button(btn GameControllerButton) byte { return byte(C.SDL_GameControllerGetButton(ctrl.cptr(), btn.c())) } // NumTouchpads returns the number of touchpads on a game controller. -// (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpads) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpadFingers) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerGetTouchpadFinger) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerHasSensor) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerSetSensorEnabled) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerIsSensorEnabled) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_GameControllerGetSensorData) +// (https://wiki.libsdl.org/SDL2/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 } // Close closes a game controller previously opened with GameControllerOpen(). -// (https://wiki.libsdl.org/SDL_GameControllerClose) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerClose) func (ctrl *GameController) Close() { C.SDL_GameControllerClose(ctrl.cptr()) } @@ -757,14 +757,14 @@ func (bind *GameControllerButtonBind) HatMask() int { } // SendEffect sends a controller specific effect packet. -// (https://wiki.libsdl.org/SDL_GameControllerSendEffect) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerSendEffect) func (ctrl *GameController) SendEffect(data []byte) (err error) { _size := C.int(len(data)) return errorFromInt(int(C.SDL_GameControllerSendEffect(ctrl.cptr(), unsafe.Pointer(&data[0]), _size))) } // GetSensorDataRate gets the data rate (number of events per second) of a game controller sensor. -// (https://wiki.libsdl.org/SDL_GameControllerGetSensorDataRate) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetSensorDataRate) func (ctrl *GameController) GetSensorDataRate(typ SensorType) (rate float32) { return float32(C.SDL_GameControllerGetSensorDataRate(ctrl.cptr(), C.SDL_SensorType(typ))) } @@ -772,7 +772,7 @@ func (ctrl *GameController) GetSensorDataRate(typ SensorType) (rate float32) { // GameControllerGetSensorData gets the current state of a game controller sensor. // // The number of values and interpretation of the data is sensor dependent. -// (https://wiki.libsdl.org/SDL_GameControllerGetSensorData) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetSensorData) func (ctrl *GameController) GetSensorData(typ SensorType, data []float32) (err error) { if data == nil { return nil @@ -786,7 +786,7 @@ func (ctrl *GameController) GetSensorData(typ SensorType, data []float32) (err e // GameeControllerGetSensorDataWithTimestamp gets current state of a game controller sensor with the timestamp of the last update. // // The number of values and interpretation of the data is sensor dependent. -// (https://wiki.libsdl.org/SDL_GameControllerGetSensorDataWithTimestamp) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetSensorDataWithTimestamp) func (ctrl *GameController) GetSensorDataWithTimestamp(typ SensorType, timestamp *uint64, data []float32) (err error) { if data == nil { return nil @@ -799,19 +799,19 @@ func (ctrl *GameController) GetSensorDataWithTimestamp(typ SensorType, timestamp } // HasRumble queries whether a game controller has rumble support. -// (https://wiki.libsdl.org/SDL_GameControllerHasRumble) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerHasRumble) func (ctrl *GameController) HasRumble() bool { return C.SDL_GameControllerHasRumble(ctrl.cptr()) == C.SDL_TRUE } // HasRumbleTriggers queries whether a game controller has rumble support on triggers. -// (https://wiki.libsdl.org/SDL_GameControllerHasRumbleTriggers) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerHasRumbleTriggers) func (ctrl *GameController) HasRumbleTriggers() bool { return C.SDL_GameControllerHasRumbleTriggers(ctrl.cptr()) == C.SDL_TRUE } // GetAppleSFSymbolsNameForButton returns the sfSymbolsName for a given button on a game controller on Apple platforms. -// (https://wiki.libsdl.org/SDL_GameControllerGetAppleSFSymbolsNameForButton) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetAppleSFSymbolsNameForButton) func (ctrl *GameController) GetAppleSFSymbolsNameForButton(button GameControllerButton) (sfSymbolsName string) { _button := C.SDL_GameControllerButton(button) _sfSymbolsName := C.SDL_GameControllerGetAppleSFSymbolsNameForButton(ctrl.cptr(), _button) @@ -820,7 +820,7 @@ func (ctrl *GameController) GetAppleSFSymbolsNameForButton(button GameController } // GetAppleSFSymbolsNameForAxis returns the sfSymbolsName for a given axis on a game controller on Apple platforms. -// (https://wiki.libsdl.org/SDL_GameControllerGetAppleSFSymbolsNameForAxis) +// (https://wiki.libsdl.org/SDL2/SDL_GameControllerGetAppleSFSymbolsNameForAxis) func (ctrl *GameController) SDL_GameControllerGetAppleSFSymbolsNameForAxis(axis GameControllerAxis) (sfSymbolsName string) { _axis := C.SDL_GameControllerAxis(axis) _sfSymbolsName := C.SDL_GameControllerGetAppleSFSymbolsNameForAxis(ctrl.cptr(), _axis) diff --git a/sdl/gesture.go b/sdl/gesture.go index 5fdeff6f..77c86648 100644 --- a/sdl/gesture.go +++ b/sdl/gesture.go @@ -11,25 +11,25 @@ func (g GestureID) c() C.SDL_GestureID { } // RecordGesture begins recording a gesture on a specified touch device or all touch devices. -// (https://wiki.libsdl.org/SDL_RecordGesture) +// (https://wiki.libsdl.org/SDL2/SDL_RecordGesture) func RecordGesture(t TouchID) int { return int(C.SDL_RecordGesture(t.c())) } // SaveAllDollarTemplates saves all currently loaded Dollar Gesture templates. -// (https://wiki.libsdl.org/SDL_SaveAllDollarTemplates) +// (https://wiki.libsdl.org/SDL2/SDL_SaveAllDollarTemplates) func SaveAllDollarTemplates(src *RWops) int { return int(C.SDL_SaveAllDollarTemplates(src.cptr())) } // SaveDollarTemplate saves a currently loaded Dollar Gesture template. -// (https://wiki.libsdl.org/SDL_SaveDollarTemplate) +// (https://wiki.libsdl.org/SDL2/SDL_SaveDollarTemplate) func SaveDollarTemplate(g GestureID, src *RWops) int { return int(C.SDL_SaveDollarTemplate(g.c(), src.cptr())) } // LoadDollarTemplates loads Dollar Gesture templates from a file. -// (https://wiki.libsdl.org/SDL_LoadDollarTemplates) +// (https://wiki.libsdl.org/SDL2/SDL_LoadDollarTemplates) func LoadDollarTemplates(t TouchID, src *RWops) int { return int(C.SDL_LoadDollarTemplates(t.c(), src.cptr())) } diff --git a/sdl/haptic.go b/sdl/haptic.go index 806b726e..96164325 100644 --- a/sdl/haptic.go +++ b/sdl/haptic.go @@ -13,7 +13,7 @@ import "C" import "unsafe" // Haptic effects. -// (https://wiki.libsdl.org/SDL_HapticEffect) +// (https://wiki.libsdl.org/SDL2/SDL_HapticEffect) const ( HAPTIC_CONSTANT = C.SDL_HAPTIC_CONSTANT // constant haptic effect HAPTIC_SINE = C.SDL_HAPTIC_SINE // periodic haptic effect that simulates sine waves @@ -35,7 +35,7 @@ const ( ) // Direction encodings. -// (https://wiki.libsdl.org/SDL_HapticDirection) +// (https://wiki.libsdl.org/SDL2/SDL_HapticDirection) const ( HAPTIC_POLAR = C.SDL_HAPTIC_POLAR // uses polar coordinates for the direction HAPTIC_CARTESIAN = C.SDL_HAPTIC_CARTESIAN // uses cartesian coordinates for the direction @@ -49,14 +49,14 @@ const ( type Haptic C.SDL_Haptic // HapticDirection contains a haptic direction. -// (https://wiki.libsdl.org/SDL_HapticDirection) +// (https://wiki.libsdl.org/SDL2/SDL_HapticDirection) type HapticDirection struct { Type byte // the type of encoding Dir [3]int32 // the encoded direction } // HapticConstant contains a template for a constant effect. -// (https://wiki.libsdl.org/SDL_HapticConstant) +// (https://wiki.libsdl.org/SDL2/SDL_HapticConstant) type HapticConstant struct { Type uint16 // HAPTIC_CONSTANT Direction HapticDirection // direction of the effect @@ -76,7 +76,7 @@ func (he *HapticConstant) cHapticEffect() *C.SDL_HapticEffect { } // HapticPeriodic contains a template for a periodic effect. -// (https://wiki.libsdl.org/SDL_HapticPeriodic) +// (https://wiki.libsdl.org/SDL2/SDL_HapticPeriodic) type HapticPeriodic struct { Type uint16 // HAPTIC_SINE, HAPTIC_LEFTRIGHT, HAPTIC_TRIANGLE, HAPTIC_SAWTOOTHUP, HAPTIC_SAWTOOTHDOWN Direction HapticDirection // direction of the effect @@ -99,7 +99,7 @@ func (he *HapticPeriodic) cHapticEffect() *C.SDL_HapticEffect { } // HapticCondition contains a template for a condition effect. -// (https://wiki.libsdl.org/SDL_HapticCondition) +// (https://wiki.libsdl.org/SDL2/SDL_HapticCondition) type HapticCondition struct { Type uint16 // HAPTIC_SPRING, HAPTIC_DAMPER, HAPTIC_INERTIA, HAPTIC_FRICTION Direction HapticDirection // direction of the effect - not used at the moment @@ -120,7 +120,7 @@ func (he *HapticCondition) cHapticEffect() *C.SDL_HapticEffect { } // HapticRamp contains a template for a ramp effect. -// (https://wiki.libsdl.org/SDL_HapticRamp) +// (https://wiki.libsdl.org/SDL2/SDL_HapticRamp) type HapticRamp struct { Type uint16 // HAPTIC_RAMP Direction HapticDirection // direction of the effect @@ -141,7 +141,7 @@ func (he *HapticRamp) cHapticEffect() *C.SDL_HapticEffect { } // HapticLeftRight contains a template for a left/right effect. -// (https://wiki.libsdl.org/SDL_HapticLeftRight) +// (https://wiki.libsdl.org/SDL2/SDL_HapticLeftRight) type HapticLeftRight struct { Type uint16 // HAPTIC_LEFTRIGHT Length uint32 // duration of the effect @@ -154,7 +154,7 @@ func (he *HapticLeftRight) cHapticEffect() *C.SDL_HapticEffect { } // HapticCustom contains a template for a custom effect. -// (https://wiki.libsdl.org/SDL_HapticCustom) +// (https://wiki.libsdl.org/SDL2/SDL_HapticCustom) type HapticCustom struct { Type uint16 // SDL_HAPTIC_CUSTOM Direction HapticDirection // direction of the effect @@ -177,7 +177,7 @@ func (he *HapticCustom) cHapticEffect() *C.SDL_HapticEffect { } // HapticEffect union that contains the generic template for any haptic effect. -// (https://wiki.libsdl.org/SDL_HapticEffect) +// (https://wiki.libsdl.org/SDL2/SDL_HapticEffect) type HapticEffect interface { cHapticEffect() *C.SDL_HapticEffect } @@ -187,14 +187,14 @@ func (h *Haptic) cptr() *C.SDL_Haptic { } // NumHaptics returns the number of haptic devices attached to the system. -// (https://wiki.libsdl.org/SDL_NumHaptics) +// (https://wiki.libsdl.org/SDL2/SDL_NumHaptics) func NumHaptics() (int, error) { i := int(C.SDL_NumHaptics()) return i, errorFromInt(i) } // HapticName returns the implementation dependent name of a haptic device. -// (https://wiki.libsdl.org/SDL_HapticName) +// (https://wiki.libsdl.org/SDL2/SDL_HapticName) func HapticName(index int) (string, error) { name := C.SDL_HapticName(C.int(index)) if name == nil { @@ -204,7 +204,7 @@ func HapticName(index int) (string, error) { } // HapticOpen opens a haptic device for use. -// (https://wiki.libsdl.org/SDL_HapticOpen) +// (https://wiki.libsdl.org/SDL2/SDL_HapticOpen) func HapticOpen(index int) (*Haptic, error) { haptic := (*Haptic)(unsafe.Pointer(C.SDL_HapticOpen(C.int(index)))) if haptic == nil { @@ -214,7 +214,7 @@ func HapticOpen(index int) (*Haptic, error) { } // HapticOpened reports whether the haptic device at the designated index has been opened. -// (https://wiki.libsdl.org/SDL_HapticOpened) +// (https://wiki.libsdl.org/SDL2/SDL_HapticOpened) func HapticOpened(index int) (bool, error) { ret := int(C.SDL_HapticOpened(C.int(index))) if ret == 0 { @@ -224,21 +224,21 @@ func HapticOpened(index int) (bool, error) { } // HapticIndex returns the index of a haptic device. -// (https://wiki.libsdl.org/SDL_HapticIndex) +// (https://wiki.libsdl.org/SDL2/SDL_HapticIndex) func HapticIndex(h *Haptic) (int, error) { i := int(C.SDL_HapticIndex(h.cptr())) return i, errorFromInt(i) } // MouseIsHaptic reports whether or not the current mouse has haptic capabilities. -// (https://wiki.libsdl.org/SDL_MouseIsHaptic) +// (https://wiki.libsdl.org/SDL2/SDL_MouseIsHaptic) func MouseIsHaptic() (bool, error) { ret := int(C.SDL_MouseIsHaptic()) return ret == C.SDL_TRUE, errorFromInt(ret) } // HapticOpenFromMouse open a haptic device from the current mouse. -// (https://wiki.libsdl.org/SDL_HapticOpenFromMouse) +// (https://wiki.libsdl.org/SDL2/SDL_HapticOpenFromMouse) func HapticOpenFromMouse() (*Haptic, error) { haptic := (*Haptic)(unsafe.Pointer(C.SDL_HapticOpenFromMouse())) if haptic == nil { @@ -248,14 +248,14 @@ func HapticOpenFromMouse() (*Haptic, error) { } // JoystickIsHaptic reports whether a joystick has haptic features. -// (https://wiki.libsdl.org/SDL_JoystickIsHaptic) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickIsHaptic) func JoystickIsHaptic(joy *Joystick) (bool, error) { ret := int(C.SDL_JoystickIsHaptic(joy.cptr())) return ret == C.SDL_TRUE, errorFromInt(ret) } // HapticOpenFromJoystick opens a haptic device for use from a joystick device. -// (https://wiki.libsdl.org/SDL_HapticOpenFromJoystick) +// (https://wiki.libsdl.org/SDL2/SDL_HapticOpenFromJoystick) func HapticOpenFromJoystick(joy *Joystick) (*Haptic, error) { haptic := (*Haptic)(unsafe.Pointer(C.SDL_HapticOpenFromJoystick(joy.cptr()))) if haptic == nil { @@ -265,34 +265,34 @@ func HapticOpenFromJoystick(joy *Joystick) (*Haptic, error) { } // Close closes a haptic device previously opened with HapticOpen(). -// (https://wiki.libsdl.org/SDL_HapticClose) +// (https://wiki.libsdl.org/SDL2/SDL_HapticClose) func (h *Haptic) Close() { C.SDL_HapticClose(h.cptr()) } // NumAxes returns the number of haptic axes the device has. -// (https://wiki.libsdl.org/SDL_HapticNumAxes) +// (https://wiki.libsdl.org/SDL2/SDL_HapticNumAxes) func (h *Haptic) NumAxes() (int, error) { i := int(C.SDL_HapticNumAxes(h.cptr())) return i, errorFromInt(i) } // NumEffects returns the number of effects a haptic device can store. -// (https://wiki.libsdl.org/SDL_HapticNumEffects) +// (https://wiki.libsdl.org/SDL2/SDL_HapticNumEffects) func (h *Haptic) NumEffects() (int, error) { i := int(C.SDL_HapticNumEffects(h.cptr())) return i, errorFromInt(i) } // NumEffectsPlaying returns the number of effects a haptic device can play at the same time. -// (https://wiki.libsdl.org/SDL_HapticNumEffectsPlaying) +// (https://wiki.libsdl.org/SDL2/SDL_HapticNumEffectsPlaying) func (h *Haptic) NumEffectsPlaying() (int, error) { i := int(C.SDL_HapticNumEffectsPlaying(h.cptr())) return i, errorFromInt(i) } // Query returns haptic device's supported features in bitwise manner. -// (https://wiki.libsdl.org/SDL_HapticQuery) +// (https://wiki.libsdl.org/SDL2/SDL_HapticQuery) func (h *Haptic) Query() (uint32, error) { i := uint32(C.SDL_HapticQuery(h.cptr())) if i == 0 { @@ -303,7 +303,7 @@ func (h *Haptic) Query() (uint32, error) { // EffectSupported reports whether an effect is supported by a haptic device. // Pass pointer to a Haptic struct (Constant|Periodic|Condition|Ramp|LeftRight|Custom) instead of HapticEffect union. -// (https://wiki.libsdl.org/SDL_HapticEffectSupported) +// (https://wiki.libsdl.org/SDL2/SDL_HapticEffectSupported) func (h *Haptic) EffectSupported(he HapticEffect) (bool, error) { ret := int(C.SDL_HapticEffectSupported( h.cptr(), @@ -313,7 +313,7 @@ func (h *Haptic) EffectSupported(he HapticEffect) (bool, error) { // NewEffect creates a new haptic effect on a specified device. // Pass pointer to a Haptic struct (Constant|Periodic|Condition|Ramp|LeftRight|Custom) instead of HapticEffect union. -// (https://wiki.libsdl.org/SDL_HapticNewEffect) +// (https://wiki.libsdl.org/SDL2/SDL_HapticNewEffect) func (h *Haptic) NewEffect(he HapticEffect) (int, error) { ret := int(C.SDL_HapticNewEffect( h.cptr(), @@ -323,7 +323,7 @@ func (h *Haptic) NewEffect(he HapticEffect) (int, error) { // UpdateEffect updates the properties of an effect. // Pass pointer to a Haptic struct (Constant|Periodic|Condition|Ramp|LeftRight|Custom) instead of HapticEffect union. -// (https://wiki.libsdl.org/SDL_HapticUpdateEffect) +// (https://wiki.libsdl.org/SDL2/SDL_HapticUpdateEffect) func (h *Haptic) UpdateEffect(effect int, data HapticEffect) error { return errorFromInt(int( C.SDL_HapticUpdateEffect( @@ -333,7 +333,7 @@ func (h *Haptic) UpdateEffect(effect int, data HapticEffect) error { } // RunEffect runs the haptic effect on its associated haptic device. -// (https://wiki.libsdl.org/SDL_HapticRunEffect) +// (https://wiki.libsdl.org/SDL2/SDL_HapticRunEffect) func (h *Haptic) RunEffect(effect int, iterations uint32) error { return errorFromInt(int( C.SDL_HapticRunEffect( @@ -343,20 +343,20 @@ func (h *Haptic) RunEffect(effect int, iterations uint32) error { } // StopEffect stops the haptic effect on its associated haptic device. -// (https://wiki.libsdl.org/SDL_HapticStopEffect) +// (https://wiki.libsdl.org/SDL2/SDL_HapticStopEffect) func (h *Haptic) StopEffect(effect int) error { return errorFromInt(int( C.SDL_HapticStopEffect(h.cptr(), C.int(effect)))) } // DestroyEffect destroys a haptic effect on the device. -// (https://wiki.libsdl.org/SDL_HapticDestroyEffect) +// (https://wiki.libsdl.org/SDL2/SDL_HapticDestroyEffect) func (h *Haptic) DestroyEffect(effect int) { C.SDL_HapticDestroyEffect(h.cptr(), C.int(effect)) } // GetEffectStatus returns the status of the current effect on the specified haptic device. -// (https://wiki.libsdl.org/SDL_HapticGetEffectStatus) +// (https://wiki.libsdl.org/SDL2/SDL_HapticGetEffectStatus) func (h *Haptic) GetEffectStatus(effect int) (int, error) { i := int(C.SDL_HapticGetEffectStatus(h.cptr(), C.int(effect))) return i, errorFromInt(i) @@ -364,63 +364,63 @@ func (h *Haptic) GetEffectStatus(effect int) (int, error) { } // SetGain sets the global gain of the specified haptic device. -// (https://wiki.libsdl.org/SDL_HapticSetGain) +// (https://wiki.libsdl.org/SDL2/SDL_HapticSetGain) func (h *Haptic) SetGain(gain int) error { return errorFromInt(int( C.SDL_HapticSetGain(h.cptr(), C.int(gain)))) } // SetAutocenter sets the global autocenter of the device. -// (https://wiki.libsdl.org/SDL_HapticSetAutocenter) +// (https://wiki.libsdl.org/SDL2/SDL_HapticSetAutocenter) func (h *Haptic) SetAutocenter(autocenter int) error { return errorFromInt(int( C.SDL_HapticSetAutocenter(h.cptr(), C.int(autocenter)))) } // Pause pauses a haptic device. -// (https://wiki.libsdl.org/SDL_HapticPause) +// (https://wiki.libsdl.org/SDL2/SDL_HapticPause) func (h *Haptic) Pause() error { return errorFromInt(int( C.SDL_HapticPause(h.cptr()))) } // Unpause unpauses a haptic device. -// (https://wiki.libsdl.org/SDL_HapticUnpause) +// (https://wiki.libsdl.org/SDL2/SDL_HapticUnpause) func (h *Haptic) Unpause() error { return errorFromInt(int( C.SDL_HapticUnpause(h.cptr()))) } // StopAll stops all the currently playing effects on a haptic device. -// (https://wiki.libsdl.org/SDL_HapticStopAll) +// (https://wiki.libsdl.org/SDL2/SDL_HapticStopAll) func (h *Haptic) StopAll() error { return errorFromInt(int( C.SDL_HapticStopAll(h.cptr()))) } // RumbleSupported reports whether rumble is supported on a haptic device. -// (https://wiki.libsdl.org/SDL_HapticRumbleSupported) +// (https://wiki.libsdl.org/SDL2/SDL_HapticRumbleSupported) func (h *Haptic) RumbleSupported() (bool, error) { ret := int(C.SDL_HapticRumbleSupported(h.cptr())) return ret == C.SDL_TRUE, errorFromInt(ret) } // RumbleInit initializes the haptic device for simple rumble playback. -// (https://wiki.libsdl.org/SDL_HapticRumbleInit) +// (https://wiki.libsdl.org/SDL2/SDL_HapticRumbleInit) func (h *Haptic) RumbleInit() error { return errorFromInt(int( C.SDL_HapticRumbleInit(h.cptr()))) } // RumblePlay runs a simple rumble effect on a haptic device. -// (https://wiki.libsdl.org/SDL_HapticRumblePlay) +// (https://wiki.libsdl.org/SDL2/SDL_HapticRumblePlay) func (h *Haptic) RumblePlay(strength float32, length uint32) error { return errorFromInt(int( C.SDL_HapticRumblePlay(h.cptr(), C.float(strength), C.Uint32(length)))) } // RumbleStop stops the simple rumble on a haptic device. -// (https://wiki.libsdl.org/SDL_HapticRumbleStop) +// (https://wiki.libsdl.org/SDL2/SDL_HapticRumbleStop) func (h *Haptic) RumbleStop() error { return errorFromInt(int( C.SDL_HapticRumbleStop(h.cptr()))) diff --git a/sdl/hidapi.go b/sdl/hidapi.go index 6bfa7a40..39f429e0 100644 --- a/sdl/hidapi.go +++ b/sdl/hidapi.go @@ -198,27 +198,27 @@ func (info *HIDDeviceInfo) Path() string { } // HIDInit initializes the HIDAPI library. -// (https://wiki.libsdl.org/SDL_hid_init) +// (https://wiki.libsdl.org/SDL2/SDL_hid_init) func HIDInit() (err error) { ret := C.SDL_hid_init() return errorFromInt(int(ret)) } // HIDExit finalizes the HIDAPI library. -// (https://wiki.libsdl.org/SDL_hid_exit) +// (https://wiki.libsdl.org/SDL2/SDL_hid_exit) func HIDExit() (err error) { ret := C.SDL_hid_exit() return errorFromInt(int(ret)) } // HIDDeviceChangeCount checks to see if devices may have been added or removed. -// (https://wiki.libsdl.org/SDL_hid_device_change_count) +// (https://wiki.libsdl.org/SDL2/SDL_hid_device_change_count) func HIDDeviceChangeCount() (n uint32) { return uint32(C.SDL_hid_device_change_count()) } // HIDEnumerate enumerates the HID devices. -// (https://wiki.libsdl.org/SDL_hid_enumerate) +// (https://wiki.libsdl.org/SDL2/SDL_hid_enumerate) func HIDEnumerate(vendorID, productID uint16) (info *HIDDeviceInfo) { _vendorID := C.Uint16(vendorID) _productID := C.Uint16(productID) @@ -227,14 +227,14 @@ func HIDEnumerate(vendorID, productID uint16) (info *HIDDeviceInfo) { } // HIDFreeEnumeration frees an enumeration Linked List. -// (https://wiki.libsdl.org/SDL_hid_free_enumeration) +// (https://wiki.libsdl.org/SDL2/SDL_hid_free_enumeration) func HIDFreeEnumeration(info *HIDDeviceInfo) { _info := (*C.SDL_hid_device_info)(unsafe.Pointer(info)) C.SDL_hid_free_enumeration(_info) } // HIDOpen opens a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number. -// (https://wiki.libsdl.org/SDL_hid_open) +// (https://wiki.libsdl.org/SDL2/SDL_hid_open) func HIDOpen(vendorID, productID uint16, _serialNumber *C.wchar_t) (device *HIDDevice) { _vendorID := C.Uint16(vendorID) _productID := C.Uint16(productID) @@ -243,7 +243,7 @@ func HIDOpen(vendorID, productID uint16, _serialNumber *C.wchar_t) (device *HIDD } // HIDOpenPath opens a HID device by its path name. -// (https://wiki.libsdl.org/SDL_hid_open_path) +// (https://wiki.libsdl.org/SDL2/SDL_hid_open_path) func HIDOpenPath(path string, exclusive bool) (device *HIDDevice) { _path := C.CString(path) defer C.free(unsafe.Pointer(_path)) @@ -256,7 +256,7 @@ func HIDOpenPath(path string, exclusive bool) (device *HIDDevice) { } // Write writes an Output report to a HID device. -// (https://wiki.libsdl.org/SDL_hid_write) +// (https://wiki.libsdl.org/SDL2/SDL_hid_write) func (device *HIDDevice) Write(data []byte) (n int, err error) { _length := C.size_t(len(data)) _data := (*C.uchar)(unsafe.Pointer(&data[0])) @@ -266,7 +266,7 @@ func (device *HIDDevice) Write(data []byte) (n int, err error) { } // ReadTimeout reads an Input report from a HID device with timeout. -// (https://wiki.libsdl.org/SDL_hid_read_timeout) +// (https://wiki.libsdl.org/SDL2/SDL_hid_read_timeout) func (device *HIDDevice) ReadTimeout(data []byte, milliseconds int) (n int, err error) { _length := C.size_t(len(data)) _data := (*C.uchar)(unsafe.Pointer(&data[0])) @@ -277,7 +277,7 @@ func (device *HIDDevice) ReadTimeout(data []byte, milliseconds int) (n int, err } // Read an Input report from a HID device. -// (https://wiki.libsdl.org/SDL_hid_read) +// (https://wiki.libsdl.org/SDL2/SDL_hid_read) func (device *HIDDevice) Read(data []byte) (n int, err error) { _length := C.size_t(len(data)) _data := (*C.uchar)(unsafe.Pointer(&data[0])) @@ -287,7 +287,7 @@ func (device *HIDDevice) Read(data []byte) (n int, err error) { } // SetNonBlocking sets the device handle to be non-blocking. -// (https://wiki.libsdl.org/SDL_hid_set_nonblocking) +// (https://wiki.libsdl.org/SDL2/SDL_hid_set_nonblocking) func (device *HIDDevice) SetNonBlocking(nonblock bool) (err error) { _device := (*C.SDL_hid_device)(device) _nonblock := C.int(Btoi(nonblock)) @@ -295,7 +295,7 @@ func (device *HIDDevice) SetNonBlocking(nonblock bool) (err error) { } // SendFeatureReport sends a Feature report to the device. -// (https://wiki.libsdl.org/SDL_hid_send_feature_report) +// (https://wiki.libsdl.org/SDL2/SDL_hid_send_feature_report) func (device *HIDDevice) SendFeatureReport(data []byte) (n int, err error) { _length := C.size_t(len(data)) _data := (*C.uchar)(unsafe.Pointer(&data[0])) @@ -305,7 +305,7 @@ func (device *HIDDevice) SendFeatureReport(data []byte) (n int, err error) { } // GetFeatureReport gets a feature report from a HID device. -// (https://wiki.libsdl.org/SDL_hid_get_feature_report) +// (https://wiki.libsdl.org/SDL2/SDL_hid_get_feature_report) func (device *HIDDevice) GetFeatureReport(data []byte) (n int, err error) { _length := C.size_t(len(data)) _data := (*C.uchar)(unsafe.Pointer(&data[0])) @@ -315,35 +315,35 @@ func (device *HIDDevice) GetFeatureReport(data []byte) (n int, err error) { } // Close closes a HID device. -// (https://wiki.libsdl.org/SDL_hid_close) +// (https://wiki.libsdl.org/SDL2/SDL_hid_close) func (device *HIDDevice) Close() { _device := (*C.SDL_hid_device)(device) C.SDL_hid_close(_device) } // GetManufacturerString gets The Manufacturer String from a HID device. -// (https://wiki.libsdl.org/SDL_hid_get_manufacturer_string) +// (https://wiki.libsdl.org/SDL2/SDL_hid_get_manufacturer_string) func (device *HIDDevice) GetManufacturerString(_str *C.wchar_t, _maxlen C.size_t) (err error) { _device := (*C.SDL_hid_device)(device) return errorFromInt(int(C.SDL_hid_get_manufacturer_string(_device, _str, _maxlen))) } // GetProductString gets The Product String from a HID device. -// (https://wiki.libsdl.org/SDL_hid_get_product_string) +// (https://wiki.libsdl.org/SDL2/SDL_hid_get_product_string) func (device *HIDDevice) GetProductString(_str *C.wchar_t, _maxlen C.size_t) (err error) { _device := (*C.SDL_hid_device)(device) return errorFromInt(int(C.SDL_hid_get_product_string(_device, _str, _maxlen))) } // GetSerialNumberString gets The SerialNumber String from a HID device. -// (https://wiki.libsdl.org/SDL_hid_get_serial_number_string) +// (https://wiki.libsdl.org/SDL2/SDL_hid_get_serial_number_string) func (device *HIDDevice) GetSerialNumberString(_str *C.wchar_t, _maxlen C.size_t) (err error) { _device := (*C.SDL_hid_device)(device) return errorFromInt(int(C.SDL_hid_get_serial_number_string(_device, _str, _maxlen))) } // GetIndexedString gets a string from a HID device, based on its string index. -// (https://wiki.libsdl.org/SDL_hid_get_indexed_string) +// (https://wiki.libsdl.org/SDL2/SDL_hid_get_indexed_string) func (device *HIDDevice) GetIndexedString(index int, _str *C.wchar_t, _maxlen C.size_t) (err error) { _device := (*C.SDL_hid_device)(device) _index := C.int(index) @@ -351,7 +351,7 @@ func (device *HIDDevice) GetIndexedString(index int, _str *C.wchar_t, _maxlen C. } // HIDBLEScan starts or stops a BLE scan on iOS and tvOS to pair Steam Controllers. -// (https://wiki.libsdl.org/SDL_hid_ble_scan) +// (https://wiki.libsdl.org/SDL2/SDL_hid_ble_scan) func (device *HIDDevice) HIDBLEScan(active bool) { _active := C.SDL_bool(Btoi(active)) C.SDL_hid_ble_scan(_active) diff --git a/sdl/hints.go b/sdl/hints.go index d37004ce..c39eee67 100644 --- a/sdl/hints.go +++ b/sdl/hints.go @@ -393,7 +393,7 @@ const ( // An enumeration of hint priorities. // HintPriority is a hint priority used in SetHintWithPriority(). -// (https://wiki.libsdl.org/SDL_HintPriority) +// (https://wiki.libsdl.org/SDL2/SDL_HintPriority) type HintPriority C.SDL_HintPriority const ( @@ -418,7 +418,7 @@ func (hp HintPriority) c() C.SDL_HintPriority { } // SetHintWithPriority sets a hint with a specific priority. -// (https://wiki.libsdl.org/SDL_SetHintWithPriority) +// (https://wiki.libsdl.org/SDL2/SDL_SetHintWithPriority) func SetHintWithPriority(name, value string, hp HintPriority) bool { _name := C.CString(name) _value := C.CString(value) @@ -428,7 +428,7 @@ func SetHintWithPriority(name, value string, hp HintPriority) bool { } // SetHint sets a hint with normal priority. -// (https://wiki.libsdl.org/SDL_SetHint) +// (https://wiki.libsdl.org/SDL2/SDL_SetHint) func SetHint(name, value string) bool { _name := C.CString(name) _value := C.CString(value) @@ -438,7 +438,7 @@ func SetHint(name, value string) bool { } // ResetHint resets a hint to the default value. -// (https://wiki.libsdl.org/SDL_ResetHint) +// (https://wiki.libsdl.org/SDL2/SDL_ResetHint) func ResetHint(name string) bool { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -446,13 +446,13 @@ func ResetHint(name string) bool { } // ResetHints resets all hints to the default values. -// (https://wiki.libsdl.org/SDL_ResetHints) +// (https://wiki.libsdl.org/SDL2/SDL_ResetHints) func ResetHints() { C.SDL_ResetHints() } // GetHint returns the value of a hint. -// (https://wiki.libsdl.org/SDL_GetHint) +// (https://wiki.libsdl.org/SDL2/SDL_GetHint) func GetHint(name string) string { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -460,13 +460,13 @@ func GetHint(name string) string { } // ClearHints clears all hints. -// (https://wiki.libsdl.org/SDL_ClearHints) +// (https://wiki.libsdl.org/SDL2/SDL_ClearHints) func ClearHints() { C.SDL_ClearHints() } // AddHintCallback adds a function to watch a particular hint. -// (https://wiki.libsdl.org/SDL_AddHintCallback) +// (https://wiki.libsdl.org/SDL2/SDL_AddHintCallback) func AddHintCallback(name string, fn HintCallback, data interface{}) { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -478,7 +478,7 @@ func AddHintCallback(name string, fn HintCallback, data interface{}) { } // DelHintCallback removes a function watching a particular hint. -// (https://wiki.libsdl.org/SDL_DelHintCallback) +// (https://wiki.libsdl.org/SDL2/SDL_DelHintCallback) func DelHintCallback(name string) { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) diff --git a/sdl/joystick.go b/sdl/joystick.go index f74afa58..4303cd9f 100644 --- a/sdl/joystick.go +++ b/sdl/joystick.go @@ -390,7 +390,7 @@ import "C" import "unsafe" // Hat positions. -// (https://wiki.libsdl.org/SDL_JoystickGetHat) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetHat) type JoystickHat int const ( @@ -422,7 +422,7 @@ const ( ) // An enumeration of battery levels of a joystick. -// (https://wiki.libsdl.org/SDL_JoystickPowerLevel) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickPowerLevel) type JoystickPowerLevel C.SDL_JoystickPowerLevel const ( @@ -457,7 +457,7 @@ func (joyid JoystickID) c() C.SDL_JoystickID { } // GetInfo returns the device information encoded in a JoystickGUID structure. -// (https://wiki.libsdl.org/SDL_GetJoystickGUIDInfo) +// (https://wiki.libsdl.org/SDL2/SDL_GetJoystickGUIDInfo) func (guid JoystickGUID) GetInfo() (vendor, product, version, crc16 uint16) { _vendor := (*C.Uint16)(&vendor) _product := (*C.Uint16)(&product) @@ -468,31 +468,31 @@ func (guid JoystickGUID) GetInfo() (vendor, product, version, crc16 uint16) { } // NumJoysticks returns the number of joysticks attached to the system. -// (https://wiki.libsdl.org/SDL_NumJoysticks) +// (https://wiki.libsdl.org/SDL2/SDL_NumJoysticks) func NumJoysticks() int { return (int)(C.SDL_NumJoysticks()) } // JoystickNameForIndex returns the implementation dependent name of a joystick. -// (https://wiki.libsdl.org/SDL_JoystickNameForIndex) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickNameForIndex) func JoystickNameForIndex(index int) string { return (C.GoString)(C.SDL_JoystickNameForIndex(C.int(index))) } // JoystickPathForIndex returns the implementation dependent path of a joystick. -// (https://wiki.libsdl.org/SDL_JoystickPathForIndex) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickPathForIndex) func JoystickPathForIndex(index int) string { return (C.GoString)(C.SDL_JoystickPathForIndex(C.int(index))) } // JoystickGetDevicePlayerIndex returns the player index of a joystick, or -1 if it's not available -// (https://wiki.libsdl.org/SDL_JoystickGetDevicePlayerIndex) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetDevicePlayerIndex) func JoystickGetDevicePlayerIndex(index int) int { return int(C.SDL_JoystickGetDevicePlayerIndex(C.int(index))) } // JoystickGetDeviceGUID returns the implementation dependent GUID for the joystick at a given device index. -// (https://wiki.libsdl.org/SDL_JoystickGetDeviceGUID) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetDeviceGUID) func JoystickGetDeviceGUID(index int) JoystickGUID { return (JoystickGUID)(C.SDL_JoystickGetDeviceGUID(C.int(index))) } @@ -523,7 +523,7 @@ func JoystickGetDeviceInstanceID(index int) JoystickID { } // JoystickGetGUIDString returns an ASCII string representation for a given JoystickGUID. -// (https://wiki.libsdl.org/SDL_JoystickGetGUIDString) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetGUIDString) func JoystickGetGUIDString(guid JoystickGUID) string { _pszGUID := make([]rune, 1024) pszGUID := C.CString(string(_pszGUID[:])) @@ -533,7 +533,7 @@ func JoystickGetGUIDString(guid JoystickGUID) string { } // JoystickGetGUIDFromString converts a GUID string into a JoystickGUID structure. -// (https://wiki.libsdl.org/SDL_JoystickGetGUIDFromString) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetGUIDFromString) func JoystickGetGUIDFromString(pchGUID string) JoystickGUID { _pchGUID := C.CString(pchGUID) defer C.free(unsafe.Pointer(_pchGUID)) @@ -541,37 +541,37 @@ func JoystickGetGUIDFromString(pchGUID string) JoystickGUID { } // JoystickUpdate updates the current state of the open joysticks. -// (https://wiki.libsdl.org/SDL_JoystickUpdate) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickUpdate) func JoystickUpdate() { C.SDL_JoystickUpdate() } // JoystickEventState enables or disables joystick event polling. -// (https://wiki.libsdl.org/SDL_JoystickEventState) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickEventState) func JoystickEventState(state int) int { return (int)(C.SDL_JoystickEventState(C.int(state))) } // JoystickOpen opens a joystick for use. -// (https://wiki.libsdl.org/SDL_JoystickOpen) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickOpen) func JoystickOpen(index int) *Joystick { return (*Joystick)(C.SDL_JoystickOpen(C.int(index))) } // JoystickFromInstanceID returns the Joystick associated with an instance id. -// (https://wiki.libsdl.org/SDL_JoystickFromInstanceID) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickFromInstanceID) func JoystickFromInstanceID(joyid JoystickID) *Joystick { return (*Joystick)(C.SDL_JoystickFromInstanceID(joyid.c())) } // JoystickFromPlayerIndex returns the Joystick associated with a player index. -// (https://wiki.libsdl.org/SDL_JoystickFromPlayerIndex) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickFromPlayerIndex) func JoystickFromPlayerIndex(playerIndex int) *Joystick { return (*Joystick)(C.SDL_JoystickFromPlayerIndex(C.int(playerIndex))) } // JoystickAttachVirtual attaches a new virtual joystick. -// (https://wiki.libsdl.org/SDL_JoystickAttachVirtual) +// (https://wiki.libsdl.org/SDL2/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) @@ -579,7 +579,7 @@ func JoystickAttachVirtual(typ JoystickType, naxes, nbuttons, nhats int) (device } // JoystickAttachVirtualEx attaches a new virtual joystick with extended properties. -// (https://wiki.libsdl.org/SDL_JoystickAttachVirtualEx) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickAttachVirtualEx) func JoystickAttachVirtualEx(desc *C.SDL_VirtualJoystickDesc) (deviceIndex int, err error) { deviceIndex = int(C.SDL_JoystickAttachVirtualEx(desc)) err = errorFromInt(deviceIndex) @@ -587,13 +587,13 @@ func JoystickAttachVirtualEx(desc *C.SDL_VirtualJoystickDesc) (deviceIndex int, } // JoystickDetachVirtual detaches a virtual joystick. -// (https://wiki.libsdl.org/SDL_JoystickDetachVirtual) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_JoystickIsVirtual) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickIsVirtual) func JoystickIsVirtual(deviceIndex int) bool { return C.SDL_JoystickIsVirtual(C.int(deviceIndex)) == C.SDL_TRUE } @@ -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.. -// (https://wiki.libsdl.org/SDL_JoystickSetVirtualAxis) +// (https://wiki.libsdl.org/SDL2/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)))) } @@ -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.. -// (https://wiki.libsdl.org/SDL_JoystickSetVirtualButton) +// (https://wiki.libsdl.org/SDL2/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)))) } @@ -626,49 +626,49 @@ 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.. -// (https://wiki.libsdl.org/SDL_JoystickSetVirtualHat) +// (https://wiki.libsdl.org/SDL2/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 -// (https://wiki.libsdl.org/SDL_LockJoysticks) +// (https://wiki.libsdl.org/SDL2/SDL_LockJoysticks) func LockJoysticks() { C.SDL_LockJoysticks() } // UnlockJoysticks unlocks joysticks for multi-threaded access to the joystick API -// (https://wiki.libsdl.org/SDL_UnlockJoysticks) +// (https://wiki.libsdl.org/SDL2/SDL_UnlockJoysticks) func UnlockJoysticks() { C.SDL_UnlockJoysticks() } // Name returns the implementation dependent name of a joystick. -// (https://wiki.libsdl.org/SDL_JoystickName) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickName) func (joy *Joystick) Name() string { return (C.GoString)(C.SDL_JoystickName(joy.cptr())) } // Path returns the implementation dependent path of a joystick. -// (https://wiki.libsdl.org/SDL_JoystickPath) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickPath) func (joy *Joystick) Path() string { return (C.GoString)(C.SDL_JoystickPath(joy.cptr())) } // PlayerIndex returns the player index of an opened joystick, or -1 if it's not available. -// (https://wiki.libsdl.org/SDL_JoystickGetPlayerIndex) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetPlayerIndex) func (joy *Joystick) PlayerIndex() int { return int(C.SDL_JoystickGetPlayerIndex(joy.cptr())) } // SetPlayerIndex returns set the player index of an opened joystick. -// (https://wiki.libsdl.org/SDL_JoystickSetPlayerIndex) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickSetPlayerIndex) func (joy *Joystick) SetPlayerIndex(playerIndex int) { C.SDL_JoystickSetPlayerIndex(joy.cptr(), C.int(playerIndex)) } // GUID returns the implementation-dependent GUID for the joystick. -// (https://wiki.libsdl.org/SDL_JoystickGetGUID) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetGUID) func (joy *Joystick) GUID() JoystickGUID { return (JoystickGUID)(C.SDL_JoystickGetGUID(joy.cptr())) } @@ -689,13 +689,13 @@ func (joy *Joystick) ProductVersion() int { } // FirmwareVersion returns the firmware version of an opened joystick, if available. -// (https://wiki.libsdl.org/SDL_JoystickGetFirmwareVersion) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetFirmwareVersion) func (joy *Joystick) FirmwareVersion() uint16 { return uint16(C.SDL_JoystickGetFirmwareVersion(joy.cptr())) } // Serial returns the serial number of an opened joystick, if available. -// (https://wiki.libsdl.org/SDL_JoystickGetSerial) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetSerial) func (joy *Joystick) Serial() string { return C.GoString(C.SDL_JoystickGetSerial(joy.cptr())) } @@ -706,43 +706,43 @@ func (joy *Joystick) Type() JoystickType { } // Attached returns the status of a specified joystick. -// (https://wiki.libsdl.org/SDL_JoystickGetAttached) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetAttached) func (joy *Joystick) Attached() bool { return C.SDL_JoystickGetAttached(joy.cptr()) == C.SDL_TRUE } // InstanceID returns the instance ID of an opened joystick. -// (https://wiki.libsdl.org/SDL_JoystickInstanceID) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickInstanceID) func (joy *Joystick) InstanceID() JoystickID { return (JoystickID)(C.SDL_JoystickInstanceID(joy.cptr())) } // NumAxes returns the number of general axis controls on a joystick. -// (https://wiki.libsdl.org/SDL_JoystickNumAxes) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickNumAxes) func (joy *Joystick) NumAxes() int { return (int)(C.SDL_JoystickNumAxes(joy.cptr())) } // NumBalls returns the number of trackballs on a joystick. -// (https://wiki.libsdl.org/SDL_JoystickNumBalls) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickNumBalls) func (joy *Joystick) NumBalls() int { return (int)(C.SDL_JoystickNumBalls(joy.cptr())) } // NumHats returns the number of POV hats on a joystick. -// (https://wiki.libsdl.org/SDL_JoystickNumHats) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickNumHats) func (joy *Joystick) NumHats() int { return (int)(C.SDL_JoystickNumHats(joy.cptr())) } // NumButtons returns the number of buttons on a joystick. -// (https://wiki.libsdl.org/SDL_JoystickNumButtons) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickNumButtons) func (joy *Joystick) NumButtons() int { return (int)(C.SDL_JoystickNumButtons(joy.cptr())) } // Axis returns the current state of an axis control on a joystick. -// (https://wiki.libsdl.org/SDL_JoystickGetAxis) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetAxis) func (joy *Joystick) Axis(axis int) int16 { return (int16)(C.SDL_JoystickGetAxis(joy.cptr(), C.int(axis))) } @@ -754,13 +754,13 @@ func (joy *Joystick) AxisInitialState(axis int) (state int16, ok bool) { } // Hat returns the current state of a POV hat on a joystick. -// (https://wiki.libsdl.org/SDL_JoystickGetHat) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetHat) func (joy *Joystick) Hat(hat JoystickHat) byte { return (byte)(C.SDL_JoystickGetHat(joy.cptr(), C.int(hat))) } // Ball returns the ball axis change since the last poll. -// (https://wiki.libsdl.org/SDL_JoystickGetBall) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetBall) func (joy *Joystick) Ball(ball int, dx, dy *int32) int { _dx := (*C.int)(unsafe.Pointer(dx)) _dy := (*C.int)(unsafe.Pointer(dy)) @@ -768,7 +768,7 @@ func (joy *Joystick) Ball(ball int, dx, dy *int32) int { } // Button the current state of a button on a joystick. -// (https://wiki.libsdl.org/SDL_JoystickGetButton) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickGetButton) func (joy *Joystick) Button(button int) byte { return (byte)(C.SDL_JoystickGetButton(joy.cptr(), C.int(button))) } @@ -782,49 +782,49 @@ func (joy *Joystick) Button(button int) byte { // // Returns error if rumble isn't supported on this joystick. // -// (https://wiki.libsdl.org/SDL_JoystickRumble) +// (https://wiki.libsdl.org/SDL2/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)))) } // RumbleTriggers starts a rumble effect in the joystick's triggers. -// (https://wiki.libsdl.org/SDL_JoystickRumbleTriggers) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickRumbleTriggers) func (joy *Joystick) RumbleTriggers(leftRumble, rightRumble uint16, durationMS uint32) error { return errorFromInt(int(C.SDL_JoystickRumbleTriggers(joy.cptr(), C.Uint16(leftRumble), C.Uint16(rightRumble), C.Uint32(durationMS)))) } // HasLED returns whether a joystick has an LED. -// (https://wiki.libsdl.org/SDL_JoystickHasLED) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickHasLED) func (joy *Joystick) HasLED() bool { return C.SDL_JoystickHasLED(joy.cptr()) == C.SDL_TRUE } // SetLED updates a joystick's LED color. -// (https://wiki.libsdl.org/SDL_JoystickSetLED) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickSetLED) func (joy *Joystick) SetLED(red, green, blue uint8) error { return errorFromInt(int(C.SDL_JoystickSetLED(joy.cptr(), C.Uint8(red), C.Uint8(green), C.Uint8(blue)))) } // Close closes a joystick previously opened with JoystickOpen(). -// (https://wiki.libsdl.org/SDL_JoystickClose) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickClose) func (joy *Joystick) Close() { C.SDL_JoystickClose(joy.cptr()) } // CurrentPowerLevel returns the battery level of a joystick as JoystickPowerLevel. -// (https://wiki.libsdl.org/SDL_JoystickCurrentPowerLevel) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickCurrentPowerLevel) func (joy *Joystick) CurrentPowerLevel() JoystickPowerLevel { return JoystickPowerLevel(C.SDL_JoystickCurrentPowerLevel(joy.cptr())) } // HasRumble queries whether a game controller has rumble support. -// (https://wiki.libsdl.org/SDL_JoystickHasRumble) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickHasRumble) func (ctrl *Joystick) HasRumble() bool { return C.SDL_JoystickHasRumble(ctrl.cptr()) == C.SDL_TRUE } // HasRumbleTriggers queries whether a game controller has rumble support on triggers. -// (https://wiki.libsdl.org/SDL_JoystickHasRumbleTriggers) +// (https://wiki.libsdl.org/SDL2/SDL_JoystickHasRumbleTriggers) func (ctrl *Joystick) HasRumbleTriggers() bool { return C.SDL_JoystickHasRumbleTriggers(ctrl.cptr()) == C.SDL_TRUE } diff --git a/sdl/keyboard.go b/sdl/keyboard.go index 73196492..87534b86 100644 --- a/sdl/keyboard.go +++ b/sdl/keyboard.go @@ -41,7 +41,7 @@ import ( ) // Keysym contains key information used in key events. -// (https://wiki.libsdl.org/SDL_Keysym) +// (https://wiki.libsdl.org/SDL2/SDL_Keysym) type Keysym struct { Scancode Scancode // SDL physical key code Sym Keycode // SDL virtual key code @@ -50,13 +50,13 @@ type Keysym struct { } // GetKeyboardFocus returns the window which currently has keyboard focus. -// (https://wiki.libsdl.org/SDL_GetKeyboardFocus) +// (https://wiki.libsdl.org/SDL2/SDL_GetKeyboardFocus) func GetKeyboardFocus() *Window { return (*Window)(unsafe.Pointer(C.SDL_GetKeyboardFocus())) } // GetKeyboardState returns a snapshot of the current state of the keyboard. -// (https://wiki.libsdl.org/SDL_GetKeyboardState) +// (https://wiki.libsdl.org/SDL2/SDL_GetKeyboardState) func GetKeyboardState() []uint8 { var numkeys C.int start := C.SDL_GetKeyboardState(&numkeys) @@ -68,37 +68,37 @@ func GetKeyboardState() []uint8 { } // GetModState returns the current key modifier state for the keyboard. -// (https://wiki.libsdl.org/SDL_GetModState) +// (https://wiki.libsdl.org/SDL2/SDL_GetModState) func GetModState() Keymod { return (Keymod)(C.SDL_GetModState()) } // SetModState sets the current key modifier state for the keyboard. -// (https://wiki.libsdl.org/SDL_SetModState) +// (https://wiki.libsdl.org/SDL2/SDL_SetModState) func SetModState(mod Keymod) { C.SDL_SetModState(mod.c()) } // GetKeyFromScancode returns the key code corresponding to the given scancode according to the current keyboard layout. -// (https://wiki.libsdl.org/SDL_GetKeyFromScancode) +// (https://wiki.libsdl.org/SDL2/SDL_GetKeyFromScancode) func GetKeyFromScancode(code Scancode) Keycode { return (Keycode)(C.SDL_GetKeyFromScancode(code.c())) } // GetScancodeFromKey returns the scancode corresponding to the given key code according to the current keyboard layout. -// (https://wiki.libsdl.org/SDL_GetScancodeFromKey) +// (https://wiki.libsdl.org/SDL2/SDL_GetScancodeFromKey) func GetScancodeFromKey(code Keycode) Scancode { return (Scancode)(C.SDL_GetScancodeFromKey(code.c())) } // GetScancodeName returns a human-readable name for a scancode -// (https://wiki.libsdl.org/SDL_GetScancodeName) +// (https://wiki.libsdl.org/SDL2/SDL_GetScancodeName) func GetScancodeName(code Scancode) string { return (C.GoString)(C.SDL_GetScancodeName(code.c())) } // GetScancodeFromName returns a scancode from a human-readable name. -// (https://wiki.libsdl.org/SDL_GetScancodeFromName) +// (https://wiki.libsdl.org/SDL2/SDL_GetScancodeFromName) func GetScancodeFromName(name string) Scancode { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -106,13 +106,13 @@ func GetScancodeFromName(name string) Scancode { } // GetKeyName returns a human-readable name for a key. -// (https://wiki.libsdl.org/SDL_GetKeyName) +// (https://wiki.libsdl.org/SDL2/SDL_GetKeyName) func GetKeyName(code Keycode) string { return (C.GoString)(C.SDL_GetKeyName(code.c())) } // GetKeyFromName returns a key code from a human-readable name. -// (https://wiki.libsdl.org/SDL_GetKeyFromName) +// (https://wiki.libsdl.org/SDL2/SDL_GetKeyFromName) func GetKeyFromName(name string) Keycode { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -120,49 +120,49 @@ func GetKeyFromName(name string) Keycode { } // StartTextInput starts accepting Unicode text input events. -// (https://wiki.libsdl.org/SDL_StartTextInput) +// (https://wiki.libsdl.org/SDL2/SDL_StartTextInput) func StartTextInput() { C.SDL_StartTextInput() } // IsTextInputActive checks whether or not Unicode text input events are enabled. -// (https://wiki.libsdl.org/SDL_IsTextInputActive) +// (https://wiki.libsdl.org/SDL2/SDL_IsTextInputActive) func IsTextInputActive() bool { return C.SDL_IsTextInputActive() > 0 } // StopTextInput stops receiving any text input events. -// (https://wiki.libsdl.org/SDL_StopTextInput) +// (https://wiki.libsdl.org/SDL2/SDL_StopTextInput) func StopTextInput() { C.SDL_StopTextInput() } // SetTextInputRect sets the rectangle used to type Unicode text inputs. -// (https://wiki.libsdl.org/SDL_SetTextInputRect) +// (https://wiki.libsdl.org/SDL2/SDL_SetTextInputRect) func SetTextInputRect(rect *Rect) { C.SDL_SetTextInputRect(rect.cptr()) } // HasScreenKeyboardSupport reports whether the platform has some screen keyboard support. -// (https://wiki.libsdl.org/SDL_HasScreenKeyboardSupport) +// (https://wiki.libsdl.org/SDL2/SDL_HasScreenKeyboardSupport) func HasScreenKeyboardSupport() bool { return C.SDL_HasScreenKeyboardSupport() > 0 } // IsScreenKeyboardShown reports whether the screen keyboard is shown for given window. -// (https://wiki.libsdl.org/SDL_IsScreenKeyboardShown) +// (https://wiki.libsdl.org/SDL2/SDL_IsScreenKeyboardShown) func IsScreenKeyboardShown(window *Window) bool { return C.SDL_IsScreenKeyboardShown(window.cptr()) > 0 } // IsTextInputShown returns if an IME Composite or Candidate window is currently shown. -// (https://wiki.libsdl.org/SDL_IsTextInputShown) +// (https://wiki.libsdl.org/SDL2/SDL_IsTextInputShown) func IsTextInputShown() bool { return C.SDL_IsTextInputShown() > 0 } // ClearComposition dismisses the composition window/IME without disabling the subsystem. -// (https://wiki.libsdl.org/SDL_ClearComposition) +// (https://wiki.libsdl.org/SDL2/SDL_ClearComposition) func ClearComposition() { C.SDL_ClearComposition() } diff --git a/sdl/keycode.go b/sdl/keycode.go index f3c2931f..1f974183 100644 --- a/sdl/keycode.go +++ b/sdl/keycode.go @@ -6,7 +6,7 @@ import "C" const K_SCANCODE_MASK = 1 << 30 // The SDL virtual key representation. -// (https://wiki.libsdl.org/SDL_Keycode) +// (https://wiki.libsdl.org/SDL2/SDL_Keycode) // (https://wiki.libsdl.org/SDLKeycodeLookup) type Keycode C.SDL_Keycode @@ -265,7 +265,7 @@ const ( ) // An enumeration of key modifier masks. -// (https://wiki.libsdl.org/SDL_Keymod) +// (https://wiki.libsdl.org/SDL2/SDL_Keymod) type Keymod C.SDL_Keymod const ( diff --git a/sdl/loadso.go b/sdl/loadso.go index f58b3cb2..58e2fda4 100644 --- a/sdl/loadso.go +++ b/sdl/loadso.go @@ -8,7 +8,7 @@ import "unsafe" type SharedObject uintptr // LoadObject dynamically loads a shared object and returns a pointer to the object handle. -// (https://wiki.libsdl.org/SDL_LoadObject) +// (https://wiki.libsdl.org/SDL2/SDL_LoadObject) func LoadObject(sofile string) SharedObject { _sofile := C.CString(sofile) defer C.free(unsafe.Pointer(_sofile)) @@ -16,7 +16,7 @@ func LoadObject(sofile string) SharedObject { } // LoadFunction returns a pointer to the named function from the shared object. -// (https://wiki.libsdl.org/SDL_LoadFunction) +// (https://wiki.libsdl.org/SDL2/SDL_LoadFunction) func (handle SharedObject) LoadFunction(name string) unsafe.Pointer { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -24,7 +24,7 @@ func (handle SharedObject) LoadFunction(name string) unsafe.Pointer { } // Unload unloads a shared object from memory. -// (https://wiki.libsdl.org/SDL_UnloadObject) +// (https://wiki.libsdl.org/SDL2/SDL_UnloadObject) func (handle SharedObject) Unload() { C.SDL_UnloadObject((unsafe.Pointer)(handle)) } diff --git a/sdl/log.go b/sdl/log.go index 1c461c85..af8238bf 100644 --- a/sdl/log.go +++ b/sdl/log.go @@ -61,7 +61,7 @@ import ( ) // An enumeration of the predefined log categories. -// (https://wiki.libsdl.org/SDL_LOG_CATEGORY) +// (https://wiki.libsdl.org/SDL2/SDL_LOG_CATEGORY) type LogCategory C.SDL_LogCategory const ( @@ -88,7 +88,7 @@ const ( ) // An enumeration of the predefined log priorities. -// (https://wiki.libsdl.org/SDL_LogPriority) +// (https://wiki.libsdl.org/SDL2/SDL_LogPriority) type LogPriority C.SDL_LogPriority const ( @@ -106,31 +106,31 @@ func (p LogPriority) c() C.SDL_LogPriority { } // LogSetAllPriority sets the priority of all log categories. -// (https://wiki.libsdl.org/SDL_LogSetAllPriority) +// (https://wiki.libsdl.org/SDL2/SDL_LogSetAllPriority) func LogSetAllPriority(p LogPriority) { C.SDL_LogSetAllPriority(p.c()) } // LogSetPriority sets the priority of a particular log category. -// (https://wiki.libsdl.org/SDL_LogSetPriority) +// (https://wiki.libsdl.org/SDL2/SDL_LogSetPriority) func LogSetPriority(category LogCategory, p LogPriority) { C.SDL_LogSetPriority(C.int(category), p.c()) } // LogGetPriority returns the priority of a particular log category. -// (https://wiki.libsdl.org/SDL_LogGetPriority) +// (https://wiki.libsdl.org/SDL2/SDL_LogGetPriority) func LogGetPriority(category LogCategory) LogPriority { return LogPriority(C.SDL_LogGetPriority(C.int(category))) } // LogResetPriorities resets all priorities to default. -// (https://wiki.libsdl.org/SDL_LogResetPriorities) +// (https://wiki.libsdl.org/SDL2/SDL_LogResetPriorities) func LogResetPriorities() { C.SDL_LogResetPriorities() } // Log logs a message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO. -// (https://wiki.libsdl.org/SDL_Log) +// (https://wiki.libsdl.org/SDL2/SDL_Log) func Log(str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -141,7 +141,7 @@ func Log(str string, args ...interface{}) { } // LogVerbose logs a message with LOG_PRIORITY_VERBOSE. -// (https://wiki.libsdl.org/SDL_LogVerbose) +// (https://wiki.libsdl.org/SDL2/SDL_LogVerbose) func LogVerbose(category LogCategory, str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -152,7 +152,7 @@ func LogVerbose(category LogCategory, str string, args ...interface{}) { } // LogDebug logs a message with LOG_PRIORITY_DEBUG. -// (https://wiki.libsdl.org/SDL_LogDebug) +// (https://wiki.libsdl.org/SDL2/SDL_LogDebug) func LogDebug(category LogCategory, str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -163,7 +163,7 @@ func LogDebug(category LogCategory, str string, args ...interface{}) { } // LogInfo logs a message with LOG_PRIORITY_INFO. -// (https://wiki.libsdl.org/SDL_LogInfo) +// (https://wiki.libsdl.org/SDL2/SDL_LogInfo) func LogInfo(category LogCategory, str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -174,7 +174,7 @@ func LogInfo(category LogCategory, str string, args ...interface{}) { } // LogWarn logs a message with LOG_PRIORITY_WARN. -// (https://wiki.libsdl.org/SDL_LogWarn) +// (https://wiki.libsdl.org/SDL2/SDL_LogWarn) func LogWarn(category LogCategory, str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -185,7 +185,7 @@ func LogWarn(category LogCategory, str string, args ...interface{}) { } // LogError logs a message with LOG_PRIORITY_ERROR. -// (https://wiki.libsdl.org/SDL_LogError) +// (https://wiki.libsdl.org/SDL2/SDL_LogError) func LogError(category LogCategory, str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -196,7 +196,7 @@ func LogError(category LogCategory, str string, args ...interface{}) { } // LogCritical logs a message with LOG_PRIORITY_CRITICAL. -// (https://wiki.libsdl.org/SDL_LogCritical) +// (https://wiki.libsdl.org/SDL2/SDL_LogCritical) func LogCritical(category LogCategory, str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -207,7 +207,7 @@ func LogCritical(category LogCategory, str string, args ...interface{}) { } // LogMessage logs a message with the specified category and priority. -// (https://wiki.libsdl.org/SDL_LogMessage) +// (https://wiki.libsdl.org/SDL2/SDL_LogMessage) func LogMessage(category LogCategory, pri LogPriority, str string, args ...interface{}) { str = fmt.Sprintf(str, args...) @@ -240,13 +240,13 @@ var ( ) // LogGetOutputFunction returns the current log output function. -// (https://wiki.libsdl.org/SDL_LogGetOutputFunction) +// (https://wiki.libsdl.org/SDL2/SDL_LogGetOutputFunction) func LogGetOutputFunction() (LogOutputFunction, interface{}) { return logOutputFunctionCache, logOutputDataCache } // LogSetOutputFunction replaces the default log output function with one of your own. -// (https://wiki.libsdl.org/SDL_LogSetOutputFunction) +// (https://wiki.libsdl.org/SDL2/SDL_LogSetOutputFunction) func LogSetOutputFunction(f LogOutputFunction, data interface{}) { ctx := &logOutputFunctionCtx{ f: f, diff --git a/sdl/metal.go b/sdl/metal.go index ac6f1f3f..a7024f9b 100644 --- a/sdl/metal.go +++ b/sdl/metal.go @@ -50,25 +50,25 @@ import "unsafe" type MetalView C.SDL_MetalView // Metal_CreateView creates a CAMetalLayer-backed NSView/UIView and attach it to the specified window. -// (https://wiki.libsdl.org/SDL_Metal_CreateView) +// (https://wiki.libsdl.org/SDL2/SDL_Metal_CreateView) func Metal_CreateView(window *Window) MetalView { return MetalView(C.SDL_Metal_CreateView(window.cptr())) } // Metal_DestroyView Destroy an existing SDL_MetalView object. -// (https://wiki.libsdl.org/SDL_Metal_DestroyView) +// (https://wiki.libsdl.org/SDL2/SDL_Metal_DestroyView) func Metal_DestroyView(metalView MetalView) { C.SDL_Metal_DestroyView(C.SDL_MetalView(metalView)) } // Metal_GetLayer gets a pointer to the backing CAMetalLayer for the given view. -// (https://wiki.libsdl.org/SDL_Metal_GetLayer) +// (https://wiki.libsdl.org/SDL2/SDL_Metal_GetLayer) func Metal_GetLayer(metalView MetalView) unsafe.Pointer { return C.SDL_Metal_GetLayer(C.SDL_MetalView(metalView)) } // Metal_GetDrawableSize Get the size of a window's underlying drawable in pixels (for use with setting viewport, scissor & etc). -// (https://wiki.libsdl.org/SDL_Metal_GetDrawableSize) +// (https://wiki.libsdl.org/SDL2/SDL_Metal_GetDrawableSize) func Metal_GetDrawableSize(window *Window) (w, h int) { C.SDL_Metal_GetDrawableSize(window.cptr(), (*C.int)(unsafe.Pointer(&w)), (*C.int)(unsafe.Pointer((&h)))) return diff --git a/sdl/misc.go b/sdl/misc.go index 9d943167..0f372e0b 100644 --- a/sdl/misc.go +++ b/sdl/misc.go @@ -20,7 +20,7 @@ import "C" import "unsafe" // OpenURL opens an URL / URI in the browser or other -// (https://wiki.libsdl.org/SDL_OpenURL) +// (https://wiki.libsdl.org/SDL2/SDL_OpenURL) func OpenURL(url string) error { _url := C.CString(url) defer C.free(unsafe.Pointer(_url)) diff --git a/sdl/mouse.go b/sdl/mouse.go index 7c5c4670..864c2e95 100644 --- a/sdl/mouse.go +++ b/sdl/mouse.go @@ -59,7 +59,7 @@ import "C" import "unsafe" // Cursor types for CreateSystemCursor() -// (https://wiki.libsdl.org/SDL_SystemCursor) +// (https://wiki.libsdl.org/SDL2/SDL_SystemCursor) type SystemCursor C.SDL_SystemCursor const ( @@ -126,13 +126,13 @@ func (c SystemCursor) c() C.SDL_SystemCursor { } // GetMouseFocus returns the window which currently has mouse focus. -// (https://wiki.libsdl.org/SDL_GetMouseFocus) +// (https://wiki.libsdl.org/SDL2/SDL_GetMouseFocus) func GetMouseFocus() *Window { return (*Window)(unsafe.Pointer(C.SDL_GetMouseFocus())) } // GetGlobalMouseState returns the current state of the mouse. -// (https://wiki.libsdl.org/SDL_GetGlobalMouseState) +// (https://wiki.libsdl.org/SDL2/SDL_GetGlobalMouseState) func GetGlobalMouseState() (x, y int32, state ButtonMask) { var _x, _y C.int _state := ButtonMask(C.SDL_GetGlobalMouseState(&_x, &_y)) @@ -140,7 +140,7 @@ func GetGlobalMouseState() (x, y int32, state ButtonMask) { } // GetMouseState returns the current state of the mouse. -// (https://wiki.libsdl.org/SDL_GetMouseState) +// (https://wiki.libsdl.org/SDL2/SDL_GetMouseState) func GetMouseState() (x, y int32, state ButtonMask) { var _x, _y C.int _state := ButtonMask(C.SDL_GetMouseState(&_x, &_y)) @@ -148,7 +148,7 @@ func GetMouseState() (x, y int32, state ButtonMask) { } // GetRelativeMouseState returns the relative state of the mouse. -// (https://wiki.libsdl.org/SDL_GetRelativeMouseState) +// (https://wiki.libsdl.org/SDL2/SDL_GetRelativeMouseState) func GetRelativeMouseState() (x, y int32, state ButtonMask) { var _x, _y C.int _state := ButtonMask(C.SDL_GetRelativeMouseState(&_x, &_y)) @@ -156,25 +156,25 @@ func GetRelativeMouseState() (x, y int32, state ButtonMask) { } // WarpMouseInWindow moves the mouse to the given position within the window. -// (https://wiki.libsdl.org/SDL_WarpMouseInWindow) +// (https://wiki.libsdl.org/SDL2/SDL_WarpMouseInWindow) func (window *Window) WarpMouseInWindow(x, y int32) { C.SDL_WarpMouseInWindow(window.cptr(), C.int(x), C.int(y)) } // SetRelativeMouseMode sets relative mouse mode. -// (https://wiki.libsdl.org/SDL_SetRelativeMouseMode) +// (https://wiki.libsdl.org/SDL2/SDL_SetRelativeMouseMode) func SetRelativeMouseMode(enabled bool) int { return int(C.SDL_SetRelativeMouseMode(C.SDL_bool(Btoi(enabled)))) } // GetRelativeMouseMode reports where relative mouse mode is enabled. -// (https://wiki.libsdl.org/SDL_GetRelativeMouseMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetRelativeMouseMode) func GetRelativeMouseMode() bool { return C.SDL_GetRelativeMouseMode() > 0 } // CreateCursor creates a cursor using the specified bitmap data and mask (in MSB format). -// (https://wiki.libsdl.org/SDL_CreateCursor) +// (https://wiki.libsdl.org/SDL2/SDL_CreateCursor) func CreateCursor(data, mask *uint8, w, h, hotX, hotY int32) *Cursor { _data := (*C.Uint8)(unsafe.Pointer(data)) _mask := (*C.Uint8)(unsafe.Pointer(mask)) @@ -182,50 +182,50 @@ func CreateCursor(data, mask *uint8, w, h, hotX, hotY int32) *Cursor { } // CreateColorCursor creates a color cursor. -// (https://wiki.libsdl.org/SDL_CreateColorCursor) +// (https://wiki.libsdl.org/SDL2/SDL_CreateColorCursor) func CreateColorCursor(surface *Surface, hotX, hotY int32) *Cursor { return (*Cursor)(C.SDL_CreateColorCursor(surface.cptr(), C.int(hotX), C.int(hotY))) } // CreateSystemCursor creates a system cursor. -// (https://wiki.libsdl.org/SDL_CreateSystemCursor) +// (https://wiki.libsdl.org/SDL2/SDL_CreateSystemCursor) func CreateSystemCursor(id SystemCursor) *Cursor { return (*Cursor)(C.SDL_CreateSystemCursor(id.c())) } // SetCursor sets the active cursor. -// (https://wiki.libsdl.org/SDL_SetCursor) +// (https://wiki.libsdl.org/SDL2/SDL_SetCursor) func SetCursor(cursor *Cursor) { C.SDL_SetCursor(cursor.cptr()) } // GetCursor returns the active cursor. -// (https://wiki.libsdl.org/SDL_GetCursor) +// (https://wiki.libsdl.org/SDL2/SDL_GetCursor) func GetCursor() *Cursor { return (*Cursor)(C.SDL_GetCursor()) } // GetDefaultCursor returns the default cursor. -// (https://wiki.libsdl.org/SDL_GetDefaultCursor) +// (https://wiki.libsdl.org/SDL2/SDL_GetDefaultCursor) func GetDefaultCursor() *Cursor { return (*Cursor)(C.SDL_GetDefaultCursor()) } // FreeCursor frees a cursor created with CreateCursor(), CreateColorCursor() or CreateSystemCursor(). -// (https://wiki.libsdl.org/SDL_FreeCursor) +// (https://wiki.libsdl.org/SDL2/SDL_FreeCursor) func FreeCursor(cursor *Cursor) { C.SDL_FreeCursor(cursor.cptr()) } // ShowCursor toggles whether or not the cursor is shown. -// (https://wiki.libsdl.org/SDL_ShowCursor) +// (https://wiki.libsdl.org/SDL2/SDL_ShowCursor) func ShowCursor(toggle EventStateConstant) (int, error) { i := int(C.SDL_ShowCursor(C.int(toggle))) return i, errorFromInt(i) } // CaptureMouse captures the mouse and tracks input outside an SDL window. -// (https://wiki.libsdl.org/SDL_CaptureMouse) +// (https://wiki.libsdl.org/SDL2/SDL_CaptureMouse) func CaptureMouse(toggle bool) error { var ierr C.int if toggle { @@ -240,7 +240,7 @@ func CaptureMouse(toggle bool) error { } // WarpMouseGlobal moves the mouse to the given position in global screen space. -// (https://wiki.libsdl.org/SDL_WarpMouseGlobal) +// (https://wiki.libsdl.org/SDL2/SDL_WarpMouseGlobal) func WarpMouseGlobal(x, y int32) error { i := int(C.SDL_WarpMouseGlobal(C.int(x), C.int(y))) return errorFromInt(i) diff --git a/sdl/mutex.go b/sdl/mutex.go index dacc6de3..461d8671 100644 --- a/sdl/mutex.go +++ b/sdl/mutex.go @@ -44,7 +44,7 @@ func (c *Cond) cptr() *C.SDL_cond { } // CreateMutex creates a new mutex. -// (https://wiki.libsdl.org/SDL_CreateMutex) +// (https://wiki.libsdl.org/SDL2/SDL_CreateMutex) func CreateMutex() (*Mutex, error) { mutex := C.SDL_CreateMutex() if mutex == nil { @@ -54,7 +54,7 @@ func CreateMutex() (*Mutex, error) { } // Lock locks a mutex created with CreateMutex(). -// (https://wiki.libsdl.org/SDL_LockMutex) +// (https://wiki.libsdl.org/SDL2/SDL_LockMutex) func (mutex *Mutex) Lock() error { ret := int(C.SDL_LockMutex(mutex.cptr())) if ret != 0 { @@ -64,7 +64,7 @@ func (mutex *Mutex) Lock() error { } // TryLock tries to lock a mutex without blocking. -// (https://wiki.libsdl.org/SDL_TryLockMutex) +// (https://wiki.libsdl.org/SDL2/SDL_TryLockMutex) func (mutex *Mutex) TryLock() error { ret := int(C.SDL_TryLockMutex(mutex.cptr())) if ret != 0 { @@ -74,7 +74,7 @@ func (mutex *Mutex) TryLock() error { } // Unlock unlocks a mutex created with CreateMutex(). -// (https://wiki.libsdl.org/SDL_UnlockMutex) +// (https://wiki.libsdl.org/SDL2/SDL_UnlockMutex) func (mutex *Mutex) Unlock() error { ret := int(C.SDL_UnlockMutex(mutex.cptr())) if ret != 0 { @@ -84,13 +84,13 @@ func (mutex *Mutex) Unlock() error { } // Destroy destroys a mutex created with CreateMutex(). -// (https://wiki.libsdl.org/SDL_DestroyMutex) +// (https://wiki.libsdl.org/SDL2/SDL_DestroyMutex) func (mutex *Mutex) Destroy() { C.SDL_DestroyMutex(mutex.cptr()) } // CreateSemaphore creates a semaphore. -// (https://wiki.libsdl.org/SDL_CreateSemaphore) +// (https://wiki.libsdl.org/SDL2/SDL_CreateSemaphore) func CreateSemaphore(initialValue uint32) (*Sem, error) { sem := C.SDL_CreateSemaphore(C.Uint32(initialValue)) if sem == nil { @@ -100,13 +100,13 @@ func CreateSemaphore(initialValue uint32) (*Sem, error) { } // Destroy destroys a semaphore. -// (https://wiki.libsdl.org/SDL_DestroySemaphore) +// (https://wiki.libsdl.org/SDL2/SDL_DestroySemaphore) func (sem *Sem) Destroy() { C.SDL_DestroySemaphore(sem.cptr()) } // Wait waits until a semaphore has a positive value and then decrements it. -// (https://wiki.libsdl.org/SDL_SemWait) +// (https://wiki.libsdl.org/SDL2/SDL_SemWait) func (sem *Sem) Wait() error { ret := int(C.SDL_SemWait(sem.cptr())) if ret != 0 { @@ -116,7 +116,7 @@ func (sem *Sem) Wait() error { } // TryWait sees if a semaphore has a positive value and decrement it if it does. -// (https://wiki.libsdl.org/SDL_SemTryWait) +// (https://wiki.libsdl.org/SDL2/SDL_SemTryWait) func (sem *Sem) TryWait() error { ret := int(C.SDL_SemTryWait(sem.cptr())) if ret != 0 { @@ -126,7 +126,7 @@ func (sem *Sem) TryWait() error { } // WaitTimeout waits until a semaphore has a positive value and then decrements it. -// (https://wiki.libsdl.org/SDL_SemWaitTimeout) +// (https://wiki.libsdl.org/SDL2/SDL_SemWaitTimeout) func (sem *Sem) WaitTimeout(ms uint32) error { ret := int(C.SDL_SemWaitTimeout(sem.cptr(), C.Uint32(ms))) if ret != 0 { @@ -136,7 +136,7 @@ func (sem *Sem) WaitTimeout(ms uint32) error { } // Post atomically increments a semaphore's value and wake waiting threads. -// (https://wiki.libsdl.org/SDL_SemPost) +// (https://wiki.libsdl.org/SDL2/SDL_SemPost) func (sem *Sem) Post() error { ret := int(C.SDL_SemPost(sem.cptr())) if ret != 0 { @@ -146,24 +146,24 @@ func (sem *Sem) Post() error { } // Value returns the current value of a semaphore. -// (https://wiki.libsdl.org/SDL_SemValue) +// (https://wiki.libsdl.org/SDL2/SDL_SemValue) func (sem *Sem) Value() uint32 { return uint32(C.SDL_SemValue(sem.cptr())) } -// CreateCond (https://wiki.libsdl.org/SDL_CreateCond) +// CreateCond (https://wiki.libsdl.org/SDL2/SDL_CreateCond) func CreateCond() *Cond { return (*Cond)(unsafe.Pointer(C.SDL_CreateCond())) } // Destroy creates a condition variable. -// (https://wiki.libsdl.org/SDL_DestroyCond) +// (https://wiki.libsdl.org/SDL2/SDL_DestroyCond) func (cond *Cond) Destroy() { C.SDL_DestroyCond(cond.cptr()) } // Signal restarts one of the threads that are waiting on the condition variable. -// (https://wiki.libsdl.org/SDL_CondSignal) +// (https://wiki.libsdl.org/SDL2/SDL_CondSignal) func (cond *Cond) Signal() error { ret := int(C.SDL_CondSignal(cond.cptr())) if ret != 0 { @@ -173,7 +173,7 @@ func (cond *Cond) Signal() error { } // Broadcast restarts all threads that are waiting on the condition variable. -// (https://wiki.libsdl.org/SDL_CondBroadcast) +// (https://wiki.libsdl.org/SDL2/SDL_CondBroadcast) func (cond *Cond) Broadcast() error { ret := int(C.SDL_CondBroadcast(cond.cptr())) if ret != 0 { @@ -183,7 +183,7 @@ func (cond *Cond) Broadcast() error { } // Wait waits until a condition variable is signaled. -// (https://wiki.libsdl.org/SDL_CondWait) +// (https://wiki.libsdl.org/SDL2/SDL_CondWait) func (cond *Cond) Wait(mutex *Mutex) error { ret := int(C.SDL_CondWait(cond.cptr(), mutex.cptr())) if ret != 0 { @@ -193,7 +193,7 @@ func (cond *Cond) Wait(mutex *Mutex) error { } // WaitTimeout waits until a condition variable is signaled or a specified amount of time has passed. -// (https://wiki.libsdl.org/SDL_CondWaitTimeout) +// (https://wiki.libsdl.org/SDL2/SDL_CondWaitTimeout) func (cond *Cond) WaitTimeout(mutex *Mutex, ms uint32) error { ret := int(C.SDL_CondWaitTimeout(cond.cptr(), mutex.cptr(), C.Uint32(ms))) if ret != 0 { diff --git a/sdl/pixels.go b/sdl/pixels.go index 2acf15c9..ac22b21d 100644 --- a/sdl/pixels.go +++ b/sdl/pixels.go @@ -48,10 +48,10 @@ import ( ) // PixelFormat contains pixel format information. -// (https://wiki.libsdl.org/SDL_PixelFormat) +// (https://wiki.libsdl.org/SDL2/SDL_PixelFormat) type PixelFormat struct { - Format PixelFormatConstant // one of the PIXELFORMAT values (https://wiki.libsdl.org/SDL_PixelFormatEnum) - Palette *Palette // palette structure associated with this pixel format, or nil if the format doesn't have a palette (https://wiki.libsdl.org/SDL_Palette) + Format PixelFormatConstant // one of the PIXELFORMAT values (https://wiki.libsdl.org/SDL2/SDL_PixelFormatEnum) + Palette *Palette // palette structure associated with this pixel format, or nil if the format doesn't have a palette (https://wiki.libsdl.org/SDL2/SDL_Palette) BitsPerPixel uint8 // the number of significant bits in a pixel value, eg: 8, 15, 16, 24, 32 BytesPerPixel uint8 // the number of bytes required to hold a pixel value, eg: 1, 2, 3, 4 _ [2]uint8 // padding @@ -73,17 +73,17 @@ type PixelFormat struct { type cPixelFormat C.SDL_PixelFormat // Palette contains palette information. -// (https://wiki.libsdl.org/SDL_Palette) +// (https://wiki.libsdl.org/SDL2/SDL_Palette) type Palette struct { Ncolors int32 // the number of colors in the palette - Colors *Color // an array of Color structures representing the palette (https://wiki.libsdl.org/SDL_Color) + Colors *Color // an array of Color structures representing the palette (https://wiki.libsdl.org/SDL2/SDL_Color) version uint32 // incrementally tracks changes to the palette (internal use) refCount int32 // reference count (internal use) } type cPalette C.SDL_Palette // Color represents a color. This implements image/color.Color interface. -// (https://wiki.libsdl.org/SDL_Color) +// (https://wiki.libsdl.org/SDL2/SDL_Color) type Color color.NRGBA // Uint32 return uint32 representation of RGBA color. @@ -233,13 +233,13 @@ func (palette *Palette) cptr() *C.SDL_Palette { */ // GetPixelFormatName returns the human readable name of a pixel format. -// (https://wiki.libsdl.org/SDL_GetPixelFormatName) +// (https://wiki.libsdl.org/SDL2/SDL_GetPixelFormatName) func GetPixelFormatName(format uint) string { return C.GoString(C.SDL_GetPixelFormatName(C.Uint32(format))) } // PixelFormatEnumToMasks converts one of the enumerated pixel formats to a bpp value and RGBA masks. -// (https://wiki.libsdl.org/SDL_PixelFormatEnumToMasks) +// (https://wiki.libsdl.org/SDL2/SDL_PixelFormatEnumToMasks) func PixelFormatEnumToMasks(format uint) (bpp int, rmask, gmask, bmask, amask uint32, err error) { result := C.SDL_PixelFormatEnumToMasks(C.Uint32(format), (*C.int)(unsafe.Pointer(&bpp)), (*C.Uint32)(&rmask), (*C.Uint32)(&gmask), (*C.Uint32)(&bmask), @@ -251,14 +251,14 @@ func PixelFormatEnumToMasks(format uint) (bpp int, rmask, gmask, bmask, amask ui } // MasksToPixelFormatEnum converts a bpp value and RGBA masks to an enumerated pixel format. -// (https://wiki.libsdl.org/SDL_MasksToPixelFormatEnum) +// (https://wiki.libsdl.org/SDL2/SDL_MasksToPixelFormatEnum) func MasksToPixelFormatEnum(bpp int, rmask, gmask, bmask, amask uint32) uint { return uint(C.SDL_MasksToPixelFormatEnum(C.int(bpp), C.Uint32(rmask), C.Uint32(gmask), C.Uint32(bmask), C.Uint32(amask))) } // AllocFormat creates a PixelFormat structure corresponding to a pixel format. -// (https://wiki.libsdl.org/SDL_AllocFormat) +// (https://wiki.libsdl.org/SDL2/SDL_AllocFormat) func AllocFormat(format PixelFormatConstant) (*PixelFormat, error) { r := (*PixelFormat)(unsafe.Pointer(C.SDL_AllocFormat(C.Uint32(format)))) if r == nil { @@ -268,13 +268,13 @@ func AllocFormat(format PixelFormatConstant) (*PixelFormat, error) { } // Free frees the PixelFormat structure allocated by AllocFormat(). -// (https://wiki.libsdl.org/SDL_FreeFormat) +// (https://wiki.libsdl.org/SDL2/SDL_FreeFormat) func (format *PixelFormat) Free() { C.SDL_FreeFormat((*C.SDL_PixelFormat)(unsafe.Pointer(format))) } // AllocPalette creates a palette structure with the specified number of color entries. -// (https://wiki.libsdl.org/SDL_AllocPalette) +// (https://wiki.libsdl.org/SDL2/SDL_AllocPalette) func AllocPalette(ncolors int) (*Palette, error) { r := (*Palette)(unsafe.Pointer(C.SDL_AllocPalette(C.int(ncolors)))) if r == nil { @@ -284,7 +284,7 @@ func AllocPalette(ncolors int) (*Palette, error) { } // SetPalette sets the palette for the pixel format structure. -// (https://wiki.libsdl.org/SDL_SetPixelFormatPalette) +// (https://wiki.libsdl.org/SDL2/SDL_SetPixelFormatPalette) func (format *PixelFormat) SetPalette(palette *Palette) error { r := C.SDL_SetPixelFormatPalette((*C.SDL_PixelFormat)(unsafe.Pointer(format)), (*C.SDL_Palette)(unsafe.Pointer(palette))) @@ -295,7 +295,7 @@ func (format *PixelFormat) SetPalette(palette *Palette) error { } // SetColors sets a range of colors in the palette. -// (https://wiki.libsdl.org/SDL_SetPaletteColors) +// (https://wiki.libsdl.org/SDL2/SDL_SetPaletteColors) func (palette *Palette) SetColors(colors []Color) error { if colors == nil { return nil @@ -314,27 +314,27 @@ func (palette *Palette) SetColors(colors []Color) error { } // Free frees the palette created with AllocPalette(). -// (https://wiki.libsdl.org/SDL_FreePalette) +// (https://wiki.libsdl.org/SDL2/SDL_FreePalette) func (palette *Palette) Free() { C.SDL_FreePalette((*C.SDL_Palette)(unsafe.Pointer(palette))) } // MapRGB maps an RGB triple to an opaque pixel value for a given pixel format. -// (https://wiki.libsdl.org/SDL_MapRGB) +// (https://wiki.libsdl.org/SDL2/SDL_MapRGB) func MapRGB(format *PixelFormat, r, g, b uint8) uint32 { return uint32(C.SDL_MapRGB((*C.SDL_PixelFormat)(unsafe.Pointer(format)), C.Uint8(r), C.Uint8(g), C.Uint8(b))) } // MapRGBA maps an RGBA quadruple to a pixel value for a given pixel format. -// (https://wiki.libsdl.org/SDL_MapRGBA) +// (https://wiki.libsdl.org/SDL2/SDL_MapRGBA) func MapRGBA(format *PixelFormat, r, g, b, a uint8) uint32 { return uint32(C.SDL_MapRGBA((*C.SDL_PixelFormat)(unsafe.Pointer(format)), C.Uint8(r), C.Uint8(g), C.Uint8(b), C.Uint8(a))) } // GetRGB returns RGB values from a pixel in the specified format. -// (https://wiki.libsdl.org/SDL_GetRGB) +// (https://wiki.libsdl.org/SDL2/SDL_GetRGB) func GetRGB(pixel uint32, format *PixelFormat) (r, g, b uint8) { C.SDL_GetRGB(C.Uint32(pixel), (*C.SDL_PixelFormat)(unsafe.Pointer(format)), (*C.Uint8)(&r), (*C.Uint8)(&g), (*C.Uint8)(&b)) @@ -342,7 +342,7 @@ func GetRGB(pixel uint32, format *PixelFormat) (r, g, b uint8) { } // GetRGBA returns RGBA values from a pixel in the specified format. -// (https://wiki.libsdl.org/SDL_GetRGBA) +// (https://wiki.libsdl.org/SDL2/SDL_GetRGBA) func GetRGBA(pixel uint32, format *PixelFormat) (r, g, b, a uint8) { C.SDL_GetRGBA(C.Uint32(pixel), (*C.SDL_PixelFormat)(unsafe.Pointer(format)), (*C.Uint8)(&r), (*C.Uint8)(&g), (*C.Uint8)(&b), (*C.Uint8)(&a)) @@ -350,7 +350,7 @@ func GetRGBA(pixel uint32, format *PixelFormat) (r, g, b, a uint8) { } // CalculateGammaRamp calculates a 256 entry gamma ramp for a gamma value. -// (https://wiki.libsdl.org/SDL_CalculateGammaRamp) +// (https://wiki.libsdl.org/SDL2/SDL_CalculateGammaRamp) func CalculateGammaRamp(gamma float32, ramp *[256]uint16) { C.SDL_CalculateGammaRamp(C.float(gamma), (*C.Uint16)(unsafe.Pointer(&ramp[0]))) } diff --git a/sdl/power.go b/sdl/power.go index 52f395bf..edab879e 100644 --- a/sdl/power.go +++ b/sdl/power.go @@ -4,7 +4,7 @@ package sdl import "C" // An enumeration of the basic state of the system's power supply. -// (https://wiki.libsdl.org/SDL_PowerState) +// (https://wiki.libsdl.org/SDL2/SDL_PowerState) type PowerState C.SDL_PowerState const ( @@ -16,7 +16,7 @@ const ( ) // GetPowerInfo returns the current power supply details. -// (https://wiki.libsdl.org/SDL_GetPowerInfo) +// (https://wiki.libsdl.org/SDL2/SDL_GetPowerInfo) func GetPowerInfo() (PowerState, int, int) { _secs := C.int(0) _percent := C.int(0) diff --git a/sdl/rect.go b/sdl/rect.go index e57935d1..ff7b33c4 100644 --- a/sdl/rect.go +++ b/sdl/rect.go @@ -8,14 +8,14 @@ import ( ) // Point defines a two dimensional point. -// (https://wiki.libsdl.org/SDL_Point) +// (https://wiki.libsdl.org/SDL2/SDL_Point) type Point struct { X int32 // the x coordinate of the point Y int32 // the y coordinate of the point } // Rect contains the definition of a rectangle, with the origin at the upper left. -// (https://wiki.libsdl.org/SDL_Rect) +// (https://wiki.libsdl.org/SDL2/SDL_Rect) type Rect struct { X int32 // the x location of the rectangle's upper left corner Y int32 // the y location of the rectangle's upper left corner @@ -24,14 +24,14 @@ type Rect struct { } // FPoint defines a two dimensional point. -// (https://wiki.libsdl.org/SDL_FPoint) +// (https://wiki.libsdl.org/SDL2/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. -// (https://wiki.libsdl.org/SDL_FRect) +// (https://wiki.libsdl.org/SDL2/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 @@ -56,7 +56,7 @@ func (a *FRect) cptr() *C.SDL_FRect { } // InRect reports whether the point resides inside a rectangle. -// (https://wiki.libsdl.org/SDL_PointInRect) +// (https://wiki.libsdl.org/SDL2/SDL_PointInRect) func (p *Point) InRect(r *Rect) bool { if (p.X >= r.X) && (p.X < (r.X + r.W)) && (p.Y >= r.Y) && (p.Y < (r.Y + r.H)) { @@ -66,7 +66,7 @@ func (p *Point) InRect(r *Rect) bool { } // InRect reports whether the point resides inside a rectangle. -// (https://wiki.libsdl.org/SDL_PointInRect) +// (https://wiki.libsdl.org/SDL2/SDL_PointInRect) func (p *FPoint) InRect(r *FRect) bool { if (p.X >= r.X) && (p.X < (r.X + r.W)) && (p.Y >= r.Y) && (p.Y < (r.Y + r.H)) { @@ -76,13 +76,13 @@ func (p *FPoint) InRect(r *FRect) bool { } // Empty reports whether a rectangle has no area. -// (https://wiki.libsdl.org/SDL_RectEmpty) +// (https://wiki.libsdl.org/SDL2/SDL_RectEmpty) func (a *Rect) Empty() bool { return a == nil || a.W <= 0 || a.H <= 0 } // Equals reports whether two rectangles are equal. -// (https://wiki.libsdl.org/SDL_RectEquals) +// (https://wiki.libsdl.org/SDL2/SDL_RectEquals) func (a *Rect) Equals(b *Rect) bool { if (a != nil) && (b != nil) && (a.X == b.X) && (a.Y == b.Y) && @@ -93,7 +93,7 @@ func (a *Rect) Equals(b *Rect) bool { } // HasIntersection reports whether two rectangles intersect. -// (https://wiki.libsdl.org/SDL_HasIntersection) +// (https://wiki.libsdl.org/SDL2/SDL_HasIntersection) func (a *Rect) HasIntersection(b *Rect) bool { if a == nil || b == nil { return false @@ -112,7 +112,7 @@ func (a *Rect) HasIntersection(b *Rect) bool { } // Intersect calculates the intersection of two rectangles. -// (https://wiki.libsdl.org/SDL_IntersectRect) +// (https://wiki.libsdl.org/SDL2/SDL_IntersectRect) func (a *Rect) Intersect(b *Rect) (Rect, bool) { var result Rect @@ -157,7 +157,7 @@ func (a *Rect) Intersect(b *Rect) (Rect, bool) { } // Union calculates the union of two rectangles. -// (https://wiki.libsdl.org/SDL_UnionRect) +// (https://wiki.libsdl.org/SDL2/SDL_UnionRect) func (a *Rect) Union(b *Rect) Rect { var result Rect @@ -204,13 +204,13 @@ func (a *Rect) Union(b *Rect) Rect { } // Empty reports whether a rectangle has no area. -// (https://wiki.libsdl.org/SDL_RectEmpty) +// (https://wiki.libsdl.org/SDL2/SDL_RectEmpty) func (a *FRect) Empty() bool { return a == nil || a.W <= 0 || a.H <= 0 } // Equals reports whether two rectangles are equal. -// (https://wiki.libsdl.org/SDL_RectEquals) +// (https://wiki.libsdl.org/SDL2/SDL_RectEquals) func (a *FRect) Equals(b *FRect) bool { if (a != nil) && (b != nil) && (a.X == b.X) && (a.Y == b.Y) && @@ -221,7 +221,7 @@ func (a *FRect) Equals(b *FRect) bool { } // EqualsEpsilon returns true if the two rectangles are equal, within some given epsilon. -// (https://wiki.libsdl.org/SDL_FRectEqualsEpsilon) +// (https://wiki.libsdl.org/SDL2/SDL_FRectEqualsEpsilon) func (a *FRect) EqualsEpsilon(b *FRect, epsilon float32) bool { if (a != nil) && (b != nil) && (a == b || (float32(math.Abs(float64(a.X-b.X))) <= epsilon) && @@ -234,7 +234,7 @@ func (a *FRect) EqualsEpsilon(b *FRect, epsilon float32) bool { } // HasIntersection reports whether two rectangles intersect. -// (https://wiki.libsdl.org/SDL_HasIntersection) +// (https://wiki.libsdl.org/SDL2/SDL_HasIntersection) func (a *FRect) HasIntersection(b *FRect) bool { if a == nil || b == nil { return false @@ -253,7 +253,7 @@ func (a *FRect) HasIntersection(b *FRect) bool { } // Intersect calculates the intersection of two rectangles. -// (https://wiki.libsdl.org/SDL_IntersectRect) +// (https://wiki.libsdl.org/SDL2/SDL_IntersectRect) func (a *FRect) Intersect(b *FRect) (FRect, bool) { var result FRect @@ -298,7 +298,7 @@ func (a *FRect) Intersect(b *FRect) (FRect, bool) { } // Union calculates the union of two rectangles. -// (https://wiki.libsdl.org/SDL_UnionRect) +// (https://wiki.libsdl.org/SDL2/SDL_UnionRect) func (a *FRect) Union(b *FRect) FRect { var result FRect @@ -345,7 +345,7 @@ func (a *FRect) Union(b *FRect) FRect { } // EnclosePoints calculates a minimal rectangle that encloses a set of points. -// (https://wiki.libsdl.org/SDL_EnclosePoints) +// (https://wiki.libsdl.org/SDL2/SDL_EnclosePoints) func EnclosePoints(points []Point, clip *Rect) (Rect, bool) { var result Rect @@ -427,7 +427,7 @@ func EnclosePoints(points []Point, clip *Rect) (Rect, bool) { } // EncloseFPoints calculates a minimal rectangle that encloses a set of points with float precision. -// (https://wiki.libsdl.org/SDL_EncloseFPoints) +// (https://wiki.libsdl.org/SDL2/SDL_EncloseFPoints) func EncloseFPoints(points []FPoint, clip *FRect) (result FRect, enclosed bool) { if len(points) == 0 { return result, false @@ -546,7 +546,7 @@ func computeFOutCode(rect *FRect, x, y float32) int { } // IntersectLine calculates the intersection of a rectangle and a line segment. -// (https://wiki.libsdl.org/SDL_IntersectRectAndLine) +// (https://wiki.libsdl.org/SDL2/SDL_IntersectRectAndLine) func (a *Rect) IntersectLine(X1, Y1, X2, Y2 *int32) bool { if a.Empty() { return false @@ -663,7 +663,7 @@ func (a *Rect) IntersectLine(X1, Y1, X2, Y2 *int32) bool { } // IntersectLine calculates the intersection of a rectangle and a line segment. -// (https://wiki.libsdl.org/SDL_IntersectFRectAndLine) +// (https://wiki.libsdl.org/SDL2/SDL_IntersectFRectAndLine) func (a *FRect) IntersectLine(X1, Y1, X2, Y2 *float32) bool { if a.Empty() { return false diff --git a/sdl/render.go b/sdl/render.go index bb6f066d..89e84ce2 100644 --- a/sdl/render.go +++ b/sdl/render.go @@ -282,7 +282,7 @@ import ( ) // An enumeration of flags used when creating a rendering context. -// (https://wiki.libsdl.org/SDL_RendererFlags) +// (https://wiki.libsdl.org/SDL2/SDL_RendererFlags) type RendererFlags uint32 const ( @@ -310,7 +310,7 @@ func (sm *ScaleMode) cptr() *C.SDL_ScaleMode { } // An enumeration of texture access patterns.. -// (https://wiki.libsdl.org/SDL_TextureAccess) +// (https://wiki.libsdl.org/SDL2/SDL_TextureAccess) type TextureAccess int const ( @@ -320,7 +320,7 @@ const ( ) // An enumeration of the texture channel modulation used in Renderer.Copy(). -// (https://wiki.libsdl.org/SDL_TextureModulate) +// (https://wiki.libsdl.org/SDL2/SDL_TextureModulate) type TextureModulate C.SDL_TextureModulate const ( @@ -330,7 +330,7 @@ const ( ) // An enumeration of flags that can be used in the flip parameter for Renderer.CopyEx(). -// (https://wiki.libsdl.org/SDL_RendererFlip) +// (https://wiki.libsdl.org/SDL2/SDL_RendererFlip) type RendererFlip C.SDL_RendererFlip const ( @@ -344,7 +344,7 @@ func (flip RendererFlip) c() C.SDL_RendererFlip { } // RendererInfo contains information on the capabilities of a render driver or the current render context. -// (https://wiki.libsdl.org/SDL_RendererInfo) +// (https://wiki.libsdl.org/SDL2/SDL_RendererInfo) type RendererInfo struct { Name string // the name of the renderer RendererInfoData @@ -356,7 +356,7 @@ type cRendererInfo struct { } // RendererInfoData contains information on the capabilities of a render driver or the current render context. -// (https://wiki.libsdl.org/SDL_RendererInfo) +// (https://wiki.libsdl.org/SDL2/SDL_RendererInfo) type RendererInfoData struct { Flags uint32 // a mask of supported renderer flags NumTextureFormats uint32 // the number of available texture formats @@ -381,14 +381,14 @@ type Vertex struct { } // GetNumRenderDrivers returns the number of 2D rendering drivers available for the current display. -// (https://wiki.libsdl.org/SDL_GetNumRenderDrivers) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumRenderDrivers) func GetNumRenderDrivers() (int, error) { i := int(C.SDL_GetNumRenderDrivers()) return i, errorFromInt(i) } // GetRenderDriverInfo returns information about a specific 2D rendering driver for the current display. -// (https://wiki.libsdl.org/SDL_GetRenderDriverInfo) +// (https://wiki.libsdl.org/SDL2/SDL_GetRenderDriverInfo) func GetRenderDriverInfo(index int, info *RendererInfo) (int, error) { var cinfo cRendererInfo ret := int(C.SDL_GetRenderDriverInfo(C.int(index), cinfo.cptr())) @@ -402,7 +402,7 @@ func GetRenderDriverInfo(index int, info *RendererInfo) (int, error) { } // CreateWindowAndRenderer returns a new window and default renderer. -// (https://wiki.libsdl.org/SDL_CreateWindowAndRenderer) +// (https://wiki.libsdl.org/SDL2/SDL_CreateWindowAndRenderer) func CreateWindowAndRenderer(w, h int32, flags WindowFlags) (*Window, *Renderer, error) { var window *C.SDL_Window var renderer *C.SDL_Renderer @@ -419,7 +419,7 @@ func CreateWindowAndRenderer(w, h int32, flags WindowFlags) (*Window, *Renderer, } // CreateRenderer returns a new 2D rendering context for a window. -// (https://wiki.libsdl.org/SDL_CreateRenderer) +// (https://wiki.libsdl.org/SDL2/SDL_CreateRenderer) func CreateRenderer(window *Window, index int, flags RendererFlags) (*Renderer, error) { renderer := C.SDL_CreateRenderer(window.cptr(), C.int(index), C.Uint32(flags)) if renderer == nil { @@ -429,7 +429,7 @@ func CreateRenderer(window *Window, index int, flags RendererFlags) (*Renderer, } // CreateSoftwareRenderer returns a new 2D software rendering context for a surface. -// (https://wiki.libsdl.org/SDL_CreateSoftwareRenderer) +// (https://wiki.libsdl.org/SDL2/SDL_CreateSoftwareRenderer) func CreateSoftwareRenderer(surface *Surface) (*Renderer, error) { renderer := C.SDL_CreateSoftwareRenderer(surface.cptr()) if renderer == nil { @@ -439,7 +439,7 @@ func CreateSoftwareRenderer(surface *Surface) (*Renderer, error) { } // GetRenderer returns the renderer associated with a window. -// (https://wiki.libsdl.org/SDL_GetRenderer) +// (https://wiki.libsdl.org/SDL2/SDL_GetRenderer) func (window *Window) GetRenderer() (*Renderer, error) { renderer := C.SDL_GetRenderer(window.cptr()) if renderer == nil { @@ -449,7 +449,7 @@ func (window *Window) GetRenderer() (*Renderer, error) { } // GetInfo returns information about a rendering context. -// (https://wiki.libsdl.org/SDL_GetRendererInfo) +// (https://wiki.libsdl.org/SDL2/SDL_GetRendererInfo) func (renderer *Renderer) GetInfo() (RendererInfo, error) { var cinfo cRendererInfo var info RendererInfo @@ -464,7 +464,7 @@ func (renderer *Renderer) GetInfo() (RendererInfo, error) { } // GetOutputSize returns the output size in pixels of a rendering context. -// (https://wiki.libsdl.org/SDL_GetRendererOutputSize) +// (https://wiki.libsdl.org/SDL2/SDL_GetRendererOutputSize) func (renderer *Renderer) GetOutputSize() (w, h int32, err error) { ret := C.SDL_GetRendererOutputSize( renderer.cptr(), @@ -475,7 +475,7 @@ func (renderer *Renderer) GetOutputSize() (w, h int32, err error) { } // CreateTexture returns a new texture for a rendering context. -// (https://wiki.libsdl.org/SDL_CreateTexture) +// (https://wiki.libsdl.org/SDL2/SDL_CreateTexture) func (renderer *Renderer) CreateTexture(format PixelFormatConstant, access TextureAccess, w, h int32) (*Texture, error) { texture := C.SDL_CreateTexture( renderer.cptr(), @@ -490,7 +490,7 @@ func (renderer *Renderer) CreateTexture(format PixelFormatConstant, access Textu } // CreateTextureFromSurface returns a new texture from an existing surface. -// (https://wiki.libsdl.org/SDL_CreateTextureFromSurface) +// (https://wiki.libsdl.org/SDL2/SDL_CreateTextureFromSurface) func (renderer *Renderer) CreateTextureFromSurface(surface *Surface) (*Texture, error) { texture := C.SDL_CreateTextureFromSurface(renderer.cptr(), surface.cptr()) if texture == nil { @@ -500,7 +500,7 @@ func (renderer *Renderer) CreateTextureFromSurface(surface *Surface) (*Texture, } // Query returns the attributes of a texture. -// (https://wiki.libsdl.org/SDL_QueryTexture) +// (https://wiki.libsdl.org/SDL2/SDL_QueryTexture) func (texture *Texture) Query() (format uint32, access int, width int32, height int32, err error) { var _format C.Uint32 var _access C.int @@ -519,7 +519,7 @@ func (texture *Texture) Query() (format uint32, access int, width int32, height } // SetColorMod sets an additional color value multiplied into render copy operations. -// (https://wiki.libsdl.org/SDL_SetTextureColorMod) +// (https://wiki.libsdl.org/SDL2/SDL_SetTextureColorMod) func (texture *Texture) SetColorMod(r uint8, g uint8, b uint8) error { return errorFromInt(int( C.SDL_SetTextureColorMod( @@ -530,49 +530,49 @@ func (texture *Texture) SetColorMod(r uint8, g uint8, b uint8) error { } // SetAlphaMod sets an additional alpha value multiplied into render copy operations. -// (https://wiki.libsdl.org/SDL_SetTextureAlphaMod) +// (https://wiki.libsdl.org/SDL2/SDL_SetTextureAlphaMod) func (texture *Texture) SetAlphaMod(alpha uint8) error { return errorFromInt(int( C.SDL_SetTextureAlphaMod(texture.cptr(), C.Uint8(alpha)))) } // GetAlphaMod returns the additional alpha value multiplied into render copy operations. -// (https://wiki.libsdl.org/SDL_GetTextureAlphaMod) +// (https://wiki.libsdl.org/SDL2/SDL_GetTextureAlphaMod) func (texture *Texture) GetAlphaMod() (alpha uint8, err error) { ret := C.SDL_GetTextureAlphaMod(texture.cptr(), (*C.Uint8)(unsafe.Pointer(&alpha))) return alpha, errorFromInt(int(ret)) } // SetBlendMode sets the blend mode for a texture, used by Renderer.Copy(). -// (https://wiki.libsdl.org/SDL_SetTextureBlendMode) +// (https://wiki.libsdl.org/SDL2/SDL_SetTextureBlendMode) func (texture *Texture) SetBlendMode(bm BlendMode) error { return errorFromInt(int( C.SDL_SetTextureBlendMode(texture.cptr(), bm.c()))) } // GetBlendMode returns the blend mode used for texture copy operations. -// (https://wiki.libsdl.org/SDL_GetTextureBlendMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetTextureBlendMode) func (texture *Texture) GetBlendMode() (bm BlendMode, err error) { ret := C.SDL_GetTextureBlendMode(texture.cptr(), bm.cptr()) return bm, errorFromInt(int(ret)) } // SetScaleMode Set the scale mode used for texture scale operations. -// (https://wiki.libsdl.org/SDL_SetTextureScaleMode) +// (https://wiki.libsdl.org/SDL2/SDL_SetTextureScaleMode) func (texture *Texture) SetScaleMode(sm ScaleMode) error { return errorFromInt(int( C.SDL_SetTextureScaleMode(texture.cptr(), sm.c()))) } // GetScaleMode returns the scale mode used for texture scale operations. -// (https://wiki.libsdl.org/SDL_GetTextureScaleMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetTextureScaleMode) func (texture *Texture) GetScaleMode() (sm ScaleMode, err error) { ret := C.SDL_GetTextureScaleMode(texture.cptr(), sm.cptr()) return sm, errorFromInt(int(ret)) } // Update updates the given texture rectangle with new pixel data. -// (https://wiki.libsdl.org/SDL_UpdateTexture) +// (https://wiki.libsdl.org/SDL2/SDL_UpdateTexture) func (texture *Texture) Update(rect *Rect, pixels unsafe.Pointer, pitch int) error { if pixels == nil { return nil @@ -586,7 +586,7 @@ func (texture *Texture) Update(rect *Rect, pixels unsafe.Pointer, pitch int) err } // UpdateRGBA updates the given texture rectangle with new uint32 pixel data. -// (https://wiki.libsdl.org/SDL_UpdateTexture) +// (https://wiki.libsdl.org/SDL2/SDL_UpdateTexture) func (texture *Texture) UpdateRGBA(rect *Rect, pixels []uint32, pitch int) error { if pixels == nil { return nil @@ -600,7 +600,7 @@ func (texture *Texture) UpdateRGBA(rect *Rect, pixels []uint32, pitch int) error } // UpdateYUV updates a rectangle within a planar YV12 or IYUV texture with new pixel data. -// (https://wiki.libsdl.org/SDL_UpdateYUVTexture) +// (https://wiki.libsdl.org/SDL2/SDL_UpdateYUVTexture) func (texture *Texture) UpdateYUV(rect *Rect, yPlane []byte, yPitch int, uPlane []byte, uPitch int, vPlane []byte, vPitch int) error { var yPlanePtr, uPlanePtr, vPlanePtr *byte if yPlane != nil { @@ -625,7 +625,7 @@ func (texture *Texture) UpdateYUV(rect *Rect, yPlane []byte, yPitch int, uPlane } // Lock locks a portion of the texture for write-only pixel access. -// (https://wiki.libsdl.org/SDL_LockTexture) +// (https://wiki.libsdl.org/SDL2/SDL_LockTexture) func (texture *Texture) Lock(rect *Rect) ([]byte, int, error) { var _pitch C.int var _pixels unsafe.Pointer @@ -659,7 +659,7 @@ func (texture *Texture) Lock(rect *Rect) ([]byte, int, error) { // LockToSurface locks a portion of the texture for write-only pixel access. // Expose it as a SDL surface. -// (https://wiki.libsdl.org/SDL_LockTextureToSurface) +// (https://wiki.libsdl.org/SDL2/SDL_LockTextureToSurface) func (texture *Texture) LockToSurface(rect *Rect) (surface *Surface, err error) { _surface := surface.cptr() ret := C.SDL_LockTextureToSurface(texture.cptr(), rect.cptr(), (**C.SDL_Surface)(&_surface)) @@ -668,19 +668,19 @@ func (texture *Texture) LockToSurface(rect *Rect) (surface *Surface, err error) } // Unlock unlocks a texture, uploading the changes to video memory, if needed. -// (https://wiki.libsdl.org/SDL_UnlockTexture) +// (https://wiki.libsdl.org/SDL2/SDL_UnlockTexture) func (texture *Texture) Unlock() { C.SDL_UnlockTexture(texture.cptr()) } // RenderTargetSupported reports whether a window supports the use of render targets. -// (https://wiki.libsdl.org/SDL_RenderTargetSupported) +// (https://wiki.libsdl.org/SDL2/SDL_RenderTargetSupported) func (renderer *Renderer) RenderTargetSupported() bool { return C.SDL_RenderTargetSupported(renderer.cptr()) != 0 } // SetRenderTarget sets a texture as the current rendering target. -// (https://wiki.libsdl.org/SDL_SetRenderTarget) +// (https://wiki.libsdl.org/SDL2/SDL_SetRenderTarget) func (renderer *Renderer) SetRenderTarget(texture *Texture) error { return errorFromInt(int( C.SDL_SetRenderTarget(renderer.cptr(), texture.cptr()))) @@ -688,20 +688,20 @@ func (renderer *Renderer) SetRenderTarget(texture *Texture) error { } // GetRenderTarget returns the current render target. -// (https://wiki.libsdl.org/SDL_GetRenderTarget) +// (https://wiki.libsdl.org/SDL2/SDL_GetRenderTarget) func (renderer *Renderer) GetRenderTarget() *Texture { return (*Texture)(unsafe.Pointer(C.SDL_GetRenderTarget(renderer.cptr()))) } // SetLogicalSize sets a device independent resolution for rendering. -// (https://wiki.libsdl.org/SDL_RenderSetLogicalSize) +// (https://wiki.libsdl.org/SDL2/SDL_RenderSetLogicalSize) func (renderer *Renderer) SetLogicalSize(w, h int32) error { return errorFromInt(int( C.SDL_RenderSetLogicalSize(renderer.cptr(), C.int(w), C.int(h)))) } // GetLogicalSize returns device independent resolution for rendering. -// (https://wiki.libsdl.org/SDL_RenderGetLogicalSize) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetLogicalSize) func (renderer *Renderer) GetLogicalSize() (w, h int32) { C.SDL_RenderGetLogicalSize( renderer.cptr(), @@ -711,41 +711,41 @@ func (renderer *Renderer) GetLogicalSize() (w, h int32) { } // SetViewport sets the drawing area for rendering on the current target. -// (https://wiki.libsdl.org/SDL_RenderSetViewport) +// (https://wiki.libsdl.org/SDL2/SDL_RenderSetViewport) func (renderer *Renderer) SetViewport(rect *Rect) error { return errorFromInt(int( C.SDL_RenderSetViewport(renderer.cptr(), rect.cptr()))) } // GetViewport returns the drawing area for the current target. -// (https://wiki.libsdl.org/SDL_RenderGetViewport) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetViewport) func (renderer *Renderer) GetViewport() (rect Rect) { C.SDL_RenderGetViewport(renderer.cptr(), rect.cptr()) return } // IsClipEnabled returns whether clipping is enabled on the given renderer. -// (https://wiki.libsdl.org/SDL_RenderIsClipEnabled) +// (https://wiki.libsdl.org/SDL2/SDL_RenderIsClipEnabled) func (renderer *Renderer) IsClipEnabled() bool { return C.SDL_RenderIsClipEnabled(renderer.cptr()) == C.SDL_TRUE } // SetClipRect sets the clip rectangle for rendering on the specified target. -// (https://wiki.libsdl.org/SDL_RenderSetClipRect) +// (https://wiki.libsdl.org/SDL2/SDL_RenderSetClipRect) func (renderer *Renderer) SetClipRect(rect *Rect) error { return errorFromInt(int( C.SDL_RenderSetClipRect(renderer.cptr(), rect.cptr()))) } // GetClipRect returns the clip rectangle for the current target. -// (https://wiki.libsdl.org/SDL_RenderGetClipRect) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetClipRect) func (renderer *Renderer) GetClipRect() (rect Rect) { C.SDL_RenderGetClipRect(renderer.cptr(), rect.cptr()) return } // SetScale sets the drawing scale for rendering on the current target. -// (https://wiki.libsdl.org/SDL_RenderSetScale) +// (https://wiki.libsdl.org/SDL2/SDL_RenderSetScale) func (renderer *Renderer) SetScale(scaleX, scaleY float32) error { return errorFromInt(int( C.SDL_RenderSetScale( @@ -755,7 +755,7 @@ func (renderer *Renderer) SetScale(scaleX, scaleY float32) error { } // GetScale returns the drawing scale for the current target. -// (https://wiki.libsdl.org/SDL_RenderGetScale) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetScale) func (renderer *Renderer) GetScale() (scaleX, scaleY float32) { C.SDL_RenderGetScale( renderer.cptr(), @@ -771,7 +771,7 @@ func (renderer *Renderer) GetScale() (scaleX, scaleY float32) { // when a resolution is between two multiples of a logical size, the viewport // size is rounded down to the lower multiple. // -// (https://wiki.libsdl.org/SDL_RenderSetIntegerScale) +// (https://wiki.libsdl.org/SDL2/SDL_RenderSetIntegerScale) func (renderer *Renderer) SetIntegerScale(v bool) error { var cv C.SDL_bool = C.SDL_FALSE if v { @@ -784,7 +784,7 @@ func (renderer *Renderer) SetIntegerScale(v bool) error { // GetIntegerScale reports whether integer scales are forced for // resolution-independent rendering. // -// (https://wiki.libsdl.org/SDL_RenderGetIntegerScale) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetIntegerScale) func (renderer *Renderer) GetIntegerScale() (bool, error) { ClearError() if C.SDL_RenderGetIntegerScale(renderer.cptr()) == C.SDL_TRUE { @@ -794,7 +794,7 @@ func (renderer *Renderer) GetIntegerScale() (bool, error) { } // SetDrawColor sets the color used for drawing operations (Rect, Line and Clear). -// (https://wiki.libsdl.org/SDL_SetRenderDrawColor) +// (https://wiki.libsdl.org/SDL2/SDL_SetRenderDrawColor) func (renderer *Renderer) SetDrawColor(r, g, b, a uint8) error { return errorFromInt(int( C.SDL_SetRenderDrawColor( @@ -821,7 +821,7 @@ func (renderer *Renderer) SetDrawColorArray(bs ...uint8) error { } // GetDrawColor returns the color used for drawing operations (Rect, Line and Clear). -// (https://wiki.libsdl.org/SDL_GetRenderDrawColor) +// (https://wiki.libsdl.org/SDL2/SDL_GetRenderDrawColor) func (renderer *Renderer) GetDrawColor() (r, g, b, a uint8, err error) { ret := C.SDL_GetRenderDrawColor( renderer.cptr(), @@ -833,35 +833,35 @@ func (renderer *Renderer) GetDrawColor() (r, g, b, a uint8, err error) { } // SetDrawBlendMode sets the blend mode used for drawing operations (Fill and Line). -// (https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode) +// (https://wiki.libsdl.org/SDL2/SDL_SetRenderDrawBlendMode) func (renderer *Renderer) SetDrawBlendMode(bm BlendMode) error { return errorFromInt(int( C.SDL_SetRenderDrawBlendMode(renderer.cptr(), bm.c()))) } // GetDrawBlendMode returns the blend mode used for drawing operations. -// (https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetRenderDrawBlendMode) func (renderer *Renderer) GetDrawBlendMode(bm *BlendMode) error { return errorFromInt(int( C.SDL_GetRenderDrawBlendMode(renderer.cptr(), bm.cptr()))) } // Clear clears the current rendering target with the drawing color. -// (https://wiki.libsdl.org/SDL_RenderClear) +// (https://wiki.libsdl.org/SDL2/SDL_RenderClear) func (renderer *Renderer) Clear() error { return errorFromInt(int( C.SDL_RenderClear(renderer.cptr()))) } // DrawPoint draws a point on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawPoint) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawPoint) func (renderer *Renderer) DrawPoint(x, y int32) error { return errorFromInt(int( C.SDL_RenderDrawPoint(renderer.cptr(), C.int(x), C.int(y)))) } // DrawPoints draws multiple points on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawPoints) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawPoints) func (renderer *Renderer) DrawPoints(points []Point) error { return errorFromInt(int( C.SDL_RenderDrawPoints( @@ -871,7 +871,7 @@ func (renderer *Renderer) DrawPoints(points []Point) error { } // DrawLine draws a line on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawLine) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawLine) func (renderer *Renderer) DrawLine(x1, y1, x2, y2 int32) error { return errorFromInt(int( C.SDL_RenderDrawLine( @@ -883,7 +883,7 @@ func (renderer *Renderer) DrawLine(x1, y1, x2, y2 int32) error { } // DrawLines draws a series of connected lines on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawLines) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawLines) func (renderer *Renderer) DrawLines(points []Point) error { return errorFromInt(int( C.SDL_RenderDrawLines( @@ -893,14 +893,14 @@ func (renderer *Renderer) DrawLines(points []Point) error { } // DrawRect draws a rectangle on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawRect) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawRect) func (renderer *Renderer) DrawRect(rect *Rect) error { return errorFromInt(int( C.SDL_RenderDrawRect(renderer.cptr(), rect.cptr()))) } // DrawRects draws some number of rectangles on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawRects) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawRects) func (renderer *Renderer) DrawRects(rects []Rect) error { return errorFromInt(int( C.SDL_RenderDrawRects( @@ -910,14 +910,14 @@ func (renderer *Renderer) DrawRects(rects []Rect) error { } // FillRect fills a rectangle on the current rendering target with the drawing color. -// (https://wiki.libsdl.org/SDL_RenderFillRect) +// (https://wiki.libsdl.org/SDL2/SDL_RenderFillRect) func (renderer *Renderer) FillRect(rect *Rect) error { return errorFromInt(int( C.SDL_RenderFillRect(renderer.cptr(), rect.cptr()))) } // FillRects fills some number of rectangles on the current rendering target with the drawing color. -// (https://wiki.libsdl.org/SDL_RenderFillRects) +// (https://wiki.libsdl.org/SDL2/SDL_RenderFillRects) func (renderer *Renderer) FillRects(rects []Rect) error { return errorFromInt(int( C.SDL_RenderFillRects( @@ -927,7 +927,7 @@ func (renderer *Renderer) FillRects(rects []Rect) error { } // Copy copies a portion of the texture to the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderCopy) +// (https://wiki.libsdl.org/SDL2/SDL_RenderCopy) func (renderer *Renderer) Copy(texture *Texture, src, dst *Rect) error { if dst == nil { return errorFromInt(int( @@ -946,7 +946,7 @@ func (renderer *Renderer) Copy(texture *Texture, src, dst *Rect) error { } // CopyEx copies a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right. -// (https://wiki.libsdl.org/SDL_RenderCopyEx) +// (https://wiki.libsdl.org/SDL2/SDL_RenderCopyEx) func (renderer *Renderer) CopyEx(texture *Texture, src, dst *Rect, angle float64, center *Point, flip RendererFlip) error { return errorFromInt(int( C.SDL_RenderCopyEx( @@ -960,14 +960,14 @@ func (renderer *Renderer) CopyEx(texture *Texture, src, dst *Rect, angle float64 } // DrawPointF draws a point on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawPointF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawPointF) func (renderer *Renderer) DrawPointF(x, y float32) error { return errorFromInt(int( C.SDL_RenderDrawPointF(renderer.cptr(), C.float(x), C.float(y)))) } // DrawPointsF draws multiple points on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawPointsF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawPointsF) func (renderer *Renderer) DrawPointsF(points []FPoint) error { return errorFromInt(int( C.SDL_RenderDrawPointsF( @@ -977,7 +977,7 @@ func (renderer *Renderer) DrawPointsF(points []FPoint) error { } // DrawLineF draws a line on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawLineF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawLineF) func (renderer *Renderer) DrawLineF(x1, y1, x2, y2 float32) error { return errorFromInt(int( C.SDL_RenderDrawLineF( @@ -989,7 +989,7 @@ func (renderer *Renderer) DrawLineF(x1, y1, x2, y2 float32) error { } // DrawLinesF draws a series of connected lines on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawLinesF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawLinesF) func (renderer *Renderer) DrawLinesF(points []FPoint) error { return errorFromInt(int( C.SDL_RenderDrawLinesF( @@ -999,14 +999,14 @@ func (renderer *Renderer) DrawLinesF(points []FPoint) error { } // DrawRectF draws a rectangle on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawRectF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawRectF) func (renderer *Renderer) DrawRectF(rect *FRect) error { return errorFromInt(int( C.SDL_RenderDrawRectF(renderer.cptr(), rect.cptr()))) } // DrawRectsF draws some number of rectangles on the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderDrawRectsF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderDrawRectsF) func (renderer *Renderer) DrawRectsF(rects []FRect) error { return errorFromInt(int( C.SDL_RenderDrawRectsF( @@ -1016,14 +1016,14 @@ func (renderer *Renderer) DrawRectsF(rects []FRect) error { } // FillRectF fills a rectangle on the current rendering target with the drawing color. -// (https://wiki.libsdl.org/SDL_RenderFillRectF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderFillRectF) func (renderer *Renderer) FillRectF(rect *FRect) error { return errorFromInt(int( C.SDL_RenderFillRectF(renderer.cptr(), rect.cptr()))) } // FillRectsF fills some number of rectangles on the current rendering target with the drawing color. -// (https://wiki.libsdl.org/SDL_RenderFillRectsF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderFillRectsF) func (renderer *Renderer) FillRectsF(rects []FRect) error { return errorFromInt(int( C.SDL_RenderFillRectsF( @@ -1033,7 +1033,7 @@ func (renderer *Renderer) FillRectsF(rects []FRect) error { } // CopyF copies a portion of the texture to the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderCopyF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderCopyF) func (renderer *Renderer) CopyF(texture *Texture, src *Rect, dst *FRect) error { return errorFromInt(int( C.SDL_RenderCopyF( @@ -1044,7 +1044,7 @@ func (renderer *Renderer) CopyF(texture *Texture, src *Rect, dst *FRect) error { } // CopyExF copies a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right. -// (https://wiki.libsdl.org/SDL_RenderCopyExF) +// (https://wiki.libsdl.org/SDL2/SDL_RenderCopyExF) func (renderer *Renderer) CopyExF(texture *Texture, src *Rect, dst *FRect, angle float64, center *FPoint, flip RendererFlip) error { return errorFromInt(int( C.SDL_RenderCopyExF( @@ -1058,7 +1058,7 @@ func (renderer *Renderer) CopyExF(texture *Texture, src *Rect, dst *FRect, angle } // ReadPixels reads pixels from the current rendering target. -// (https://wiki.libsdl.org/SDL_RenderReadPixels) +// (https://wiki.libsdl.org/SDL2/SDL_RenderReadPixels) func (renderer *Renderer) ReadPixels(rect *Rect, format PixelFormatConstant, pixels unsafe.Pointer, pitch int) error { return errorFromInt(int( C.SDL_RenderReadPixels( @@ -1070,13 +1070,13 @@ func (renderer *Renderer) ReadPixels(rect *Rect, format PixelFormatConstant, pix } // Present updates the screen with any rendering performed since the previous call. -// (https://wiki.libsdl.org/SDL_RenderPresent) +// (https://wiki.libsdl.org/SDL2/SDL_RenderPresent) func (renderer *Renderer) Present() { C.SDL_RenderPresent(renderer.cptr()) } // Destroy destroys the specified texture. -// (https://wiki.libsdl.org/SDL_DestroyTexture) +// (https://wiki.libsdl.org/SDL2/SDL_DestroyTexture) func (texture *Texture) Destroy() error { lastErr := GetError() ClearError() @@ -1090,7 +1090,7 @@ func (texture *Texture) Destroy() error { } // Destroy destroys the rendering context for a window and free associated textures. -// (https://wiki.libsdl.org/SDL_DestroyRenderer) +// (https://wiki.libsdl.org/SDL2/SDL_DestroyRenderer) func (renderer *Renderer) Destroy() error { lastErr := GetError() ClearError() @@ -1104,13 +1104,13 @@ func (renderer *Renderer) Destroy() error { } // Flush forces the rendering context to flush any pending commands to the underlying rendering API. -// (https://wiki.libsdl.org/SDL_RenderFlush) +// (https://wiki.libsdl.org/SDL2/SDL_RenderFlush) func (renderer *Renderer) Flush() error { return errorFromInt(int(C.SDL_RenderFlush(renderer.cptr()))) } // GLBind binds an OpenGL/ES/ES2 texture to the current context for use with OpenGL instructions when rendering OpenGL primitives directly. -// (https://wiki.libsdl.org/SDL_GL_BindTexture) +// (https://wiki.libsdl.org/SDL2/SDL_GL_BindTexture) func (texture *Texture) GLBind(texw, texh *float32) error { return errorFromInt(int( C.SDL_GL_BindTexture( @@ -1120,14 +1120,14 @@ func (texture *Texture) GLBind(texw, texh *float32) error { } // GLUnbind unbinds an OpenGL/ES/ES2 texture from the current context. -// (https://wiki.libsdl.org/SDL_GL_UnbindTexture) +// (https://wiki.libsdl.org/SDL2/SDL_GL_UnbindTexture) func (texture *Texture) GLUnbind() error { return errorFromInt(int( C.SDL_GL_UnbindTexture(texture.cptr()))) } // GetMetalLayer gets the CAMetalLayer associated with the given Metal renderer -// (https://wiki.libsdl.org/SDL_RenderGetMetalLayer) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetMetalLayer) func (renderer *Renderer) GetMetalLayer() (layer unsafe.Pointer, err error) { layer = C.SDL_RenderGetMetalLayer(renderer.cptr()) if layer == nil { @@ -1137,7 +1137,7 @@ func (renderer *Renderer) GetMetalLayer() (layer unsafe.Pointer, err error) { } // GetMetalCommandEncoder gets the Metal command encoder for the current frame -// (https://wiki.libsdl.org/SDL_RenderGetMetalCommandEncoder) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetMetalCommandEncoder) func (renderer *Renderer) GetMetalCommandEncoder() (encoder unsafe.Pointer, err error) { encoder = C.SDL_RenderGetMetalCommandEncoder(renderer.cptr()) if encoder == nil { @@ -1147,7 +1147,7 @@ func (renderer *Renderer) GetMetalCommandEncoder() (encoder unsafe.Pointer, err } // UpdateNV updates a rectangle within a planar NV12 or NV21 texture with new pixels. -// (https://wiki.libsdl.org/SDL_UpdateNVTexture) +// (https://wiki.libsdl.org/SDL2/SDL_UpdateNVTexture) func (texture *Texture) UpdateNV(rect *Rect, yPlane []byte, yPitch int, uvPlane []byte, uvPitch int) error { var yPlanePtr, uvPlanePtr *byte if yPlane != nil { @@ -1169,7 +1169,7 @@ func (texture *Texture) UpdateNV(rect *Rect, yPlane []byte, yPitch int, uvPlane // RenderGeometry renders a list of triangles, optionally using a texture and // indices into the vertex array Color and alpha modulation is done per vertex // (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). -// (https://wiki.libsdl.org/SDL_RenderGeometry) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGeometry) func (renderer *Renderer) RenderGeometry(texture *Texture, vertices []Vertex, indices []int32) (err error) { _texture := texture.cptr() _vertices := (*C.SDL_Vertex)(unsafe.Pointer(&vertices[0])) @@ -1187,7 +1187,7 @@ func (renderer *Renderer) RenderGeometry(texture *Texture, vertices []Vertex, in // RenderGeomtryRaw renders a list of triangles, optionally using a texture and // indices into the vertex arrays Color and alpha modulation is done per vertex // (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). -// (https://wiki.libsdl.org/SDL_RenderGeometryRaw) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGeometryRaw) func (renderer *Renderer) RenderGeometryRaw(texture *Texture, xy *float32, xy_stride int, color *Color, color_stride int, uv *float32, uv_stride int, num_vertices int, indices unsafe.Pointer, num_indices int, size_indices int, //indices interface{} @@ -1210,14 +1210,14 @@ func (renderer *Renderer) RenderGeometryRaw(texture *Texture, xy *float32, xy_st } // SetTextureUserData associates a user-specified pointer with a texture. -// (https://wiki.libsdl.org/SDL_SetTextureUserData) +// (https://wiki.libsdl.org/SDL2/SDL_SetTextureUserData) func (texture *Texture) SetTextureUserData(userdata unsafe.Pointer) (err error) { err = errorFromInt(int(C.SDL_SetTextureUserData(texture.cptr(), userdata))) return } // GetTextureUserData gets the user-specified pointer associated with a texture. -// (https://wiki.libsdl.org/SDL_GetTextureUserData) +// (https://wiki.libsdl.org/SDL2/SDL_GetTextureUserData) func (texture *Texture) GetTextureUserData() (userdata unsafe.Pointer) { userdata = C.SDL_GetTextureUserData(texture.cptr()) return @@ -1229,7 +1229,7 @@ func (texture *Texture) GetTextureUserData() (userdata unsafe.Pointer) { // Logical coordinates will differ from real coordinates when render is scaled // and logical renderer size set // -// (https://wiki.libsdl.org/SDL_RenderWindowToLogical) +// (https://wiki.libsdl.org/SDL2/SDL_RenderWindowToLogical) func (renderer *Renderer) RenderWindowToLogical(windowX, windowY int) (logicalX, logicalY float32) { _windowX := C.int(windowX) _windowY := C.int(windowY) @@ -1243,7 +1243,7 @@ func (renderer *Renderer) RenderWindowToLogical(windowX, windowY int) (logicalX, // RenderLogicalToWindow gets real coordinates of point in window when given logical coordinates of point in renderer. // Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set. -// (https://wiki.libsdl.org/SDL_RenderLogicalToWindow) +// (https://wiki.libsdl.org/SDL2/SDL_RenderLogicalToWindow) func (renderer *Renderer) RenderLogicalToWindow(logicalX, logicalY float32) (windowX, windowY int) { _logicalX := C.float(logicalX) _logicalY := C.float(logicalY) @@ -1256,7 +1256,7 @@ func (renderer *Renderer) RenderLogicalToWindow(logicalX, logicalY float32) (win } // RenderSetVSync toggles VSync of the given renderer. -// (https://wiki.libsdl.org/SDL_RenderSetVSync) +// (https://wiki.libsdl.org/SDL2/SDL_RenderSetVSync) func (renderer *Renderer) RenderSetVSync(vsync bool) (err error) { _vsync := C.int(Btoi(vsync)) err = errorFromInt(int(C.SDL_RenderSetVSync(renderer.cptr(), _vsync))) @@ -1264,7 +1264,7 @@ func (renderer *Renderer) RenderSetVSync(vsync bool) (err error) { } // GetWindow gets the window associated with a renderer. -// (https://wiki.libsdl.org/SDL_RenderGetWindow) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetWindow) func (renderer *Renderer) GetWindow() (window *Window, err error) { window = (*Window)(unsafe.Pointer(C.SDL_RenderGetWindow(renderer.cptr()))) return diff --git a/sdl/rwops.go b/sdl/rwops.go index 91e23b67..cea44c42 100644 --- a/sdl/rwops.go +++ b/sdl/rwops.go @@ -46,7 +46,7 @@ import ( ) // RWops types -// (https://wiki.libsdl.org/SDL_RWops#stream_type) +// (https://wiki.libsdl.org/SDL2/SDL_RWops#stream_type) type RWStreamType int const ( @@ -59,7 +59,7 @@ const ( ) // RWops seek from -// (https://wiki.libsdl.org/SDL_RWops#seek_function) +// (https://wiki.libsdl.org/SDL2/SDL_RWops#seek_function) type RWSeek int const ( @@ -69,7 +69,7 @@ const ( ) // RWops provides an abstract interface to stream I/O. Applications can generally ignore the specifics of this structure's internals and treat them as opaque pointers. The details are important to lower-level code that might need to implement one of these, however. -// (https://wiki.libsdl.org/SDL_RWops) +// (https://wiki.libsdl.org/SDL2/SDL_RWops) type RWops C.SDL_RWops func (rwops *RWops) cptr() *C.SDL_RWops { @@ -77,7 +77,7 @@ func (rwops *RWops) cptr() *C.SDL_RWops { } // RWFromFile creates a new RWops structure for reading from and/or writing to a named file. -// (https://wiki.libsdl.org/SDL_RWFromFile) +// (https://wiki.libsdl.org/SDL2/SDL_RWFromFile) func RWFromFile(file, mode string) *RWops { _file := C.CString(file) _mode := C.CString(mode) @@ -87,7 +87,7 @@ func RWFromFile(file, mode string) *RWops { } // RWFromMem prepares a read-write memory buffer for use with RWops. -// (https://wiki.libsdl.org/SDL_RWFromMem) +// (https://wiki.libsdl.org/SDL2/SDL_RWFromMem) func RWFromMem(mem []byte) (*RWops, error) { if mem == nil { return nil, ErrInvalidParameters @@ -104,13 +104,13 @@ func RWFromMem(mem []byte) (*RWops, error) { } // AllocRW allocates an empty, unpopulated RWops structure. -// (https://wiki.libsdl.org/SDL_AllocRW) +// (https://wiki.libsdl.org/SDL2/SDL_AllocRW) func AllocRW() *RWops { return (*RWops)(unsafe.Pointer(C.SDL_AllocRW())) } // Free frees the RWops structure allocated by AllocRW(). -// (https://wiki.libsdl.org/SDL_FreeRW) +// (https://wiki.libsdl.org/SDL2/SDL_FreeRW) func (rwops *RWops) Free() error { if rwops == nil { return ErrInvalidParameters @@ -121,7 +121,7 @@ func (rwops *RWops) Free() error { } // Size returns the size of the data stream in the RWops. -// (https://wiki.libsdl.org/SDL_RWsize) +// (https://wiki.libsdl.org/SDL2/SDL_RWsize) func (rwops *RWops) Size() (int64, error) { n := int64(C.RWsize(rwops.cptr())) if n < 0 { @@ -131,7 +131,7 @@ func (rwops *RWops) Size() (int64, error) { } // Seek seeks within the RWops data stream. -// (https://wiki.libsdl.org/SDL_RWseek) +// (https://wiki.libsdl.org/SDL2/SDL_RWseek) func (rwops *RWops) Seek(offset int64, whence RWSeek) (int64, error) { if rwops == nil { return -1, ErrInvalidParameters @@ -145,13 +145,13 @@ func (rwops *RWops) Seek(offset int64, whence RWSeek) (int64, error) { } // Read reads from a data source. -// (https://wiki.libsdl.org/SDL_RWread) +// (https://wiki.libsdl.org/SDL2/SDL_RWread) func (rwops *RWops) Read(buf []byte) (n int, err error) { return rwops.Read2(buf, 1, uint(len(buf))) } // Read2 reads from a data source (native). -// (https://wiki.libsdl.org/SDL_RWread) +// (https://wiki.libsdl.org/SDL2/SDL_RWread) func (rwops *RWops) Read2(buf []byte, size, maxnum uint) (n int, err error) { if rwops == nil || buf == nil { return 0, ErrInvalidParameters @@ -168,7 +168,7 @@ func (rwops *RWops) Read2(buf []byte, size, maxnum uint) (n int, err error) { } // Tell returns the current read/write offset in the RWops data stream. -// (https://wiki.libsdl.org/SDL_RWtell) +// (https://wiki.libsdl.org/SDL2/SDL_RWtell) func (rwops *RWops) Tell() (int64, error) { if rwops == nil { return 0, ErrInvalidParameters @@ -182,13 +182,13 @@ func (rwops *RWops) Tell() (int64, error) { } // Write writes to the RWops data stream. -// (https://wiki.libsdl.org/SDL_RWwrite) +// (https://wiki.libsdl.org/SDL2/SDL_RWwrite) func (rwops *RWops) Write(buf []byte) (n int, err error) { return rwops.Write2(buf, 1, uint(len(buf))) } // Write2 writes to the RWops data stream (native). -// (https://wiki.libsdl.org/SDL_RWwrite) +// (https://wiki.libsdl.org/SDL2/SDL_RWwrite) func (rwops *RWops) Write2(buf []byte, size, num uint) (n int, err error) { if rwops == nil || buf == nil { return 0, ErrInvalidParameters @@ -205,7 +205,7 @@ func (rwops *RWops) Write2(buf []byte, size, num uint) (n int, err error) { } // Close closes and frees the allocated RWops structure. -// (https://wiki.libsdl.org/SDL_RWclose) +// (https://wiki.libsdl.org/SDL2/SDL_RWclose) func (rwops *RWops) Close() error { if rwops != nil && C.RWclose(rwops.cptr()) != 0 { return GetError() @@ -214,7 +214,7 @@ func (rwops *RWops) Close() error { } // ReadU8 reads a byte from the RWops. -// (https://wiki.libsdl.org/SDL_ReadU8) +// (https://wiki.libsdl.org/SDL2/SDL_ReadU8) func (rwops *RWops) ReadU8() uint8 { if rwops == nil { return 0 @@ -223,7 +223,7 @@ func (rwops *RWops) ReadU8() uint8 { } // ReadLE16 reads 16 bits of little-endian data from the RWops and returns in native format. -// (https://wiki.libsdl.org/SDL_ReadLE16) +// (https://wiki.libsdl.org/SDL2/SDL_ReadLE16) func (rwops *RWops) ReadLE16() uint16 { if rwops == nil { return 0 @@ -232,7 +232,7 @@ func (rwops *RWops) ReadLE16() uint16 { } // ReadBE16 read 16 bits of big-endian data from the RWops and returns in native format. -// (https://wiki.libsdl.org/SDL_ReadBE16) +// (https://wiki.libsdl.org/SDL2/SDL_ReadBE16) func (rwops *RWops) ReadBE16() uint16 { if rwops == nil { return 0 @@ -241,7 +241,7 @@ func (rwops *RWops) ReadBE16() uint16 { } // ReadLE32 reads 32 bits of little-endian data from the RWops and returns in native format. -// (https://wiki.libsdl.org/SDL_ReadLE32) +// (https://wiki.libsdl.org/SDL2/SDL_ReadLE32) func (rwops *RWops) ReadLE32() uint32 { if rwops == nil { return 0 @@ -250,7 +250,7 @@ func (rwops *RWops) ReadLE32() uint32 { } // ReadBE32 reads 32 bits of big-endian data from the RWops and returns in native format. -// (https://wiki.libsdl.org/SDL_ReadBE32) +// (https://wiki.libsdl.org/SDL2/SDL_ReadBE32) func (rwops *RWops) ReadBE32() uint32 { if rwops == nil { return 0 @@ -259,7 +259,7 @@ func (rwops *RWops) ReadBE32() uint32 { } // ReadLE64 reads 64 bits of little-endian data from the RWops and returns in native format. -// (https://wiki.libsdl.org/SDL_ReadLE64) +// (https://wiki.libsdl.org/SDL2/SDL_ReadLE64) func (rwops *RWops) ReadLE64() uint64 { if rwops == nil { return 0 @@ -268,7 +268,7 @@ func (rwops *RWops) ReadLE64() uint64 { } // ReadBE64 reads 64 bits of big-endian data from the RWops and returns in native format. -// (https://wiki.libsdl.org/SDL_ReadBE64) +// (https://wiki.libsdl.org/SDL2/SDL_ReadBE64) func (rwops *RWops) ReadBE64() uint64 { if rwops == nil { return 0 @@ -277,7 +277,7 @@ func (rwops *RWops) ReadBE64() uint64 { } // LoadFile_RW loads all the data from an SDL data stream. -// (https://wiki.libsdl.org/SDL_LoadFile_RW) +// (https://wiki.libsdl.org/SDL2/SDL_LoadFile_RW) func (src *RWops) LoadFileRW(freesrc bool) (data []byte, size int) { var _size C.size_t var _freesrc C.int = 0 @@ -296,13 +296,13 @@ func (src *RWops) LoadFileRW(freesrc bool) (data []byte, size int) { } // LoadFile loads an entire file -// (https://wiki.libsdl.org/SDL_LoadFile) +// (https://wiki.libsdl.org/SDL2/SDL_LoadFile) func LoadFile(file string) (data []byte, size int) { return RWFromFile(file, "rb").LoadFileRW(true) } // WriteU8 writes a byte to the RWops. -// (https://wiki.libsdl.org/SDL_WriteU8) +// (https://wiki.libsdl.org/SDL2/SDL_WriteU8) func (rwops *RWops) WriteU8(value uint8) uint { if rwops == nil { return 0 @@ -311,7 +311,7 @@ func (rwops *RWops) WriteU8(value uint8) uint { } // WriteLE16 writes 16 bits in native format to the RWops as little-endian data. -// (https://wiki.libsdl.org/SDL_WriteLE16) +// (https://wiki.libsdl.org/SDL2/SDL_WriteLE16) func (rwops *RWops) WriteLE16(value uint16) uint { if rwops == nil { return 0 @@ -320,7 +320,7 @@ func (rwops *RWops) WriteLE16(value uint16) uint { } // WriteBE16 writes 16 bits in native format to the RWops as big-endian data. -// (https://wiki.libsdl.org/SDL_WriteBE16) +// (https://wiki.libsdl.org/SDL2/SDL_WriteBE16) func (rwops *RWops) WriteBE16(value uint16) uint { if rwops == nil { return 0 @@ -329,7 +329,7 @@ func (rwops *RWops) WriteBE16(value uint16) uint { } // WriteLE32 writes 32 bits in native format to the RWops as little-endian data. -// (https://wiki.libsdl.org/SDL_WriteLE32) +// (https://wiki.libsdl.org/SDL2/SDL_WriteLE32) func (rwops *RWops) WriteLE32(value uint32) uint { if rwops == nil { return 0 @@ -338,7 +338,7 @@ func (rwops *RWops) WriteLE32(value uint32) uint { } // WriteBE32 writes 32 bits in native format to the RWops as big-endian data. -// (https://wiki.libsdl.org/SDL_WriteBE32) +// (https://wiki.libsdl.org/SDL2/SDL_WriteBE32) func (rwops *RWops) WriteBE32(value uint32) uint { if rwops == nil { return 0 @@ -347,7 +347,7 @@ func (rwops *RWops) WriteBE32(value uint32) uint { } // WriteLE64 writes 64 bits in native format to the RWops as little-endian data. -// (https://wiki.libsdl.org/SDL_WriteLE64) +// (https://wiki.libsdl.org/SDL2/SDL_WriteLE64) func (rwops *RWops) WriteLE64(value uint64) uint { if rwops == nil { return 0 @@ -356,7 +356,7 @@ func (rwops *RWops) WriteLE64(value uint64) uint { } // WriteBE64 writes 64 bits in native format to the RWops as big-endian data. -// (https://wiki.libsdl.org/SDL_WriteBE64) +// (https://wiki.libsdl.org/SDL2/SDL_WriteBE64) func (rwops *RWops) WriteBE64(value uint64) uint { if rwops == nil { return 0 diff --git a/sdl/scancode.go b/sdl/scancode.go index f600df63..77bacf1d 100644 --- a/sdl/scancode.go +++ b/sdl/scancode.go @@ -4,7 +4,7 @@ package sdl import "C" // The SDL keyboard scancode representation. -// (https://wiki.libsdl.org/SDL_Scancode) +// (https://wiki.libsdl.org/SDL2/SDL_Scancode) // (https://wiki.libsdl.org/SDLScancodeLookup) type Scancode uint32 diff --git a/sdl/sdl.go b/sdl/sdl.go index d0c0e302..647d785e 100644 --- a/sdl/sdl.go +++ b/sdl/sdl.go @@ -20,7 +20,7 @@ import ( ) // These are the flags which may be passed to SDL_Init(). -// (https://wiki.libsdl.org/SDL_Init) +// (https://wiki.libsdl.org/SDL2/SDL_Init) const ( INIT_TIMER = C.SDL_INIT_TIMER // timer subsystem INIT_AUDIO = C.SDL_INIT_AUDIO // audio subsystem @@ -111,7 +111,7 @@ func Do(f func()) { } // Init initialize the SDL library. This must be called before using most other SDL functions. -// (https://wiki.libsdl.org/SDL_Init) +// (https://wiki.libsdl.org/SDL2/SDL_Init) func Init(flags uint32) error { if C.SDL_Init(C.Uint32(flags)) != 0 { return GetError() @@ -120,7 +120,7 @@ func Init(flags uint32) error { } // Quit cleans up all initialized subsystems. You should call it upon all exit conditions. -// (https://wiki.libsdl.org/SDL_Quit) +// (https://wiki.libsdl.org/SDL2/SDL_Quit) func Quit() { C.SDL_Quit() @@ -131,7 +131,7 @@ func Quit() { } // InitSubSystem initializes specific SDL subsystems. -// (https://wiki.libsdl.org/SDL_InitSubSystem) +// (https://wiki.libsdl.org/SDL2/SDL_InitSubSystem) func InitSubSystem(flags uint32) error { if C.SDL_InitSubSystem(C.Uint32(flags)) != 0 { return GetError() @@ -140,19 +140,19 @@ func InitSubSystem(flags uint32) error { } // QuitSubSystem shuts down specific SDL subsystems. -// (https://wiki.libsdl.org/SDL_QuitSubSystem) +// (https://wiki.libsdl.org/SDL2/SDL_QuitSubSystem) func QuitSubSystem(flags uint32) { C.SDL_QuitSubSystem(C.Uint32(flags)) } // WasInit returns a mask of the specified subsystems which have previously been initialized. -// (https://wiki.libsdl.org/SDL_WasInit) +// (https://wiki.libsdl.org/SDL2/SDL_WasInit) func WasInit(flags uint32) uint32 { return uint32(C.SDL_WasInit(C.Uint32(flags))) } // GetPlatform returns the name of the platform. -// (https://wiki.libsdl.org/SDL_GetPlatform) +// (https://wiki.libsdl.org/SDL2/SDL_GetPlatform) func GetPlatform() string { return string(C.GoString(C.SDL_GetPlatform())) } diff --git a/sdl/sensor.go b/sdl/sensor.go index 24c55e58..937880be 100644 --- a/sdl/sensor.go +++ b/sdl/sensor.go @@ -158,19 +158,19 @@ type SensorID int32 type SensorType int // LockSensors locks sensors for multi-threaded access to the sensor API -// (https://wiki.libsdl.org/SDL_LockSensors) +// (https://wiki.libsdl.org/SDL2/SDL_LockSensors) func LockSensors() { C.SDL_LockSensors() } // UnlockSensors unlocks sensors for multi-threaded access to the sensor API -// (https://wiki.libsdl.org/SDL_UnlockSensors) +// (https://wiki.libsdl.org/SDL2/SDL_UnlockSensors) func UnlockSensors() { C.SDL_UnlockSensors() } // NumSensors counts the number of sensors attached to the system right now -// (https://wiki.libsdl.org/SDL_NumSensors) +// (https://wiki.libsdl.org/SDL2/SDL_NumSensors) func NumSensors() int { return int(C.SDL_NumSensors()) } @@ -180,7 +180,7 @@ func NumSensors() int { // This can be called before any sensors are opened. // // Returns the sensor name, or empty string if deviceIndex is out of range. -// (https://wiki.libsdl.org/SDL_SensorGetDeviceName) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetDeviceName) func SensorGetDeviceName(deviceIndex int) (name string) { name = C.GoString(C.SDL_SensorGetDeviceName(C.int(deviceIndex))) return @@ -191,7 +191,7 @@ func SensorGetDeviceName(deviceIndex int) (name string) { // This can be called before any sensors are opened. // // Returns the sensor type, or SDL_SENSOR_INVALID if deviceIndex is out of range. -// (https://wiki.libsdl.org/SDL_SensorGetDeviceType) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetDeviceType) func SensorGetDeviceType(deviceIndex int) (typ SensorType) { typ = SensorType(C.SDL_SensorGetDeviceType(C.int(deviceIndex))) return @@ -202,7 +202,7 @@ func SensorGetDeviceType(deviceIndex int) (typ SensorType) { // This can be called before any sensors are opened. // // Returns the sensor platform dependent type, or -1 if deviceIndex is out of range. -// (https://wiki.libsdl.org/SDL_SensorGetDeviceNonPortableType) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetDeviceNonPortableType) func SensorGetDeviceNonPortableType(deviceIndex int) (typ int) { typ = int(C.SDL_SensorGetDeviceNonPortableType(C.int(deviceIndex))) return @@ -213,7 +213,7 @@ func SensorGetDeviceNonPortableType(deviceIndex int) (typ int) { // This can be called before any sensors are opened. // // Returns the sensor instance ID, or -1 if deviceIndex is out of range. -// (https://wiki.libsdl.org/SDL_SensorGetDeviceInstanceID) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetDeviceInstanceID) func SensorGetDeviceInstanceID(deviceIndex int) (id SensorID) { id = SensorID(C.SDL_SensorGetDeviceInstanceID(C.int(deviceIndex))) return @@ -224,14 +224,14 @@ func SensorGetDeviceInstanceID(deviceIndex int) (id SensorID) { // The index passed as an argument refers to the N'th sensor on the system. // // Returns a sensor identifier, or nil if an error occurred. -// (https://wiki.libsdl.org/SDL_SensorOpen) +// (https://wiki.libsdl.org/SDL2/SDL_SensorOpen) func SensorOpen(deviceIndex int) (sensor *Sensor) { sensor = (*Sensor)(unsafe.Pointer(C.SDL_SensorOpen(C.int(deviceIndex)))) return } // SensorFromInstanceID returns the Sensor associated with an instance id. -// (https://wiki.libsdl.org/SDL_SensorFromInstanceID) +// (https://wiki.libsdl.org/SDL2/SDL_SensorFromInstanceID) func SensorFromInstanceID(id SensorID) (sensor *Sensor) { sensor = (*Sensor)(unsafe.Pointer(C.SDL_SensorFromInstanceID(C.SDL_SensorID(id)))) return @@ -240,7 +240,7 @@ func SensorFromInstanceID(id SensorID) (sensor *Sensor) { // GetName gets the implementation dependent name of a sensor. // // Returns the sensor name, or empty string if the sensor is nil. -// (https://wiki.libsdl.org/SDL_SensorGetName) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetName) func (sensor *Sensor) GetName() (name string) { name = C.GoString(C.SDL_SensorGetName((*C.SDL_Sensor)(sensor))) return @@ -251,7 +251,7 @@ func (sensor *Sensor) GetName() (name string) { // This can be called before any sensors are opened. // // Returns the sensor type, or SENSOR_INVALID if the sensor is nil. -// (https://wiki.libsdl.org/SDL_SensorGetType) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetType) func (sensor *Sensor) GetType() (typ SensorType) { typ = SensorType(C.SDL_SensorGetType((*C.SDL_Sensor)(sensor))) return @@ -262,7 +262,7 @@ func (sensor *Sensor) GetType() (typ SensorType) { // This can be called before any sensors are opened. // // Returns the sensor platform dependent type, or -1 if the sensor is nil. -// (https://wiki.libsdl.org/SDL_SensorGetNonPortableType) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetNonPortableType) func (sensor *Sensor) GetNonPortableType() (typ int) { typ = int(C.SDL_SensorGetNonPortableType((*C.SDL_Sensor)(sensor))) return @@ -273,7 +273,7 @@ func (sensor *Sensor) GetNonPortableType() (typ int) { // This can be called before any sensors are opened. // // Returns the sensor instance ID, or -1 if the sensor is nil. -// (https://wiki.libsdl.org/SDL_SensorGetInstanceID) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetInstanceID) func (sensor *Sensor) GetInstanceID() (id SensorID) { id = SensorID(C.SDL_SensorGetInstanceID((*C.SDL_Sensor)(sensor))) return @@ -282,7 +282,7 @@ func (sensor *Sensor) GetInstanceID() (id SensorID) { // GetData gets the current state of an opened sensor. // // The number of values and interpretation of the data is sensor dependent. -// (https://wiki.libsdl.org/SDL_SensorGetData) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetData) func (sensor *Sensor) GetData(data []float32) (err error) { if data == nil { return nil @@ -296,7 +296,7 @@ func (sensor *Sensor) GetData(data []float32) (err error) { // GetDataWithTimestamp gets the current state of an opened sensor with the timestamp of the last update. // // The number of values and interpretation of the data is sensor dependent. -// (https://wiki.libsdl.org/SDL_SensorGetDataWithTimestamp) +// (https://wiki.libsdl.org/SDL2/SDL_SensorGetDataWithTimestamp) func (sensor *Sensor) GetDataWithTimestamp(timestamp *uint64, data []float32) (err error) { if data == nil { return nil @@ -309,7 +309,7 @@ func (sensor *Sensor) GetDataWithTimestamp(timestamp *uint64, data []float32) (e } // Close closes a sensor previously opened with SensorOpen() -// (https://wiki.libsdl.org/SDL_SensorClose) +// (https://wiki.libsdl.org/SDL2/SDL_SensorClose) func (sensor *Sensor) Close() { C.SDL_SensorClose((*C.SDL_Sensor)(sensor)) } @@ -319,7 +319,7 @@ func (sensor *Sensor) Close() { // This is called automatically by the event loop if sensor events are enabled. // // This needs to be called from the thread that initialized the sensor subsystem. -// (https://wiki.libsdl.org/SDL_SensorUpdate) +// (https://wiki.libsdl.org/SDL2/SDL_SensorUpdate) func SensorUpdate() { C.SDL_SensorUpdate() } diff --git a/sdl/shape.go b/sdl/shape.go index baffae41..051896db 100644 --- a/sdl/shape.go +++ b/sdl/shape.go @@ -144,7 +144,7 @@ func (wsm *cWindowShapeMode) cptr() *C.SDL_WindowShapeMode { } // CreateShapedWindow creates a window that can be shaped with the specified position, dimensions, and flags -// (https://wiki.libsdl.org/SDL_CreateShapedWindow) +// (https://wiki.libsdl.org/SDL2/SDL_CreateShapedWindow) func CreateShapedWindow(title string, x, y, w, h uint32, flags uint32) (*Window, error) { _title := C.CString(title) defer C.free(unsafe.Pointer(_title)) @@ -156,13 +156,13 @@ func CreateShapedWindow(title string, x, y, w, h uint32, flags uint32) (*Window, } // IsShapedWindow returns whether the given window is a shaped window. -// (https://wiki.libsdl.org/SDL_IsShapedWindow) +// (https://wiki.libsdl.org/SDL2/SDL_IsShapedWindow) func (window *Window) IsShaped() bool { return (C.SDL_IsShapedWindow(window.cptr()) & 1) == 1 } // SetShape sets the shape and parameters of a shaped window -// (https://wiki.libsdl.org/SDL_SetWindowShape) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowShape) func (window *Window) SetShape(shape *Surface, shape_mode WindowShapeMode) int32 { if shape_mode == nil { panic("shape_mode can not be nil") @@ -173,7 +173,7 @@ func (window *Window) SetShape(shape *Surface, shape_mode WindowShapeMode) int32 } // GetShapeMode gets the shape parameters of a shaped window -// (https://wiki.libsdl.org/SDL_GetShapedWindowMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetShapedWindowMode) func (window *Window) GetShapeMode() (WindowShapeMode, int32) { var _cWSM cWindowShapeMode var _resInt32 = (int32)(C.SDL_GetShapedWindowMode(window.cptr(), _cWSM.cptr())) diff --git a/sdl/surface.go b/sdl/surface.go index a16b6b0f..35db3f6c 100644 --- a/sdl/surface.go +++ b/sdl/surface.go @@ -155,10 +155,10 @@ const ( ) // Surface contains a collection of pixels used in software blitting. -// (https://wiki.libsdl.org/SDL_Surface) +// (https://wiki.libsdl.org/SDL2/SDL_Surface) type Surface struct { flags uint32 // (internal use) - Format *PixelFormat // the format of the pixels stored in the surface (read-only) (https://wiki.libsdl.org/SDL_PixelFormat) + Format *PixelFormat // the format of the pixels stored in the surface (read-only) (https://wiki.libsdl.org/SDL2/SDL_PixelFormat) W int32 // the width in pixels (read-only) H int32 // the height in pixels (read-only) Pitch int32 // the length of a row of pixels in bytes (read-only) @@ -177,13 +177,13 @@ func (surface *Surface) cptr() *C.SDL_Surface { } // MustLock reports whether the surface must be locked for access. -// (https://wiki.libsdl.org/SDL_MUSTLOCK) +// (https://wiki.libsdl.org/SDL2/SDL_MUSTLOCK) func (surface *Surface) MustLock() bool { return (surface.flags & RLEACCEL) != 0 } // CreateRGBSurface allocates a new RGB surface. -// (https://wiki.libsdl.org/SDL_CreateRGBSurface) +// (https://wiki.libsdl.org/SDL2/SDL_CreateRGBSurface) func CreateRGBSurface(flags uint32, width, height, depth int32, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error) { surface := (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurface( C.Uint32(flags), @@ -201,7 +201,7 @@ func CreateRGBSurface(flags uint32, width, height, depth int32, Rmask, Gmask, Bm } // CreateRGBSurfaceFrom allocate a new RGB surface with existing pixel data. -// (https://wiki.libsdl.org/SDL_CreateRGBSurfaceFrom) +// (https://wiki.libsdl.org/SDL2/SDL_CreateRGBSurfaceFrom) func CreateRGBSurfaceFrom(pixels unsafe.Pointer, width, height int32, depth, pitch int, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error) { surface := (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurfaceFrom( pixels, @@ -220,7 +220,7 @@ func CreateRGBSurfaceFrom(pixels unsafe.Pointer, width, height int32, depth, pit } // CreateRGBSurfaceWithFormat allocates an RGB surface. -// (https://wiki.libsdl.org/SDL_CreateRGBSurfaceWithFormat) +// (https://wiki.libsdl.org/SDL2/SDL_CreateRGBSurfaceWithFormat) func CreateRGBSurfaceWithFormat(flags uint32, width, height, depth int32, format uint32) (*Surface, error) { surface := (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurfaceWithFormat( C.Uint32(flags), @@ -235,7 +235,7 @@ func CreateRGBSurfaceWithFormat(flags uint32, width, height, depth int32, format } // CreateRGBSurfaceWithFormatFrom allocates an RGB surface from provided pixel data. -// (https://wiki.libsdl.org/SDL_CreateRGBSurfaceWithFormatFrom) +// (https://wiki.libsdl.org/SDL2/SDL_CreateRGBSurfaceWithFormatFrom) func CreateRGBSurfaceWithFormatFrom(pixels unsafe.Pointer, width, height, depth, pitch int32, format uint32) (*Surface, error) { surface := (*Surface)(unsafe.Pointer(C.SDL_CreateRGBSurfaceWithFormatFrom( pixels, @@ -251,20 +251,20 @@ func CreateRGBSurfaceWithFormatFrom(pixels unsafe.Pointer, width, height, depth, } // SetYUVConversionMode sets the YUV conversion mode -// (https://wiki.libsdl.org/SDL_SetYUVConversionMode) +// (https://wiki.libsdl.org/SDL2/SDL_SetYUVConversionMode) func SetYUVConversionMode(mode YUV_CONVERSION_MODE) { _mode := C.SDL_YUV_CONVERSION_MODE(mode) C.SDL_SetYUVConversionMode(_mode) } // GetYUVConversionMode gets the YUV conversion mode -// (https://wiki.libsdl.org/SDL_GetYUVConversionMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetYUVConversionMode) func GetYUVConversionMode() YUV_CONVERSION_MODE { return YUV_CONVERSION_MODE(C.SDL_GetYUVConversionMode()) } // GetYUVConversionModeForResolution gets the YUV conversion mode -// (https://wiki.libsdl.org/SDL_GetYUVConversionModeForResolution) +// (https://wiki.libsdl.org/SDL2/SDL_GetYUVConversionModeForResolution) func GetYUVConversionModeForResolution(width, height int) YUV_CONVERSION_MODE { _width := C.int(width) _height := C.int(height) @@ -272,13 +272,13 @@ func GetYUVConversionModeForResolution(width, height int) YUV_CONVERSION_MODE { } // Free frees the RGB surface. -// (https://wiki.libsdl.org/SDL_FreeSurface) +// (https://wiki.libsdl.org/SDL2/SDL_FreeSurface) func (surface *Surface) Free() { C.SDL_FreeSurface(surface.cptr()) } // SetPalette sets the palette used by the surface. -// (https://wiki.libsdl.org/SDL_SetSurfacePalette) +// (https://wiki.libsdl.org/SDL2/SDL_SetSurfacePalette) func (surface *Surface) SetPalette(palette *Palette) error { if C.SDL_SetSurfacePalette(surface.cptr(), palette.cptr()) != 0 { return GetError() @@ -287,7 +287,7 @@ func (surface *Surface) SetPalette(palette *Palette) error { } // Lock sets up the surface for directly accessing the pixels. -// (https://wiki.libsdl.org/SDL_LockSurface) +// (https://wiki.libsdl.org/SDL2/SDL_LockSurface) func (surface *Surface) Lock() error { if C.SDL_LockSurface(surface.cptr()) != 0 { return GetError() @@ -296,13 +296,13 @@ func (surface *Surface) Lock() error { } // Unlock releases the surface after directly accessing the pixels. -// (https://wiki.libsdl.org/SDL_UnlockSurface) +// (https://wiki.libsdl.org/SDL2/SDL_UnlockSurface) func (surface *Surface) Unlock() { C.SDL_UnlockSurface(surface.cptr()) } // LoadBMPRW loads a BMP image from a seekable SDL data stream (memory or file). -// (https://wiki.libsdl.org/SDL_LoadBMP_RW) +// (https://wiki.libsdl.org/SDL2/SDL_LoadBMP_RW) func LoadBMPRW(src *RWops, freeSrc bool) (*Surface, error) { surface := (*Surface)(unsafe.Pointer(C.SDL_LoadBMP_RW(src.cptr(), C.int(Btoi(freeSrc))))) if surface == nil { @@ -312,13 +312,13 @@ func LoadBMPRW(src *RWops, freeSrc bool) (*Surface, error) { } // LoadBMP loads a surface from a BMP file. -// (https://wiki.libsdl.org/SDL_LoadBMP) +// (https://wiki.libsdl.org/SDL2/SDL_LoadBMP) func LoadBMP(file string) (*Surface, error) { return LoadBMPRW(RWFromFile(file, "rb"), true) } // SaveBMPRW save the surface to a seekable SDL data stream (memory or file) in BMP format. -// (https://wiki.libsdl.org/SDL_SaveBMP_RW) +// (https://wiki.libsdl.org/SDL2/SDL_SaveBMP_RW) func (surface *Surface) SaveBMPRW(dst *RWops, freeDst bool) error { if C.SDL_SaveBMP_RW(surface.cptr(), dst.cptr(), C.int(Btoi(freeDst))) != 0 { return GetError() @@ -327,13 +327,13 @@ func (surface *Surface) SaveBMPRW(dst *RWops, freeDst bool) error { } // SaveBMP saves the surface to a BMP file. -// (https://wiki.libsdl.org/SDL_SaveBMP) +// (https://wiki.libsdl.org/SDL2/SDL_SaveBMP) func (surface *Surface) SaveBMP(file string) error { return surface.SaveBMPRW(RWFromFile(file, "wb"), true) } // SetRLE sets the RLE acceleration hint for the surface. -// (https://wiki.libsdl.org/SDL_SetSurfaceRLE) +// (https://wiki.libsdl.org/SDL2/SDL_SetSurfaceRLE) func (surface *Surface) SetRLE(flag bool) error { if C.SDL_SetSurfaceRLE(surface.cptr(), C.int(Btoi(flag))) != 0 { return GetError() @@ -342,13 +342,13 @@ func (surface *Surface) SetRLE(flag bool) error { } // HasRLE returns whether the surface is RLE enabled. -// (https://wiki.libsdl.org/SDL_HasSurfaceRLE) +// (https://wiki.libsdl.org/SDL2/SDL_HasSurfaceRLE) func (surface *Surface) HasRLE() bool { return C.SDL_HasSurfaceRLE(surface.cptr()) == C.SDL_TRUE } // SetColorKey sets the color key (transparent pixel) in the surface. -// (https://wiki.libsdl.org/SDL_SetColorKey) +// (https://wiki.libsdl.org/SDL2/SDL_SetColorKey) func (surface *Surface) SetColorKey(flag bool, key uint32) error { if C.SDL_SetColorKey(surface.cptr(), C.int(Btoi(flag)), C.Uint32(key)) != 0 { return GetError() @@ -357,13 +357,13 @@ func (surface *Surface) SetColorKey(flag bool, key uint32) error { } // HasColorKey returns the color key (transparent pixel) for the surface. -// (https://wiki.libsdl.org/SDL_HasColorKey) +// (https://wiki.libsdl.org/SDL2/SDL_HasColorKey) func (surface *Surface) HasColorKey() bool { return C.SDL_HasColorKey(surface.cptr()) == C.SDL_TRUE } // GetColorKey returns the color key (transparent pixel) for the surface. -// (https://wiki.libsdl.org/SDL_GetColorKey) +// (https://wiki.libsdl.org/SDL2/SDL_GetColorKey) func (surface *Surface) GetColorKey() (key uint32, err error) { _key := (*C.Uint32)(unsafe.Pointer(&key)) if C.SDL_GetColorKey(surface.cptr(), _key) != 0 { @@ -373,7 +373,7 @@ func (surface *Surface) GetColorKey() (key uint32, err error) { } // SetColorMod sets an additional color value multiplied into blit operations. -// (https://wiki.libsdl.org/SDL_SetSurfaceColorMod) +// (https://wiki.libsdl.org/SDL2/SDL_SetSurfaceColorMod) func (surface *Surface) SetColorMod(r, g, b uint8) error { if C.SDL_SetSurfaceColorMod(surface.cptr(), C.Uint8(r), C.Uint8(g), C.Uint8(b)) != 0 { return GetError() @@ -382,7 +382,7 @@ func (surface *Surface) SetColorMod(r, g, b uint8) error { } // GetColorMod returns the additional color value multiplied into blit operations. -// (https://wiki.libsdl.org/SDL_GetSurfaceColorMod) +// (https://wiki.libsdl.org/SDL2/SDL_GetSurfaceColorMod) func (surface *Surface) GetColorMod() (r, g, b uint8, err error) { _r := (*C.Uint8)(unsafe.Pointer(&r)) _g := (*C.Uint8)(unsafe.Pointer(&g)) @@ -394,7 +394,7 @@ func (surface *Surface) GetColorMod() (r, g, b uint8, err error) { } // SetAlphaMod sets an additional alpha value used in blit operations. -// (https://wiki.libsdl.org/SDL_SetSurfaceAlphaMod) +// (https://wiki.libsdl.org/SDL2/SDL_SetSurfaceAlphaMod) func (surface *Surface) SetAlphaMod(alpha uint8) error { if C.SDL_SetSurfaceAlphaMod(surface.cptr(), C.Uint8(alpha)) != 0 { return GetError() @@ -403,7 +403,7 @@ func (surface *Surface) SetAlphaMod(alpha uint8) error { } // GetAlphaMod returns the additional alpha value used in blit operations. -// (https://wiki.libsdl.org/SDL_GetSurfaceAlphaMod) +// (https://wiki.libsdl.org/SDL2/SDL_GetSurfaceAlphaMod) func (surface *Surface) GetAlphaMod() (alpha uint8, err error) { _alpha := (*C.Uint8)(unsafe.Pointer(&alpha)) if C.SDL_GetSurfaceAlphaMod(surface.cptr(), _alpha) != 0 { @@ -413,7 +413,7 @@ func (surface *Surface) GetAlphaMod() (alpha uint8, err error) { } // SetBlendMode sets the blend mode used for blit operations. -// (https://wiki.libsdl.org/SDL_SetSurfaceBlendMode) +// (https://wiki.libsdl.org/SDL2/SDL_SetSurfaceBlendMode) func (surface *Surface) SetBlendMode(bm BlendMode) error { if C.SDL_SetSurfaceBlendMode(surface.cptr(), bm.c()) != 0 { return GetError() @@ -422,7 +422,7 @@ func (surface *Surface) SetBlendMode(bm BlendMode) error { } // GetBlendMode returns the blend mode used for blit operations. -// (https://wiki.libsdl.org/SDL_GetSurfaceBlendMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetSurfaceBlendMode) func (surface *Surface) GetBlendMode() (bm BlendMode, err error) { if C.SDL_GetSurfaceBlendMode(surface.cptr(), bm.cptr()) != 0 { return bm, GetError() @@ -431,19 +431,19 @@ func (surface *Surface) GetBlendMode() (bm BlendMode, err error) { } // SetClipRect sets the clipping rectangle for the surface -// (https://wiki.libsdl.org/SDL_SetClipRect) +// (https://wiki.libsdl.org/SDL2/SDL_SetClipRect) func (surface *Surface) SetClipRect(rect *Rect) bool { return C.SDL_SetClipRect(surface.cptr(), rect.cptr()) > 0 } // GetClipRect returns the clipping rectangle for a surface. -// (https://wiki.libsdl.org/SDL_GetClipRect) +// (https://wiki.libsdl.org/SDL2/SDL_GetClipRect) func (surface *Surface) GetClipRect(rect *Rect) { C.SDL_GetClipRect(surface.cptr(), rect.cptr()) } // Convert copies the existing surface into a new one that is optimized for blitting to a surface of a specified pixel format. -// (https://wiki.libsdl.org/SDL_ConvertSurface) +// (https://wiki.libsdl.org/SDL2/SDL_ConvertSurface) func (surface *Surface) Convert(fmt *PixelFormat, flags uint32) (*Surface, error) { _surface := (*Surface)(unsafe.Pointer(C.SDL_ConvertSurface(surface.cptr(), fmt.cptr(), C.Uint32(flags)))) if _surface == nil { @@ -453,7 +453,7 @@ func (surface *Surface) Convert(fmt *PixelFormat, flags uint32) (*Surface, error } // ConvertFormat copies the existing surface to a new surface of the specified format. -// (https://wiki.libsdl.org/SDL_ConvertSurfaceFormat) +// (https://wiki.libsdl.org/SDL2/SDL_ConvertSurfaceFormat) func (surface *Surface) ConvertFormat(pixelFormat uint32, flags uint32) (*Surface, error) { _surface := (*Surface)(unsafe.Pointer(C.SDL_ConvertSurfaceFormat(surface.cptr(), C.Uint32(pixelFormat), C.Uint32(flags)))) if _surface == nil { @@ -463,7 +463,7 @@ func (surface *Surface) ConvertFormat(pixelFormat uint32, flags uint32) (*Surfac } // ConvertPixels copies a block of pixels of one format to another format. -// (https://wiki.libsdl.org/SDL_ConvertPixels) +// (https://wiki.libsdl.org/SDL2/SDL_ConvertPixels) func ConvertPixels(width, height int32, srcFormat uint32, src unsafe.Pointer, srcPitch int, dstFormat uint32, dst unsafe.Pointer, dstPitch int) error { if C.SDL_ConvertPixels(C.int(width), C.int(height), C.Uint32(srcFormat), src, C.int(srcPitch), C.Uint32(dstFormat), dst, C.int(dstPitch)) != 0 { @@ -473,7 +473,7 @@ func ConvertPixels(width, height int32, srcFormat uint32, src unsafe.Pointer, sr } // FillRect performs a fast fill of a rectangle with a specific color. -// (https://wiki.libsdl.org/SDL_FillRect) +// (https://wiki.libsdl.org/SDL2/SDL_FillRect) func (surface *Surface) FillRect(rect *Rect, color uint32) error { if C.SDL_FillRect(surface.cptr(), rect.cptr(), C.Uint32(color)) != 0 { return GetError() @@ -482,7 +482,7 @@ func (surface *Surface) FillRect(rect *Rect, color uint32) error { } // FillRects performs a fast fill of a set of rectangles with a specific color. -// (https://wiki.libsdl.org/SDL_FillRects) +// (https://wiki.libsdl.org/SDL2/SDL_FillRects) func (surface *Surface) FillRects(rects []Rect, color uint32) error { if C.SDL_FillRects(surface.cptr(), rects[0].cptr(), C.int(len(rects)), C.Uint32(color)) != 0 { return GetError() @@ -491,7 +491,7 @@ func (surface *Surface) FillRects(rects []Rect, color uint32) error { } // Blit performs a fast surface copy to a destination surface. -// (https://wiki.libsdl.org/SDL_BlitSurface) +// (https://wiki.libsdl.org/SDL2/SDL_BlitSurface) func (surface *Surface) Blit(srcRect *Rect, dst *Surface, dstRect *Rect) error { if C.SDL_BlitSurface(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()) != 0 { return GetError() @@ -500,7 +500,7 @@ func (surface *Surface) Blit(srcRect *Rect, dst *Surface, dstRect *Rect) error { } // BlitScaled performs a scaled surface copy to a destination surface. -// (https://wiki.libsdl.org/SDL_BlitScaled) +// (https://wiki.libsdl.org/SDL2/SDL_BlitScaled) func (surface *Surface) BlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error { if C.SDL_BlitScaled(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()) != 0 { return GetError() @@ -509,7 +509,7 @@ func (surface *Surface) BlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) e } // UpperBlit has been replaced by Blit(). -// (https://wiki.libsdl.org/SDL_UpperBlit) +// (https://wiki.libsdl.org/SDL2/SDL_UpperBlit) func (surface *Surface) UpperBlit(srcRect *Rect, dst *Surface, dstRect *Rect) error { if C.SDL_UpperBlit(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()) != 0 { return GetError() @@ -518,7 +518,7 @@ func (surface *Surface) UpperBlit(srcRect *Rect, dst *Surface, dstRect *Rect) er } // LowerBlit performs low-level surface blitting only. -// (https://wiki.libsdl.org/SDL_LowerBlit) +// (https://wiki.libsdl.org/SDL2/SDL_LowerBlit) func (surface *Surface) LowerBlit(srcRect *Rect, dst *Surface, dstRect *Rect) error { if C.SDL_LowerBlit(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()) != 0 { return GetError() @@ -527,7 +527,7 @@ func (surface *Surface) LowerBlit(srcRect *Rect, dst *Surface, dstRect *Rect) er } // SoftStretch has been replaced by BlitScaled(). -// (https://wiki.libsdl.org/SDL_SoftStretch) +// (https://wiki.libsdl.org/SDL2/SDL_SoftStretch) func (surface *Surface) SoftStretch(srcRect *Rect, dst *Surface, dstRect *Rect) error { if C.SDL_SoftStretch(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()) != 0 { return GetError() @@ -536,7 +536,7 @@ func (surface *Surface) SoftStretch(srcRect *Rect, dst *Surface, dstRect *Rect) } // UpperBlitScaled has been replaced by BlitScaled(). -// (https://wiki.libsdl.org/SDL_UpperBlitScaled) +// (https://wiki.libsdl.org/SDL2/SDL_UpperBlitScaled) func (surface *Surface) UpperBlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error { if C.SDL_UpperBlitScaled(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()) != 0 { return GetError() @@ -545,7 +545,7 @@ func (surface *Surface) UpperBlitScaled(srcRect *Rect, dst *Surface, dstRect *Re } // LowerBlitScaled performs low-level surface scaled blitting only. -// (https://wiki.libsdl.org/SDL_LowerBlitScaled) +// (https://wiki.libsdl.org/SDL2/SDL_LowerBlitScaled) func (surface *Surface) LowerBlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error { if C.SDL_LowerBlitScaled(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()) != 0 { return GetError() @@ -803,7 +803,7 @@ func (surface *Surface) Set(x, y int, c color.Color) { } // SoftStretchLinear performs bilinear scaling between two surfaces of the same format, 32BPP. -// (https://wiki.libsdl.org/SDL_SoftStretchLinear) +// (https://wiki.libsdl.org/SDL2/SDL_SoftStretchLinear) func (surface *Surface) SoftStretchLinear(srcRect *Rect, dst *Surface, dstRect *Rect) (err error) { return errorFromInt(int(C.SDL_SoftStretchLinear(surface.cptr(), srcRect.cptr(), dst.cptr(), dstRect.cptr()))) } @@ -814,7 +814,7 @@ func (surface *Surface) SoftStretchLinear(srcRect *Rect, dst *Surface, dstRect * // // This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888. // -// (https://wiki.libsdl.org/SDL_PremultiplyAlpha) +// (https://wiki.libsdl.org/SDL2/SDL_PremultiplyAlpha) func PremultiplyAlpha(width, height int, srcFormat uint32, src []byte, srcPitch int, dstFormat uint32, dst []byte, dstPitch int) (err error) { _width := C.int(width) _height := C.int(height) diff --git a/sdl/sysrender.go b/sdl/sysrender.go index add40247..38cab914 100644 --- a/sdl/sysrender.go +++ b/sdl/sysrender.go @@ -5,11 +5,11 @@ import "C" import "unsafe" // Texture contains an efficient, driver-specific representation of pixel data. -// (https://wiki.libsdl.org/SDL_Texture) +// (https://wiki.libsdl.org/SDL2/SDL_Texture) type Texture C.SDL_Texture // Renderer contains a rendering state. -// (https://wiki.libsdl.org/SDL_Renderer) +// (https://wiki.libsdl.org/SDL2/SDL_Renderer) type Renderer C.SDL_Renderer func (t *Texture) cptr() *C.SDL_Texture { diff --git a/sdl/system.go b/sdl/system.go index 153b9900..cfc935f1 100644 --- a/sdl/system.go +++ b/sdl/system.go @@ -19,7 +19,7 @@ static inline SDL_bool SDL_IsTablet() import "C" // IsTablet returns true if the current device is a tablet -// (https://wiki.libsdl.org/SDL_IsTablet) +// (https://wiki.libsdl.org/SDL2/SDL_IsTablet) func IsTablet() bool { return C.SDL_IsTablet() == C.SDL_TRUE } diff --git a/sdl/system_android.go b/sdl/system_android.go index 7769f931..dd26dd8c 100644 --- a/sdl/system_android.go +++ b/sdl/system_android.go @@ -70,19 +70,19 @@ const ( ) // AndroidGetInternalStoragePath returns the path used for internal storage for this application. -// (https://wiki.libsdl.org/SDL_AndroidGetInternalStoragePath) +// (https://wiki.libsdl.org/SDL2/SDL_AndroidGetInternalStoragePath) func AndroidGetInternalStoragePath() string { return C.GoString(C.SDL_AndroidGetInternalStoragePath()) } // AndroidGetExternalStoragePath returns the path used for external storage for this application. -// (https://wiki.libsdl.org/SDL_AndroidGetExternalStoragePath) +// (https://wiki.libsdl.org/SDL2/SDL_AndroidGetExternalStoragePath) func AndroidGetExternalStoragePath() string { return C.GoString(C.SDL_AndroidGetExternalStoragePath()) } // AndroidRequestPermission requests permissions at runtime. -// (https://wiki.libsdl.org/SDL_AndroidRequestPermission) +// (https://wiki.libsdl.org/SDL2/SDL_AndroidRequestPermission) func AndroidRequestPermission(permission string) bool { _permission := C.CString(permission) defer C.free(unsafe.Pointer(_permission)) @@ -90,37 +90,37 @@ func AndroidRequestPermission(permission string) bool { } // AndroidGetExternalStorageState returns the current state of external storage. -// (https://wiki.libsdl.org/SDL_AndroidGetExternalStorageState) +// (https://wiki.libsdl.org/SDL2/SDL_AndroidGetExternalStorageState) func AndroidGetExternalStorageState() int { return int(C.SDL_AndroidGetExternalStorageState()) } // AndroidGetJNIEnv returns the Java native interface object (JNIEnv) of the current thread on Android builds. -// (https://wiki.libsdl.org/SDL_AndroidGetJNIEnv) +// (https://wiki.libsdl.org/SDL2/SDL_AndroidGetJNIEnv) func AndroidGetJNIEnv() unsafe.Pointer { return unsafe.Pointer(C.SDL_AndroidGetJNIEnv()) } // AndroidGetActivity returns the Java instance of the activity class in an Android application. -// (https://wiki.libsdl.org/SDL_AndroidGetActivity) +// (https://wiki.libsdl.org/SDL2/SDL_AndroidGetActivity) func AndroidGetActivity() unsafe.Pointer { return unsafe.Pointer(C.SDL_AndroidGetActivity()) } // GetAndroidSDKVersion returns API level of the current device. -// (https://wiki.libsdl.org/SDL_GetAndroidSDKVersion) +// (https://wiki.libsdl.org/SDL2/SDL_GetAndroidSDKVersion) func GetAndroidSDKVersion() int { return int(C.SDL_GetAndroidSDKVersion()) } // IsAndroidTV returns true if the application is running on Android TV -// (https://wiki.libsdl.org/SDL_IsAndroidTV) +// (https://wiki.libsdl.org/SDL2/SDL_IsAndroidTV) func IsAndroidTV() bool { return C.SDL_IsAndroidTV() >= 0 } // AndroidShowToast shows an Android toast notification. -// (https://wiki.libsdl.org/SDL_AndroidShowToast) +// (https://wiki.libsdl.org/SDL2/SDL_AndroidShowToast) func AndroidShowToast(message string, duration, gravity, xoffset, yoffset int) (err error) { _message := C.CString(message) defer C.free(unsafe.Pointer(_message)) diff --git a/sdl/system_linux.go b/sdl/system_linux.go index e5a3435b..49a1da0f 100644 --- a/sdl/system_linux.go +++ b/sdl/system_linux.go @@ -37,7 +37,7 @@ import "C" // // This uses setpriority() if possible, and RealtimeKit if available. // -// (https://wiki.libsdl.org/SDL_LinuxSetThreadPriority) +// (https://wiki.libsdl.org/SDL2/SDL_LinuxSetThreadPriority) func LinuxSetThreadPriority(threadID int64, priority int) (err error) { _threadID := C.Sint64(threadID) _priority := C.int(priority) @@ -48,7 +48,7 @@ func LinuxSetThreadPriority(threadID int64, priority int) (err error) { // // This uses setpriority() if possible, and RealtimeKit if available. // -// (https://wiki.libsdl.org/SDL_LinuxSetThreadPriorityAndPolicy) +// (https://wiki.libsdl.org/SDL2/SDL_LinuxSetThreadPriorityAndPolicy) func LinuxSetThreadPriorityAndPolicy(threadID int64, sdlPriority, schedPolicy int) (err error) { _threadID := C.Sint64(threadID) _sdlPriority := C.int(sdlPriority) diff --git a/sdl/system_windows.go b/sdl/system_windows.go index 54752263..cc493365 100644 --- a/sdl/system_windows.go +++ b/sdl/system_windows.go @@ -30,7 +30,7 @@ var windowsMessageHook WindowsMessageHook type ID3D11Device C.ID3D11Device; // SetWindowsMessageHook sets a callback for every Windows message, run before TranslateMessage(). -// (https://wiki.libsdl.org/SDL_SetWindowsMessageHook) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowsMessageHook) func SetWindowsMessageHook(callback WindowsMessageHook, userdata interface{}) { windowsMessageHook = callback C.SetWindowsMessageHook() @@ -45,7 +45,7 @@ func goWindowsMessageHook(userdata interface{}, hWnd unsafe.Pointer, message uin } // SDL_RenderGetD3D11Device gets the D3D11 device associated with a renderer. -// (https://wiki.libsdl.org/SDL_RenderGetD3D11Device) +// (https://wiki.libsdl.org/SDL2/SDL_RenderGetD3D11Device) func (renderer *Renderer) GetD3D11Device() (device *ID3D11Device, err error) { device = (*ID3D11Device)(C.SDL_RenderGetD3D11Device(renderer.cptr())) if device == nil { diff --git a/sdl/syswm.go b/sdl/syswm.go index 5cdf2715..51df7cb1 100644 --- a/sdl/syswm.go +++ b/sdl/syswm.go @@ -45,7 +45,7 @@ import "C" import "unsafe" // Various supported windowing subsystems. -// (https://wiki.libsdl.org/SDL_SYSWM_TYPE) +// (https://wiki.libsdl.org/SDL2/SDL_SYSWM_TYPE) type SysWmType C.SDL_SYSWM_TYPE const ( @@ -63,7 +63,7 @@ const ( ) // SysWMInfo contains system-dependent information about a window. -// (https://wiki.libsdl.org/SDL_SysWMinfo) +// (https://wiki.libsdl.org/SDL2/SDL_SysWMinfo) type SysWMInfo struct { Version Version // a Version structure that contains the current SDL version Subsystem SysWmType // the windowing system type @@ -101,7 +101,7 @@ type UIKitInfo struct { } // SysWMmsg contains system-dependent window manager messages. -// (https://wiki.libsdl.org/SDL_SysWMmsg) +// (https://wiki.libsdl.org/SDL2/SDL_SysWMmsg) type SysWMmsg struct { Version Version // a Version structure that contains the current SDL version Subsystem SysWmType // the windowing system type @@ -113,7 +113,7 @@ func (info *SysWMInfo) cptr() *C.SDL_SysWMinfo { } // GetWMInfo returns driver specific information about a window. -// (https://wiki.libsdl.org/SDL_GetWindowWMInfo) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowWMInfo) func (window *Window) GetWMInfo() (*SysWMInfo, error) { var info SysWMInfo VERSION(&info.Version) diff --git a/sdl/thread.go b/sdl/thread.go index 970cba02..e3fd537f 100644 --- a/sdl/thread.go +++ b/sdl/thread.go @@ -4,7 +4,7 @@ package sdl import "C" // CurrentThreadID gets the thread identifier for the current thread. -// (https://wiki.libsdl.org/SDL_ThreadID) +// (https://wiki.libsdl.org/SDL2/SDL_ThreadID) func CurrentThreadID() uint { return uint(C.SDL_ThreadID()) } diff --git a/sdl/timer.go b/sdl/timer.go index ab33ef6c..c8cc5757 100644 --- a/sdl/timer.go +++ b/sdl/timer.go @@ -26,31 +26,31 @@ import "C" // breaking binary compatibility, though, so this function isn't officially // deprecated. // -// (https://wiki.libsdl.org/SDL_GetTicks) +// (https://wiki.libsdl.org/SDL2/SDL_GetTicks) func GetTicks() uint32 { return uint32(C.SDL_GetTicks()) } // GetTicks64 returns the number of milliseconds since the SDL library initialization. -// (https://wiki.libsdl.org/SDL_GetTicks64) +// (https://wiki.libsdl.org/SDL2/SDL_GetTicks64) func GetTicks64() uint64 { return uint64(C.SDL_GetTicks64()) } // GetPerformanceCounter returns the current value of the high resolution counter. -// (https://wiki.libsdl.org/SDL_GetPerformanceCounter) +// (https://wiki.libsdl.org/SDL2/SDL_GetPerformanceCounter) func GetPerformanceCounter() uint64 { return uint64(C.SDL_GetPerformanceCounter()) } // GetPerformanceFrequency returns the count per second of the high resolution counter. -// (https://wiki.libsdl.org/SDL_GetPerformanceFrequency) +// (https://wiki.libsdl.org/SDL2/SDL_GetPerformanceFrequency) func GetPerformanceFrequency() uint64 { return uint64(C.SDL_GetPerformanceFrequency()) } // Delay waits a specified number of milliseconds before returning. -// (https://wiki.libsdl.org/SDL_Delay) +// (https://wiki.libsdl.org/SDL2/SDL_Delay) func Delay(ms uint32) { C.SDL_Delay(C.Uint32(ms)) } diff --git a/sdl/touch.go b/sdl/touch.go index 6c97d9a9..8fc44798 100644 --- a/sdl/touch.go +++ b/sdl/touch.go @@ -60,31 +60,31 @@ func (t TouchID) c() C.SDL_TouchID { } // GetNumTouchDevices returns the number of registered touch devices. -// (https://wiki.libsdl.org/SDL_GetNumTouchDevices) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumTouchDevices) func GetNumTouchDevices() int { return int(C.SDL_GetNumTouchDevices()) } // GetTouchDevice returns the touch ID with the given index. -// (https://wiki.libsdl.org/SDL_GetTouchDevice) +// (https://wiki.libsdl.org/SDL2/SDL_GetTouchDevice) func GetTouchDevice(index int) TouchID { return TouchID(C.SDL_GetTouchDevice(C.int(index))) } // GetTouchDeviceType returns the type of the given touch device. -// (https://wiki.libsdl.org/SDL_GetTouchDeviceType) +// (https://wiki.libsdl.org/SDL2/SDL_GetTouchDeviceType) func GetTouchDeviceType(id TouchID) TouchDeviceType { return TouchDeviceType(C.SDL_GetTouchDeviceType(C.SDL_TouchID(id))) } // GetNumTouchFingers returns the number of active fingers for a given touch device. -// (https://wiki.libsdl.org/SDL_GetNumTouchFingers) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumTouchFingers) func GetNumTouchFingers(t TouchID) int { return int(C.SDL_GetNumTouchFingers(t.c())) } // GetTouchFinger returns the finger object for specified touch device ID and finger index. -// (https://wiki.libsdl.org/SDL_GetTouchFinger) +// (https://wiki.libsdl.org/SDL2/SDL_GetTouchFinger) func GetTouchFinger(t TouchID, index int) *Finger { return (*Finger)(unsafe.Pointer(C.SDL_GetTouchFinger(t.c(), C.int(index)))) } diff --git a/sdl/version.go b/sdl/version.go index 38830241..ef4b1278 100644 --- a/sdl/version.go +++ b/sdl/version.go @@ -30,7 +30,7 @@ const ( ) // Version contains information about the version of SDL in use. -// (https://wiki.libsdl.org/SDL_version) +// (https://wiki.libsdl.org/SDL2/SDL_version) type Version struct { Major uint8 // major version Minor uint8 // minor version @@ -43,7 +43,7 @@ func (v *Version) cptr() *C.SDL_version { } // VERSION fills the selected struct with the version of SDL in use. -// (https://wiki.libsdl.org/SDL_VERSION) +// (https://wiki.libsdl.org/SDL2/SDL_VERSION) func VERSION(v *Version) { v.Major = MAJOR_VERSION v.Minor = MINOR_VERSION @@ -51,31 +51,31 @@ func VERSION(v *Version) { } // VERSIONNUM converts separate version components into a single numeric value. -// (https://wiki.libsdl.org/SDL_VERSIONNUM) +// (https://wiki.libsdl.org/SDL2/SDL_VERSIONNUM) func VERSIONNUM(x, y, z int) int { return (x*1000 + y*100 + z) } // COMPILEDVERSION returns the SDL version number that you compiled against. -// (https://wiki.libsdl.org/SDL_COMPILEDVERSION) +// (https://wiki.libsdl.org/SDL2/SDL_COMPILEDVERSION) func COMPILEDVERSION() int { return VERSIONNUM(MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL) } // VERSION_ATLEAST reports whether the SDL version compiled against is at least as new as the specified version. -// (https://wiki.libsdl.org/SDL_VERSION_ATLEAST) +// (https://wiki.libsdl.org/SDL2/SDL_VERSION_ATLEAST) func VERSION_ATLEAST(x, y, z int) bool { return COMPILEDVERSION() >= VERSIONNUM(x, y, z) } // GetVersion returns the version of SDL that is linked against your program. -// (https://wiki.libsdl.org/SDL_GetVersion) +// (https://wiki.libsdl.org/SDL2/SDL_GetVersion) func GetVersion(v *Version) { C.SDL_GetVersion(v.cptr()) } // GetRevision returns the code revision of SDL that is linked against your program. -// (https://wiki.libsdl.org/SDL_GetRevision) +// (https://wiki.libsdl.org/SDL2/SDL_GetRevision) func GetRevision() string { return (string)(C.GoString(C.SDL_GetRevision())) } diff --git a/sdl/video.go b/sdl/video.go index d92e5716..c0bc097b 100644 --- a/sdl/video.go +++ b/sdl/video.go @@ -315,7 +315,7 @@ import "C" import "unsafe" // An enumeration of window states. -// (https://wiki.libsdl.org/SDL_WindowFlags) +// (https://wiki.libsdl.org/SDL2/SDL_WindowFlags) type WindowFlags uint32 const ( @@ -344,7 +344,7 @@ const ( ) // An enumeration of window events. -// (https://wiki.libsdl.org/SDL_WindowEventID) +// (https://wiki.libsdl.org/SDL2/SDL_WindowEventID) type WindowEventID uint32 const ( @@ -370,7 +370,7 @@ const ( ) // Window position flags. -// (https://wiki.libsdl.org/SDL_CreateWindow) +// (https://wiki.libsdl.org/SDL2/SDL_CreateWindow) const ( WINDOWPOS_UNDEFINED_MASK = C.SDL_WINDOWPOS_UNDEFINED_MASK // used to indicate that you don't care what the window position is WINDOWPOS_UNDEFINED = C.SDL_WINDOWPOS_UNDEFINED // used to indicate that you don't care what the window position is @@ -379,7 +379,7 @@ const ( ) // An enumeration of message box flags (e.g. if supported message box will display warning icon). -// (https://wiki.libsdl.org/SDL_MessageBoxFlags) +// (https://wiki.libsdl.org/SDL2/SDL_MessageBoxFlags) type MessageBoxFlags uint32 const ( @@ -389,7 +389,7 @@ const ( ) // Flags for MessageBoxButtonData. -// (https://wiki.libsdl.org/SDL_MessageBoxButtonFlags) +// (https://wiki.libsdl.org/SDL2/SDL_MessageBoxButtonFlags) type MessageBoxButtonDataFlags uint32 const ( @@ -398,8 +398,8 @@ const ( ) // OpenGL configuration attributes. -// (https://wiki.libsdl.org/SDL_GLattr) -// (https://wiki.libsdl.org/SDL_GL_SetAttribute) +// (https://wiki.libsdl.org/SDL2/SDL_GLattr) +// (https://wiki.libsdl.org/SDL2/SDL_GL_SetAttribute) type GLattr C.SDL_GLattr const ( @@ -423,8 +423,8 @@ const ( GL_CONTEXT_MAJOR_VERSION GLattr = C.SDL_GL_CONTEXT_MAJOR_VERSION // OpenGL context major version GL_CONTEXT_MINOR_VERSION GLattr = C.SDL_GL_CONTEXT_MINOR_VERSION // OpenGL context minor version GL_CONTEXT_EGL GLattr = C.SDL_GL_CONTEXT_EGL // not used (deprecated) - GL_CONTEXT_FLAGS GLattr = C.SDL_GL_CONTEXT_FLAGS // some combination of 0 or more of elements of the GLcontextFlag enumeration; defaults to 0 (https://wiki.libsdl.org/SDL_GLcontextFlag) - GL_CONTEXT_PROFILE_MASK GLattr = C.SDL_GL_CONTEXT_PROFILE_MASK // type of GL context (Core, Compatibility, ES); default value depends on platform (https://wiki.libsdl.org/SDL_GLprofile) + GL_CONTEXT_FLAGS GLattr = C.SDL_GL_CONTEXT_FLAGS // some combination of 0 or more of elements of the GLcontextFlag enumeration; defaults to 0 (https://wiki.libsdl.org/SDL2/SDL_GLcontextFlag) + GL_CONTEXT_PROFILE_MASK GLattr = C.SDL_GL_CONTEXT_PROFILE_MASK // type of GL context (Core, Compatibility, ES); default value depends on platform (https://wiki.libsdl.org/SDL2/SDL_GLprofile) GL_SHARE_WITH_CURRENT_CONTEXT GLattr = C.SDL_GL_SHARE_WITH_CURRENT_CONTEXT // OpenGL context sharing; defaults to 0 GL_FRAMEBUFFER_SRGB_CAPABLE GLattr = C.SDL_GL_FRAMEBUFFER_SRGB_CAPABLE // requests sRGB capable visual; defaults to 0 (>= SDL 2.0.1) GL_CONTEXT_RELEASE_BEHAVIOR GLattr = C.SDL_GL_CONTEXT_RELEASE_BEHAVIOR // sets context the release behavior; defaults to 1 (>= SDL 2.0.4) @@ -434,7 +434,7 @@ const ( ) // An enumeration of OpenGL profiles. -// (https://wiki.libsdl.org/SDL_GLprofile) +// (https://wiki.libsdl.org/SDL2/SDL_GLprofile) const ( GL_CONTEXT_PROFILE_CORE = C.SDL_GL_CONTEXT_PROFILE_CORE // OpenGL core profile - deprecated functions are disabled GL_CONTEXT_PROFILE_COMPATIBILITY = C.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY // OpenGL compatibility profile - deprecated functions are allowed @@ -442,7 +442,7 @@ const ( ) // An enumeration of OpenGL context configuration flags. -// (https://wiki.libsdl.org/SDL_GLcontextFlag) +// (https://wiki.libsdl.org/SDL2/SDL_GLcontextFlag) const ( GL_CONTEXT_DEBUG_FLAG = C.SDL_GL_CONTEXT_DEBUG_FLAG // intended to put the GL into a "debug" mode which might offer better developer insights, possibly at a loss of performance GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = C.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG // intended to put the GL into a "forward compatible" mode, which means that no deprecated functionality will be supported, possibly at a gain in performance, and only applies to GL 3.0 and later contexts @@ -470,9 +470,9 @@ const ( type DisplayOrientation C.SDL_DisplayOrientation // DisplayMode contains the description of a display mode. -// (https://wiki.libsdl.org/SDL_DisplayMode) +// (https://wiki.libsdl.org/SDL2/SDL_DisplayMode) type DisplayMode struct { - Format uint32 // one of the PixelFormatEnum values (https://wiki.libsdl.org/SDL_PixelFormatEnum) + Format uint32 // one of the PixelFormatEnum values (https://wiki.libsdl.org/SDL2/SDL_PixelFormatEnum) W int32 // width, in screen coordinates H int32 // height, in screen coordinates RefreshRate int32 // refresh rate (in Hz), or 0 for unspecified @@ -487,7 +487,7 @@ type Window C.SDL_Window type GLContext C.SDL_GLContext // MessageBoxColor contains RGB value used in an MessageBoxColorScheme. -// (https://wiki.libsdl.org/SDL_MessageBoxColor) +// (https://wiki.libsdl.org/SDL2/SDL_MessageBoxColor) type MessageBoxColor struct { R uint8 // the red component in the range 0-255 G uint8 // the green component in the range 0-255 @@ -496,14 +496,14 @@ type MessageBoxColor struct { type cMessageBoxColor C.SDL_MessageBoxColor // MessageBoxColorScheme contains a set of colors to use for message box dialogs. -// (https://wiki.libsdl.org/SDL_MessageBoxColorScheme) +// (https://wiki.libsdl.org/SDL2/SDL_MessageBoxColorScheme) type MessageBoxColorScheme struct { Colors [5]MessageBoxColor // background, text, button border, button background, button selected } type cMessageBoxColorScheme C.SDL_MessageBoxColorScheme // MessageBoxButtonData contains individual button data for a message box. -// (https://wiki.libsdl.org/SDL_MessageBoxButtonData) +// (https://wiki.libsdl.org/SDL2/SDL_MessageBoxButtonData) type MessageBoxButtonData struct { Flags MessageBoxButtonDataFlags // MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT ButtonID int32 // user defined button id (value returned via ShowMessageBox()) @@ -511,7 +511,7 @@ type MessageBoxButtonData struct { } // MessageBoxData contains title, text, window and other data for a message box. -// (https://wiki.libsdl.org/SDL_MessageBoxData) +// (https://wiki.libsdl.org/SDL2/SDL_MessageBoxData) type MessageBoxData struct { Flags MessageBoxFlags // MESSAGEBOX_ERROR, MESSAGEBOX_WARNING, MESSAGEBOX_INFORMATION Window *Window // parent window or nil @@ -550,7 +550,7 @@ func (attr GLattr) c() C.SDL_GLattr { } // GetDisplayName returns the name of a display in UTF-8 encoding. -// (https://wiki.libsdl.org/SDL_GetDisplayName) +// (https://wiki.libsdl.org/SDL2/SDL_GetDisplayName) func GetDisplayName(displayIndex int) (string, error) { name := C.SDL_GetDisplayName(C.int(displayIndex)) if name == nil { @@ -560,27 +560,27 @@ func GetDisplayName(displayIndex int) (string, error) { } // GetNumVideoDisplays returns the number of available video displays. -// (https://wiki.libsdl.org/SDL_GetNumVideoDisplays) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumVideoDisplays) func GetNumVideoDisplays() (int, error) { n := int(C.SDL_GetNumVideoDisplays()) return n, errorFromInt(n) } // GetNumVideoDrivers returns the number of video drivers compiled into SDL. -// (https://wiki.libsdl.org/SDL_GetNumVideoDrivers) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumVideoDrivers) func GetNumVideoDrivers() (int, error) { n := int(C.SDL_GetNumVideoDrivers()) return n, errorFromInt(n) } // GetVideoDriver returns the name of a built in video driver. -// (https://wiki.libsdl.org/SDL_GetVideoDriver) +// (https://wiki.libsdl.org/SDL2/SDL_GetVideoDriver) func GetVideoDriver(index int) string { return string(C.GoString(C.SDL_GetVideoDriver(C.int(index)))) } // VideoInit initializes the video subsystem, optionally specifying a video driver. -// (https://wiki.libsdl.org/SDL_VideoInit) +// (https://wiki.libsdl.org/SDL2/SDL_VideoInit) func VideoInit(driverName string) error { _driverName := C.CString(driverName) defer C.free(unsafe.Pointer(_driverName)) @@ -588,13 +588,13 @@ func VideoInit(driverName string) error { } // VideoQuit shuts down the video subsystem, if initialized with VideoInit(). -// (https://wiki.libsdl.org/SDL_VideoQuit) +// (https://wiki.libsdl.org/SDL2/SDL_VideoQuit) func VideoQuit() { C.SDL_VideoQuit() } // GetCurrentVideoDriver returns the name of the currently initialized video driver. -// (https://wiki.libsdl.org/SDL_GetCurrentVideoDriver) +// (https://wiki.libsdl.org/SDL2/SDL_GetCurrentVideoDriver) func GetCurrentVideoDriver() (string, error) { name := C.SDL_GetCurrentVideoDriver() if name == nil { @@ -610,14 +610,14 @@ func GetDisplayOrientation(displayIndex int) DisplayOrientation { } // GetNumDisplayModes returns the number of available display modes. -// (https://wiki.libsdl.org/SDL_GetNumDisplayModes) +// (https://wiki.libsdl.org/SDL2/SDL_GetNumDisplayModes) func GetNumDisplayModes(displayIndex int) (int, error) { n := int(C.SDL_GetNumDisplayModes(C.int(displayIndex))) return n, errorFromInt(n) } // GetDisplayBounds returns the desktop area represented by a display, with the primary display located at 0,0. -// (https://wiki.libsdl.org/SDL_GetDisplayBounds) +// (https://wiki.libsdl.org/SDL2/SDL_GetDisplayBounds) func GetDisplayBounds(displayIndex int) (rect Rect, err error) { err = errorFromInt(int( C.SDL_GetDisplayBounds(C.int(displayIndex), (&rect).cptr()))) @@ -625,7 +625,7 @@ func GetDisplayBounds(displayIndex int) (rect Rect, err error) { } // GetDisplayUsableBounds returns the usable desktop area represented by a display, with the primary display located at 0,0. -// (https://wiki.libsdl.org/SDL_GetDisplayUsableBounds) +// (https://wiki.libsdl.org/SDL2/SDL_GetDisplayUsableBounds) func GetDisplayUsableBounds(displayIndex int) (rect Rect, err error) { err = errorFromInt(int( C.SDL_GetDisplayUsableBounds(C.int(displayIndex), rect.cptr()))) @@ -633,7 +633,7 @@ func GetDisplayUsableBounds(displayIndex int) (rect Rect, err error) { } // GetDisplayMode returns information about a specific display mode. -// (https://wiki.libsdl.org/SDL_GetDisplayMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetDisplayMode) func GetDisplayMode(displayIndex int, modeIndex int) (mode DisplayMode, err error) { err = errorFromInt(int( C.SDL_GetDisplayMode(C.int(displayIndex), C.int(modeIndex), (&mode).cptr()))) @@ -641,7 +641,7 @@ func GetDisplayMode(displayIndex int, modeIndex int) (mode DisplayMode, err erro } // GetDesktopDisplayMode returns information about the desktop display mode. -// (https://wiki.libsdl.org/SDL_GetDesktopDisplayMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetDesktopDisplayMode) func GetDesktopDisplayMode(displayIndex int) (mode DisplayMode, err error) { err = errorFromInt(int( C.SDL_GetDesktopDisplayMode(C.int(displayIndex), (&mode).cptr()))) @@ -649,7 +649,7 @@ func GetDesktopDisplayMode(displayIndex int) (mode DisplayMode, err error) { } // GetCurrentDisplayMode returns information about the current display mode. -// (https://wiki.libsdl.org/SDL_GetCurrentDisplayMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetCurrentDisplayMode) func GetCurrentDisplayMode(displayIndex int) (mode DisplayMode, err error) { err = errorFromInt(int( C.SDL_GetCurrentDisplayMode(C.int(displayIndex), (&mode).cptr()))) @@ -657,7 +657,7 @@ func GetCurrentDisplayMode(displayIndex int) (mode DisplayMode, err error) { } // GetClosestDisplayMode returns the closest match to the requested display mode. -// (https://wiki.libsdl.org/SDL_GetClosestDisplayMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetClosestDisplayMode) func GetClosestDisplayMode(displayIndex int, mode *DisplayMode, closest *DisplayMode) (*DisplayMode, error) { m := (*DisplayMode)(unsafe.Pointer((C.SDL_GetClosestDisplayMode(C.int(displayIndex), mode.cptr(), closest.cptr())))) if m == nil { @@ -667,7 +667,7 @@ func GetClosestDisplayMode(displayIndex int, mode *DisplayMode, closest *Display } // GetPointDisplayIndex returns the index of the display containing a point. -// (https://wiki.libsdl.org/SDL_GetPointDisplayIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GetPointDisplayIndex) func GetPointDisplayIndex(p Point) (index int, err error) { _index := C.SDL_GetPointDisplayIndex(p.cptr()) index = int(_index) @@ -675,7 +675,7 @@ func GetPointDisplayIndex(p Point) (index int, err error) { } // GetRectDisplayIndex returns the index of the display containing a point. -// (https://wiki.libsdl.org/SDL_GetPointDisplayIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GetPointDisplayIndex) func GetRectDisplayIndex(r Rect) (index int, err error) { _index := C.SDL_GetRectDisplayIndex(r.cptr()) index = int(_index) @@ -683,7 +683,7 @@ func GetRectDisplayIndex(r Rect) (index int, err error) { } // GetDisplayDPI returns the dots/pixels-per-inch for a display. -// (https://wiki.libsdl.org/SDL_GetDisplayDPI) +// (https://wiki.libsdl.org/SDL2/SDL_GetDisplayDPI) func GetDisplayDPI(displayIndex int) (ddpi, hdpi, vdpi float32, err error) { err = errorFromInt(int( C.SDL_GetDisplayDPI(C.int(displayIndex), (*C.float)(unsafe.Pointer(&ddpi)), (*C.float)(unsafe.Pointer(&hdpi)), (*C.float)(unsafe.Pointer(&vdpi))))) @@ -691,21 +691,21 @@ func GetDisplayDPI(displayIndex int) (ddpi, hdpi, vdpi float32, err error) { } // GetDisplayIndex returns the index of the display associated with the window. -// (https://wiki.libsdl.org/SDL_GetWindowDisplayIndex) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowDisplayIndex) func (window *Window) GetDisplayIndex() (int, error) { i := int(C.SDL_GetWindowDisplayIndex(window.cptr())) return i, errorFromInt(i) } // SetDisplayMode sets the display mode to use when the window is visible at fullscreen. -// (https://wiki.libsdl.org/SDL_SetWindowDisplayMode) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowDisplayMode) func (window *Window) SetDisplayMode(mode *DisplayMode) error { return errorFromInt(int( C.SDL_SetWindowDisplayMode(window.cptr(), mode.cptr()))) } // GetDisplayMode fills in information about the display mode to use when the window is visible at fullscreen. -// (https://wiki.libsdl.org/SDL_GetWindowDisplayMode) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowDisplayMode) func (window *Window) GetDisplayMode() (mode DisplayMode, err error) { err = errorFromInt(int( C.SDL_GetWindowDisplayMode(window.cptr(), (&mode).cptr()))) @@ -713,7 +713,7 @@ func (window *Window) GetDisplayMode() (mode DisplayMode, err error) { } // GetPixelFormat returns the pixel format associated with the window. -// (https://wiki.libsdl.org/SDL_GetWindowPixelFormat) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowPixelFormat) func (window *Window) GetPixelFormat() (PixelFormatConstant, error) { f := (PixelFormatConstant)(C.SDL_GetWindowPixelFormat(window.cptr())) if f == PIXELFORMAT_UNKNOWN { @@ -723,7 +723,7 @@ func (window *Window) GetPixelFormat() (PixelFormatConstant, error) { } // CreateWindow creates a window with the specified position, dimensions, and flags. -// (https://wiki.libsdl.org/SDL_CreateWindow) +// (https://wiki.libsdl.org/SDL2/SDL_CreateWindow) func CreateWindow(title string, x, y, w, h int32, flags WindowFlags) (*Window, error) { _title := C.CString(title) defer C.free(unsafe.Pointer(_title)) @@ -735,7 +735,7 @@ func CreateWindow(title string, x, y, w, h int32, flags WindowFlags) (*Window, e } // CreateWindowFrom creates an SDL window from an existing native window. -// (https://wiki.libsdl.org/SDL_CreateWindowFrom) +// (https://wiki.libsdl.org/SDL2/SDL_CreateWindowFrom) func CreateWindowFrom(data unsafe.Pointer) (*Window, error) { _window := C.SDL_CreateWindowFrom(data) if _window == nil { @@ -745,7 +745,7 @@ func CreateWindowFrom(data unsafe.Pointer) (*Window, error) { } // Destroy destroys the window. -// (https://wiki.libsdl.org/SDL_DestroyWindow) +// (https://wiki.libsdl.org/SDL2/SDL_DestroyWindow) func (window *Window) Destroy() error { lastErr := GetError() ClearError() @@ -760,7 +760,7 @@ func (window *Window) Destroy() error { // GetID returns the numeric ID of the window, for logging purposes. // -// (https://wiki.libsdl.org/SDL_GetWindowID) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowID) func (window *Window) GetID() (uint32, error) { id := uint32(C.SDL_GetWindowID(window.cptr())) if id == 0 { @@ -770,7 +770,7 @@ func (window *Window) GetID() (uint32, error) { } // GetWindowFromID returns a window from a stored ID. -// (https://wiki.libsdl.org/SDL_GetWindowFromID) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowFromID) func GetWindowFromID(id uint32) (*Window, error) { _window := C.SDL_GetWindowFromID(C.Uint32(id)) if _window == nil { @@ -780,13 +780,13 @@ func GetWindowFromID(id uint32) (*Window, error) { } // GetFlags returns the window flags. -// (https://wiki.libsdl.org/SDL_GetWindowFlags) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowFlags) func (window *Window) GetFlags() WindowFlags { return (WindowFlags)(C.SDL_GetWindowFlags(window.cptr())) } // SetTitle sets the title of the window. -// (https://wiki.libsdl.org/SDL_SetWindowTitle) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowTitle) func (window *Window) SetTitle(title string) { _title := C.CString(title) defer C.free(unsafe.Pointer(_title)) @@ -794,19 +794,19 @@ func (window *Window) SetTitle(title string) { } // GetTitle returns the title of the window. -// (https://wiki.libsdl.org/SDL_GetWindowTitle) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowTitle) func (window *Window) GetTitle() string { return C.GoString(C.SDL_GetWindowTitle(window.cptr())) } // SetIcon sets the icon for the window. -// (https://wiki.libsdl.org/SDL_SetWindowIcon) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowIcon) func (window *Window) SetIcon(icon *Surface) { C.SDL_SetWindowIcon(window.cptr(), icon.cptr()) } // SetData associates an arbitrary named pointer with the window. -// (https://wiki.libsdl.org/SDL_SetWindowData) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowData) func (window *Window) SetData(name string, userdata unsafe.Pointer) unsafe.Pointer { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -814,7 +814,7 @@ func (window *Window) SetData(name string, userdata unsafe.Pointer) unsafe.Point } // GetData returns the data pointer associated with the window. -// (https://wiki.libsdl.org/SDL_GetWindowData) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowData) func (window *Window) GetData(name string) unsafe.Pointer { _name := C.CString(name) defer C.free(unsafe.Pointer(_name)) @@ -822,13 +822,13 @@ func (window *Window) GetData(name string) unsafe.Pointer { } // SetPosition sets the position of the window. -// (https://wiki.libsdl.org/SDL_SetWindowPosition) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowPosition) func (window *Window) SetPosition(x, y int32) { C.SDL_SetWindowPosition(window.cptr(), C.int(x), C.int(y)) } // GetPosition returns the position of the window. -// (https://wiki.libsdl.org/SDL_GetWindowPosition) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowPosition) func (window *Window) GetPosition() (x, y int32) { var _x, _y C.int C.SDL_GetWindowPosition(window.cptr(), &_x, &_y) @@ -836,19 +836,19 @@ func (window *Window) GetPosition() (x, y int32) { } // SetResizable sets the user-resizable state of the window. -// (https://wiki.libsdl.org/SDL_SetWindowResizable) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowResizable) func (window *Window) SetResizable(resizable bool) { C.SDL_SetWindowResizable(window.cptr(), C.SDL_bool(Btoi(resizable))) } // SetSize sets the size of the window's client area. -// (https://wiki.libsdl.org/SDL_SetWindowSize) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowSize) func (window *Window) SetSize(w, h int32) { C.SDL_SetWindowSize(window.cptr(), C.int(w), C.int(h)) } // GetSize returns the size of the window's client area. -// (https://wiki.libsdl.org/SDL_GetWindowSize) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowSize) func (window *Window) GetSize() (w, h int32) { var _w, _h C.int C.SDL_GetWindowSize(window.cptr(), &_w, &_h) @@ -856,7 +856,7 @@ func (window *Window) GetSize() (w, h int32) { } // GetSizeInPixels returns the size of a window in pixels. -// (https://wiki.libsdl.org/SDL_GetWindowSizeInPixels) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowSizeInPixels) func (window *Window) GetSizeInPixels() (w, h int32) { var _w, _h C.int C.SDL_GetWindowSizeInPixels(window.cptr(), &_w, &_h) @@ -864,13 +864,13 @@ func (window *Window) GetSizeInPixels() (w, h int32) { } // SetMinimumSize sets the minimum size of the window's client area. -// (https://wiki.libsdl.org/SDL_SetWindowMinimumSize) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowMinimumSize) func (window *Window) SetMinimumSize(minW, minH int32) { C.SDL_SetWindowMinimumSize(window.cptr(), C.int(minW), C.int(minH)) } // GetMinimumSize returns the minimum size of the window's client area. -// (https://wiki.libsdl.org/SDL_GetWindowMinimumSize) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowMinimumSize) func (window *Window) GetMinimumSize() (w, h int32) { var _w, _h C.int C.SDL_GetWindowMinimumSize(window.cptr(), &_w, &_h) @@ -878,13 +878,13 @@ func (window *Window) GetMinimumSize() (w, h int32) { } // SetMaximumSize sets the maximum size of the window's client area. -// (https://wiki.libsdl.org/SDL_SetWindowMaximumSize) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowMaximumSize) func (window *Window) SetMaximumSize(maxW, maxH int32) { C.SDL_SetWindowMaximumSize(window.cptr(), C.int(maxW), C.int(maxH)) } // GetMaximumSize returns the maximum size of the window's client area. -// (https://wiki.libsdl.org/SDL_GetWindowMaximumSize) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowMaximumSize) func (window *Window) GetMaximumSize() (w, h int32) { var _w, _h C.int C.SDL_GetWindowMaximumSize(window.cptr(), &_w, &_h) @@ -892,68 +892,68 @@ func (window *Window) GetMaximumSize() (w, h int32) { } // SetBordered sets the border state of the window. -// (https://wiki.libsdl.org/SDL_SetWindowBordered) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowBordered) func (window *Window) SetBordered(bordered bool) { C.SDL_SetWindowBordered(window.cptr(), C.SDL_bool(Btoi(bordered))) } // Show shows the window. -// (https://wiki.libsdl.org/SDL_ShowWindow) +// (https://wiki.libsdl.org/SDL2/SDL_ShowWindow) func (window *Window) Show() { C.SDL_ShowWindow(window.cptr()) } // Hide hides the window. -// (https://wiki.libsdl.org/SDL_HideWindow) +// (https://wiki.libsdl.org/SDL2/SDL_HideWindow) func (window *Window) Hide() { C.SDL_HideWindow(window.cptr()) } // Raise raises the window above other windows and set the input focus. -// (https://wiki.libsdl.org/SDL_RaiseWindow) +// (https://wiki.libsdl.org/SDL2/SDL_RaiseWindow) func (window *Window) Raise() { C.SDL_RaiseWindow(window.cptr()) } // Maximize makes the window as large as possible. -// (https://wiki.libsdl.org/SDL_MaximizeWindow) +// (https://wiki.libsdl.org/SDL2/SDL_MaximizeWindow) func (window *Window) Maximize() { C.SDL_MaximizeWindow(window.cptr()) } // Minimize minimizes the window to an iconic representation. -// (https://wiki.libsdl.org/SDL_MinimizeWindow) +// (https://wiki.libsdl.org/SDL2/SDL_MinimizeWindow) func (window *Window) Minimize() { C.SDL_MinimizeWindow(window.cptr()) } // Restore restores the size and position of a minimized or maximized window. -// (https://wiki.libsdl.org/SDL_RestoreWindow) +// (https://wiki.libsdl.org/SDL2/SDL_RestoreWindow) func (window *Window) Restore() { C.SDL_RestoreWindow(window.cptr()) } // SetFullscreen sets the window's fullscreen state. -// (https://wiki.libsdl.org/SDL_SetWindowFullscreen) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowFullscreen) func (window *Window) SetFullscreen(flags uint32) error { return errorFromInt(int( C.SDL_SetWindowFullscreen(window.cptr(), C.Uint32(flags)))) } // HasSurface returns whether the window has a surface associated with it. -// (https://wiki.libsdl.org/SDL_HasWindowSurface) +// (https://wiki.libsdl.org/SDL2/SDL_HasWindowSurface) func (window *Window) HasSurface() bool { return C.SDL_HasWindowSurface(window.cptr()) == C.SDL_TRUE } // DestroySurface destroys the surface associated with the window.. -// (https://wiki.libsdl.org/SDL_DestroyWindowSurface) +// (https://wiki.libsdl.org/SDL2/SDL_DestroyWindowSurface) func (window *Window) DestroySurface() error { return errorFromInt(int(C.SDL_DestroyWindowSurface(window.cptr()))) } // GetSurface returns the SDL surface associated with the window. -// (https://wiki.libsdl.org/SDL_GetWindowSurface) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowSurface) func (window *Window) GetSurface() (*Surface, error) { surface := (*Surface)(unsafe.Pointer(C.SDL_GetWindowSurface(window.cptr()))) if surface == nil { @@ -963,46 +963,46 @@ func (window *Window) GetSurface() (*Surface, error) { } // UpdateSurface copies the window surface to the screen. -// (https://wiki.libsdl.org/SDL_UpdateWindowSurface) +// (https://wiki.libsdl.org/SDL2/SDL_UpdateWindowSurface) func (window *Window) UpdateSurface() error { return errorFromInt(int( C.SDL_UpdateWindowSurface(window.cptr()))) } // UpdateSurfaceRects copies areas of the window surface to the screen. -// (https://wiki.libsdl.org/SDL_UpdateWindowSurfaceRects) +// (https://wiki.libsdl.org/SDL2/SDL_UpdateWindowSurfaceRects) func (window *Window) UpdateSurfaceRects(rects []Rect) error { return errorFromInt(int( C.SDL_UpdateWindowSurfaceRects(window.cptr(), rects[0].cptr(), C.int(len(rects))))) } // SetGrab sets the window's input grab mode. -// (https://wiki.libsdl.org/SDL_SetWindowGrab) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowGrab) func (window *Window) SetGrab(grabbed bool) { C.SDL_SetWindowGrab(window.cptr(), C.SDL_bool((Btoi(grabbed)))) } // GetGrab returns the window's input grab mode. -// (https://wiki.libsdl.org/SDL_GetWindowGrab) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowGrab) func (window *Window) GetGrab() bool { return C.SDL_GetWindowGrab(window.cptr()) != 0 } // SetBrightness sets the brightness (gamma multiplier) for the display that owns the given window. -// (https://wiki.libsdl.org/SDL_SetWindowBrightness) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowBrightness) func (window *Window) SetBrightness(brightness float32) error { return errorFromInt(int( C.SDL_SetWindowBrightness(window.cptr(), C.float(brightness)))) } // GetBrightness returns the brightness (gamma multiplier) for the display that owns the given window. -// (https://wiki.libsdl.org/SDL_GetWindowBrightness) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowBrightness) func (window *Window) GetBrightness() float32 { return float32(C.SDL_GetWindowBrightness(window.cptr())) } // SetGammaRamp sets the gamma ramp for the display that owns the given window. -// (https://wiki.libsdl.org/SDL_SetWindowGammaRamp) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowGammaRamp) func (window *Window) SetGammaRamp(red, green, blue *[256]uint16) error { return errorFromInt(int( C.SDL_SetWindowGammaRamp( @@ -1013,7 +1013,7 @@ func (window *Window) SetGammaRamp(red, green, blue *[256]uint16) error { } // GetGammaRamp returns the gamma ramp for the display that owns a given window. -// (https://wiki.libsdl.org/SDL_GetWindowGammaRamp) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowGammaRamp) func (window *Window) GetGammaRamp() (red, green, blue *[256]uint16, err error) { code := int(C.SDL_GetWindowGammaRamp( window.cptr(), @@ -1024,21 +1024,21 @@ func (window *Window) GetGammaRamp() (red, green, blue *[256]uint16, err error) } // SetWindowOpacity sets the opacity of the window. -// (https://wiki.libsdl.org/SDL_SetWindowOpacity) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowOpacity) func (window *Window) SetWindowOpacity(opacity float32) error { return errorFromInt(int( C.SDL_SetWindowOpacity(window.cptr(), C.float(opacity)))) } // GetWindowOpacity returns the opacity of the window. -// (https://wiki.libsdl.org/SDL_GetWindowOpacity) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowOpacity) func (window *Window) GetWindowOpacity() (opacity float32, err error) { return opacity, errorFromInt(int( C.SDL_GetWindowOpacity(window.cptr(), (*C.float)(unsafe.Pointer(&opacity))))) } // ShowSimpleMessageBox displays a simple modal message box. -// (https://wiki.libsdl.org/SDL_ShowSimpleMessageBox) +// (https://wiki.libsdl.org/SDL2/SDL_ShowSimpleMessageBox) func ShowSimpleMessageBox(flags MessageBoxFlags, title, message string, window *Window) error { _title := C.CString(title) defer C.free(unsafe.Pointer(_title)) @@ -1049,7 +1049,7 @@ func ShowSimpleMessageBox(flags MessageBoxFlags, title, message string, window * } // ShowMessageBox creates a modal message box. -// (https://wiki.libsdl.org/SDL_ShowMessageBox) +// (https://wiki.libsdl.org/SDL2/SDL_ShowMessageBox) func ShowMessageBox(data *MessageBoxData) (buttonid int32, err error) { _title := C.CString(data.Title) defer C.free(unsafe.Pointer(_title)) @@ -1095,25 +1095,25 @@ func ShowMessageBox(data *MessageBoxData) (buttonid int32, err error) { } // IsScreenSaverEnabled reports whether the screensaver is currently enabled. -// (https://wiki.libsdl.org/SDL_IsScreenSaverEnabled) +// (https://wiki.libsdl.org/SDL2/SDL_IsScreenSaverEnabled) func IsScreenSaverEnabled() bool { return C.SDL_IsScreenSaverEnabled() != 0 } // EnableScreenSaver allows the screen to be blanked by a screen saver. -// (https://wiki.libsdl.org/SDL_EnableScreenSaver) +// (https://wiki.libsdl.org/SDL2/SDL_EnableScreenSaver) func EnableScreenSaver() { C.SDL_EnableScreenSaver() } // DisableScreenSaver prevents the screen from being blanked by a screen saver. -// (https://wiki.libsdl.org/SDL_DisableScreenSaver) +// (https://wiki.libsdl.org/SDL2/SDL_DisableScreenSaver) func DisableScreenSaver() { C.SDL_DisableScreenSaver() } // GLLoadLibrary dynamically loads an OpenGL library. -// (https://wiki.libsdl.org/SDL_GL_LoadLibrary) +// (https://wiki.libsdl.org/SDL2/SDL_GL_LoadLibrary) func GLLoadLibrary(path string) error { _path := C.CString(path) defer C.free(unsafe.Pointer(_path)) @@ -1122,7 +1122,7 @@ func GLLoadLibrary(path string) error { } // GLGetProcAddress returns an OpenGL function by name. -// (https://wiki.libsdl.org/SDL_GL_GetProcAddress) +// (https://wiki.libsdl.org/SDL2/SDL_GL_GetProcAddress) func GLGetProcAddress(proc string) unsafe.Pointer { _proc := C.CString(proc) defer C.free(unsafe.Pointer(_proc)) @@ -1130,13 +1130,13 @@ func GLGetProcAddress(proc string) unsafe.Pointer { } // GLUnloadLibrary unloads the OpenGL library previously loaded by GLLoadLibrary(). -// (https://wiki.libsdl.org/SDL_GL_UnloadLibrary) +// (https://wiki.libsdl.org/SDL2/SDL_GL_UnloadLibrary) func GLUnloadLibrary() { C.SDL_GL_UnloadLibrary() } // GLExtensionSupported reports whether an OpenGL extension is supported for the current context. -// (https://wiki.libsdl.org/SDL_GL_ExtensionSupported) +// (https://wiki.libsdl.org/SDL2/SDL_GL_ExtensionSupported) func GLExtensionSupported(extension string) bool { _extension := C.CString(extension) defer C.free(unsafe.Pointer(_extension)) @@ -1144,14 +1144,14 @@ func GLExtensionSupported(extension string) bool { } // GLSetAttribute sets an OpenGL window attribute before window creation. -// (https://wiki.libsdl.org/SDL_GL_SetAttribute) +// (https://wiki.libsdl.org/SDL2/SDL_GL_SetAttribute) func GLSetAttribute(attr GLattr, value int) error { return errorFromInt(int( C.SDL_GL_SetAttribute(attr.c(), C.int(value)))) } // GLGetAttribute returns the actual value for an attribute from the current context. -// (https://wiki.libsdl.org/SDL_GL_GetAttribute) +// (https://wiki.libsdl.org/SDL2/SDL_GL_GetAttribute) func GLGetAttribute(attr GLattr) (int, error) { var _value C.int if C.SDL_GL_GetAttribute(attr.c(), &_value) != 0 { @@ -1161,7 +1161,7 @@ func GLGetAttribute(attr GLattr) (int, error) { } // GLCreateContext creates an OpenGL context for use with an OpenGL window, and make it current. -// (https://wiki.libsdl.org/SDL_GL_CreateContext) +// (https://wiki.libsdl.org/SDL2/SDL_GL_CreateContext) func (window *Window) GLCreateContext() (GLContext, error) { c := GLContext(C.SDL_GL_CreateContext(window.cptr())) if c == nil { @@ -1171,21 +1171,21 @@ func (window *Window) GLCreateContext() (GLContext, error) { } // GLMakeCurrent sets up an OpenGL context for rendering into an OpenGL window. -// (https://wiki.libsdl.org/SDL_GL_MakeCurrent) +// (https://wiki.libsdl.org/SDL2/SDL_GL_MakeCurrent) func (window *Window) GLMakeCurrent(glcontext GLContext) error { return errorFromInt(int( C.SDL_GL_MakeCurrent(window.cptr(), C.SDL_GLContext(glcontext)))) } // GLSetSwapInterval sets the swap interval for the current OpenGL context. -// (https://wiki.libsdl.org/SDL_GL_SetSwapInterval) +// (https://wiki.libsdl.org/SDL2/SDL_GL_SetSwapInterval) func GLSetSwapInterval(interval int) error { return errorFromInt(int( C.SDL_GL_SetSwapInterval(C.int(interval)))) } // GLGetSwapInterval returns the swap interval for the current OpenGL context. -// (https://wiki.libsdl.org/SDL_GL_GetSwapInterval) +// (https://wiki.libsdl.org/SDL2/SDL_GL_GetSwapInterval) func GLGetSwapInterval() (int, error) { i := int(C.SDL_GL_GetSwapInterval()) // -1 means adaptive vsync, not an error @@ -1199,7 +1199,7 @@ func GLGetSwapInterval() (int, error) { } // GLGetDrawableSize returns the size of a window's underlying drawable in pixels (for use with glViewport). -// (https://wiki.libsdl.org/SDL_GL_GetDrawableSize) +// (https://wiki.libsdl.org/SDL2/SDL_GL_GetDrawableSize) func (window *Window) GLGetDrawableSize() (w, h int32) { var _w, _h C.int C.SDL_GL_GetDrawableSize(window.cptr(), &_w, &_h) @@ -1207,31 +1207,31 @@ func (window *Window) GLGetDrawableSize() (w, h int32) { } // GLSwap updates a window with OpenGL rendering. -// (https://wiki.libsdl.org/SDL_GL_SwapWindow) +// (https://wiki.libsdl.org/SDL2/SDL_GL_SwapWindow) func (window *Window) GLSwap() { C.SDL_GL_SwapWindow(window.cptr()) } // GLDeleteContext deletes an OpenGL context. -// (https://wiki.libsdl.org/SDL_GL_DeleteContext) +// (https://wiki.libsdl.org/SDL2/SDL_GL_DeleteContext) func GLDeleteContext(context GLContext) { C.SDL_GL_DeleteContext(C.SDL_GLContext(context)) } // Flash requests the window to demand attention from the user. -// (https://wiki.libsdl.org/SDL_FlashWindow) +// (https://wiki.libsdl.org/SDL2/SDL_FlashWindow) func (window *Window) Flash(operation FlashOperation) (err error) { return errorFromInt(int(C.SDL_FlashWindow(window.cptr(), C.SDL_FlashOperation(operation)))) } // SetAlwaysOnTop sets the window to always be above the others. -// (https://wiki.libsdl.org/SDL_SetWindowAlwaysOnTop) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowAlwaysOnTop) func (window *Window) SetAlwaysOnTop(onTop bool) { C.SDL_SetWindowAlwaysOnTop(window.cptr(), C.SDL_bool(Btoi(onTop))) } // SetKeyboardGrab sets a window's keyboard grab mode. -// (https://wiki.libsdl.org/SDL_GetWindowKeyboardGrab) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowKeyboardGrab) func (window *Window) SetKeyboardGrab(grabbed bool) { C.SDL_SetWindowKeyboardGrab(window.cptr(), C.SDL_bool(Btoi(grabbed))) } @@ -1240,7 +1240,7 @@ func (window *Window) SetKeyboardGrab(grabbed bool) { // // Data returned should be freed with SDL_free. // -// (https://wiki.libsdl.org/SDL_GetWindowICCProfile) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowICCProfile) func (window *Window) GetICCProfile() (iccProfile unsafe.Pointer, size uintptr, err error) { _size := (*C.size_t)(unsafe.Pointer(&size)) iccProfile = C.SDL_GetWindowICCProfile(window.cptr(), _size) @@ -1255,7 +1255,7 @@ func (window *Window) GetICCProfile() (iccProfile unsafe.Pointer, size uintptr, // Note that this does NOT grab the cursor, it only defines the area a cursor // is restricted to when the window has mouse focus. // -// (https://wiki.libsdl.org/SDL_SetWindowMouseRect) +// (https://wiki.libsdl.org/SDL2/SDL_SetWindowMouseRect) func (window *Window) SetMouseRect(rect Rect) (err error) { _rect := (*C.SDL_Rect)(unsafe.Pointer(&rect)) err = errorFromInt(int(C.SDL_SetWindowMouseRect(window.cptr(), _rect))) @@ -1263,7 +1263,7 @@ func (window *Window) SetMouseRect(rect Rect) (err error) { } // GetMouseRect gets the mouse confinement rectangle of a window. -// (https://wiki.libsdl.org/SDL_GetWindowMouseRect) +// (https://wiki.libsdl.org/SDL2/SDL_GetWindowMouseRect) func (window *Window) GetMouseRect() (rect Rect) { _rect := C.SDL_GetWindowMouseRect(window.cptr()) rect = *((*Rect)(unsafe.Pointer(_rect))) diff --git a/sdl/vulkan.go b/sdl/vulkan.go index 573ec9c9..de80b7e6 100644 --- a/sdl/vulkan.go +++ b/sdl/vulkan.go @@ -90,7 +90,7 @@ import ( ) // VulkanLoadLibrary dynamically loads a Vulkan loader library. -// (https://wiki.libsdl.org/SDL_Vulkan_LoadLibrary) +// (https://wiki.libsdl.org/SDL2/SDL_Vulkan_LoadLibrary) func VulkanLoadLibrary(path string) error { var ret C.int if path == "" { @@ -107,19 +107,19 @@ func VulkanLoadLibrary(path string) error { } // VulkanGetVkGetInstanceProcAddr gets the address of the vkGetInstanceProcAddr function. -// (https://wiki.libsdl.org/SDL_Vulkan_GetVkInstanceProcAddr) +// (https://wiki.libsdl.org/SDL2/SDL_Vulkan_GetVkInstanceProcAddr) func VulkanGetVkGetInstanceProcAddr() unsafe.Pointer { return C.SDL_Vulkan_GetVkGetInstanceProcAddr() } // VulkanUnloadLibrary unloads the Vulkan loader library previously loaded by VulkanLoadLibrary(). -// (https://wiki.libsdl.org/SDL_Vulkan_UnloadLibrary) +// (https://wiki.libsdl.org/SDL2/SDL_Vulkan_UnloadLibrary) func VulkanUnloadLibrary() { C.SDL_Vulkan_UnloadLibrary() } // VulkanGetInstanceExtensions gets the names of the Vulkan instance extensions needed to create a surface with VulkanCreateSurface(). -// (https://wiki.libsdl.org/SDL_Vulkan_GetInstanceExtensions) +// (https://wiki.libsdl.org/SDL2/SDL_Vulkan_GetInstanceExtensions) func (window *Window) VulkanGetInstanceExtensions() []string { var count C.uint C.SDL_Vulkan_GetInstanceExtensions(window.cptr(), &count, nil) @@ -137,7 +137,7 @@ func (window *Window) VulkanGetInstanceExtensions() []string { } // VulkanCreateSurface creates a Vulkan rendering surface for a window. -// (https://wiki.libsdl.org/SDL_Vulkan_CreateSurface) +// (https://wiki.libsdl.org/SDL2/SDL_Vulkan_CreateSurface) func (window *Window) VulkanCreateSurface(instance interface{}) (surface unsafe.Pointer, err error) { if instance == nil { return nil, errors.New("vulkan: instance is nil") @@ -157,7 +157,7 @@ func (window *Window) VulkanCreateSurface(instance interface{}) (surface unsafe. } // VulkanGetDrawableSize gets the size of a window's underlying drawable in pixels (for use with setting viewport, scissor & etc). -// (https://wiki.libsdl.org/SDL_Vulkan_GetDrawableSize) +// (https://wiki.libsdl.org/SDL2/SDL_Vulkan_GetDrawableSize) func (window *Window) VulkanGetDrawableSize() (w, h int32) { var _w, _h C.int C.SDL_Vulkan_GetDrawableSize(window.cptr(), &_w, &_h)