sdl package - github.com/veandco/go-sdl2/sdl - Go Packages (original) (raw)
Package sdl is SDL2 wrapped for Go users. It enables interoperability between Go and the SDL2 library which is written in C. That means the original SDL2 installation is required for this to work. SDL2 is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.
- Constants
- Variables
- func AddHintCallback(name string, fn HintCallback, data interface{})
- func AudioInit(driverName string) error
- func AudioQuit()
- func BitsPerPixel(format uint32) int
- func Btoi(b bool) int
- func BuildAudioCVT(cvt *AudioCVT, srcFormat AudioFormat, srcChannels uint8, srcRate int, ...) (converted bool, err error)
- func Button(flag uint32) uint32
- func ButtonLMask() uint32
- func ButtonMMask() uint32
- func ButtonRMask() uint32
- func ButtonX1Mask() uint32
- func ButtonX2Mask() uint32
- func BytesPerPixel(format uint32) int
- func COMPILEDVERSION() int
- func CalculateGammaRamp(gamma float32, ramp *[256]uint16)
- func CaptureMouse(toggle bool) error
- func ClearError()
- func ClearHints()
- func ClearQueuedAudio(dev AudioDeviceID)
- func CloseAudio()
- func CloseAudioDevice(dev AudioDeviceID)
- func ConvertAudio(cvt *AudioCVT) error
- func ConvertPixels(width, height int32, srcFormat uint32, src unsafe.Pointer, srcPitch int, ...) error
- func CreateWindowAndRenderer(w, h int32, flags uint32) (*Window, *Renderer, error)
- func CurrentThreadID() uint
- func DelEventWatch(handle EventWatchHandle)
- func DelHintCallback(name string)
- func Delay(ms uint32)
- func DequeueAudio(dev AudioDeviceID, data []byte) error
- func DisableScreenSaver()
- func Do(f func())
- func EnableScreenSaver()
- func Error(code ErrorCode)
- func EventState(type_ uint32, state int) uint8
- func FilterEvents(filter EventFilter, userdata interface{})
- func FilterEventsFunc(filter eventFilterFunc, userdata interface{})
- func FlushEvent(type_ uint32)
- func FlushEvents(minType, maxType uint32)
- func FreeCursor(cursor *Cursor)
- func FreeWAV(audioBuf []uint8)
- func GLDeleteContext(context GLContext)
- func GLExtensionSupported(extension string) bool
- func GLGetAttribute(attr GLattr) (int, error)
- func GLGetProcAddress(proc string) unsafe.Pointer
- func GLGetSwapInterval() (int, error)
- func GLLoadLibrary(path string) error
- func GLSetAttribute(attr GLattr, value int) error
- func GLSetSwapInterval(interval int) error
- func GLUnloadLibrary()
- func GameControllerAddMapping(mappingString string) int
- func GameControllerEventState(state int) int
- func GameControllerGetStringForAxis(axis GameControllerAxis) string
- func GameControllerGetStringForButton(btn GameControllerButton) string
- func GameControllerMappingForDeviceIndex(index int) string
- func GameControllerMappingForGUID(guid JoystickGUID) string
- func GameControllerMappingForIndex(index int) string
- func GameControllerNameForIndex(index int) string
- func GameControllerNumMappings() int
- func GameControllerUpdate()
- func GetAudioDeviceName(index int, isCapture bool) string
- func GetAudioDriver(index int) string
- func GetBasePath() string
- func GetCPUCacheLineSize() int
- func GetCPUCount() int
- func GetClipboardText() (string, error)
- func GetCurrentAudioDriver() string
- func GetCurrentVideoDriver() (string, error)
- func GetDisplayDPI(displayIndex int) (ddpi, hdpi, vdpi float32, err error)
- func GetDisplayName(displayIndex int) (string, error)
- func GetError() error
- func GetEventState(type_ uint32) uint8
- func GetGlobalMouseState() (x, y int32, state uint32)
- func GetHint(name string) string
- func GetKeyName(code Keycode) string
- func GetKeyboardState() []uint8
- func GetMouseState() (x, y int32, state uint32)
- func GetNumAudioDevices(isCapture bool) int
- func GetNumAudioDrivers() int
- func GetNumDisplayModes(displayIndex int) (int, error)
- func GetNumRenderDrivers() (int, error)
- func GetNumTouchDevices() int
- func GetNumTouchFingers(t TouchID) int
- func GetNumVideoDisplays() (int, error)
- func GetNumVideoDrivers() (int, error)
- func GetPerformanceCounter() uint64
- func GetPerformanceFrequency() uint64
- func GetPixelFormatName(format uint) string
- func GetPlatform() string
- func GetPowerInfo() (int, int, int)
- func GetPrefPath(org, app string) string
- func GetQueuedAudioSize(dev AudioDeviceID) uint32
- func GetRGB(pixel uint32, format *PixelFormat) (r, g, b uint8)
- func GetRGBA(pixel uint32, format *PixelFormat) (r, g, b, a uint8)
- func GetRelativeMouseMode() bool
- func GetRelativeMouseState() (x, y int32, state uint32)
- func GetRenderDriverInfo(index int, info *RendererInfo) (int, error)
- func GetRevision() string
- func GetRevisionNumber() intdeprecated
- func GetScancodeName(code Scancode) string
- func GetSystemRAM() int
- func GetTicks() uint32deprecated
- func GetTicks64() uint64
- func GetVersion(v *Version)
- func GetVideoDriver(index int) string
- func HIDDeviceChangeCount() (n uint32)
- func HIDExit() (err error)
- func HIDFreeEnumeration(info *HIDDeviceInfo)
- func HIDInit() (err error)
- func HapticIndex(h *Haptic) (int, error)
- func HapticName(index int) (string, error)
- func HapticOpened(index int) (bool, error)
- func Has3DNow() bool
- func HasAVX() bool
- func HasAVX2() bool
- func HasAVX512F() bool
- func HasAltiVec() bool
- func HasClipboardText() bool
- func HasEvent(type_ uint32) bool
- func HasEvents(minType, maxType uint32) bool
- func HasMMX() bool
- func HasNEON() bool
- func HasRDTSC() bool
- func HasSSE() bool
- func HasSSE2() bool
- func HasSSE3() bool
- func HasSSE41() bool
- func HasSSE42() bool
- func HasScreenKeyboardSupport() bool
- func Init(flags uint32) error
- func InitSubSystem(flags uint32) error
- func IsGameController(index int) bool
- func IsScreenKeyboardShown(window *Window) bool
- func IsScreenSaverEnabled() bool
- func IsTablet() bool
- func IsTextInputActive() bool
- func JoystickEventState(state int) int
- func JoystickGetDevicePlayerIndex(index int) int
- func JoystickGetDeviceProduct(index int) int
- func JoystickGetDeviceProductVersion(index int) int
- func JoystickGetDeviceVendor(index int) int
- func JoystickGetGUIDString(guid JoystickGUID) string
- func JoystickIsHaptic(joy *Joystick) (bool, error)
- func JoystickNameForIndex(index int) string
- func JoystickUpdate()
- func LinuxSetThreadPriority(threadID int64, priority int) (err error)
- func LinuxSetThreadPriorityAndPolicy(threadID int64, sdlPriority, schedPolicy int) (err error)
- func LoadDollarTemplates(t TouchID, src *RWops) int
- func LoadFile(file string) (data []byte, size int)
- func LockAudio()
- func LockAudioDevice(dev AudioDeviceID)
- func LockJoysticks()
- func Log(str string, args ...interface{})
- func LogCritical(category int, str string, args ...interface{})
- func LogDebug(category int, str string, args ...interface{})
- func LogError(category int, str string, args ...interface{})
- func LogInfo(category int, str string, args ...interface{})
- func LogMessage(category int, pri LogPriority, str string, args ...interface{})
- func LogResetPriorities()
- func LogSetAllPriority(p LogPriority)
- func LogSetOutputFunction(f LogOutputFunction, data interface{})
- func LogSetPriority(category int, p LogPriority)
- func LogVerbose(category int, str string, args ...interface{})
- func LogWarn(category int, str string, args ...interface{})
- func Main(main func())
- func MapRGB(format *PixelFormat, r, g, b uint8) uint32
- func MapRGBA(format *PixelFormat, r, g, b, a uint8) uint32
- func MasksToPixelFormatEnum(bpp int, rmask, gmask, bmask, amask uint32) uint
- func MixAudio(dst, src *uint8, len uint32, volume int)
- func MixAudioFormat(dst, src *uint8, format AudioFormat, len uint32, volume int)
- func MouseIsHaptic() (bool, error)
- func NumHaptics() (int, error)
- func NumJoysticks() int
- func NumSensors() int
- func OpenAudio(desired, obtained *AudioSpec) error
- func OutOfMemory()
- func PauseAudio(pauseOn bool)
- func PauseAudioDevice(dev AudioDeviceID, pauseOn bool)
- func PeepEvents(events []Event, action EventAction, minType, maxType uint32) (storedEvents int, err error)
- func PixelFormatEnumToMasks(format uint) (bpp int, rmask, gmask, bmask, amask uint32, err error)
- func PremultiplyAlpha(width, height int, srcFormat uint32, src []byte, srcPitch int, ...) (err error)
- func PumpEvents()
- func PushEvent(event Event) (filtered bool, err error)
- func QueueAudio(dev AudioDeviceID, data []byte) error
- func Quit()
- func QuitSubSystem(flags uint32)
- func RecordGesture(t TouchID) int
- func RegisterEvents(numEvents int) uint32
- func SIMDAlloc(_len int) unsafe.Pointer
- func SIMDFree(p unsafe.Pointer)
- func SIMDGetAlignment() int
- func SaveAllDollarTemplates(src *RWops) int
- func SaveDollarTemplate(g GestureID, src *RWops) int
- func SensorGetDeviceName(deviceIndex int) (name string)
- func SensorGetDeviceNonPortableType(deviceIndex int) (typ int)
- func SensorUpdate()
- func SetClipboardText(text string) error
- func SetCursor(cursor *Cursor)
- func SetError(err error)
- func SetEventFilter(filter EventFilter, userdata interface{})
- func SetEventFilterFunc(filterFunc eventFilterFunc, userdata interface{})
- func SetHint(name, value string) bool
- func SetHintWithPriority(name, value string, hp HintPriority) bool
- func SetModState(mod Keymod)
- func SetRelativeMouseMode(enabled bool) int
- func SetTextInputRect(rect *Rect)
- func SetYUVConversionMode(mode YUV_CONVERSION_MODE)
- func ShowCursor(toggle int) (int, error)
- func ShowMessageBox(data *MessageBoxData) (buttonid int32, err error)
- func ShowSimpleMessageBox(flags uint32, title, message string, window *Window) error
- func StartTextInput()
- func StopTextInput()
- func UnlockAudio()
- func UnlockAudioDevice(dev AudioDeviceID)
- func UnlockJoysticks()
- func Unsupported()
- func VERSION(v *Version)
- func VERSIONNUM(x, y, z int) int
- func VERSION_ATLEAST(x, y, z int) bool
- func VideoInit(driverName string) error
- func VideoQuit()
- func VulkanGetVkGetInstanceProcAddr() unsafe.Pointer
- func VulkanLoadLibrary(path string) error
- func VulkanUnloadLibrary()
- func WarpMouseGlobal(x, y int32) error
- func WasInit(flags uint32) uint32
- type ABGR1555
- type ABGR4444
- type ARGB1555
- type ARGB4444
- type AudioCVT
- type AudioCallback
- type AudioDeviceEvent
- type AudioDeviceID
- type AudioFilter
- type AudioFormat
- type AudioSpec
- type AudioStatus
- type AudioStream
- type BGR555
- type BGR565
- type BGRA4444
- type BGRA5551
- type BGRA8888
- type BlendFactor
- type BlendMode
- type BlendOperation
- type CEvent
- type ClipboardEvent
- type CocoaInfo
- type Color
- type CommonEvent
- type Cond
- type ControllerAxisEvent
- type ControllerButtonEvent
- type ControllerDeviceEvent
- type Cursor
- type DFBInfo
- type DisplayEvent
- type DisplayMode
- func GetClosestDisplayMode(displayIndex int, mode *DisplayMode, closest *DisplayMode) (*DisplayMode, error)
- func GetCurrentDisplayMode(displayIndex int) (mode DisplayMode, err error)
- func GetDesktopDisplayMode(displayIndex int) (mode DisplayMode, err error)
- func GetDisplayMode(displayIndex int, modeIndex int) (mode DisplayMode, err error)
- type DollarGestureEvent
- type DropEvent
- type ErrorCode
- type Event
- type EventAction
- type EventFilter
- type EventWatchHandle
- type FPoint
- type FRect
- type Finger
- type FingerID
- type FlashOperation
- type GLContext
- type GLattr
- type GameController
- func (ctrl *GameController) Attached() bool
- func (ctrl *GameController) Axis(axis GameControllerAxis) int16
- func (ctrl *GameController) BindForAxis(axis GameControllerAxis) GameControllerButtonBind
- func (ctrl *GameController) BindForButton(btn GameControllerButton) GameControllerButtonBind
- func (ctrl *GameController) Button(btn GameControllerButton) byte
- func (ctrl *GameController) Close()
- func (ctrl *GameController) GetAppleSFSymbolsNameForButton(button GameControllerButton) (sfSymbolsName string)
- func (ctrl *GameController) HasRumble() bool
- func (ctrl *GameController) HasRumbleTriggers() bool
- func (ctrl *GameController) Joystick() *Joystick
- func (ctrl *GameController) Mapping() string
- func (ctrl *GameController) Name() string
- func (ctrl *GameController) PlayerIndex() int
- func (ctrl *GameController) Product() int
- func (ctrl *GameController) ProductVersion() int
- func (ctrl *GameController) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error
- func (ctrl *GameController) SDL_GameControllerGetAppleSFSymbolsNameForAxis(axis GameControllerAxis) (sfSymbolsName string)
- func (ctrl *GameController) SendEffect(data []byte) (err error)
- func (ctrl *GameController) SensorDataRate(typ SensorType) (rate float32)
- func (ctrl *GameController) Vendor() int
- type GameControllerAxis
- type GameControllerBindType
- type GameControllerButton
- type GameControllerButtonBind
- type GestureID
- type HIDDevice
- func (device *HIDDevice) Close()
- func (device *HIDDevice) GetFeatureReport(data []byte) (n int, err error)
- func (device *HIDDevice) GetIndexedString(index int, _str *C.wchar_t, _maxlen C.size_t) (err error)
- func (device *HIDDevice) GetManufacturerString(_str *C.wchar_t, _maxlen C.size_t) (err error)
- func (device *HIDDevice) GetProductString(_str *C.wchar_t, _maxlen C.size_t) (err error)
- func (device *HIDDevice) GetSerialNumberString(_str *C.wchar_t, _maxlen C.size_t) (err error)
- func (device *HIDDevice) HIDBLEScan(active bool)
- func (device *HIDDevice) Read(data []byte) (n int, err error)
- func (device *HIDDevice) ReadTimeout(data []byte, milliseconds int) (n int, err error)
- func (device *HIDDevice) SendFeatureReport(data []byte) (n int, err error)
- func (device *HIDDevice) SetNonBlocking(nonblock bool) (err error)
- func (device *HIDDevice) Write(data []byte) (n int, err error)
- type HIDDeviceInfo
- type Haptic
- func (h *Haptic) Close()
- func (h *Haptic) DestroyEffect(effect int)
- func (h *Haptic) EffectSupported(he HapticEffect) (bool, error)
- func (h *Haptic) GetEffectStatus(effect int) (int, error)
- func (h *Haptic) NewEffect(he HapticEffect) (int, error)
- func (h *Haptic) NumAxes() (int, error)
- func (h *Haptic) NumEffects() (int, error)
- func (h *Haptic) NumEffectsPlaying() (int, error)
- func (h *Haptic) Pause() error
- func (h *Haptic) Query() (uint32, error)
- func (h *Haptic) RumbleInit() error
- func (h *Haptic) RumblePlay(strength float32, length uint32) error
- func (h *Haptic) RumbleStop() error
- func (h *Haptic) RumbleSupported() (bool, error)
- func (h *Haptic) RunEffect(effect int, iterations uint32) error
- func (h *Haptic) SetAutocenter(autocenter int) error
- func (h *Haptic) SetGain(gain int) error
- func (h *Haptic) StopAll() error
- func (h *Haptic) StopEffect(effect int) error
- func (h *Haptic) Unpause() error
- func (h *Haptic) UpdateEffect(effect int, data HapticEffect) error
- type HapticCondition
- type HapticConstant
- type HapticCustom
- type HapticDirection
- type HapticEffect
- type HapticLeftRight
- type HapticPeriodic
- type HapticRamp
- type HintCallback
- type HintCallbackAndData
- type HintPriority
- type JoyAxisEvent
- type JoyBallEvent
- type JoyButtonEvent
- type JoyDeviceAddedEvent
- type JoyDeviceRemovedEvent
- type JoyHatEvent
- type Joystick
- func (joy *Joystick) Attached() bool
- func (joy *Joystick) Axis(axis int) int16
- func (joy *Joystick) AxisInitialState(axis int) (state int16, ok bool)
- func (joy *Joystick) Ball(ball int, dx, dy *int32) int
- func (joy *Joystick) Button(button int) byte
- func (joy *Joystick) Close()
- func (joy *Joystick) CurrentPowerLevel() JoystickPowerLevel
- func (joy *Joystick) GUID() JoystickGUID
- func (ctrl *Joystick) HasRumble() bool
- func (ctrl *Joystick) HasRumbleTriggers() bool
- func (joy *Joystick) Hat(hat int) byte
- func (joy *Joystick) InstanceID() JoystickID
- func (joy *Joystick) Name() string
- func (joy *Joystick) NumAxes() int
- func (joy *Joystick) NumBalls() int
- func (joy *Joystick) NumButtons() int
- func (joy *Joystick) NumHats() int
- func (joy *Joystick) PlayerIndex() int
- func (joy *Joystick) Product() int
- func (joy *Joystick) ProductVersion() int
- func (joy *Joystick) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error
- func (joy *Joystick) Type() JoystickType
- func (joy *Joystick) Vendor() int
- type JoystickGUID
- type JoystickID
- type JoystickPowerLevel
- type JoystickType
- type KeyboardEvent
- type Keycode
- type Keymod
- type Keysym
- type LogOutputFunction
- type LogPriority
- type MessageBoxButtonData
- type MessageBoxColor
- type MessageBoxColorScheme
- type MessageBoxData
- type MouseButtonEvent
- type MouseMotionEvent
- type MouseWheelEvent
- type MultiGestureEvent
- type Mutex
- type OSEvent
- type Palette
- type PixelFormat
- type Point
- type PowerState
- type QuitEvent
- type RGB332
- type RGB444
- type RGB555
- type RGB565
- type RGBA4444
- type RGBA5551
- type RGBA8888
- type RWops
- func (rwops *RWops) Close() error
- func (rwops *RWops) Free() error
- func (src *RWops) LoadFileRW(freesrc bool) (data []byte, size int)
- func (rwops *RWops) Read(buf []byte) (n int, err error)
- func (rwops *RWops) Read2(buf []byte, size, maxnum uint) (n int, err error)
- func (rwops *RWops) ReadBE16() uint16
- func (rwops *RWops) ReadBE32() uint32
- func (rwops *RWops) ReadBE64() uint64
- func (rwops *RWops) ReadLE16() uint16
- func (rwops *RWops) ReadLE32() uint32
- func (rwops *RWops) ReadLE64() uint64
- func (rwops *RWops) ReadU8() uint8
- func (rwops *RWops) Seek(offset int64, whence int) (int64, error)
- func (rwops *RWops) Size() (int64, error)
- func (rwops *RWops) Tell() (int64, error)
- func (rwops *RWops) Write(buf []byte) (n int, err error)
- func (rwops *RWops) Write2(buf []byte, size, num uint) (n int, err error)
- func (rwops *RWops) WriteBE16(value uint16) uint
- func (rwops *RWops) WriteBE32(value uint32) uint
- func (rwops *RWops) WriteBE64(value uint64) uint
- func (rwops *RWops) WriteLE16(value uint16) uint
- func (rwops *RWops) WriteLE32(value uint32) uint
- func (rwops *RWops) WriteLE64(value uint64) uint
- func (rwops *RWops) WriteU8(value uint8) uint
- type Rect
- type RenderEvent
- type Renderer
- func (renderer *Renderer) Clear() error
- func (renderer *Renderer) Copy(texture *Texture, src, dst *Rect) error
- func (renderer *Renderer) CopyEx(texture *Texture, src, dst *Rect, angle float64, center *Point, ...) error
- func (renderer *Renderer) CopyExF(texture *Texture, src *Rect, dst *FRect, angle float64, center *FPoint, ...) error
- func (renderer *Renderer) CopyF(texture *Texture, src *Rect, dst *FRect) error
- func (renderer *Renderer) CreateTexture(format uint32, access int, w, h int32) (*Texture, error)
- func (renderer *Renderer) CreateTextureFromSurface(surface *Surface) (*Texture, error)
- func (renderer *Renderer) Destroy() error
- func (renderer *Renderer) DrawLine(x1, y1, x2, y2 int32) error
- func (renderer *Renderer) DrawLineF(x1, y1, x2, y2 float32) error
- func (renderer *Renderer) DrawLines(points []Point) error
- func (renderer *Renderer) DrawLinesF(points []FPoint) error
- func (renderer *Renderer) DrawPoint(x, y int32) error
- func (renderer *Renderer) DrawPointF(x, y float32) error
- func (renderer *Renderer) DrawPoints(points []Point) error
- func (renderer *Renderer) DrawPointsF(points []FPoint) error
- func (renderer *Renderer) DrawRect(rect *Rect) error
- func (renderer *Renderer) DrawRectF(rect *FRect) error
- func (renderer *Renderer) DrawRects(rects []Rect) error
- func (renderer *Renderer) DrawRectsF(rects []FRect) error
- func (renderer *Renderer) FillRect(rect *Rect) error
- func (renderer *Renderer) FillRectF(rect *FRect) error
- func (renderer *Renderer) FillRects(rects []Rect) error
- func (renderer *Renderer) FillRectsF(rects []FRect) error
- func (renderer *Renderer) Flush() error
- func (renderer *Renderer) GetClipRect() (rect Rect)
- func (renderer *Renderer) GetDrawBlendMode(bm *BlendMode) error
- func (renderer *Renderer) GetDrawColor() (r, g, b, a uint8, err error)
- func (renderer *Renderer) GetInfo() (RendererInfo, error)
- func (renderer *Renderer) GetIntegerScale() (bool, error)
- func (renderer *Renderer) GetLogicalSize() (w, h int32)
- func (renderer *Renderer) GetMetalCommandEncoder() (encoder unsafe.Pointer, err error)
- func (renderer *Renderer) GetMetalLayer() (layer unsafe.Pointer, err error)
- func (renderer *Renderer) GetOutputSize() (w, h int32, err error)
- func (renderer *Renderer) GetRenderTarget() *Texture
- func (renderer *Renderer) GetScale() (scaleX, scaleY float32)
- func (renderer *Renderer) GetViewport() (rect Rect)
- func (renderer *Renderer) Present()
- func (renderer *Renderer) ReadPixels(rect *Rect, format uint32, pixels unsafe.Pointer, pitch int) error
- func (renderer *Renderer) RenderGeometry(texture *Texture, vertices []Vertex, indices []int32) (err error)
- func (renderer *Renderer) RenderGeometryRaw(texture *Texture, xy *float32, xy_stride int, color *Color, color_stride int, ...) (err error)
- func (renderer *Renderer) RenderLogicalToWindow(logicalX, logicalY float32) (windowX, windowY int)
- func (renderer *Renderer) RenderSetVSync(vsync bool) (err error)
- func (renderer *Renderer) RenderTargetSupported() bool
- func (renderer *Renderer) RenderWindowToLogical(windowX, windowY int) (logicalX, logicalY float32)
- func (renderer *Renderer) SetClipRect(rect *Rect) error
- func (renderer *Renderer) SetDrawBlendMode(bm BlendMode) error
- func (renderer *Renderer) SetDrawColor(r, g, b, a uint8) error
- func (renderer *Renderer) SetDrawColorArray(bs ...uint8) error
- func (renderer *Renderer) SetIntegerScale(v bool) error
- func (renderer *Renderer) SetLogicalSize(w, h int32) error
- func (renderer *Renderer) SetRenderTarget(texture *Texture) error
- func (renderer *Renderer) SetScale(scaleX, scaleY float32) error
- func (renderer *Renderer) SetViewport(rect *Rect) error
- type RendererFlip
- type RendererInfo
- type RendererInfoData
- type ScaleMode
- type Scancode
- type Sem
- type Sensor
- type SensorEvent
- type SensorID
- type SensorType
- type SharedObject
- type Surface
- func CreateRGBSurface(flags uint32, width, height, depth int32, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error)
- func CreateRGBSurfaceFrom(pixels unsafe.Pointer, width, height int32, depth, pitch int, ...) (*Surface, error)
- func CreateRGBSurfaceWithFormat(flags uint32, width, height, depth int32, format uint32) (*Surface, error)
- func CreateRGBSurfaceWithFormatFrom(pixels unsafe.Pointer, width, height, depth, pitch int32, format uint32) (*Surface, error)
- func LoadBMP(file string) (*Surface, error)
- func LoadBMPRW(src *RWops, freeSrc bool) (*Surface, error)
- func (surface *Surface) At(x, y int) color.Color
- func (surface *Surface) Blit(srcRect *Rect, dst *Surface, dstRect *Rect) error
- func (surface *Surface) BlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error
- func (surface *Surface) Bounds() image.Rectangle
- func (surface *Surface) BytesPerPixel() int
- func (surface *Surface) ColorModel() color.Model
- func (surface *Surface) Convert(fmt *PixelFormat, flags uint32) (*Surface, error)
- func (surface *Surface) ConvertFormat(pixelFormat uint32, flags uint32) (*Surface, error)
- func (surface *Surface) Data() unsafe.Pointer
- func (surface *Surface) Duplicate() (newSurface *Surface, err error)
- func (surface *Surface) FillRect(rect *Rect, color uint32) error
- func (surface *Surface) FillRects(rects []Rect, color uint32) error
- func (surface *Surface) Free()
- func (surface *Surface) GetAlphaMod() (alpha uint8, err error)
- func (surface *Surface) GetBlendMode() (bm BlendMode, err error)
- func (surface *Surface) GetClipRect(rect *Rect)
- func (surface *Surface) GetColorKey() (key uint32, err error)
- func (surface *Surface) GetColorMod() (r, g, b uint8, err error)
- func (surface *Surface) HasColorKey() bool
- func (surface *Surface) Lock() error
- func (surface *Surface) LowerBlit(srcRect *Rect, dst *Surface, dstRect *Rect) error
- func (surface *Surface) LowerBlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error
- func (surface *Surface) MustLock() bool
- func (surface *Surface) PixelNum() int
- func (surface *Surface) Pixels() []byte
- func (surface *Surface) SaveBMP(file string) error
- func (surface *Surface) SaveBMPRW(dst *RWops, freeDst bool) error
- func (surface *Surface) Set(x, y int, c color.Color)
- func (surface *Surface) SetAlphaMod(alpha uint8) error
- func (surface *Surface) SetBlendMode(bm BlendMode) error
- func (surface *Surface) SetClipRect(rect *Rect) bool
- func (surface *Surface) SetColorKey(flag bool, key uint32) error
- func (surface *Surface) SetColorMod(r, g, b uint8) error
- func (surface *Surface) SetPalette(palette *Palette) error
- func (surface *Surface) SetRLE(flag bool) error
- func (surface *Surface) SoftStretch(srcRect *Rect, dst *Surface, dstRect *Rect) error
- func (surface *Surface) SoftStretchLinear(srcRect *Rect, dst *Surface, dstRect *Rect) (err error)
- func (surface *Surface) Unlock()
- func (surface *Surface) UpperBlit(srcRect *Rect, dst *Surface, dstRect *Rect) error
- func (surface *Surface) UpperBlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error
- type SysWMEvent
- type SysWMInfo
- type SysWMmsg
- type SystemCursor
- type TextEditingEvent
- type TextInputEvent
- type Texture
- func (texture *Texture) Destroy() error
- func (texture *Texture) GLBind(texw, texh *float32) error
- func (texture *Texture) GLUnbind() error
- func (texture *Texture) GetAlphaMod() (alpha uint8, err error)
- func (texture *Texture) GetBlendMode() (bm BlendMode, err error)
- func (texture *Texture) GetTextureUserData() (userdata unsafe.Pointer)
- func (texture *Texture) Lock(rect *Rect) ([]byte, int, error)
- func (texture *Texture) Query() (format uint32, access int, width int32, height int32, err error)
- func (texture *Texture) SetAlphaMod(alpha uint8) error
- func (texture *Texture) SetBlendMode(bm BlendMode) error
- func (texture *Texture) SetColorMod(r uint8, g uint8, b uint8) error
- func (texture *Texture) SetTextureUserData(userdata unsafe.Pointer) (err error)
- func (texture *Texture) Unlock()
- func (texture *Texture) Update(rect *Rect, pixels []byte, pitch int) error
- func (texture *Texture) UpdateNV(rect *Rect, yPlane []byte, yPitch int, uvPlane []byte, uvPitch int) error
- func (texture *Texture) UpdateRGBA(rect *Rect, pixels []uint32, pitch int) error
- func (texture *Texture) UpdateYUV(rect *Rect, yPlane []byte, yPitch int, uPlane []byte, uPitch int, ...) error
- type ThreadID
- type TouchDeviceType
- type TouchFingerEvent
- type TouchID
- type UIKitInfo
- type UserEvent
- type Version
- type Vertex
- type Window
- func (window *Window) Destroy() error
- func (window *Window) Flash(operation FlashOperation) (err error)
- func (window *Window) GLCreateContext() (GLContext, error)
- func (window *Window) GLGetDrawableSize() (w, h int32)
- func (window *Window) GLMakeCurrent(glcontext GLContext) error
- func (window *Window) GLSwap()
- func (window *Window) GetBrightness() float32
- func (window *Window) GetData(name string) unsafe.Pointer
- func (window *Window) GetDisplayIndex() (int, error)
- func (window *Window) GetDisplayMode() (mode DisplayMode, err error)
- func (window *Window) GetFlags() uint32
- func (window *Window) GetGammaRamp() (red, green, blue *[256]uint16, err error)
- func (window *Window) GetGrab() bool
- func (window *Window) GetICCProfile() (iccProfile unsafe.Pointer, size uintptr, err error)
- func (window *Window) GetID() (uint32, error)
- func (window *Window) GetMaximumSize() (w, h int32)
- func (window *Window) GetMinimumSize() (w, h int32)
- func (window *Window) GetMouseRect() (rect Rect)
- func (window *Window) GetPixelFormat() (uint32, error)
- func (window *Window) GetPosition() (x, y int32)
- func (window *Window) GetRenderer() (*Renderer, error)
- func (window *Window) GetSize() (w, h int32)
- func (window *Window) GetSurface() (*Surface, error)
- func (window *Window) GetTitle() string
- func (window *Window) GetWMInfo() (*SysWMInfo, error)
- func (window *Window) GetWindowOpacity() (opacity float32, err error)
- func (window *Window) Hide()
- func (window *Window) Maximize()
- func (window *Window) Minimize()
- func (window *Window) Raise()
- func (window *Window) Restore()
- func (window *Window) SetAlwaysOnTop(onTop bool)
- func (window *Window) SetBordered(bordered bool)
- func (window *Window) SetBrightness(brightness float32) error
- func (window *Window) SetData(name string, userdata unsafe.Pointer) unsafe.Pointer
- func (window *Window) SetDisplayMode(mode *DisplayMode) error
- func (window *Window) SetFullscreen(flags uint32) error
- func (window *Window) SetGammaRamp(red, green, blue *[256]uint16) error
- func (window *Window) SetGrab(grabbed bool)
- func (window *Window) SetIcon(icon *Surface)
- func (window *Window) SetKeyboardGrab(grabbed bool)
- func (window *Window) SetMaximumSize(maxW, maxH int32)
- func (window *Window) SetMinimumSize(minW, minH int32)
- func (window *Window) SetMouseRect(rect Rect) (err error)
- func (window *Window) SetPosition(x, y int32)
- func (window *Window) SetResizable(resizable bool)
- func (window *Window) SetSize(w, h int32)
- func (window *Window) SetTitle(title string)
- func (window *Window) SetWindowOpacity(opacity float32) error
- func (window *Window) Show()
- func (window *Window) UpdateSurface() error
- func (window *Window) UpdateSurfaceRects(rects []Rect) error
- func (window *Window) VulkanCreateSurface(instance interface{}) (surface unsafe.Pointer, err error)
- func (window *Window) VulkanGetDrawableSize() (w, h int32)
- func (window *Window) VulkanGetInstanceExtensions() []string
- func (window *Window) WarpMouseInWindow(x, y int32)
- type WindowEvent
- type WindowsInfo
- type X11Info
- type YUV_CONVERSION_MODE
Audio format masks. (https://wiki.libsdl.org/SDL_AudioFormat)
Audio format values. (https://wiki.libsdl.org/SDL_AudioFormat)
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)
An enumeration of audio device states used in GetAudioDeviceStatus() and GetAudioStatus(). (https://wiki.libsdl.org/SDL_AudioStatus)
Endian-specific values. (https://wiki.libsdl.org/CategoryEndian)
SDL error codes with their corresponding predefined strings.
Enumeration of the types of events that can be delivered. (https://wiki.libsdl.org/SDL_EventType)
Actions for PeepEvents(). (https://wiki.libsdl.org/SDL_PeepEvents)
Toggles for different event state functions.
Types of game controller inputs.
An enumeration of axes available from a controller. (https://wiki.libsdl.org/SDL_GameControllerAxis)
An enumeration of buttons available from a controller. (https://wiki.libsdl.org/SDL_GameControllerButton)
Haptic effects. (https://wiki.libsdl.org/SDL_HapticEffect)
Direction encodings. (https://wiki.libsdl.org/SDL_HapticDirection)
Configuration hints (https://wiki.libsdl.org/CategoryHints)
An enumeration of hint priorities. (https://wiki.libsdl.org/SDL_HintPriority)
Hat positions. (https://wiki.libsdl.org/SDL_JoystickGetHat)
Types of a joystick.
An enumeration of battery levels of a joystick. (https://wiki.libsdl.org/SDL_JoystickPowerLevel)
The SDL virtual key representation. (https://wiki.libsdl.org/SDL_Keycode) (https://wiki.libsdl.org/SDLKeycodeLookup)
An enumeration of key modifier masks. (https://wiki.libsdl.org/SDL_Keymod)
const (
LOG_CATEGORY_APPLICATION = iota
LOG_CATEGORY_ERROR
LOG_CATEGORY_ASSERT
LOG_CATEGORY_SYSTEM
LOG_CATEGORY_AUDIO
LOG_CATEGORY_VIDEO
LOG_CATEGORY_RENDER
LOG_CATEGORY_INPUT
LOG_CATEGORY_TEST
LOG_CATEGORY_RESERVED1
LOG_CATEGORY_RESERVED2
LOG_CATEGORY_RESERVED3
LOG_CATEGORY_RESERVED4
LOG_CATEGORY_RESERVED5
LOG_CATEGORY_RESERVED6
LOG_CATEGORY_RESERVED7
LOG_CATEGORY_RESERVED8
LOG_CATEGORY_RESERVED9
LOG_CATEGORY_RESERVED10
LOG_CATEGORY_CUSTOM
)
An enumeration of the predefined log categories. (https://wiki.libsdl.org/SDL_LOG_CATEGORY)
const (
LOG_PRIORITY_VERBOSE = iota + 1
LOG_PRIORITY_DEBUG
LOG_PRIORITY_INFO
LOG_PRIORITY_WARN
LOG_PRIORITY_ERROR
LOG_PRIORITY_CRITICAL
NUM_LOG_PRIORITIES
)
An enumeration of the predefined log priorities. (https://wiki.libsdl.org/SDL_LogPriority)
Cursor types for CreateSystemCursor()
Scroll direction types for the Scroll event
Used as a mask when testing buttons in buttonstate.
Pixel types.
Bitmap pixel order high bit -> low bit.
Packed component order high bit -> low bit.
Array component order low byte -> high byte.
Packed component layout.
Pixel format values.
These define alpha as the opacity of a surface.
An enumeration of the basic state of the system's power supply. (https://wiki.libsdl.org/SDL_PowerState)
An enumeration of flags used when creating a rendering context. (https://wiki.libsdl.org/SDL_RendererFlags)
The scaling mode for a texture.
An enumeration of texture access patterns.. (https://wiki.libsdl.org/SDL_TextureAccess)
An enumeration of the texture channel modulation used in Renderer.Copy(). (https://wiki.libsdl.org/SDL_TextureModulate)
An enumeration of flags that can be used in the flip parameter for Renderer.CopyEx(). (https://wiki.libsdl.org/SDL_RendererFlip)
const ( RWOPS_UNKNOWN = 0 RWOPS_WINFILE = 1 RWOPS_STDFILE = 2 RWOPS_JNIFILE = 3 RWOPS_MEMORY = 4 RWOPS_MEMORY_RO = 5 )
RWops types
RWops seek from
The SDL keyboard scancode representation. (https://wiki.libsdl.org/SDL_Scancode) (https://wiki.libsdl.org/SDLScancodeLookup)
These are the flags which may be passed to SDL_Init(). (https://wiki.libsdl.org/SDL_Init)
Surface flags (internal use)
YUV Conversion Modes
Various supported windowing subsystems.
The version of SDL in use.
An enumeration of window states. (https://wiki.libsdl.org/SDL_WindowFlags)
An enumeration of window events. (https://wiki.libsdl.org/SDL_WindowEventID)
Window position flags. (https://wiki.libsdl.org/SDL_CreateWindow)
An enumeration of message box flags (e.g. if supported message box will display warning icon). (https://wiki.libsdl.org/SDL_MessageBoxFlags)
Flags for MessageBoxButtonData.
OpenGL configuration attributes. (https://wiki.libsdl.org/SDL_GL_SetAttribute)
An enumeration of OpenGL profiles. (https://wiki.libsdl.org/SDL_GLprofile)
An enumeration of OpenGL context configuration flags. (https://wiki.libsdl.org/SDL_GLcontextFlag)
Window flash operation
CACHELINE_SIZE is a cacheline size used for padding.
MIX_MAXVOLUME is the full audio volume value used in MixAudioFormat() and AudioFormat(). (https://wiki.libsdl.org/SDL_MixAudioFormat)
TOUCH_MOUSEID is the device ID for mouse events simulated with touch input
Pixel format variables.
BitsPerPixel returns the number of bits per pixel for the given format
Btoi returns 0 or 1 according to the value of b.
Button is used as a mask when testing buttons in buttonstate.
ButtonLMask is used as a mask when testing buttons in buttonstate.
ButtonMMask is used as a mask when testing buttons in buttonstate.
ButtonRMask is used as a mask when testing buttons in buttonstate.
ButtonX1Mask is used as a mask when testing buttons in buttonstate.
ButtonX2Mask is used as a mask when testing buttons in buttonstate.
BytesPerPixel returns the number of bytes per pixel for the given format
Do the specified function in the main thread. For this function to work, you must have correctly used sdl.Main(..) in your main() function. Calling this function before/without sdl.Main(..) will cause a panic.
func Error(code ErrorCode)
Error sets the SDL error message to the specified error code.
func FilterEvents(filter EventFilter, userdata interface{})
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)
func FilterEventsFunc(filter eventFilterFunc, userdata interface{})
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)
func GameControllerMappingForDeviceIndex(index int) string
GameControllerMappingForDeviceIndex returns the game controller mapping string at a particular index.
func GameControllerMappingForIndex(index int) string
GameControllerMappingForIndex returns the game controller mapping string at a particular index.
func GameControllerNumMappings() int
GameControllerNumMappings returns the number of mappings installed.
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)
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)
func GetRevisionNumber() int
Deprecated: GetRevisionNumber is deprecated in SDL2 2.0.16 and will return 0. Users should use GetRevision instead.
GetTicks returns the number of milliseconds since the SDL library initialization.
Deprecated: This function is not recommended as of SDL 2.0.18; use GetTicks64() instead, where the value doesn't wrap every ~49 days. There are places in SDL where we provide a 32-bit timestamp that can not change without breaking binary compatibility, though, so this function isn't officially deprecated.
(https://wiki.libsdl.org/SDL_GetTicks)
func JoystickGetDeviceProduct(index int) int
JoystickGetDeviceProduct returns the USB product ID of a joystick, if available, 0 otherwise.
func JoystickGetDeviceProductVersion(index int) int
JoystickGetDeviceProductVersion returns the product version of a joystick, if available, 0 otherwise.
func JoystickGetDeviceVendor(index int) int
JoystickGetDeviceVendor returns the USB vendor ID of a joystick, if available, 0 otherwise.
func Main ¶
Main entry point. Run this function at the beginning of main(), and pass your own main body to it as a function. E.g.:
func main() { sdl.Main(func() { // Your code here.... // [....]
// Calls to SDL can be made by any goroutine, but always guarded by sdl.Do()
sdl.Do(func() {
sdl.Init(0)
})
})}
Avoid calling functions like os.Exit(..) within your passed-in function since they don't respect deferred calls. Instead, do this:
func main() { var exitcode int sdl.Main(func() { exitcode = run()) // assuming run has signature func() int }) os.Exit(exitcode) }
OutOfMemory sets SDL error message to ENOMEM (out of memory).
PremultiplyAlpha premultiplies the alpha on a block of pixels.
This is safe to use with src == dst, but not for other overlapping areas.
This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.
(https://wiki.libsdl.org/SDL_PremultiplyAlpha)
func SensorGetDeviceName(deviceIndex int) (name string)
SensorGetDeviceName gets the implementation dependent name of a sensor.
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)
func SensorGetDeviceNonPortableType(deviceIndex int) (typ int)
SensorGetDeviceNonPortableType gets the platform dependent type of a sensor.
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)
SensorUpdate updates the current state of the open sensors.
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)
func SetEventFilter(filter EventFilter, userdata interface{})
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)
func SetEventFilterFunc(filterFunc eventFilterFunc, 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)
Unsupported sets SDL error message to UNSUPPORTED (that operation is not supported).
type ABGR1555 struct { A, R, G, B byte }
func (c ABGR1555) RGBA() (r, g, b, a uint32)
type ABGR4444 struct { A, B, G, R byte }
func (c ABGR4444) RGBA() (r, g, b, a uint32)
type ARGB1555 struct { A, R, G, B byte }
func (c ARGB1555) RGBA() (r, g, b, a uint32)
type ARGB4444 struct { A, R, G, B byte }
func (c ARGB4444) RGBA() (r, g, b, a uint32)
AudioCVT contains audio data conversion information. (https://wiki.libsdl.org/SDL_AudioCVT)
AllocBuf allocates the requested memory for AudioCVT buffer.
func (cvt AudioCVT) BufAsSlice() []byte
BufAsSlice returns AudioCVT.buf as byte slice. NOTE: Must be used after ConvertAudio() because it uses LenCVT as slice length.
func (cvt *AudioCVT) FreeBuf()
FreeBuf deallocates the memory previously allocated from AudioCVT buffer.
type BGR555 struct { B, G, R byte }
func (c BGR555) RGBA() (r, g, b, a uint32)
type BGR565 struct { B, G, R byte }
func (c BGR565) RGBA() (r, g, b, a uint32)
type BGRA4444 struct { B, G, R, A byte }
func (c BGRA4444) RGBA() (r, g, b, a uint32)
type BGRA5551 struct { B, G, R, A byte }
func (c BGRA5551) RGBA() (r, g, b, a uint32)
type BGRA8888 struct { B, G, R, A byte }
func (c BGRA8888) RGBA() (r, g, b, a uint32)
BlendMode is an enumeration of blend modes used in Render.Copy() and drawing operations. (https://wiki.libsdl.org/SDL_BlendMode)
func ComposeCustomBlendMode(srcColorFactor, dstColorFactor BlendFactor, colorOperation BlendOperation, srcAlphaFactor, dstAlphaFactor BlendFactor, alphaOperation BlendOperation) BlendMode
ComposeCustomBlendMode creates a custom blend mode, which may or may not be supported by a given renderer The result of the blend mode operation will be:
dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor
and
dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor
(https://wiki.libsdl.org/SDL_ComposeCustomBlendMode)
CocoaInfo contains Apple Mac OS X window information.
type Cond struct { Lock *Mutex Waiting int Signals int WaitSem *Sem WaitDone *Sem }
Cond is the SDL condition variable structure.
Cursor is a custom cursor created by CreateCursor() or CreateColorCursor().
DFBInfo contains DirectFB window information.
DropEvent contains an event used to request a file open by the system. (https://wiki.libsdl.org/SDL_DropEvent)
GetTimestamp returns the timestamp of the event.
GetType returns the event type.
ErrorCode is an error code used in SDL error messages.
type EventWatchHandle ¶
EventWatchHandle is an event watch callback added with AddEventWatch().
func AddEventWatchFunc(filterFunc eventFilterFunc, 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)
Finger contains touch information.
GLContext is an opaque handle to an OpenGL context.
GameController used to identify an SDL game controller.
func (ctrl *GameController) Joystick() *Joystick
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)
func (ctrl *GameController) Product() int
Product returns the USB product ID of an opened controller, if available, 0 otherwise.
func (ctrl *GameController) ProductVersion() int
ProductVersion returns the product version of an opened controller, if available, 0 otherwise.
func (ctrl *GameController) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error
Rumble triggers a rumble effect Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
lowFrequencyRumble - The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF highFrequencyRumble - The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF durationMS - The duration of the rumble effect, in milliseconds
Returns error if rumble isn't supported on this joystick.
TODO: (https://wiki.libsdl.org/SDL_GameControllerRumble)
func (ctrl *GameController) Vendor() int
Vendor returns the USB vendor ID of an opened controller, if available, 0 otherwise.
GameControllerBindType is a type of game controller input.
GameControllerButtonBind SDL joystick layer binding for controller button/axis mapping.
Axis returns axis mapped for this SDL joystick layer binding.
Button returns button mapped for this SDL joystick layer binding.
Hat returns hat mapped for this SDL joystick layer binding.
func (bind *GameControllerButtonBind) HatMask() int
HatMask returns hat mask for this SDL joystick layer binding.
Type returns the type of game controller input for this SDL joystick layer binding.
GestureID is the unique id of the closest gesture to the performed stroke.
type HintCallback func(data interface{}, name, oldValue, newValue string)
HintCallback is the function to call when the hint value changes.
type HintCallbackAndData ¶ added in v0.2.0
type HintCallbackAndData struct {
}
HintCallbackAndData contains a callback function and userdata.
Joystick is an SDL joystick.
AxisInitialState returns the initial state of an axis control on a joystick, ok is true if this axis has any initial value.
func (joy *Joystick) Product() int
Product returns the USB product ID of an opened joystick, if available, 0 otherwise.
func (joy *Joystick) ProductVersion() int
ProductVersion returns the product version of an opened joystick, if available, 0 otherwise.
func (joy *Joystick) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error
Rumble triggers a rumble effect Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.
lowFrequencyRumble - The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF highFrequencyRumble - The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF durationMS - The duration of the rumble effect, in milliseconds
Returns error if rumble isn't supported on this joystick.
TODO: (https://wiki.libsdl.org/SDL_JoystickRumble)
func (joy *Joystick) Type() JoystickType
Type returns the the type of an opened joystick.
func (joy *Joystick) Vendor() int
Vendor returns the USB vendor ID of an opened joystick, if available, 0 otherwise.
JoystickGUID is a stable unique id for a joystick device.
JoystickID is joystick's instance id.
func JoystickGetDeviceInstanceID(index int) JoystickID
JoystickGetDeviceInstanceID returns the instance ID of a joystick.
JoystickPowerLevel is a battery level of a joystick.
JoystickType is a type of a joystick.
func JoystickGetDeviceType(index int) JoystickType
JoystickGetDeviceType returns the type of a joystick.
type LogOutputFunction func(data interface{}, category int, pri LogPriority, message string)
LogOutputFunction is the function to call instead of the default
type Mutex struct { Recursive int Owner ThreadID Sem *Sem }
Mutex is the SDL mutex structure.
OSEvent contains OS specific event information.
GetTimestamp returns the timestamp of the event.
GetType returns the event type.
type RGB332 struct { R, G, B byte }
func (c RGB332) RGBA() (r, g, b, a uint32)
type RGB444 struct { R, G, B byte }
func (c RGB444) RGBA() (r, g, b, a uint32)
type RGB555 struct { R, G, B byte }
func (c RGB555) RGBA() (r, g, b, a uint32)
type RGB565 struct { R, G, B byte }
func (c RGB565) RGBA() (r, g, b, a uint32)
type RGBA4444 struct { R, G, B, A byte }
func (c RGBA4444) RGBA() (r, g, b, a uint32)
type RGBA5551 struct { R, G, B, A byte }
func (c RGBA5551) RGBA() (r, g, b, a uint32)
type RGBA8888 struct { R, G, B, A byte }
func (c RGBA8888) RGBA() (r, g, b, a uint32)
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)
Renderer contains a rendering state. (https://wiki.libsdl.org/SDL_Renderer)
func (renderer *Renderer) CopyEx(texture *Texture, src, dst *Rect, angle float64, center *Point, flip RendererFlip) 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)
func (renderer *Renderer) CopyExF(texture *Texture, src *Rect, dst *FRect, angle float64, center *FPoint, flip RendererFlip) 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. TODO: (https://wiki.libsdl.org/SDL_RenderCopyExF)
func (renderer *Renderer) RenderGeometry(texture *Texture, vertices []Vertex, indices []int32) (err error)
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)
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 interface{}) (err error)
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)
func (renderer *Renderer) RenderLogicalToWindow(logicalX, logicalY float32) (windowX, windowY int)
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)
func (renderer *Renderer) RenderWindowToLogical(windowX, windowY int) (logicalX, logicalY float32)
RenderWindowToLogical gets logical coordinates of point in renderer when given real coordinates of point in window.
Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set
(https://wiki.libsdl.org/SDL_RenderWindowToLogical)
func (renderer *Renderer) SetDrawColorArray(bs ...uint8) error
SetDrawColorArray is a custom variant of SetDrawColor.
SetIntegerScale sets whether to force integer scales for resolution-independent rendering.
This function restricts the logical viewport to integer values - that is, 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)
type Sem struct { Count uint32 WaitersCount uint32 CountLock *Mutex CountNonzero *Cond }
Sem is the SDL semaphore structure.
func SensorOpen(deviceIndex int) (sensor *Sensor)
SensorOpen opens a sensor for use.
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)
func (sensor *Sensor) GetInstanceID() (id SensorID)
GetInstanceID gets the instance ID of a sensor.
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)
func (sensor *Sensor) GetNonPortableType() (typ int)
GetNonPortableType gets the platform dependent type of a sensor.
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)
func (sensor *Sensor) GetType() (typ SensorType)
GetType gets the type of a sensor.
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)
SensorEvent contains data from sensors such as accelerometer and gyroscope (https://wiki.libsdl.org/SDL_SensorEvent)
GetTimestamp returns the timestamp of the event.
GetType returns the event type.
func SensorGetDeviceInstanceID(deviceIndex int) (id SensorID)
SensorGetDeviceInstanceID gets the instance ID of a sensor.
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)
func SensorGetDeviceType(deviceIndex int) (typ SensorType)
SensorGetDeviceType gets the type of a sensor.
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)
SharedObject is a pointer to the object handle.
Surface contains a collection of pixels used in software blitting. (https://wiki.libsdl.org/SDL_Surface)
At returns the pixel color at (x, y)
Bounds return the bounds of this surface. Currently, it always starts at (0,0), but this is not guaranteed in the future so don't rely on it.
func (surface *Surface) BytesPerPixel() int
BytesPerPixel return the number of significant bits in a pixel values of the surface.
ColorModel returns the color model used by this Surface.
Data returns the pointer to the actual pixel data of the surface.
func (surface *Surface) Duplicate() (newSurface *Surface, err error)
Duplicate creates a new surface identical to the existing surface
func (surface *Surface) PixelNum() int
PixelNum returns the number of pixels stored in the surface.
func (surface *Surface) Pixels() []byte
Pixels returns the actual pixel data of the surface.
Set the color of the pixel at (x, y) using this surface's color model to convert c to the appropriate color. This method is required for the draw.Image interface. The surface may require locking before calling Set.
type SysWMInfo struct { Version Version Subsystem uint32
}
SysWMInfo contains system-dependent information about a window. (https://wiki.libsdl.org/SDL_SysWMinfo)
func (info *SysWMInfo) GetCocoaInfo() *CocoaInfo
GetCocoaInfo returns Apple Mac OS X window information.
func (info *SysWMInfo) GetDFBInfo() *DFBInfo
GetDFBInfo returns DirectFB window information.
func (info *SysWMInfo) GetUIKitInfo() *UIKitInfo
GetUIKitInfo returns Apple iOS window information.
func (info *SysWMInfo) GetWindowsInfo() *WindowsInfo
GetWindowsInfo returns Microsoft Windows window information.
func (info *SysWMInfo) GetX11Info() *X11Info
GetX11Info returns X Window System window information.
SystemCursor is a system cursor created by CreateSystemCursor().
TextEditingEvent contains keyboard text editing event information. (https://wiki.libsdl.org/SDL_TextEditingEvent)
GetText returns the text as string
GetTimestamp returns the timestamp of the event.
GetType returns the event type.
TextInputEvent contains keyboard text input event information. (https://wiki.libsdl.org/SDL_TextInputEvent)
GetText returns the text as string
GetTimestamp returns the timestamp of the event.
GetType returns the event type.
ThreadID is the thread identifier for a thread.
TouchDeviceType is a touch device type.
TouchID is the ID of a touch device.
UIKitInfo contains Apple iOS window information.
type Vertex struct {
Position FPoint
Color Color
TexCoord FPoint
}
Vertex structure
Window is a type used to identify a window.
GetID returns the numeric ID of the window, for logging purposes.
(https://wiki.libsdl.org/SDL_GetWindowID)
func (window *Window) SetMouseRect(rect Rect) (err error)
SetMouseRect confines the cursor to the specified area of a window.
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)
WindowsInfo contains Microsoft Windows window information.
X11Info contains X Window System window information.