Documentation ¶
Overview ¶
Bindings for Simple DirectMedia Layer (www.libsdl.org)
Index ¶
- Constants
- func AddHintCallback(name string, callback HintCallback, userdata uintptr)
- func AudioInit(driver_name string) (retval int)
- func AudioQuit()
- func BITSPERPIXEL(X uint32) uint32
- func BYTESPERPIXEL(X uint32) uint32
- func BlitScaled(src *Surface, srcrect Rect, dst *Surface, dstrect Rect) (retval int)
- func BlitSurface(src *Surface, srcrect Rect, dst *Surface, dstrect Rect) (retval int)
- func CalculateGammaRamp(gamma float32, ramp *[256]uint16)
- func CaptureMouse(enabled bool) (retval int)
- func ClearError()
- func ClearHints()
- func ClearQueuedAudio(dev AudioDeviceID)
- func CloseAudio()
- func CloseAudioDevice(dev AudioDeviceID)
- func ConvertAudio(cvt *AudioCVT) (retval int)
- func ConvertPixels(width int, height int, src_format uint32, src []byte, src_pitch int, ...) (retval int)
- func CreateWindowAndRenderer(width int, height int, window_flags uint32) (retval int, window *Window, renderer *Renderer)
- func DEFINE_PIXELFORMAT(typ, order, layout, bits, bytes uint32) uint32
- func DelHintCallback(name string, callback HintCallback, userdata uintptr)
- func Delay(ms uint32)
- func DisableScreenSaver()
- func EnableScreenSaver()
- func Error(code Errorcode) (retval int)
- func EventState(_type uint32, state int) (retval uint8)
- func FlushEvent(_type EventType)
- func FlushEvents(minType EventType, maxType EventType)
- func GL_DeleteContext(context GLContext)
- func GL_ExtensionSupported(extension string) (retval bool)
- func GL_GetAttribute(attr GLattr) (retval int, value int)
- func GL_GetProcAddress(proc string) (retval uintptr)
- func GL_GetSwapInterval() (retval int)
- func GL_LoadLibrary(path string) (retval int)
- func GL_ResetAttributes()
- func GL_SetAttribute(attr GLattr, value int) (retval int)
- func GL_SetSwapInterval(interval int) (retval int)
- func GL_UnloadLibrary()
- func GameControllerAddMapping(mappingString string) (retval int)
- func GameControllerAddMappingsFromRW(rw *RWops, freerw int) (retval int)
- func GameControllerEventState(state int) (retval int)
- func GameControllerGetStringForAxis(axis GameControllerAxis) (retval string)
- func GameControllerGetStringForButton(button GameControllerButton) (retval string)
- func GameControllerMappingForGUID(guid JoystickGUID) (retval string)
- func GameControllerNameForIndex(joystick_index int) (retval string)
- func GameControllerUpdate()
- func GetAudioDeviceName(index int, iscapture int) (retval string)
- func GetAudioDriver(index int) (retval string)
- func GetBasePath() (retval string)
- func GetCPUCacheLineSize() (retval int)
- func GetCPUCount() (retval int)
- func GetClipboardText() (retval string)
- func GetClosestDisplayMode(displayIndex int, mode *DisplayMode) (retval *DisplayMode, closest *DisplayMode)
- func GetCurrentAudioDriver() (retval string)
- func GetCurrentVideoDriver() (retval string)
- func GetDisplayDPI(displayIndex int) (retval int, ddpi float32, hdpi float32, vdpi float32)
- func GetDisplayName(displayIndex int) (retval string)
- func GetError() (retval string)
- func GetGlobalMouseState() (retval uint32, x int, y int)
- func GetHint(name string) (retval string)
- func GetKeyName(key Keycode) (retval string)
- func GetKeyboardState() []byte
- func GetMouseState() (retval uint32, x int, y int)
- func GetNumAudioDevices(iscapture int) (retval int)
- func GetNumAudioDrivers() (retval int)
- func GetNumDisplayModes(displayIndex int) (retval int)
- func GetNumRenderDrivers() (retval int)
- func GetNumTouchDevices() (retval int)
- func GetNumTouchFingers(touchID TouchID) (retval int)
- func GetNumVideoDisplays() (retval int)
- func GetNumVideoDrivers() (retval int)
- func GetPerformanceCounter() (retval uint64)
- func GetPerformanceFrequency() (retval uint64)
- func GetPixelFormatName(format uint32) (retval string)
- func GetPrefPath(org string, app string) (retval string)
- func GetQueuedAudioSize(dev AudioDeviceID) (retval uint32)
- func GetRelativeMouseMode() (retval bool)
- func GetRelativeMouseState() (retval uint32, x int, y int)
- func GetRevision() (retval string)
- func GetRevisionNumber() (retval int)
- func GetScancodeName(scancode Scancode) (retval string)
- func GetSystemRAM() (retval int)
- func GetTicks() (retval uint32)
- func GetVideoDriver(index int) (retval string)
- func HapticName(device_index int) (retval string)
- func HapticOpened(device_index int) (retval int)
- func Has3DNow() (retval bool)
- func HasAVX() (retval bool)
- func HasAVX2() (retval bool)
- func HasAltiVec() (retval bool)
- func HasClipboardText() (retval bool)
- func HasEvent(_type EventType) (retval bool)
- func HasEvents(minType uint32, maxType uint32) (retval bool)
- func HasIntersection(A Rect, B Rect) (retval bool)
- func HasMMX() (retval bool)
- func HasRDTSC() (retval bool)
- func HasSSE() (retval bool)
- func HasSSE2() (retval bool)
- func HasSSE3() (retval bool)
- func HasSSE41() (retval bool)
- func HasSSE42() (retval bool)
- func HasScreenKeyboardSupport() (retval bool)
- func ISPIXELFORMAT_ALPHA(format uint32) bool
- func ISPIXELFORMAT_ARRAY(format uint32) bool
- func ISPIXELFORMAT_FOURCC(format uint32) bool
- func ISPIXELFORMAT_INDEXED(format uint32) bool
- func ISPIXELFORMAT_PACKED(format uint32) bool
- func Init(flags uint32) (retval int)
- func InitSubSystem(flags uint32) (retval int)
- func IntersectRectAndLine(rect Rect, lineX1 int, lineY1 int, lineX2 int, lineY2 int) (retval bool, X1 int, Y1 int, X2 int, Y2 int)
- func IsGameController(joystick_index int) (retval bool)
- func IsScreenSaverEnabled() (retval bool)
- func IsTextInputActive() (retval bool)
- func JoystickEventState(state int) (retval int)
- func JoystickNameForIndex(device_index int) (retval string)
- func JoystickUpdate()
- func LoadDollarTemplates(touchId TouchID, src *RWops) (retval int)
- func LockAudio()
- func LockAudioDevice(dev AudioDeviceID)
- func LowerBlit(src *Surface, srcrect Rect, dst *Surface, dstrect Rect) (retval int)
- func LowerBlitScaled(src *Surface, srcrect Rect, dst *Surface, dstrect Rect) (retval int)
- func MasksToPixelFormatEnum(bpp int, Rmask uint32, Gmask uint32, Bmask uint32, Amask uint32) (retval uint32)
- func MixAudio(dst []byte, src []byte, volume int)
- func MixAudioFormat(dst []byte, src []byte, format AudioFormat, volume int)
- func MouseIsHaptic() (retval int)
- func NumHaptics() (retval int)
- func NumJoysticks() (retval int)
- func OpenAudio(desired *AudioSpec, obtained *AudioSpec) (retval int)
- func PIXELFLAG(X uint32) uint32
- func PIXELLAYOUT(X uint32) uint32
- func PIXELORDER(X uint32) uint32
- func PIXELTYPE(X uint32) uint32
- func PauseAudio(pause_on int)
- func PauseAudioDevice(dev AudioDeviceID, pause_on int)
- func PeepEvents(events []Event, numevents int, action Eventaction, minType uint32, ...) int
- func PixelFormatEnumToMasks(format uint32) (retval bool, bpp int, Rmask uint32, Gmask uint32, Bmask uint32, Amask uint32)
- func PointInRect(p Point, r Rect) (retval bool)
- func PollEvent(event *Event) (retval bool)
- func PumpEvents()
- func QueueAudio(dev AudioDeviceID, data []byte) (retval int)
- func Quit()
- func QuitSubSystem(flags uint32)
- func RecordGesture(touchId TouchID) (retval int)
- func RectEmpty(r Rect) (retval bool)
- func RectEquals(a Rect, b Rect) (retval bool)
- func RegisterEvents(numevents int) (retval uint32)
- func RemoveTimer(id TimerID) (retval bool)
- func SaveAllDollarTemplates(dst *RWops) (retval int)
- func SaveBMP_RW(surface *Surface, dst *RWops, freedst int) (retval int)
- func SaveDollarTemplate(gestureId GestureID, dst *RWops) (retval int)
- func SetClipboardText(text string) (retval int)
- func SetCursor(cursor *Cursor)
- func SetError(fo string) int
- func SetHint(name string, value string) (retval bool)
- func SetHintWithPriority(name string, value string, priority HintPriority) (retval bool)
- func SetModState(modstate Keymod)
- func SetRelativeMouseMode(enabled bool) (retval int)
- func SetTextInputRect(rect Rect)
- func ShowCursor(toggle int) (retval int)
- func ShowMessageBox(messageboxdata *MessageBoxData) (retval int, buttonid int)
- func ShowSimpleMessageBox(flags uint32, title string, message string, window *Window) (retval int)
- func SoftStretch(src *Surface, srcrect Rect, dst *Surface, dstrect Rect) (retval int)
- func StartTextInput()
- func StopTextInput()
- func UnlockAudio()
- func UnlockAudioDevice(dev AudioDeviceID)
- func UpperBlit(src *Surface, srcrect Rect, dst *Surface, dstrect Rect) (retval int)
- func UpperBlitScaled(src *Surface, srcrect Rect, dst *Surface, dstrect Rect) (retval int)
- func VideoInit(driver_name string) (retval int)
- func VideoQuit()
- func WarpMouseGlobal(x int, y int) (retval int)
- func WarpMouseInWindow(window *Window, x int, y int)
- func WasInit(flags uint32) (retval uint32)
- type AudioCVT
- type AudioCallback
- type AudioDeviceEvent
- type AudioDeviceID
- type AudioFilter
- type AudioFormat
- type AudioSpec
- type AudioStatus
- type BlendMode
- type Blit
- type Color
- type CommonEvent
- type ControllerAxisEvent
- type ControllerButtonEvent
- type ControllerDeviceEvent
- type Cursor
- func CreateColorCursor(surface *Surface, hot_x int, hot_y int) (retval *Cursor)
- func CreateCursor(data []byte, mask []byte, width int, height int, hot_x int, hot_y int) (retval *Cursor)
- func CreateSystemCursor(id SystemCursor) (retval *Cursor)
- func GetCursor() (retval *Cursor)
- func GetDefaultCursor() (retval *Cursor)
- type CustomRWops
- type DisplayMode
- type DollarGestureEvent
- type DropEvent
- type Errorcode
- type Event
- func (u *Event) Adevice() AudioDeviceEvent
- func (u *Event) Button() MouseButtonEvent
- func (u *Event) Caxis() ControllerAxisEvent
- func (u *Event) Cbutton() ControllerButtonEvent
- func (u *Event) Cdevice() ControllerDeviceEvent
- func (u *Event) Common() CommonEvent
- func (u *Event) Dgesture() DollarGestureEvent
- func (u *Event) Drop() DropEvent
- func (u *Event) Edit() TextEditingEvent
- func (u *Event) Jaxis() JoyAxisEvent
- func (u *Event) Jball() JoyBallEvent
- func (u *Event) Jbutton() JoyButtonEvent
- func (u *Event) Jdevice() JoyDeviceEvent
- func (u *Event) Jhat() JoyHatEvent
- func (u *Event) Key() KeyboardEvent
- func (u *Event) Mgesture() MultiGestureEvent
- func (u *Event) Motion() MouseMotionEvent
- func (u *Event) Padding() [56]uint8
- func (event *Event) Push() (retval int)
- func (u *Event) Quit() QuitEvent
- func (u *Event) SetAdevice(x AudioDeviceEvent)
- func (u *Event) SetButton(x MouseButtonEvent)
- func (u *Event) SetCaxis(x ControllerAxisEvent)
- func (u *Event) SetCbutton(x ControllerButtonEvent)
- func (u *Event) SetCdevice(x ControllerDeviceEvent)
- func (u *Event) SetCommon(x CommonEvent)
- func (u *Event) SetDgesture(x DollarGestureEvent)
- func (u *Event) SetEdit(x TextEditingEvent)
- func (u *Event) SetJaxis(x JoyAxisEvent)
- func (u *Event) SetJball(x JoyBallEvent)
- func (u *Event) SetJbutton(x JoyButtonEvent)
- func (u *Event) SetJdevice(x JoyDeviceEvent)
- func (u *Event) SetJhat(x JoyHatEvent)
- func (u *Event) SetKey(x KeyboardEvent)
- func (u *Event) SetMgesture(x MultiGestureEvent)
- func (u *Event) SetMotion(x MouseMotionEvent)
- func (u *Event) SetPadding(x [56]uint8)
- func (u *Event) SetQuit(x QuitEvent)
- func (u *Event) SetText(x TextInputEvent)
- func (u *Event) SetTfinger(x TouchFingerEvent)
- func (u *Event) SetType(x EventType)
- func (u *Event) SetUser(x UserEvent)
- func (u *Event) SetWheel(x MouseWheelEvent)
- func (u *Event) SetWindow(x WindowEvent)
- func (u *Event) Text() TextInputEvent
- func (u *Event) Tfinger() TouchFingerEvent
- func (u *Event) Type() EventType
- func (u *Event) User() UserEvent
- func (u *Event) Wheel() MouseWheelEvent
- func (u *Event) Window() WindowEvent
- type EventFilter
- type EventType
- type Eventaction
- type Finger
- type FingerID
- type GLContext
- type GLattr
- type GLcontextFlag
- type GLcontextReleaseFlag
- type GLprofile
- type GameController
- func (gamecontroller *GameController) Close()
- func (gamecontroller *GameController) GetAttached() (retval bool)
- func (gamecontroller *GameController) GetAxis(axis GameControllerAxis) (retval int16)
- func (gamecontroller *GameController) GetBindForAxis(axis GameControllerAxis) (retval GameControllerButtonBind)
- func (gamecontroller *GameController) GetBindForButton(button GameControllerButton) (retval GameControllerButtonBind)
- func (gamecontroller *GameController) GetButton(button GameControllerButton) (retval uint8)
- func (gamecontroller *GameController) GetJoystick() (retval *Joystick)
- func (gamecontroller *GameController) Mapping() (retval string)
- func (gamecontroller *GameController) Name() (retval string)
- type GameControllerAxis
- type GameControllerBindType
- type GameControllerButton
- type GameControllerButtonBind
- type GestureID
- type Haptic
- func (haptic *Haptic) Close()
- func (haptic *Haptic) DestroyEffect(effect int)
- func (haptic *Haptic) EffectSupported(effect *HapticEffect) (retval int)
- func (haptic *Haptic) GetEffectStatus(effect int) (retval int)
- func (haptic *Haptic) Index() (retval int)
- func (haptic *Haptic) NewEffect(effect *HapticEffect) (retval int)
- func (haptic *Haptic) NumAxes() (retval int)
- func (haptic *Haptic) NumEffects() (retval int)
- func (haptic *Haptic) NumEffectsPlaying() (retval int)
- func (haptic *Haptic) Pause() (retval int)
- func (haptic *Haptic) Query() (retval uint)
- func (haptic *Haptic) RumbleInit() (retval int)
- func (haptic *Haptic) RumblePlay(strength float32, length uint32) (retval int)
- func (haptic *Haptic) RumbleStop() (retval int)
- func (haptic *Haptic) RumbleSupported() (retval int)
- func (haptic *Haptic) RunEffect(effect int, iterations uint32) (retval int)
- func (haptic *Haptic) SetAutocenter(autocenter int) (retval int)
- func (haptic *Haptic) SetGain(gain int) (retval int)
- func (haptic *Haptic) StopAll() (retval int)
- func (haptic *Haptic) StopEffect(effect int) (retval int)
- func (haptic *Haptic) Unpause() (retval int)
- func (haptic *Haptic) UpdateEffect(effect int, data *HapticEffect) (retval int)
- type HapticCondition
- type HapticConstant
- type HapticCustom
- type HapticDirection
- type HapticEffect
- func (u *HapticEffect) Condition() HapticCondition
- func (u *HapticEffect) Constant() HapticConstant
- func (u *HapticEffect) Custom() HapticCustom
- func (u *HapticEffect) Leftright() HapticLeftRight
- func (u *HapticEffect) Periodic() HapticPeriodic
- func (u *HapticEffect) Ramp() HapticRamp
- func (u *HapticEffect) SetCondition(x HapticCondition)
- func (u *HapticEffect) SetConstant(x HapticConstant)
- func (u *HapticEffect) SetCustom(x HapticCustom)
- func (u *HapticEffect) SetLeftright(x HapticLeftRight)
- func (u *HapticEffect) SetPeriodic(x HapticPeriodic)
- func (u *HapticEffect) SetRamp(x HapticRamp)
- func (u *HapticEffect) SetType(x uint16)
- func (u *HapticEffect) Type() uint16
- type HapticLeftRight
- type HapticPeriodic
- type HapticRamp
- type HintCallback
- type HintPriority
- type HitTest
- type HitTestResult
- type JoyAxisEvent
- type JoyBallEvent
- type JoyButtonEvent
- type JoyDeviceEvent
- type JoyHatEvent
- type Joystick
- func (joystick *Joystick) Close()
- func (joystick *Joystick) CurrentPowerLevel() (retval JoystickPowerLevel)
- func (joystick *Joystick) GetAttached() (retval bool)
- func (joystick *Joystick) GetAxis(axis int) (retval int16)
- func (joystick *Joystick) GetBall(ball int) (retval int, dx int, dy int)
- func (joystick *Joystick) GetButton(button int) (retval uint8)
- func (joystick *Joystick) GetGUID() (retval JoystickGUID)
- func (joystick *Joystick) GetHat(hat int) (retval uint8)
- func (joystick *Joystick) HapticOpenFrom() (retval *Haptic)
- func (joystick *Joystick) InstanceID() (retval JoystickID)
- func (joystick *Joystick) IsHaptic() (retval int)
- func (joystick *Joystick) Name() (retval string)
- func (joystick *Joystick) NumAxes() (retval int)
- func (joystick *Joystick) NumBalls() (retval int)
- func (joystick *Joystick) NumButtons() (retval int)
- func (joystick *Joystick) NumHats() (retval int)
- type JoystickGUID
- type JoystickID
- type JoystickPowerLevel
- type KeyboardEvent
- type Keycode
- type Keymod
- type Keysym
- type MessageBoxButtonData
- type MessageBoxButtonFlags
- type MessageBoxColor
- type MessageBoxColorScheme
- type MessageBoxColorType
- type MessageBoxData
- type MessageBoxFlags
- type MouseButtonEvent
- type MouseMotionEvent
- type MouseWheelDirection
- type MouseWheelEvent
- type MultiGestureEvent
- type OSEvent
- type Palette
- type PixelFormat
- func (format *PixelFormat) FreeFormat()
- func (format *PixelFormat) GetRGB(pixel uint32) (r byte, g byte, b byte)
- func (format *PixelFormat) GetRGBA(pixel uint32) (r byte, g byte, b byte, a byte)
- func (format *PixelFormat) MapRGB(r uint8, g uint8, b uint8) (retval uint32)
- func (format *PixelFormat) MapRGBA(r uint8, g uint8, b uint8, a uint8) (retval uint32)
- func (format *PixelFormat) SetPalette(palette *Palette) (retval int)
- type Point
- type PowerState
- type QuitEvent
- type RWops
- func (rw *RWops) Close() int
- func (src *RWops) ReadBE16() (retval uint16)
- func (src *RWops) ReadBE32() (retval uint32)
- func (src *RWops) ReadBE64() (retval uint64)
- func (src *RWops) ReadLE16() (retval uint16)
- func (src *RWops) ReadLE32() (retval uint32)
- func (src *RWops) ReadLE64() (retval uint64)
- func (src *RWops) ReadU8() (retval uint8)
- func (rw *RWops) Size() int64
- func (dst *RWops) WriteBE16(value uint16) (retval uint64)
- func (dst *RWops) WriteBE32(value uint32) (retval uint64)
- func (dst *RWops) WriteBE64(value uint64) (retval uint64)
- func (dst *RWops) WriteLE16(value uint16) (retval uint64)
- func (dst *RWops) WriteLE32(value uint32) (retval uint64)
- func (dst *RWops) WriteLE64(value uint64) (retval uint64)
- func (dst *RWops) WriteU8(value uint8) (retval uint64)
- type Rect
- type Renderer
- func (renderer *Renderer) Clear() (retval int)
- func (renderer *Renderer) Copy(texture *Texture, srcrect *Rect, dstrect *Rect) (retval int)
- func (renderer *Renderer) CopyEx(texture *Texture, srcrect Rect, dstrect Rect, angle float64, center Point, ...) (retval int)
- func (renderer *Renderer) CreateTexture(format uint32, access int, w int, h int) (retval *Texture)
- func (renderer *Renderer) CreateTextureFromSurface(surface *Surface) (retval *Texture)
- func (renderer *Renderer) Destroy()
- func (renderer *Renderer) DrawLine(x1 int, y1 int, x2 int, y2 int) (retval int)
- func (renderer *Renderer) DrawLines(points []Point) (retval int)
- func (renderer *Renderer) DrawPoint(x int, y int) (retval int)
- func (renderer *Renderer) DrawPoints(points []Point) (retval int)
- func (renderer *Renderer) DrawRect(rect Rect) (retval int)
- func (renderer *Renderer) DrawRects(rects []Rect) (retval int)
- func (renderer *Renderer) FillRect(rect Rect) (retval int)
- func (renderer *Renderer) FillRects(rects []Rect) (retval int)
- func (renderer *Renderer) GetClipRect() (rect Rect)
- func (renderer *Renderer) GetDrawBlendMode() (retval int, blendMode *BlendMode)
- func (renderer *Renderer) GetDrawColor() (retval int, r byte, g byte, b byte, a byte)
- func (renderer *Renderer) GetInfo() (retval int, info *RendererInfo)
- func (renderer *Renderer) GetLogicalSize() (w int, h int)
- func (renderer *Renderer) GetOutputSize() (retval int, w int, h int)
- func (renderer *Renderer) GetScale() (scaleX float32, scaleY float32)
- func (renderer *Renderer) GetTarget() (retval *Texture)
- func (renderer *Renderer) GetViewport() (rect Rect)
- func (renderer *Renderer) IsClipEnabled() (retval bool)
- func (renderer *Renderer) Present()
- func (renderer *Renderer) ReadPixels(rect *Rect, format uint32, pixels []byte, pitch int) (retval int)
- func (renderer *Renderer) SetClipRect(rect Rect) (retval int)
- func (renderer *Renderer) SetDrawBlendMode(blendMode BlendMode) (retval int)
- func (renderer *Renderer) SetDrawColor(r uint8, g uint8, b uint8, a uint8) (retval int)
- func (renderer *Renderer) SetLogicalSize(w int, h int) (retval int)
- func (renderer *Renderer) SetScale(scaleX float32, scaleY float32) (retval int)
- func (renderer *Renderer) SetTarget(texture *Texture) (retval int)
- func (renderer *Renderer) SetViewport(rect Rect) (retval int)
- func (renderer *Renderer) TargetSupported() (retval bool)
- type RendererFlags
- type RendererFlip
- type RendererInfo
- type Scancode
- type ShapeMode
- type Sizer
- type Surface
- func CreateRGBSurface(flags uint32, width int, height int, depth int, Rmask uint32, Gmask uint32, ...) (retval *Surface)
- func CreateRGBSurfaceFrom(pixels []byte, width int, height int, depth int, pitch int, Rmask uint32, ...) (retval *Surface)
- func LoadBMP(fpath string) (retval *Surface)
- func LoadBMP_RW(src *RWops, freesrc int) (retval *Surface)
- func (src *Surface) Convert(fmt *PixelFormat, flags uint32) (retval *Surface)
- func (src *Surface) ConvertFormat(pixel_format uint32, flags uint32) (retval *Surface)
- func (surface *Surface) CreateSoftwareRenderer() (retval *Renderer)
- func (dst *Surface) FillRect(rect Rect, color uint32) (retval int)
- func (dst *Surface) FillRects(rects []Rect, color uint32) (retval int)
- func (surface *Surface) Free()
- func (surface *Surface) GetAlphaMod() (retval int, alpha byte)
- func (surface *Surface) GetBlendMode() (retval int, blendMode *BlendMode)
- func (surface *Surface) GetClipRect() (rect Rect)
- func (surface *Surface) GetColorKey() (retval int, key uint32)
- func (surface *Surface) GetColorMod() (retval int, r byte, g byte, b byte)
- func (surface *Surface) Lock() (retval int)
- func (surface *Surface) SetAlphaMod(alpha uint8) (retval int)
- func (surface *Surface) SetBlendMode(blendMode BlendMode) (retval int)
- func (surface *Surface) SetClipRect(rect Rect) (retval bool)
- func (surface *Surface) SetColorKey(flag int, key uint32) (retval int)
- func (surface *Surface) SetColorMod(r uint8, g uint8, b uint8) (retval int)
- func (surface *Surface) SetPalette(palette *Palette) (retval int)
- func (surface *Surface) SetRLE(flag int) (retval int)
- func (surface *Surface) Unlock()
- type SysWMmsg
- type SystemCursor
- type TextEditingEvent
- type TextInputEvent
- type Texture
- func (texture *Texture) Destroy()
- func (texture *Texture) GL_Bind() (retval int, texw float32, texh float32)
- func (texture *Texture) GL_Unbind() (retval int)
- func (texture *Texture) GetAlphaMod() (retval int, alpha byte)
- func (texture *Texture) GetBlendMode() (retval int, blendMode *BlendMode)
- func (texture *Texture) GetColorMod() (retval int, r byte, g byte, b byte)
- func (texture *Texture) Lock(rect *Rect) (retval int, pixels *[999999999]byte, pitch int)
- func (texture *Texture) Query() (retval int, format uint32, access int, w int, h int)
- func (texture *Texture) SetAlphaMod(alpha uint8) (retval int)
- func (texture *Texture) SetBlendMode(blendMode BlendMode) (retval int)
- func (texture *Texture) SetColorMod(r uint8, g uint8, b uint8) (retval int)
- func (texture *Texture) Unlock()
- func (texture *Texture) Update(rect *Rect, pixels []byte, pitch int) (retval int)
- func (texture *Texture) UpdateYUV(rect *Rect, Yplane []byte, Ypitch int, Uplane []byte, Upitch int, ...) (retval int)
- type TextureAccess
- type TextureModulate
- type TimerCallback
- type TimerID
- type TouchFingerEvent
- type TouchID
- type UserEvent
- type Version
- type Window
- func CreateShapedWindow(title string, x uint, y uint, w uint, h uint, flags WindowFlags) (retval *Window)
- func CreateWindow(title string, x int, y int, w int, h int, flags WindowFlags) (retval *Window)
- func CreateWindowFrom(data uintptr) (retval *Window)
- func GL_GetCurrentWindow() (retval *Window)
- func GetGrabbedWindow() (retval *Window)
- func GetKeyboardFocus() (retval *Window)
- func GetMouseFocus() (retval *Window)
- func GetWindowFromID(id uint32) (retval *Window)
- func (window *Window) CreateRenderer(index int, flags RendererFlags) (retval *Renderer)
- func (window *Window) Destroy()
- func (window *Window) GL_CreateContext() (retval GLContext)
- func (window *Window) GL_GetDrawableSize() (w int, h int)
- func (window *Window) GL_MakeCurrent(context GLContext) (retval int)
- func (window *Window) GL_Swap()
- func (window *Window) GetBrightness() (retval float32)
- func (window *Window) GetData(name string) (retval uintptr)
- func (window *Window) GetDisplayIndex() (retval int)
- func (window *Window) GetDisplayMode() (retval int, mode *DisplayMode)
- func (window *Window) GetFlags() (retval uint32)
- func (window *Window) GetGammaRamp(red *[256]uint16, green *[256]uint16, blue *[256]uint16) (retval int)
- func (window *Window) GetGrab() (retval bool)
- func (window *Window) GetID() (retval uint32)
- func (window *Window) GetMaximumSize() (w int, h int)
- func (window *Window) GetMinimumSize() (w int, h int)
- func (window *Window) GetPixelFormat() (retval uint32)
- func (window *Window) GetPosition() (x int, y int)
- func (window *Window) GetRenderer() (retval *Renderer)
- func (window *Window) GetShapedMode() (retval int, shape_mode *WindowShapeMode)
- func (window *Window) GetSize() (w int, h int)
- func (window *Window) GetSurface() (retval *Surface)
- func (window *Window) GetTitle() (retval string)
- func (window *Window) Hide()
- func (window *Window) IsScreenKeyboardShown() (retval bool)
- func (window *Window) IsShaped() (retval bool)
- func (window *Window) Maximize()
- func (window *Window) Minimize()
- func (window *Window) Raise()
- func (window *Window) Restore()
- func (window *Window) SetBordered(bordered bool)
- func (window *Window) SetBrightness(brightness float32) (retval int)
- func (window *Window) SetData(name string, userdata uintptr) (retval uintptr)
- func (window *Window) SetDisplayMode(mode *DisplayMode) (retval int)
- func (window *Window) SetFullscreen(flags uint32) (retval int)
- func (window *Window) SetGammaRamp(red *[256]uint16, green *[256]uint16, blue *[256]uint16) (retval int)
- func (window *Window) SetGrab(grabbed bool)
- func (window *Window) SetHitTest(callback HitTest, callback_data uintptr) (retval int)
- func (window *Window) SetIcon(icon *Surface)
- func (window *Window) SetMaximumSize(max_w int, max_h int)
- func (window *Window) SetMinimumSize(min_w int, min_h int)
- func (window *Window) SetPosition(x int, y int)
- func (window *Window) SetShape(shape *Surface, shape_mode *WindowShapeMode) (retval int)
- func (window *Window) SetSize(w int, h int)
- func (window *Window) SetTitle(title string)
- func (window *Window) Show()
- func (window *Window) UpdateSurface() (retval int)
- func (window *Window) UpdateSurfaceRects(rects []Rect) (retval int)
- type WindowEvent
- type WindowEventID
- type WindowFlags
- type WindowShapeMode
- type WindowShapeParams
Constants ¶
const ( INIT_TIMER = C.SDL_INIT_TIMER INIT_AUDIO = C.SDL_INIT_AUDIO // SDL_INIT_VIDEO implies SDL_INIT_EVENTS INIT_VIDEO = C.SDL_INIT_VIDEO // SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS INIT_JOYSTICK = C.SDL_INIT_JOYSTICK INIT_HAPTIC = C.SDL_INIT_HAPTIC // SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK INIT_GAMECONTROLLER = C.SDL_INIT_GAMECONTROLLER INIT_EVENTS = C.SDL_INIT_EVENTS // compatibility; this flag is ignored. INIT_NOPARACHUTE = C.SDL_INIT_NOPARACHUTE INIT_EVERYTHING = C.SDL_INIT_EVERYTHING )
SDL_INIT_*
These are the flags which may be passed to SDL_Init(). You should specify the subsystems which you will be using in your application.
const ( AUDIO_MASK_BITSIZE = C.SDL_AUDIO_MASK_BITSIZE AUDIO_MASK_DATATYPE = C.SDL_AUDIO_MASK_DATATYPE AUDIO_MASK_ENDIAN = C.SDL_AUDIO_MASK_ENDIAN AUDIO_MASK_SIGNED = C.SDL_AUDIO_MASK_SIGNED )
Audio flags
const ( // Unsigned 8-bit samples AUDIO_U8 = C.AUDIO_U8 // Signed 8-bit samples AUDIO_S8 = C.AUDIO_S8 // Unsigned 16-bit samples AUDIO_U16LSB = C.AUDIO_U16LSB // Signed 16-bit samples AUDIO_S16LSB = C.AUDIO_S16LSB // As above, but big-endian byte order AUDIO_U16MSB = C.AUDIO_U16MSB // As above, but big-endian byte order AUDIO_S16MSB = C.AUDIO_S16MSB AUDIO_U16 = C.AUDIO_U16 AUDIO_S16 = C.AUDIO_S16 )
Audio format flags
Defaults to LSB byte order.
const ( // 32-bit integer samples AUDIO_S32LSB = C.AUDIO_S32LSB // As above, but big-endian byte order AUDIO_S32MSB = C.AUDIO_S32MSB AUDIO_S32 = C.AUDIO_S32 )
int32 support
const ( // 32-bit floating point samples AUDIO_F32LSB = C.AUDIO_F32LSB // As above, but big-endian byte order AUDIO_F32MSB = C.AUDIO_F32MSB AUDIO_F32 = C.AUDIO_F32 )
float32 support
const ( AUDIO_U16SYS = C.AUDIO_U16SYS AUDIO_S16SYS = C.AUDIO_S16SYS AUDIO_S32SYS = C.AUDIO_S32SYS AUDIO_F32SYS = C.AUDIO_F32SYS )
Native audio byte ordering
const ( AUDIO_ALLOW_FREQUENCY_CHANGE = C.SDL_AUDIO_ALLOW_FREQUENCY_CHANGE AUDIO_ALLOW_FORMAT_CHANGE = C.SDL_AUDIO_ALLOW_FORMAT_CHANGE AUDIO_ALLOW_CHANNELS_CHANGE = C.SDL_AUDIO_ALLOW_CHANNELS_CHANGE AUDIO_ALLOW_ANY_CHANGE = C.SDL_AUDIO_ALLOW_ANY_CHANGE )
Allow change flags
Which audio format changes are allowed when opening a device.
const ( QUERY = C.SDL_QUERY IGNORE = C.SDL_IGNORE DISABLE = C.SDL_DISABLE ENABLE = C.SDL_ENABLE )
const ( RELEASED = C.SDL_RELEASED PRESSED = C.SDL_PRESSED TEXTEDITINGEVENT_TEXT_SIZE = C.SDL_TEXTEDITINGEVENT_TEXT_SIZE TEXTINPUTEVENT_TEXT_SIZE = C.SDL_TEXTINPUTEVENT_TEXT_SIZE )
const ( // Constant effect supported. // // Constant haptic effect. // // See also: SDL_HapticCondition // HAPTIC_CONSTANT = C.SDL_HAPTIC_CONSTANT // Sine wave effect supported. // // Periodic haptic effect that simulates sine waves. // // See also: SDL_HapticPeriodic // HAPTIC_SINE = C.SDL_HAPTIC_SINE // Left/Right effect supported. // // Haptic effect for direct control over high/low frequency motors. // // See also: SDL_HapticLeftRight // // Warning: this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. // Sorry, we ran out of bits, and this is important for XInput devices. // HAPTIC_LEFTRIGHT = C.SDL_HAPTIC_LEFTRIGHT // Triangle wave effect supported. // // Periodic haptic effect that simulates triangular waves. // // See also: SDL_HapticPeriodic // HAPTIC_TRIANGLE = C.SDL_HAPTIC_TRIANGLE // Sawtoothup wave effect supported. // // Periodic haptic effect that simulates saw tooth up waves. // // See also: SDL_HapticPeriodic // HAPTIC_SAWTOOTHUP = C.SDL_HAPTIC_SAWTOOTHUP // Sawtoothdown wave effect supported. // // Periodic haptic effect that simulates saw tooth down waves. // // See also: SDL_HapticPeriodic // HAPTIC_SAWTOOTHDOWN = C.SDL_HAPTIC_SAWTOOTHDOWN // Ramp effect supported. // // Ramp haptic effect. // // See also: SDL_HapticRamp // HAPTIC_RAMP = C.SDL_HAPTIC_RAMP // Spring effect supported - uses axes position. // // Condition haptic effect that simulates a spring. Effect is based on // the axes position. // // See also: SDL_HapticCondition // HAPTIC_SPRING = C.SDL_HAPTIC_SPRING // Damper effect supported - uses axes velocity. // // Condition haptic effect that simulates dampening. Effect is based on // the axes velocity. // // See also: SDL_HapticCondition // HAPTIC_DAMPER = C.SDL_HAPTIC_DAMPER // Inertia effect supported - uses axes acceleration. // // Condition haptic effect that simulates inertia. Effect is based on the // axes acceleration. // // See also: SDL_HapticCondition // HAPTIC_INERTIA = C.SDL_HAPTIC_INERTIA // Friction effect supported - uses axes movement. // // Condition haptic effect that simulates friction. Effect is based on // the axes movement. // // See also: SDL_HapticCondition // HAPTIC_FRICTION = C.SDL_HAPTIC_FRICTION // Custom effect is supported. // // User defined custom haptic effect. HAPTIC_CUSTOM = C.SDL_HAPTIC_CUSTOM )
Haptic effects
const ( // Uses polar coordinates for the direction. // // See also: SDL_HapticDirection // HAPTIC_POLAR = C.SDL_HAPTIC_POLAR // Uses cartesian coordinates for the direction. // // See also: SDL_HapticDirection // HAPTIC_CARTESIAN = C.SDL_HAPTIC_CARTESIAN // Uses spherical coordinates for the direction. // // See also: SDL_HapticDirection // HAPTIC_SPHERICAL = C.SDL_HAPTIC_SPHERICAL )
Direction encodings
const ( // Device can set global gain. // // Device supports setting the global gain. // // See also: SDL_HapticSetGain // HAPTIC_GAIN = C.SDL_HAPTIC_GAIN // Device can set autocenter. // // Device supports setting autocenter. // // See also: SDL_HapticSetAutocenter // HAPTIC_AUTOCENTER = C.SDL_HAPTIC_AUTOCENTER // Device can be queried for effect status. // // Device can be queried for effect status. // // See also: SDL_HapticGetEffectStatus // HAPTIC_STATUS = C.SDL_HAPTIC_STATUS // Device can be paused. // // See also: SDL_HapticPause // // See also: SDL_HapticUnpause // HAPTIC_PAUSE = C.SDL_HAPTIC_PAUSE // Used to play a device an infinite number of times. // // See also: SDL_HapticRunEffect // HAPTIC_INFINITY = C.SDL_HAPTIC_INFINITY )
const ( // A variable controlling how 3D acceleration is used to accelerate the // SDL screen surface. // // SDL can try to accelerate the SDL screen surface by using streaming // textures with a 3D rendering engine. This variable controls whether // and how this is done. // // This variable can be set to the following values: "0" - Disable 3D // acceleration "1" - Enable 3D acceleration, using the default renderer. // "X" - Enable 3D acceleration, using X where X is one of the valid // rendering drivers. (e.g. "direct3d", "opengl", etc.) // // By default SDL tries to make a best guess for each platform whether to // use acceleration or not. // ↪ https://wiki.libsdl.org/SDL_HINT_FRAMEBUFFER_ACCELERATION HINT_FRAMEBUFFER_ACCELERATION = C.SDL_HINT_FRAMEBUFFER_ACCELERATION // A variable specifying which render driver to use. // // If the application doesn't pick a specific renderer to use, this // variable specifies the name of the preferred renderer. If the // preferred renderer can't be initialized, the normal default renderer // is used. // // This variable is case insensitive and can be set to the following // values: "direct3d" "opengl" "opengles2" "opengles" "software" // // The default varies by platform, but it's the first one in the list // that is available on the current platform. // ↪ https://wiki.libsdl.org/SDL_HINT_RENDER_DRIVER HINT_RENDER_DRIVER = C.SDL_HINT_RENDER_DRIVER // A variable controlling whether the OpenGL render driver uses shaders // if they are available. // // This variable can be set to the following values: "0" - Disable // shaders "1" - Enable shaders // // By default shaders are used if OpenGL supports them. // ↪ https://wiki.libsdl.org/SDL_HINT_RENDER_OPENGL_SHADERS HINT_RENDER_OPENGL_SHADERS = C.SDL_HINT_RENDER_OPENGL_SHADERS // A variable controlling whether the Direct3D device is initialized for // thread-safe operations. // // This variable can be set to the following values: "0" - Thread-safety // is not enabled (faster) "1" - Thread-safety is enabled // // By default the Direct3D device is created with thread-safety disabled. // ↪ https://wiki.libsdl.org/SDL_HINT_RENDER_DIRECT3D_THREADSAFE HINT_RENDER_DIRECT3D_THREADSAFE = C.SDL_HINT_RENDER_DIRECT3D_THREADSAFE // A variable controlling whether to enable Direct3D 11+'s Debug Layer. // // This variable does not have any effect on the Direct3D 9 based // renderer. // // This variable can be set to the following values: "0" - Disable Debug // Layer use "1" - Enable Debug Layer use // // By default, SDL does not use Direct3D Debug Layer. // ↪ https://wiki.libsdl.org/SDL_HINT_RENDER_DIRECT3D11_DEBUG HINT_RENDER_DIRECT3D11_DEBUG = C.SDL_HINT_RENDER_DIRECT3D11_DEBUG // A variable controlling the scaling quality. // // This variable can be set to the following values: "0" or "nearest" - // Nearest pixel sampling "1" or "linear" - Linear filtering (supported // by OpenGL and Direct3D) "2" or "best" - Currently this is the same as // "linear" // // By default nearest pixel sampling is used // ↪ https://wiki.libsdl.org/SDL_HINT_RENDER_SCALE_QUALITY HINT_RENDER_SCALE_QUALITY = C.SDL_HINT_RENDER_SCALE_QUALITY // A variable controlling whether updates to the SDL screen surface // should be synchronized with the vertical refresh, to avoid tearing. // // This variable can be set to the following values: "0" - Disable vsync // "1" - Enable vsync // // By default SDL does not sync screen surface updates with vertical // refresh. // ↪ https://wiki.libsdl.org/SDL_HINT_RENDER_VSYNC HINT_RENDER_VSYNC = C.SDL_HINT_RENDER_VSYNC // A variable controlling whether the screensaver is enabled. // // This variable can be set to the following values: "0" - Disable // screensaver "1" - Enable screensaver // // By default SDL will disable the screensaver. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_ALLOW_SCREENSAVER HINT_VIDEO_ALLOW_SCREENSAVER = C.SDL_HINT_VIDEO_ALLOW_SCREENSAVER // A variable controlling whether the X11 VidMode extension should be // used. // // This variable can be set to the following values: "0" - Disable // XVidMode "1" - Enable XVidMode // // By default SDL will use XVidMode if it is available. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_X11_XVIDMODE HINT_VIDEO_X11_XVIDMODE = C.SDL_HINT_VIDEO_X11_XVIDMODE // A variable controlling whether the X11 Xinerama extension should be // used. // // This variable can be set to the following values: "0" - Disable // Xinerama "1" - Enable Xinerama // // By default SDL will use Xinerama if it is available. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_X11_XINERAMA HINT_VIDEO_X11_XINERAMA = C.SDL_HINT_VIDEO_X11_XINERAMA // A variable controlling whether the X11 XRandR extension should be // used. // // This variable can be set to the following values: "0" - Disable XRandR // "1" - Enable XRandR // // By default SDL will not use XRandR because of window manager issues. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_X11_XRANDR HINT_VIDEO_X11_XRANDR = C.SDL_HINT_VIDEO_X11_XRANDR // A variable controlling whether the X11 _NET_WM_PING protocol should be // supported. // // This variable can be set to the following values: "0" - Disable // _NET_WM_PING "1" - Enable _NET_WM_PING // // By default SDL will use _NET_WM_PING, but for applications that know // they will not always be able to respond to ping requests in a timely // manner they can turn it off to avoid the window manager thinking the // app is hung. The hint is checked in CreateWindow. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_X11_NET_WM_PING HINT_VIDEO_X11_NET_WM_PING = C.SDL_HINT_VIDEO_X11_NET_WM_PING // A variable controlling whether the window frame and title bar are // interactive when the cursor is hidden. // // This variable can be set to the following values: "0" - The window // frame is not interactive when the cursor is hidden (no move, resize, // etc) "1" - The window frame is interactive when the cursor is hidden // // By default SDL will allow interaction with the window frame when the // cursor is hidden // ↪ https://wiki.libsdl.org/SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN = C.SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN // A variable controlling whether the windows message loop is processed // by SDL. // // This variable can be set to the following values: "0" - The window // message loop is not run "1" - The window message loop is processed in // SDL_PumpEvents() // // By default SDL will process the windows message loop // ↪ https://wiki.libsdl.org/SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP HINT_WINDOWS_ENABLE_MESSAGELOOP = C.SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP // A variable controlling whether grabbing input grabs the keyboard. // // This variable can be set to the following values: "0" - Grab will // affect only the mouse "1" - Grab will affect mouse and keyboard // // By default SDL will not grab the keyboard so system shortcuts still // work. // ↪ https://wiki.libsdl.org/SDL_HINT_GRAB_KEYBOARD HINT_GRAB_KEYBOARD = C.SDL_HINT_GRAB_KEYBOARD // A variable controlling whether relative mouse mode is implemented // using mouse warping. // // This variable can be set to the following values: "0" - Relative mouse // mode uses raw input "1" - Relative mouse mode uses mouse warping // // By default SDL will use raw input for relative mouse mode // ↪ https://wiki.libsdl.org/SDL_HINT_MOUSE_RELATIVE_MODE_WARP HINT_MOUSE_RELATIVE_MODE_WARP = C.SDL_HINT_MOUSE_RELATIVE_MODE_WARP // Minimize your SDL_Window if it loses key focus when in fullscreen // mode. Defaults to true. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = C.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS // A variable controlling whether the idle timer is disabled on iOS. // // When an iOS app does not receive touches for some time, the screen is // dimmed automatically. For games where the accelerometer is the only // input this is problematic. This functionality can be disabled by // setting this hint. // // As of SDL 2.0.4, SDL_EnableScreenSaver and SDL_DisableScreenSaver // accomplish the same thing on iOS. They should be preferred over this // hint. // // This variable can be set to the following values: "0" - Enable idle // timer "1" - Disable idle timer // ↪ https://wiki.libsdl.org/SDL_HINT_IDLE_TIMER_DISABLED HINT_IDLE_TIMER_DISABLED = C.SDL_HINT_IDLE_TIMER_DISABLED // A variable controlling which orientations are allowed on iOS. // // In some circumstances it is necessary to be able to explicitly control // which UI orientations are allowed. // // This variable is a space delimited list of the following values: // "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" // ↪ https://wiki.libsdl.org/SDL_HINT_ORIENTATIONS HINT_ORIENTATIONS = C.SDL_HINT_ORIENTATIONS // A variable controlling whether the Android / iOS built-in // accelerometer should be listed as a joystick device, rather than // listing actual joysticks only. // // This variable can be set to the following values: "0" - List only real // joysticks and accept input from them "1" - List real joysticks along // with the accelerometer as if it were a 3 axis joystick (the default). // ↪ https://wiki.libsdl.org/SDL_HINT_ACCELEROMETER_AS_JOYSTICK HINT_ACCELEROMETER_AS_JOYSTICK = C.SDL_HINT_ACCELEROMETER_AS_JOYSTICK // A variable that lets you disable the detection and use of Xinput // gamepad devices. // // The variable can be set to the following values: "0" - Disable XInput // detection (only uses direct input) "1" - Enable XInput detection (the // default) // ↪ https://wiki.libsdl.org/SDL_HINT_XINPUT_ENABLED HINT_XINPUT_ENABLED = C.SDL_HINT_XINPUT_ENABLED // A variable that causes SDL to use the old axis and button mapping for // XInput devices. // // This hint is for backwards compatibility only and will be removed in // SDL 2.1 // // The default value is "0". This hint must be set before SDL_Init() // ↪ https://wiki.libsdl.org/SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING = C.SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING // A variable that lets you manually hint extra gamecontroller db // entries. // // The variable should be newline delimited rows of gamecontroller config // data, see SDL_gamecontroller.h // // This hint must be set before calling SDL_Init(SDL_INIT_GAMECONTROLLER) // You can update mappings after the system is initialized with // SDL_GameControllerMappingForGUID() and SDL_GameControllerAddMapping() // ↪ https://wiki.libsdl.org/SDL_HINT_GAMECONTROLLERCONFIG HINT_GAMECONTROLLERCONFIG = C.SDL_HINT_GAMECONTROLLERCONFIG // A variable that lets you enable joystick (and gamecontroller) events // even when your app is in the background. // // The variable can be set to the following values: "0" - Disable // joystick & gamecontroller input events when the application is in the // background. "1" - Enable joystick & gamecontroller input events when // the application is in the background. // // The default value is "0". This hint may be set at any time. // ↪ https://wiki.libsdl.org/SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS = C.SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS // If set to "0" then never set the top most bit on a SDL Window, even if // the video mode expects it. This is a debugging aid for developers and // not expected to be used by end users. The default is "1". // // This variable can be set to the following values: "0" - don't allow // topmost "1" - allow topmost HINT_ALLOW_TOPMOST = C.SDL_HINT_ALLOW_TOPMOST // A variable that controls the timer resolution, in milliseconds. // // The higher resolution the timer, the more frequently the CPU services // timer interrupts, and the more precise delays are, but this takes up // power and CPU time. This hint is only used on Windows 7 and earlier. // // See this blog post for more information: // http://randomascii.wordpress.com/2013/07/08/windows-timer-resolution- // megawatts-wasted/ // // If this variable is set to "0", the system timer resolution is not // set. // // The default value is "1". This hint may be set at any time. // ↪ https://wiki.libsdl.org/SDL_HINT_TIMER_RESOLUTION HINT_TIMER_RESOLUTION = C.SDL_HINT_TIMER_RESOLUTION // A string specifying SDL's threads stack size in bytes or "0" for the // backend's default size. // // Use this hint in case you need to set SDL's threads stack size to // other than the default. This is specially useful if you build SDL // against a non glibc libc library (such as musl) which provides a // relatively small default thread stack size (a few kilobytes versus the // default 8MB glibc uses). Support for this hint is currently available // only in the pthread backend. // ↪ https://wiki.libsdl.org/SDL_HINT_THREAD_STACK_SIZE HINT_THREAD_STACK_SIZE = C.SDL_HINT_THREAD_STACK_SIZE // If set to 1, then do not allow high-DPI windows. ("Retina" on Mac and // iOS) // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_HIGHDPI_DISABLED HINT_VIDEO_HIGHDPI_DISABLED = C.SDL_HINT_VIDEO_HIGHDPI_DISABLED // A variable that determines whether ctrl+click should generate a right- // click event on Mac. // // If present, holding ctrl while left clicking will generate a right // click event when on Mac. // ↪ https://wiki.libsdl.org/SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK = C.SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK // A variable specifying which shader compiler to preload when using the // Chrome ANGLE binaries. // // SDL has EGL and OpenGL ES2 support on Windows via the ANGLE project. // It can use two different sets of binaries, those compiled by the user // from source or those provided by the Chrome browser. In the later // case, these binaries require that SDL loads a DLL providing the shader // compiler. // // This variable can be set to the following values: "d3dcompiler_46.dll" // - default, best for Vista or later. "d3dcompiler_43.dll" - for XP // support. "none" - do not load any library, useful if you compiled // ANGLE from source and included the compiler in your binaries. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_WIN_D3DCOMPILER HINT_VIDEO_WIN_D3DCOMPILER = C.SDL_HINT_VIDEO_WIN_D3DCOMPILER // A variable that is the address of another SDL_Window* (as a hex string // formatted with "%p"). // // If this hint is set before SDL_CreateWindowFrom() and the SDL_Window* // it is set to has SDL_WINDOW_OPENGL set (and running on WGL only, // currently), then two things will occur on the newly created // SDL_Window: // // // 1. Its pixel format will be set to the same pixel format as this // SDL_Window. This is needed for example when sharing an OpenGL // context across multiple windows. // // 2. The flag SDL_WINDOW_OPENGL will be set on the new window so it // can be used for OpenGL rendering. // // // This variable can be set to the following values: The address (as a // string "%p") of the SDL_Window* that new windows created with // SDL_CreateWindowFrom() should share a pixel format with. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT = C.SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT // A URL to a WinRT app's privacy policy. // // All network-enabled WinRT apps must make a privacy policy available to // its users. On Windows 8, 8.1, and RT, Microsoft mandates that this // policy be be available in the Windows Settings charm, as accessed from // within the app. SDL provides code to add a URL-based link there, which // can point to the app's privacy policy. // // To setup a URL to an app's privacy policy, set // SDL_HINT_WINRT_PRIVACY_POLICY_URL before calling any SDL_Init // functions. The contents of the hint should be a valid URL. For // example, "http://www.example.com". // // The default value is "", which will prevent SDL from adding a privacy // policy link to the Settings charm. This hint should only be set during // app init. // // The label text of an app's "Privacy Policy" link may be customized via // another hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. // // Please note that on Windows Phone, Microsoft does not provide standard // UI for displaying a privacy policy link, and as such, // SDL_HINT_WINRT_PRIVACY_POLICY_URL will not get used on that platform. // Network-enabled phone apps should display their privacy policy through // some other, in-app means. // ↪ https://wiki.libsdl.org/SDL_HINT_WINRT_PRIVACY_POLICY_URL HINT_WINRT_PRIVACY_POLICY_URL = C.SDL_HINT_WINRT_PRIVACY_POLICY_URL // Label text for a WinRT app's privacy policy link. // // Network-enabled WinRT apps must include a privacy policy. On Windows // 8, 8.1, and RT, Microsoft mandates that this policy be available via // the Windows Settings charm. SDL provides code to add a link there, // with its label text being set via the optional hint, // SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. // // Please note that a privacy policy's contents are not set via this // hint. A separate hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to // link to the actual text of the policy. // // The contents of this hint should be encoded as a UTF8 string. // // The default value is "Privacy Policy". This hint should only be set // during app initialization, preferably before any calls to SDL_Init. // // For additional information on linking to a privacy policy, see the // documentation for SDL_HINT_WINRT_PRIVACY_POLICY_URL. // ↪ https://wiki.libsdl.org/SDL_HINT_WINRT_PRIVACY_POLICY_LABEL HINT_WINRT_PRIVACY_POLICY_LABEL = C.SDL_HINT_WINRT_PRIVACY_POLICY_LABEL // Allows back-button-press events on Windows Phone to be marked as // handled. // // Windows Phone devices typically feature a Back button. When pressed, // the OS will emit back-button-press events, which apps are expected to // handle in an appropriate manner. If apps do not explicitly mark these // events as 'Handled', then the OS will invoke its default behavior for // unhandled back-button-press events, which on Windows Phone 8 and 8.1 // is to terminate the app (and attempt to switch to the previous app, or // to the device's home screen). // // Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause // SDL to mark back-button-press events as Handled, if and when one is // sent to the app. // // Internally, Windows Phone sends back button events as parameters to // special back-button-press callback functions. Apps that need to // respond to back-button-press events are expected to register one or // more callback functions for such, shortly after being launched (during // the app's initialization phase). After the back button is pressed, the // OS will invoke these callbacks. If the app's callback(s) do not // explicitly mark the event as handled by the time they return, or if // the app never registers one of these callback, the OS will consider // the event un-handled, and it will apply its default back button // behavior (terminate the app). // // SDL registers its own back-button-press callback with the Windows // Phone OS. This callback will emit a pair of SDL key-press events // (SDL_KEYDOWN and SDL_KEYUP), each with a scancode of // SDL_SCANCODE_AC_BACK, after which it will check the contents of the // hint, SDL_HINT_WINRT_HANDLE_BACK_BUTTON. If the hint's value is set to // "1", the back button event's Handled property will get set to 'true'. // If the hint's value is set to something else, or if it is unset, SDL // will leave the event's Handled property alone. (By default, the OS // sets this property to 'false', to note.) // // SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before // a back button is pressed, or can set it in direct-response to a back // button being pressed. // // In order to get notified when a back button is pressed, SDL apps // should register a callback function with SDL_AddEventWatch(), and have // it listen for SDL_KEYDOWN events that have a scancode of // SDL_SCANCODE_AC_BACK. (Alternatively, SDL_KEYUP events can be // listened-for. Listening for either event type is suitable.) Any value // of SDL_HINT_WINRT_HANDLE_BACK_BUTTON set by such a callback, will be // applied to the OS' current back-button-press event. // // More details on back button behavior in Windows Phone apps can be // found at the following page, on Microsoft's developer site: // http://msdn.microsoft.com/en- // us/library/windowsphone/develop/jj247550(v=vs.105).aspx // ↪ https://wiki.libsdl.org/SDL_HINT_WINRT_HANDLE_BACK_BUTTON HINT_WINRT_HANDLE_BACK_BUTTON = C.SDL_HINT_WINRT_HANDLE_BACK_BUTTON // A variable that dictates policy for fullscreen Spaces on Mac OS X. // // This hint only applies to Mac OS X. // // The variable can be set to the following values: "0" - Disable Spaces // support (FULLSCREEN_DESKTOP won't use them and SDL_WINDOW_RESIZABLE // windows won't offer the "fullscreen" button on their titlebars). "1" - // Enable Spaces support (FULLSCREEN_DESKTOP will use them and // SDL_WINDOW_RESIZABLE windows will offer the "fullscreen" button on // their titlebars). // // The default value is "1". Spaces are disabled regardless of this hint // if the OS isn't at least Mac OS X Lion (10.7). This hint must be set // before any windows are created. // ↪ https://wiki.libsdl.org/SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES HINT_VIDEO_MAC_FULLSCREEN_SPACES = C.SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES // When set don't force the SDL app to become a foreground process. // // This hint only applies to Mac OS X. // ↪ https://wiki.libsdl.org/SDL_HINT_MAC_BACKGROUND_APP HINT_MAC_BACKGROUND_APP = C.SDL_HINT_MAC_BACKGROUND_APP // Android APK expansion main file version. Should be a string number // like "1", "2" etc. // // Must be set together with // SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION. // // If both hints were set then SDL_RWFromFile() will look into expansion // files after a given relative path was not found in the internal // storage and assets. // // By default this hint is not set and the APK expansion files are not // searched. // ↪ https://wiki.libsdl.org/SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION = C.SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION // Android APK expansion patch file version. Should be a string number // like "1", "2" etc. // // Must be set together with // SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION. // // If both hints were set then SDL_RWFromFile() will look into expansion // files after a given relative path was not found in the internal // storage and assets. // // By default this hint is not set and the APK expansion files are not // searched. // ↪ https://wiki.libsdl.org/SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = C.SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION // A variable to control whether certain IMEs should handle text editing // internally instead of sending SDL_TEXTEDITING events. // // The variable can be set to the following values: "0" - SDL_TEXTEDITING // events are sent, and it is the application's responsibility to render // the text from these events and differentiate it somehow from committed // text. (default) "1" - If supported by the IME then SDL_TEXTEDITING // events are not sent, and text that is being composed will be rendered // in its own UI. // ↪ https://wiki.libsdl.org/SDL_HINT_IME_INTERNAL_EDITING HINT_IME_INTERNAL_EDITING = C.SDL_HINT_IME_INTERNAL_EDITING // A variable to control whether mouse and touch events are to be treated // together or separately. // // The variable can be set to the following values: "0" - Mouse events // will be handled as touch events, and touch will raise fake mouse // events. This is the behaviour of SDL <= 2.0.3. (default) "1" - Mouse // events will be handled separately from pure touch events. // // The value of this hint is used at runtime, so it can be changed at any // time. // ↪ https://wiki.libsdl.org/SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH = C.SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH // override the binding element for keyboard inputs for Emscripten builds // // This hint only applies to the emscripten platform // // The variable can be one of "#window" - The javascript window object // (this is the default) "#document" - The javascript document object // "#screen" - the javascript window.screen object "#canvas" - the WebGL // canvas element any other string without a leading # sign applies to // the element on the page with that ID. // ↪ https://wiki.libsdl.org/SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT HINT_EMSCRIPTEN_KEYBOARD_ELEMENT = C.SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT // Tell SDL not to catch the SIGINT or SIGTERM signals. // // This hint only applies to Unix-like platforms. // // The variable can be set to the following values: "0" - SDL will // install a SIGINT and SIGTERM handler, and when it catches a signal, // convert it into an SDL_QUIT event. "1" - SDL will not install a signal // handler at all. // ↪ https://wiki.libsdl.org/SDL_HINT_NO_SIGNAL_HANDLERS HINT_NO_SIGNAL_HANDLERS = C.SDL_HINT_NO_SIGNAL_HANDLERS // Tell SDL not to generate window-close events for Alt+F4 on Windows. // // The variable can be set to the following values: "0" - SDL will // generate a window-close event when it sees Alt+F4. "1" - SDL will only // do normal key handling for Alt+F4. // ↪ https://wiki.libsdl.org/SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 = C.SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 )
const ( HAT_CENTERED = C.SDL_HAT_CENTERED HAT_UP = C.SDL_HAT_UP HAT_RIGHT = C.SDL_HAT_RIGHT HAT_DOWN = C.SDL_HAT_DOWN HAT_LEFT = C.SDL_HAT_LEFT HAT_RIGHTUP = C.SDL_HAT_RIGHTUP HAT_RIGHTDOWN = C.SDL_HAT_RIGHTDOWN HAT_LEFTUP = C.SDL_HAT_LEFTUP HAT_LEFTDOWN = C.SDL_HAT_LEFTDOWN )
Hat positions
const ( K_SCANCODE_MASK = C.SDLK_SCANCODE_MASK KMOD_CTRL = C.KMOD_CTRL KMOD_SHIFT = C.KMOD_SHIFT KMOD_ALT = C.KMOD_ALT KMOD_GUI = C.KMOD_GUI )
const ( K_UNKNOWN = C.SDLK_UNKNOWN K_RETURN = C.SDLK_RETURN K_ESCAPE = C.SDLK_ESCAPE K_BACKSPACE = C.SDLK_BACKSPACE K_TAB = C.SDLK_TAB K_SPACE = C.SDLK_SPACE K_EXCLAIM = C.SDLK_EXCLAIM K_QUOTEDBL = C.SDLK_QUOTEDBL K_HASH = C.SDLK_HASH K_PERCENT = C.SDLK_PERCENT K_DOLLAR = C.SDLK_DOLLAR K_AMPERSAND = C.SDLK_AMPERSAND K_QUOTE = C.SDLK_QUOTE K_LEFTPAREN = C.SDLK_LEFTPAREN K_RIGHTPAREN = C.SDLK_RIGHTPAREN K_ASTERISK = C.SDLK_ASTERISK K_PLUS = C.SDLK_PLUS K_COMMA = C.SDLK_COMMA K_MINUS = C.SDLK_MINUS K_PERIOD = C.SDLK_PERIOD K_SLASH = C.SDLK_SLASH K_0 = C.SDLK_0 K_1 = C.SDLK_1 K_2 = C.SDLK_2 K_3 = C.SDLK_3 K_4 = C.SDLK_4 K_5 = C.SDLK_5 K_6 = C.SDLK_6 K_7 = C.SDLK_7 K_8 = C.SDLK_8 K_9 = C.SDLK_9 K_COLON = C.SDLK_COLON K_SEMICOLON = C.SDLK_SEMICOLON K_LESS = C.SDLK_LESS K_EQUALS = C.SDLK_EQUALS K_GREATER = C.SDLK_GREATER K_QUESTION = C.SDLK_QUESTION K_AT = C.SDLK_AT K_LEFTBRACKET = C.SDLK_LEFTBRACKET K_BACKSLASH = C.SDLK_BACKSLASH K_RIGHTBRACKET = C.SDLK_RIGHTBRACKET K_CARET = C.SDLK_CARET K_UNDERSCORE = C.SDLK_UNDERSCORE K_BACKQUOTE = C.SDLK_BACKQUOTE K_a = C.SDLK_a K_b = C.SDLK_b K_c = C.SDLK_c K_d = C.SDLK_d K_e = C.SDLK_e K_f = C.SDLK_f K_g = C.SDLK_g K_h = C.SDLK_h K_i = C.SDLK_i K_j = C.SDLK_j K_k = C.SDLK_k K_l = C.SDLK_l K_m = C.SDLK_m K_n = C.SDLK_n K_o = C.SDLK_o K_p = C.SDLK_p K_q = C.SDLK_q K_r = C.SDLK_r K_s = C.SDLK_s K_t = C.SDLK_t K_u = C.SDLK_u K_v = C.SDLK_v K_w = C.SDLK_w K_x = C.SDLK_x K_y = C.SDLK_y K_z = C.SDLK_z K_CAPSLOCK = C.SDLK_CAPSLOCK K_F1 = C.SDLK_F1 K_F2 = C.SDLK_F2 K_F3 = C.SDLK_F3 K_F4 = C.SDLK_F4 K_F5 = C.SDLK_F5 K_F6 = C.SDLK_F6 K_F7 = C.SDLK_F7 K_F8 = C.SDLK_F8 K_F9 = C.SDLK_F9 K_F10 = C.SDLK_F10 K_F11 = C.SDLK_F11 K_F12 = C.SDLK_F12 K_PRINTSCREEN = C.SDLK_PRINTSCREEN K_SCROLLLOCK = C.SDLK_SCROLLLOCK K_PAUSE = C.SDLK_PAUSE K_INSERT = C.SDLK_INSERT K_HOME = C.SDLK_HOME K_PAGEUP = C.SDLK_PAGEUP K_DELETE = C.SDLK_DELETE K_END = C.SDLK_END K_PAGEDOWN = C.SDLK_PAGEDOWN K_RIGHT = C.SDLK_RIGHT K_LEFT = C.SDLK_LEFT K_DOWN = C.SDLK_DOWN K_UP = C.SDLK_UP K_NUMLOCKCLEAR = C.SDLK_NUMLOCKCLEAR K_KP_DIVIDE = C.SDLK_KP_DIVIDE K_KP_MULTIPLY = C.SDLK_KP_MULTIPLY K_KP_MINUS = C.SDLK_KP_MINUS K_KP_PLUS = C.SDLK_KP_PLUS K_KP_ENTER = C.SDLK_KP_ENTER K_KP_1 = C.SDLK_KP_1 K_KP_2 = C.SDLK_KP_2 K_KP_3 = C.SDLK_KP_3 K_KP_4 = C.SDLK_KP_4 K_KP_5 = C.SDLK_KP_5 K_KP_6 = C.SDLK_KP_6 K_KP_7 = C.SDLK_KP_7 K_KP_8 = C.SDLK_KP_8 K_KP_9 = C.SDLK_KP_9 K_KP_0 = C.SDLK_KP_0 K_KP_PERIOD = C.SDLK_KP_PERIOD K_APPLICATION = C.SDLK_APPLICATION K_POWER = C.SDLK_POWER K_KP_EQUALS = C.SDLK_KP_EQUALS K_F13 = C.SDLK_F13 K_F14 = C.SDLK_F14 K_F15 = C.SDLK_F15 K_F16 = C.SDLK_F16 K_F17 = C.SDLK_F17 K_F18 = C.SDLK_F18 K_F19 = C.SDLK_F19 K_F20 = C.SDLK_F20 K_F21 = C.SDLK_F21 K_F22 = C.SDLK_F22 K_F23 = C.SDLK_F23 K_F24 = C.SDLK_F24 K_EXECUTE = C.SDLK_EXECUTE K_HELP = C.SDLK_HELP K_MENU = C.SDLK_MENU K_SELECT = C.SDLK_SELECT K_STOP = C.SDLK_STOP K_AGAIN = C.SDLK_AGAIN K_UNDO = C.SDLK_UNDO K_CUT = C.SDLK_CUT K_COPY = C.SDLK_COPY K_PASTE = C.SDLK_PASTE K_FIND = C.SDLK_FIND K_MUTE = C.SDLK_MUTE K_VOLUMEUP = C.SDLK_VOLUMEUP K_VOLUMEDOWN = C.SDLK_VOLUMEDOWN K_KP_COMMA = C.SDLK_KP_COMMA K_KP_EQUALSAS400 = C.SDLK_KP_EQUALSAS400 K_ALTERASE = C.SDLK_ALTERASE K_SYSREQ = C.SDLK_SYSREQ K_CANCEL = C.SDLK_CANCEL K_CLEAR = C.SDLK_CLEAR K_PRIOR = C.SDLK_PRIOR K_RETURN2 = C.SDLK_RETURN2 K_SEPARATOR = C.SDLK_SEPARATOR K_OUT = C.SDLK_OUT K_OPER = C.SDLK_OPER K_CLEARAGAIN = C.SDLK_CLEARAGAIN K_CRSEL = C.SDLK_CRSEL K_EXSEL = C.SDLK_EXSEL K_KP_00 = C.SDLK_KP_00 K_KP_000 = C.SDLK_KP_000 K_THOUSANDSSEPARATOR = C.SDLK_THOUSANDSSEPARATOR K_DECIMALSEPARATOR = C.SDLK_DECIMALSEPARATOR K_CURRENCYUNIT = C.SDLK_CURRENCYUNIT K_CURRENCYSUBUNIT = C.SDLK_CURRENCYSUBUNIT K_KP_LEFTPAREN = C.SDLK_KP_LEFTPAREN K_KP_RIGHTPAREN = C.SDLK_KP_RIGHTPAREN K_KP_LEFTBRACE = C.SDLK_KP_LEFTBRACE K_KP_RIGHTBRACE = C.SDLK_KP_RIGHTBRACE K_KP_TAB = C.SDLK_KP_TAB K_KP_BACKSPACE = C.SDLK_KP_BACKSPACE K_KP_A = C.SDLK_KP_A K_KP_B = C.SDLK_KP_B K_KP_C = C.SDLK_KP_C K_KP_D = C.SDLK_KP_D K_KP_E = C.SDLK_KP_E K_KP_F = C.SDLK_KP_F K_KP_XOR = C.SDLK_KP_XOR K_KP_POWER = C.SDLK_KP_POWER K_KP_PERCENT = C.SDLK_KP_PERCENT K_KP_LESS = C.SDLK_KP_LESS K_KP_GREATER = C.SDLK_KP_GREATER K_KP_AMPERSAND = C.SDLK_KP_AMPERSAND K_KP_DBLAMPERSAND = C.SDLK_KP_DBLAMPERSAND K_KP_VERTICALBAR = C.SDLK_KP_VERTICALBAR K_KP_DBLVERTICALBAR = C.SDLK_KP_DBLVERTICALBAR K_KP_COLON = C.SDLK_KP_COLON K_KP_HASH = C.SDLK_KP_HASH K_KP_SPACE = C.SDLK_KP_SPACE K_KP_AT = C.SDLK_KP_AT K_KP_EXCLAM = C.SDLK_KP_EXCLAM K_KP_MEMSTORE = C.SDLK_KP_MEMSTORE K_KP_MEMRECALL = C.SDLK_KP_MEMRECALL K_KP_MEMCLEAR = C.SDLK_KP_MEMCLEAR K_KP_MEMADD = C.SDLK_KP_MEMADD K_KP_MEMSUBTRACT = C.SDLK_KP_MEMSUBTRACT K_KP_MEMMULTIPLY = C.SDLK_KP_MEMMULTIPLY K_KP_MEMDIVIDE = C.SDLK_KP_MEMDIVIDE K_KP_PLUSMINUS = C.SDLK_KP_PLUSMINUS K_KP_CLEAR = C.SDLK_KP_CLEAR K_KP_CLEARENTRY = C.SDLK_KP_CLEARENTRY K_KP_BINARY = C.SDLK_KP_BINARY K_KP_OCTAL = C.SDLK_KP_OCTAL K_KP_DECIMAL = C.SDLK_KP_DECIMAL K_KP_HEXADECIMAL = C.SDLK_KP_HEXADECIMAL K_LCTRL = C.SDLK_LCTRL K_LSHIFT = C.SDLK_LSHIFT K_LALT = C.SDLK_LALT K_LGUI = C.SDLK_LGUI K_RCTRL = C.SDLK_RCTRL K_RSHIFT = C.SDLK_RSHIFT K_RALT = C.SDLK_RALT K_RGUI = C.SDLK_RGUI K_MODE = C.SDLK_MODE K_AUDIONEXT = C.SDLK_AUDIONEXT K_AUDIOPREV = C.SDLK_AUDIOPREV K_AUDIOSTOP = C.SDLK_AUDIOSTOP K_AUDIOPLAY = C.SDLK_AUDIOPLAY K_AUDIOMUTE = C.SDLK_AUDIOMUTE K_MEDIASELECT = C.SDLK_MEDIASELECT K_WWW = C.SDLK_WWW K_MAIL = C.SDLK_MAIL K_CALCULATOR = C.SDLK_CALCULATOR K_COMPUTER = C.SDLK_COMPUTER K_AC_SEARCH = C.SDLK_AC_SEARCH K_AC_HOME = C.SDLK_AC_HOME K_AC_BACK = C.SDLK_AC_BACK K_AC_FORWARD = C.SDLK_AC_FORWARD K_AC_STOP = C.SDLK_AC_STOP K_AC_REFRESH = C.SDLK_AC_REFRESH K_AC_BOOKMARKS = C.SDLK_AC_BOOKMARKS K_BRIGHTNESSDOWN = C.SDLK_BRIGHTNESSDOWN K_BRIGHTNESSUP = C.SDLK_BRIGHTNESSUP K_DISPLAYSWITCH = C.SDLK_DISPLAYSWITCH K_KBDILLUMTOGGLE = C.SDLK_KBDILLUMTOGGLE K_KBDILLUMDOWN = C.SDLK_KBDILLUMDOWN K_KBDILLUMUP = C.SDLK_KBDILLUMUP K_EJECT = C.SDLK_EJECT K_SLEEP = C.SDLK_SLEEP )
const ( BUTTON_LEFT = C.SDL_BUTTON_LEFT BUTTON_MIDDLE = C.SDL_BUTTON_MIDDLE BUTTON_RIGHT = C.SDL_BUTTON_RIGHT BUTTON_X1 = C.SDL_BUTTON_X1 BUTTON_X2 = C.SDL_BUTTON_X2 BUTTON_LMASK = C.SDL_BUTTON_LMASK BUTTON_MMASK = C.SDL_BUTTON_MMASK BUTTON_RMASK = C.SDL_BUTTON_RMASK BUTTON_X1MASK = C.SDL_BUTTON_X1MASK BUTTON_X2MASK = C.SDL_BUTTON_X2MASK )
const ( ALPHA_OPAQUE = C.SDL_ALPHA_OPAQUE ALPHA_TRANSPARENT = C.SDL_ALPHA_TRANSPARENT )
Transparency definitions
These define alpha as the opacity of a surface.
const ( PIXELTYPE_UNKNOWN = C.SDL_PIXELTYPE_UNKNOWN PIXELTYPE_INDEX1 = C.SDL_PIXELTYPE_INDEX1 PIXELTYPE_INDEX4 = C.SDL_PIXELTYPE_INDEX4 PIXELTYPE_INDEX8 = C.SDL_PIXELTYPE_INDEX8 PIXELTYPE_PACKED8 = C.SDL_PIXELTYPE_PACKED8 PIXELTYPE_PACKED16 = C.SDL_PIXELTYPE_PACKED16 PIXELTYPE_PACKED32 = C.SDL_PIXELTYPE_PACKED32 PIXELTYPE_ARRAYU8 = C.SDL_PIXELTYPE_ARRAYU8 PIXELTYPE_ARRAYU16 = C.SDL_PIXELTYPE_ARRAYU16 PIXELTYPE_ARRAYU32 = C.SDL_PIXELTYPE_ARRAYU32 PIXELTYPE_ARRAYF16 = C.SDL_PIXELTYPE_ARRAYF16 PIXELTYPE_ARRAYF32 = C.SDL_PIXELTYPE_ARRAYF32 )
Pixel type.
const ( BITMAPORDER_NONE = C.SDL_BITMAPORDER_NONE BITMAPORDER_4321 = C.SDL_BITMAPORDER_4321 BITMAPORDER_1234 = C.SDL_BITMAPORDER_1234 )
Bitmap pixel order, high bit -> low bit.
const ( PACKEDORDER_NONE = C.SDL_PACKEDORDER_NONE PACKEDORDER_XRGB = C.SDL_PACKEDORDER_XRGB PACKEDORDER_RGBX = C.SDL_PACKEDORDER_RGBX PACKEDORDER_ARGB = C.SDL_PACKEDORDER_ARGB PACKEDORDER_RGBA = C.SDL_PACKEDORDER_RGBA PACKEDORDER_XBGR = C.SDL_PACKEDORDER_XBGR PACKEDORDER_BGRX = C.SDL_PACKEDORDER_BGRX PACKEDORDER_ABGR = C.SDL_PACKEDORDER_ABGR PACKEDORDER_BGRA = C.SDL_PACKEDORDER_BGRA )
Packed component order, high bit -> low bit.
const ( ARRAYORDER_NONE = C.SDL_ARRAYORDER_NONE ARRAYORDER_RGB = C.SDL_ARRAYORDER_RGB ARRAYORDER_RGBA = C.SDL_ARRAYORDER_RGBA ARRAYORDER_ARGB = C.SDL_ARRAYORDER_ARGB ARRAYORDER_BGR = C.SDL_ARRAYORDER_BGR ARRAYORDER_BGRA = C.SDL_ARRAYORDER_BGRA ARRAYORDER_ABGR = C.SDL_ARRAYORDER_ABGR )
Array component order, low byte -> high byte.
const ( PACKEDLAYOUT_NONE = C.SDL_PACKEDLAYOUT_NONE PACKEDLAYOUT_332 = C.SDL_PACKEDLAYOUT_332 PACKEDLAYOUT_4444 = C.SDL_PACKEDLAYOUT_4444 PACKEDLAYOUT_1555 = C.SDL_PACKEDLAYOUT_1555 PACKEDLAYOUT_5551 = C.SDL_PACKEDLAYOUT_5551 PACKEDLAYOUT_565 = C.SDL_PACKEDLAYOUT_565 PACKEDLAYOUT_8888 = C.SDL_PACKEDLAYOUT_8888 PACKEDLAYOUT_2101010 = C.SDL_PACKEDLAYOUT_2101010 PACKEDLAYOUT_1010102 = C.SDL_PACKEDLAYOUT_1010102 )
Packed component layout.
const ( PIXELFORMAT_UNKNOWN = C.SDL_PIXELFORMAT_UNKNOWN PIXELFORMAT_INDEX1LSB = C.SDL_PIXELFORMAT_INDEX1LSB PIXELFORMAT_INDEX1MSB = C.SDL_PIXELFORMAT_INDEX1MSB PIXELFORMAT_INDEX4LSB = C.SDL_PIXELFORMAT_INDEX4LSB PIXELFORMAT_INDEX4MSB = C.SDL_PIXELFORMAT_INDEX4MSB PIXELFORMAT_INDEX8 = C.SDL_PIXELFORMAT_INDEX8 PIXELFORMAT_RGB332 = C.SDL_PIXELFORMAT_RGB332 PIXELFORMAT_RGB444 = C.SDL_PIXELFORMAT_RGB444 PIXELFORMAT_RGB555 = C.SDL_PIXELFORMAT_RGB555 PIXELFORMAT_BGR555 = C.SDL_PIXELFORMAT_BGR555 PIXELFORMAT_ARGB4444 = C.SDL_PIXELFORMAT_ARGB4444 PIXELFORMAT_RGBA4444 = C.SDL_PIXELFORMAT_RGBA4444 PIXELFORMAT_ABGR4444 = C.SDL_PIXELFORMAT_ABGR4444 PIXELFORMAT_BGRA4444 = C.SDL_PIXELFORMAT_BGRA4444 PIXELFORMAT_ARGB1555 = C.SDL_PIXELFORMAT_ARGB1555 PIXELFORMAT_RGBA5551 = C.SDL_PIXELFORMAT_RGBA5551 PIXELFORMAT_ABGR1555 = C.SDL_PIXELFORMAT_ABGR1555 PIXELFORMAT_BGRA5551 = C.SDL_PIXELFORMAT_BGRA5551 PIXELFORMAT_RGB565 = C.SDL_PIXELFORMAT_RGB565 PIXELFORMAT_BGR565 = C.SDL_PIXELFORMAT_BGR565 PIXELFORMAT_RGB24 = C.SDL_PIXELFORMAT_RGB24 PIXELFORMAT_BGR24 = C.SDL_PIXELFORMAT_BGR24 PIXELFORMAT_RGB888 = C.SDL_PIXELFORMAT_RGB888 PIXELFORMAT_RGBX8888 = C.SDL_PIXELFORMAT_RGBX8888 PIXELFORMAT_BGR888 = C.SDL_PIXELFORMAT_BGR888 PIXELFORMAT_BGRX8888 = C.SDL_PIXELFORMAT_BGRX8888 PIXELFORMAT_ARGB8888 = C.SDL_PIXELFORMAT_ARGB8888 PIXELFORMAT_RGBA8888 = C.SDL_PIXELFORMAT_RGBA8888 PIXELFORMAT_ABGR8888 = C.SDL_PIXELFORMAT_ABGR8888 PIXELFORMAT_BGRA8888 = C.SDL_PIXELFORMAT_BGRA8888 PIXELFORMAT_ARGB2101010 = C.SDL_PIXELFORMAT_ARGB2101010 // Planar mode: Y + V + U (3 planes) PIXELFORMAT_YV12 = C.SDL_PIXELFORMAT_YV12 // Planar mode: Y + U + V (3 planes) PIXELFORMAT_IYUV = C.SDL_PIXELFORMAT_IYUV // Packed mode: Y0+U0+Y1+V0 (1 plane) PIXELFORMAT_YUY2 = C.SDL_PIXELFORMAT_YUY2 // Packed mode: U0+Y0+V0+Y1 (1 plane) PIXELFORMAT_UYVY = C.SDL_PIXELFORMAT_UYVY // Packed mode: Y0+V0+Y1+U0 (1 plane) PIXELFORMAT_YVYU = C.SDL_PIXELFORMAT_YVYU // Planar mode: Y + U/V interleaved (2 planes) PIXELFORMAT_NV12 = C.SDL_PIXELFORMAT_NV12 // Planar mode: Y + V/U interleaved (2 planes) PIXELFORMAT_NV21 = C.SDL_PIXELFORMAT_NV21 )
const ( RWOPS_UNKNOWN = C.SDL_RWOPS_UNKNOWN RWOPS_WINFILE = C.SDL_RWOPS_WINFILE RWOPS_STDFILE = C.SDL_RWOPS_STDFILE RWOPS_JNIFILE = C.SDL_RWOPS_JNIFILE RWOPS_MEMORY = C.SDL_RWOPS_MEMORY RWOPS_MEMORY_RO = C.SDL_RWOPS_MEMORY_RO // Seek from the beginning of data RW_SEEK_SET = C.RW_SEEK_SET // Seek relative to current read point RW_SEEK_CUR = C.RW_SEEK_CUR // Seek relative to the end of data RW_SEEK_END = C.RW_SEEK_END )
const ( NONSHAPEABLE_WINDOW = C.SDL_NONSHAPEABLE_WINDOW INVALID_SHAPE_ARGUMENT = C.SDL_INVALID_SHAPE_ARGUMENT WINDOW_LACKS_SHAPE = C.SDL_WINDOW_LACKS_SHAPE )
const ( // Just here for compatibility SWSURFACE = C.SDL_SWSURFACE // Surface uses preallocated memory PREALLOC = C.SDL_PREALLOC // Surface is RLE encoded RLEACCEL = C.SDL_RLEACCEL // Surface is referenced internally DONTFREE = C.SDL_DONTFREE )
Surface flags
These are the currently supported flags for the SDL_Surface.
const ( MAJOR_VERSION = C.SDL_MAJOR_VERSION MINOR_VERSION = C.SDL_MINOR_VERSION PATCHLEVEL = C.SDL_PATCHLEVEL // This is the version number macro for the current SDL version. // ↪ https://wiki.libsdl.org/SDL_COMPILEDVERSION COMPILEDVERSION = C.SDL_COMPILEDVERSION )
const ( // Used to indicate that you don't care what the window position is. WINDOWPOS_UNDEFINED_MASK = C.SDL_WINDOWPOS_UNDEFINED_MASK WINDOWPOS_UNDEFINED = C.SDL_WINDOWPOS_UNDEFINED // Used to indicate that the window position should be centered. WINDOWPOS_CENTERED_MASK = C.SDL_WINDOWPOS_CENTERED_MASK WINDOWPOS_CENTERED = C.SDL_WINDOWPOS_CENTERED )
const (
CACHELINE_SIZE = C.SDL_CACHELINE_SIZE
)
const (
MIX_MAXVOLUME = C.SDL_MIX_MAXVOLUME
)
const (
TOUCH_MOUSEID = C.SDL_TOUCH_MOUSEID
)
Variables ¶
This section is empty.
Functions ¶
func AddHintCallback ¶
func AddHintCallback(name string, callback HintCallback, userdata uintptr)
func BITSPERPIXEL ¶
func BYTESPERPIXEL ¶
func BlitScaled ¶
Like BlitSurface() but srcrect and dstrect need not be the same size. ↪ https://wiki.libsdl.org/SDL_BlitScaled
func BlitSurface ¶
Performs a fast blit from the source surface to the destination surface.
This assumes that the source and destination rectangles are the same size. If either srcrect or dstrect are NULL, the entire surface (src or dst) is copied. The final blit rectangles are saved in srcrect and dstrect after all clipping is performed.
Returns: If the blit is successful, it returns 0, otherwise it returns -1.
The blit function should not be called on a locked surface.
The blit semantics for surfaces with and without blending and colorkey are defined as follows:
RGBA->RGB: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source alpha-channel and per-surface alpha) SDL_SRCCOLORKEY ignored. Source surface blend mode set to SDL_BLENDMODE_NONE: copy RGB. if SDL_SRCCOLORKEY set, only copy the pixels matching the RGB values of the source color key, ignoring alpha in the comparison. RGB->RGBA: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source per-surface alpha) Source surface blend mode set to SDL_BLENDMODE_NONE: copy RGB, set destination alpha to source per-surface alpha value. both: if SDL_SRCCOLORKEY set, only copy the pixels matching the source color key. RGBA->RGBA: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source alpha-channel and per-surface alpha) SDL_SRCCOLORKEY ignored. Source surface blend mode set to SDL_BLENDMODE_NONE: copy all of RGBA to the destination. if SDL_SRCCOLORKEY set, only copy the pixels matching the RGB values of the source color key, ignoring alpha in the comparison. RGB->RGB: Source surface blend mode set to SDL_BLENDMODE_BLEND: alpha-blend (using the source per-surface alpha) Source surface blend mode set to SDL_BLENDMODE_NONE: copy RGB. both: if SDL_SRCCOLORKEY set, only copy the pixels matching the source color key.
You should call SDL_BlitSurface() unless you know exactly how SDL blitting works internally and how to use the other blit functions. ↪ https://wiki.libsdl.org/SDL_BlitSurface
func CalculateGammaRamp ¶
Calculate a 256 entry gamma ramp for a gamma value. ↪ https://wiki.libsdl.org/SDL_CalculateGammaRamp
func CaptureMouse ¶
Capture the mouse, to track input outside an SDL window.
enabled Whether or not to enable capturing
Capturing enables your app to obtain mouse events globally, instead of just within your window. Not all video targets support this function. When capturing is enabled, the current window will get all mouse events, but unlike relative mode, no change is made to the cursor and it is not restrained to your window.
This function may also deny mouse input to other windows--both those in your application and others on the system--so you should use this function sparingly, and in small bursts. For example, you might want to track the mouse while the user is dragging something, until the user releases a mouse button. It is not recommended that you capture the mouse for long periods of time, such as the entire time your app is running.
While captured, mouse events still report coordinates relative to the current (foreground) window, but those coordinates may be outside the bounds of the window (including negative values). Capturing is only allowed for the foreground window. If the window loses focus while capturing, the capture will be disabled automatically.
While capturing is enabled, the current window will have the SDL_WINDOW_MOUSE_CAPTURE flag set.
Returns: 0 on success, or -1 if not supported.
func ClearHints ¶
func ClearHints()
Clear all hints.
This function is called during SDL_Quit() to free stored hints. ↪ https://wiki.libsdl.org/SDL_ClearHints
func ClearQueuedAudio ¶
func ClearQueuedAudio(dev AudioDeviceID)
Drop any queued audio data waiting to be sent to the hardware.
Immediately after this call, SDL_GetQueuedAudioSize() will return 0 and the hardware will start playing silence if more audio isn't queued.
This will not prevent playback of queued audio that's already been sent to the hardware, as we can not undo that, so expect there to be some fraction of a second of audio that might still be heard. This can be useful if you want to, say, drop any pending music during a level change in your game.
You may not queue audio on a device that is using an application- supplied callback; calling this function on such a device is always a no-op. You have to use the audio callback or queue audio with SDL_QueueAudio(), but not both.
You should not call SDL_LockAudio() on the device before clearing the queue; SDL handles locking internally for this function.
This function always succeeds and thus returns void.
See also: SDL_QueueAudio
See also: SDL_GetQueuedAudioSize
dev The device ID of which to clear the audio queue.
func CloseAudio ¶
func CloseAudio()
This function shuts down audio processing and closes the audio device. ↪ https://wiki.libsdl.org/SDL_CloseAudio
func CloseAudioDevice ¶
func CloseAudioDevice(dev AudioDeviceID)
func ConvertAudio ¶
Once you have initialized the cvt structure using sdl.BuildAudioCVT(), and filled in cvt.Buf of audio data in the source format, this function will convert it to the desired format.
The data conversion may expand or shrink the size of the audio data in cvt.Buf.
func ConvertPixels ¶
func ConvertPixels(width int, height int, src_format uint32, src []byte, src_pitch int, dst_format uint32, dst []byte, dst_pitch int) (retval int)
Copy a block of pixels of one format to another format.
Returns: 0 on success, or -1 if there was an error
func CreateWindowAndRenderer ¶
func CreateWindowAndRenderer(width int, height int, window_flags uint32) (retval int, window *Window, renderer *Renderer)
Create a window and default renderer.
Returns: 0 on success, or -1 on error
width The width of the window height The height of the window window_flags The flags used to create the window window A pointer filled with the window, or NULL on error renderer A pointer filled with the renderer, or NULL on error
func DEFINE_PIXELFORMAT ¶
func DelHintCallback ¶
func DelHintCallback(name string, callback HintCallback, userdata uintptr)
Remove a function watching a particular hint.
name The hint being watched callback The function being called when the hint value changes userdata A pointer being passed to the callback function
func Delay ¶
func Delay(ms uint32)
Wait a specified number of milliseconds before returning. ↪ https://wiki.libsdl.org/SDL_Delay
func DisableScreenSaver ¶
func DisableScreenSaver()
Prevent the screen from being blanked by a screensaver.
See also: SDL_IsScreenSaverEnabled()
See also: SDL_EnableScreenSaver()
func EnableScreenSaver ¶
func EnableScreenSaver()
Allow the screen to be blanked by a screensaver.
See also: SDL_IsScreenSaverEnabled()
See also: SDL_DisableScreenSaver()
func EventState ¶
This function allows you to set the state of processing certain events.
- If state is set to SDL_IGNORE, that event will be automatically dropped from the event queue and will not event be filtered.
- If state is set to SDL_ENABLE, that event will be processed normally.
- If state is set to SDL_QUERY, SDL_EventState() will return the current processing state of the specified event.
func FlushEvent ¶
func FlushEvent(_type EventType)
This function clears events from the event queue This function only affects currently queued events. If you want to make sure that all pending OS events are flushed, you can call SDL_PumpEvents() on the main thread immediately before the flush call. ↪ https://wiki.libsdl.org/SDL_FlushEvent
func FlushEvents ¶
func GL_DeleteContext ¶
func GL_DeleteContext(context GLContext)
Delete an OpenGL context.
See also: SDL_GL_CreateContext()
func GL_ExtensionSupported ¶
Return true if an OpenGL extension is supported for the current context. ↪ https://wiki.libsdl.org/SDL_GL_ExtensionSupported
func GL_GetAttribute ¶
Get the actual value for an attribute from the current context. ↪ https://wiki.libsdl.org/SDL_GL_GetAttribute
func GL_GetProcAddress ¶
Get the address of an OpenGL function. ↪ https://wiki.libsdl.org/SDL_GL_GetProcAddress
func GL_GetSwapInterval ¶
func GL_GetSwapInterval() (retval int)
Get the swap interval for the current OpenGL context.
Returns: 0 if there is no vertical retrace synchronization, 1 if the buffer swap is synchronized with the vertical retrace, and -1 if late swaps happen immediately instead of waiting for the next retrace. If the system can't determine the swap interval, or there isn't a valid current context, this will return 0 as a safe default.
See also: SDL_GL_SetSwapInterval()
func GL_LoadLibrary ¶
Dynamically load an OpenGL library.
Returns: 0 on success, or -1 if the library couldn't be loaded.
path The platform dependent OpenGL library name, or NULL to open the default OpenGL library.
This should be done after initializing the video driver, but before creating any OpenGL windows. If no OpenGL library is loaded, the default library will be loaded upon creation of the first OpenGL window.
Note: If you do this, you need to retrieve all of the GL functions used in your program from the dynamic library using SDL_GL_GetProcAddress().
See also: SDL_GL_GetProcAddress()
See also: SDL_GL_UnloadLibrary()
func GL_ResetAttributes ¶
func GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values. ↪ https://wiki.libsdl.org/SDL_GL_ResetAttributes
func GL_SetAttribute ¶
Set an OpenGL window attribute before window creation. ↪ https://wiki.libsdl.org/SDL_GL_SetAttribute
func GL_SetSwapInterval ¶
Set the swap interval for the current OpenGL context.
Returns: 0 on success, or -1 if setting the swap interval is not supported.
See also: SDL_GL_GetSwapInterval()
interval 0 for immediate updates, 1 for updates synchronized with the vertical retrace. If the system supports it, you may specify -1 to allow late swaps to happen immediately instead of waiting for the next retrace.
func GL_UnloadLibrary ¶
func GL_UnloadLibrary()
Unload the OpenGL library previously loaded by SDL_GL_LoadLibrary().
See also: SDL_GL_LoadLibrary()
func GameControllerAddMapping ¶
Add or update an existing mapping configuration
Returns: 1 if mapping is added, 0 if updated, -1 on error
func GameControllerAddMappingsFromRW ¶
To count the number of game controllers in the system for the following: int nJoysticks = SDL_NumJoysticks(); int nGameControllers = 0; for ( int i = 0; i < nJoysticks; i++ ) { if ( SDL_IsGameController(i) ) { nGameControllers++; } }
Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: guid,name,mappings
Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. Under Windows there is a reserved GUID of "xinput" that covers any XInput devices. The mapping format for joystick is: bX - a joystick button, index X hX.Y - hat X with value Y aX - axis X of the joystick Buttons can be used as a controller axis and vice versa.
This string shows an example of a valid mapping for a controller "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y :b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4, dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick :b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger :b7", Load a set of mappings from a seekable SDL data stream (memory or file), filtered by the current SDL_GetPlatform() A community sourced database of controllers is available at https://raw.github.com /gabomdq/SDL_GameControllerDB/master/gamecontrollerdb.txt
If freerw is non-zero, the stream will be closed after being read.
Returns: number of mappings added, -1 on error
↪ https://wiki.libsdl.org/SDL_GameControllerAddMappingsFromRW
func GameControllerEventState ¶
Enable/disable controller event polling.
If controller events are disabled, you must call SDL_GameControllerUpdate() yourself and check the state of the controller when you want controller information.
The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. ↪ https://wiki.libsdl.org/SDL_GameControllerEventState
func GameControllerGetStringForAxis ¶
func GameControllerGetStringForAxis(axis GameControllerAxis) (retval string)
turn this axis enum into a string mapping ↪ https://wiki.libsdl.org/SDL_GameControllerGetStringForAxis
func GameControllerGetStringForButton ¶
func GameControllerGetStringForButton(button GameControllerButton) (retval string)
turn this button enum into a string mapping ↪ https://wiki.libsdl.org/SDL_GameControllerGetStringForButton
func GameControllerMappingForGUID ¶
func GameControllerMappingForGUID(guid JoystickGUID) (retval string)
Get a mapping string for a GUID
Returns: the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
func GameControllerNameForIndex ¶
Get the implementation dependent name of a game controller. This can be called before any controllers are opened. If no name can be found, this function returns NULL. ↪ https://wiki.libsdl.org/SDL_GameControllerNameForIndex
func GameControllerUpdate ¶
func GameControllerUpdate()
Update the current state of the open game controllers.
This is called automatically by the event loop if any game controller events are enabled. ↪ https://wiki.libsdl.org/SDL_GameControllerUpdate
func GetAudioDeviceName ¶
Get the human-readable name of a specific audio device. Must be a value between 0 and (number of audio devices-1). Only valid after a successfully initializing the audio subsystem. The values returned by this function reflect the latest call to SDL_GetNumAudioDevices(); recall that function to redetect available hardware.
The string returned by this function is UTF-8 encoded, read-only, and managed internally. You are not to free it. If you need to keep the string for any length of time, you should make your own copy of it, as it will be invalid next time any of several other SDL functions is called. ↪ https://wiki.libsdl.org/SDL_GetAudioDeviceName
func GetAudioDriver ¶
func GetBasePath ¶
func GetBasePath() (retval string)
Get the path where the application resides.
Get the "base path". This is the directory where the application was run from, which is probably the installation directory, and may or may not be the process's current working directory.
This returns an absolute path in UTF-8 encoding, and is guaranteed to end with a path separator ('\' on Windows, '/' most other places).
The pointer returned by this function is owned by you. Please call SDL_free() on the pointer when you are done with it, or it will be a memory leak. This is not necessarily a fast call, though, so you should call this once near startup and save the string if you need it.
Some platforms can't determine the application's path, and on other platforms, this might be meaningless. In such cases, this function will return NULL.
Returns: String of base dir in UTF-8 encoding, or NULL on error.
See also: SDL_GetPrefPath
func GetCPUCacheLineSize ¶
func GetCPUCacheLineSize() (retval int)
This function returns the L1 cache line size of the CPU
This is useful for determining multi-threaded structure padding or SIMD prefetch sizes. ↪ https://wiki.libsdl.org/SDL_GetCPUCacheLineSize
func GetCPUCount ¶
func GetCPUCount() (retval int)
This function returns the number of CPU cores available. ↪ https://wiki.libsdl.org/SDL_GetCPUCount
func GetClipboardText ¶
func GetClipboardText() (retval string)
Get UTF-8 text from the clipboard, which must be freed with SDL_free()
See also: SDL_SetClipboardText()
func GetClosestDisplayMode ¶
func GetClosestDisplayMode(displayIndex int, mode *DisplayMode) (retval *DisplayMode, closest *DisplayMode)
Get the closest match to the requested display mode.
Returns: The passed in value closest, or NULL if no matching video mode was available.
displayIndex The index of display from which mode should be queried. mode The desired display mode closest A pointer to a display mode to be filled in with the closest match of the available display modes.
The available display modes are scanned, and closest is filled in with the closest mode matching the requested mode and returned. The mode format and refresh_rate default to the desktop mode if they are 0. The modes are scanned with size being first priority, format being second priority, and finally checking the refresh_rate. If all the available modes are too small, then NULL is returned.
See also: SDL_GetNumDisplayModes()
See also: SDL_GetDisplayMode()
func GetCurrentAudioDriver ¶
func GetCurrentAudioDriver() (retval string)
This function returns the name of the current audio driver, or NULL if no driver has been initialized. ↪ https://wiki.libsdl.org/SDL_GetCurrentAudioDriver
func GetCurrentVideoDriver ¶
func GetCurrentVideoDriver() (retval string)
Returns the name of the currently initialized video driver.
Returns: The name of the current video driver or NULL if no driver has been initialized
See also: SDL_GetNumVideoDrivers()
See also: SDL_GetVideoDriver()
func GetDisplayDPI ¶
Get the dots/pixels-per-inch for a display.
Note: Diagonal, horizontal and vertical DPI can all be optionally returned if the parameter is non-NULL.
Returns: 0 on success, or -1 if no DPI information is available or the index is out of range.
See also: SDL_GetNumVideoDisplays()
func GetDisplayName ¶
Get the name of a display in UTF-8 encoding.
Returns: The name of a display, or NULL for an invalid display index.
See also: SDL_GetNumVideoDisplays()
func GetGlobalMouseState ¶
Get the current state of the mouse, in relation to the desktop.
This works just like SDL_GetMouseState(), but the coordinates will be reported relative to the top-left of the desktop. This can be useful if you need to track the mouse outside of a specific window and SDL_CaptureMouse() doesn't fit your needs. For example, it could be useful if you need to track the mouse while dragging a window, where coordinates relative to a window might not be in sync at all times.
Note: SDL_GetMouseState() returns the mouse position as SDL understands it from the last pump of the event queue. This function, however, queries the OS for the current mouse position, and as such, might be a slightly less efficient function. Unless you know what you're doing and have a good reason to use this function, you probably want SDL_GetMouseState() instead.
Returns: The current button state as a bitmask, which can be tested using the SDL_BUTTON(X) macros.
See also: SDL_GetMouseState
x Returns the current X coord, relative to the desktop. Can be NULL. y Returns the current Y coord, relative to the desktop. Can be NULL.
func GetKeyName ¶
Get a human-readable name for a key.
Returns: A pointer to a UTF-8 string that stays valid at least until the next call to this function. If you need it around any longer, you must copy it. If the key doesn't have a name, this function returns an empty string ("").
See also: SDL_Key
func GetKeyboardState ¶
func GetKeyboardState() []byte
Get a snapshot of the current state of the keyboard.
Returns: An array of key states. Indexes into this array are obtained by using SDL_Scancode values. The pointer returned is a pointer to an internal SDL array. It will be valid for the whole lifetime of the application.
Example:
state := SDL_GetKeyboardState(); if state[sdl.SCANCODE_RETURN] != 0 { fmt.Printf("<RETURN> is pressed.\n"); }
func GetMouseState ¶
Retrieve the current state of the mouse.
The current button state is returned as a button bitmask, which can be tested using the SDL_BUTTON(X) macros, and x and y are set to the mouse cursor position relative to the focus window for the currently selected mouse. You can pass NULL for either x or y. ↪ https://wiki.libsdl.org/SDL_GetMouseState
func GetNumAudioDevices ¶
Get the number of available devices exposed by the current driver. Only valid after a successfully initializing the audio subsystem. Returns -1 if an explicit list of devices can't be determined; this is not an error. For example, if SDL is set up to talk to a remote audio server, it can't list every one available on the Internet, but it will still allow a specific host to be specified to SDL_OpenAudioDevice().
In many common cases, when this function returns a value <= 0, it can still successfully open the default device (NULL for first argument of SDL_OpenAudioDevice()). ↪ https://wiki.libsdl.org/SDL_GetNumAudioDevices
func GetNumAudioDrivers ¶
func GetNumAudioDrivers() (retval int)
func GetNumDisplayModes ¶
Returns the number of available display modes.
See also: SDL_GetDisplayMode()
func GetNumRenderDrivers ¶
func GetNumRenderDrivers() (retval int)
Get the number of 2D rendering drivers available for the current display.
A render driver is a set of code that handles rendering and texture management on a particular display. Normally there is only one, but some drivers may have several available with different capabilities.
See also: SDL_GetRenderDriverInfo()
See also: SDL_CreateRenderer()
func GetNumTouchDevices ¶
func GetNumTouchDevices() (retval int)
Get the number of registered touch devices. ↪ https://wiki.libsdl.org/SDL_GetNumTouchDevices
func GetNumTouchFingers ¶
Get the number of active fingers for a given touch device. ↪ https://wiki.libsdl.org/SDL_GetNumTouchFingers
func GetNumVideoDisplays ¶
func GetNumVideoDisplays() (retval int)
Returns the number of available video displays.
See also: SDL_GetDisplayBounds()
func GetNumVideoDrivers ¶
func GetNumVideoDrivers() (retval int)
Get the number of video drivers compiled into SDL.
See also: SDL_GetVideoDriver()
func GetPerformanceCounter ¶
func GetPerformanceCounter() (retval uint64)
Get the current value of the high resolution counter. ↪ https://wiki.libsdl.org/SDL_GetPerformanceCounter
func GetPerformanceFrequency ¶
func GetPerformanceFrequency() (retval uint64)
Get the count per second of the high resolution counter. ↪ https://wiki.libsdl.org/SDL_GetPerformanceFrequency
func GetPixelFormatName ¶
Get the human readable name of a pixel format. ↪ https://wiki.libsdl.org/SDL_GetPixelFormatName
func GetPrefPath ¶
Get the user-and-app-specific path where files can be written.
Get the "pref dir". This is meant to be where users can write personal files (preferences and save games, etc) that are specific to your application. This directory is unique per user, per application.
This function will decide the appropriate location in the native filesystem, create the directory if necessary, and return a string of the absolute path to the directory in UTF-8 encoding.
On Windows, the string might look like: "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name\\"
On Linux, the string might look like: "/home/bob/.local/share/My Program Name/"
On Mac OS X, the string might look like: "/Users/bob/Library/Application Support/My Program Name/"
(etc.)
You specify the name of your organization (if it's not a real organization, your name or an Internet domain you own might do) and the name of your application. These should be untranslated proper names.
Both the org and app strings may become part of a directory name, so please follow these rules:
- Try to use the same org string (including case-sensitivity) for all your applications that use this function.
- Always use a unique app string for each one, and make sure it never changes for an app once you've decided on it.
- Unicode characters are legal, as long as it's UTF-8 encoded, but...
- ...only use letters, numbers, and spaces. Avoid punctuation like "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
This returns an absolute path in UTF-8 encoding, and is guaranteed to end with a path separator ('\' on Windows, '/' most other places).
The pointer returned by this function is owned by you. Please call SDL_free() on the pointer when you are done with it, or it will be a memory leak. This is not necessarily a fast call, though, so you should call this once near startup and save the string if you need it.
You should assume the path returned by this function is the only safe place to write files (and that SDL_GetBasePath(), while it might be writable, or even the parent of the returned path, aren't where you should be writing things).
Some platforms can't determine the pref path, and on other platforms, this might be meaningless. In such cases, this function will return NULL.
Returns: UTF-8 string of user dir in platform-dependent notation. NULL if there's a problem (creating directory failed, etc).
See also: SDL_GetBasePath
org The name of your organization. app The name of your application.
func GetQueuedAudioSize ¶
func GetQueuedAudioSize(dev AudioDeviceID) (retval uint32)
Get the number of bytes of still-queued audio.
This is the number of bytes that have been queued for playback with SDL_QueueAudio(), but have not yet been sent to the hardware.
Once we've sent it to the hardware, this function can not decide the exact byte boundary of what has been played. It's possible that we just gave the hardware several kilobytes right before you called this function, but it hasn't played any of it yet, or maybe half of it, etc.
You may not queue audio on a device that is using an application- supplied callback; calling this function on such a device always returns 0. You have to use the audio callback or queue audio with SDL_QueueAudio(), but not both.
You should not call SDL_LockAudio() on the device before querying; SDL handles locking internally for this function.
Returns: Number of bytes (not samples!) of queued audio.
See also: SDL_QueueAudio
See also: SDL_ClearQueuedAudio
dev The device ID of which we will query queued audio size.
func GetRelativeMouseMode ¶
func GetRelativeMouseMode() (retval bool)
Query whether relative mouse mode is enabled.
See also: SDL_SetRelativeMouseMode()
func GetRelativeMouseState ¶
Retrieve the relative state of the mouse.
The current button state is returned as a button bitmask, which can be tested using the SDL_BUTTON(X) macros, and x and y are set to the mouse deltas since the last call to SDL_GetRelativeMouseState(). ↪ https://wiki.libsdl.org/SDL_GetRelativeMouseState
func GetRevision ¶
func GetRevision() (retval string)
Get the code revision of SDL that is linked against your program.
Returns an arbitrary string (a hash value) uniquely identifying the exact revision of the SDL library in use, and is only useful in comparing against other revisions. It is NOT an incrementing number. ↪ https://wiki.libsdl.org/SDL_GetRevision
func GetRevisionNumber ¶
func GetRevisionNumber() (retval int)
Get the revision number of SDL that is linked against your program.
Returns a number uniquely identifying the exact revision of the SDL library in use. It is an incrementing number based on commits to hg.libsdl.org. ↪ https://wiki.libsdl.org/SDL_GetRevisionNumber
func GetScancodeName ¶
Get a human-readable name for a scancode.
Returns: A pointer to the name for the scancode. If the scancode doesn't have a name, this function returns an empty string ("").
See also: SDL_Scancode
func GetSystemRAM ¶
func GetSystemRAM() (retval int)
This function returns the amount of RAM configured in the system, in MB. ↪ https://wiki.libsdl.org/SDL_GetSystemRAM
func GetTicks ¶
func GetTicks() (retval uint32)
Get the number of milliseconds since the SDL library initialization.
Note: This value wraps if the program runs for more than ~49 days.
func GetVideoDriver ¶
Get the name of a built in video driver.
Note: The video drivers are presented in the order in which they are normally checked during initialization.
See also: SDL_GetNumVideoDrivers()
func HapticName ¶
Get the implementation dependent name of a Haptic device.
This can be called before any joysticks are opened. If no name can be found, this function returns NULL.
Returns: Name of the device or NULL on error.
See also: SDL_NumHaptics
device_index Index of the device to get its name.
func HapticOpened ¶
Checks if the haptic device at index has been opened.
Returns: 1 if it has been opened or 0 if it hasn't.
See also: SDL_HapticOpen
See also: SDL_HapticIndex
device_index Index to check to see if it has been opened.
func Has3DNow ¶
func Has3DNow() (retval bool)
This function returns true if the CPU has 3DNow! features. ↪ https://wiki.libsdl.org/SDL_Has3DNow
func HasAVX ¶
func HasAVX() (retval bool)
This function returns true if the CPU has AVX features. ↪ https://wiki.libsdl.org/SDL_HasAVX
func HasAVX2 ¶
func HasAVX2() (retval bool)
This function returns true if the CPU has AVX2 features. ↪ https://wiki.libsdl.org/SDL_HasAVX2
func HasAltiVec ¶
func HasAltiVec() (retval bool)
This function returns true if the CPU has AltiVec features. ↪ https://wiki.libsdl.org/SDL_HasAltiVec
func HasClipboardText ¶
func HasClipboardText() (retval bool)
Returns a flag indicating whether the clipboard exists and contains a text string that is non-empty.
See also: SDL_GetClipboardText()
func HasEvent ¶
Checks to see if certain event types are in the event queue. ↪ https://wiki.libsdl.org/SDL_HasEvent
func HasIntersection ¶
Determine whether two rectangles intersect.
Returns: SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
func HasMMX ¶
func HasMMX() (retval bool)
This function returns true if the CPU has MMX features. ↪ https://wiki.libsdl.org/SDL_HasMMX
func HasRDTSC ¶
func HasRDTSC() (retval bool)
This function returns true if the CPU has the RDTSC instruction. ↪ https://wiki.libsdl.org/SDL_HasRDTSC
func HasSSE ¶
func HasSSE() (retval bool)
This function returns true if the CPU has SSE features. ↪ https://wiki.libsdl.org/SDL_HasSSE
func HasSSE2 ¶
func HasSSE2() (retval bool)
This function returns true if the CPU has SSE2 features. ↪ https://wiki.libsdl.org/SDL_HasSSE2
func HasSSE3 ¶
func HasSSE3() (retval bool)
This function returns true if the CPU has SSE3 features. ↪ https://wiki.libsdl.org/SDL_HasSSE3
func HasSSE41 ¶
func HasSSE41() (retval bool)
This function returns true if the CPU has SSE4.1 features. ↪ https://wiki.libsdl.org/SDL_HasSSE41
func HasSSE42 ¶
func HasSSE42() (retval bool)
This function returns true if the CPU has SSE4.2 features. ↪ https://wiki.libsdl.org/SDL_HasSSE42
func HasScreenKeyboardSupport ¶
func HasScreenKeyboardSupport() (retval bool)
Returns whether the platform has some screen keyboard support.
Returns: SDL_TRUE if some keyboard support is available else SDL_FALSE.
Note: Not all screen keyboard functions are supported on all platforms.
See also: SDL_IsScreenKeyboardShown()
func ISPIXELFORMAT_ALPHA ¶
func ISPIXELFORMAT_ARRAY ¶
func ISPIXELFORMAT_FOURCC ¶
The flag is set to 1 because 0x1? is not in the printable ASCII range
func ISPIXELFORMAT_INDEXED ¶
func ISPIXELFORMAT_PACKED ¶
func Init ¶
This function initializes the subsystems specified by flags ↪ https://wiki.libsdl.org/SDL_Init
func InitSubSystem ¶
This function initializes specific SDL subsystems
Subsystem initialization is ref-counted, you must call SDL_QuitSubSystem for each SDL_InitSubSystem to correctly shutdown a subsystem manually (or call SDL_Quit to force shutdown). If a subsystem is already loaded then this call will increase the ref-count and return. ↪ https://wiki.libsdl.org/SDL_InitSubSystem
func IntersectRectAndLine ¶
func IntersectRectAndLine(rect Rect, lineX1 int, lineY1 int, lineX2 int, lineY2 int) (retval bool, X1 int, Y1 int, X2 int, Y2 int)
Calculate the intersection of a rectangle and line segment.
Returns: SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
func IsGameController ¶
Is the joystick on this index supported by the game controller interface? ↪ https://wiki.libsdl.org/SDL_IsGameController
func IsScreenSaverEnabled ¶
func IsScreenSaverEnabled() (retval bool)
Returns whether the screensaver is currently enabled (default on).
See also: SDL_EnableScreenSaver()
See also: SDL_DisableScreenSaver()
func IsTextInputActive ¶
func IsTextInputActive() (retval bool)
Return whether or not Unicode text input events are enabled.
See also: SDL_StartTextInput()
See also: SDL_StopTextInput()
func JoystickEventState ¶
Enable/disable joystick event polling.
If joystick events are disabled, you must call SDL_JoystickUpdate() yourself and check the state of the joystick when you want joystick information.
The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. ↪ https://wiki.libsdl.org/SDL_JoystickEventState
func JoystickNameForIndex ¶
Get the implementation dependent name of a joystick. This can be called before any joysticks are opened. If no name can be found, this function returns NULL. ↪ https://wiki.libsdl.org/SDL_JoystickNameForIndex
func JoystickUpdate ¶
func JoystickUpdate()
Update the current state of the open joysticks.
This is called automatically by the event loop if any joystick events are enabled. ↪ https://wiki.libsdl.org/SDL_JoystickUpdate
func LoadDollarTemplates ¶
Load Dollar Gesture templates from a file. ↪ https://wiki.libsdl.org/SDL_LoadDollarTemplates
func LockAudioDevice ¶
func LockAudioDevice(dev AudioDeviceID)
func LowerBlit ¶
This is a semi-private blit function and it performs low-level surface blitting only. ↪ https://wiki.libsdl.org/SDL_LowerBlit
func LowerBlitScaled ¶
This is a semi-private blit function and it performs low-level surface scaled blitting only. ↪ https://wiki.libsdl.org/SDL_LowerBlitScaled
func MasksToPixelFormatEnum ¶
func MasksToPixelFormatEnum(bpp int, Rmask uint32, Gmask uint32, Bmask uint32, Amask uint32) (retval uint32)
Convert a bpp and RGBA masks to an enumerated pixel format.
Returns: The pixel format, or SDL_PIXELFORMAT_UNKNOWN if the conversion wasn't possible.
See also: SDL_PixelFormatEnumToMasks()
func MixAudio ¶
This takes two audio buffers of the playing audio format and mixes them, performing addition, volume adjustment, and overflow clipping. The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME for full audio volume. Note this does not change hardware volume. This is provided for convenience -- you can mix your own audio data. ↪ https://wiki.libsdl.org/SDL_MixAudio
func MixAudioFormat ¶
func MixAudioFormat(dst []byte, src []byte, format AudioFormat, volume int)
This works like SDL_MixAudio(), but you specify the audio format instead of using the format of audio device 1. Thus it can be used when no audio device is open at all. ↪ https://wiki.libsdl.org/SDL_MixAudioFormat
func MouseIsHaptic ¶
func MouseIsHaptic() (retval int)
Gets whether or not the current mouse has haptic capabilities.
Returns: SDL_TRUE if the mouse is haptic, SDL_FALSE if it isn't.
See also: SDL_HapticOpenFromMouse
func NumHaptics ¶
func NumHaptics() (retval int)
Count the number of haptic devices attached to the system.
Returns: Number of haptic devices detected on the system.
func NumJoysticks ¶
func NumJoysticks() (retval int)
Count the number of joysticks attached to the system right now ↪ https://wiki.libsdl.org/SDL_NumJoysticks
func OpenAudio ¶
This function opens the audio device with the desired parameters, and returns 0 if successful, placing the actual hardware parameters in the structure pointed to by obtained. If obtained is NULL, the audio data passed to the callback function will be guaranteed to be in the requested format, and will be automatically converted to the hardware audio format if necessary. This function returns -1 if it failed to open the audio device, or couldn't set up the audio thread.
When filling in the desired audio spec structure,
- desired->freq should be the desired audio frequency in samples-per- second.
- desired->format should be the desired audio format.
- desired->samples is the desired size of the audio buffer, in samples. This number should be a power of two, and may be adjusted by the audio driver to a value more suitable for the hardware. Good values seem to range between 512 and 8096 inclusive, depending on the application and CPU speed. Smaller values yield faster response time, but can lead to underflow if the application is doing heavy processing and cannot fill the audio buffer in time. A stereo sample consists of both right and left channels in LR ordering. Note that the number of samples is directly related to time by the following formula:ms=(samples*1000)/freq
- desired->size is the size in bytes of the audio buffer, and is calculated by SDL_OpenAudio().
- desired->silence is the value used to set the buffer to silence, and is calculated by SDL_OpenAudio().
- desired->callback should be set to a function that will be called when the audio device is ready for more data. It is passed a pointer to the audio buffer, and the length in bytes of the audio buffer. This function usually runs in a separate thread, and so you should protect data structures that it accesses by calling SDL_LockAudio() and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL pointer here, and call SDL_QueueAudio() with some frequency, to queue more audio samples to be played.
- desired->userdata is passed as the first parameter to your callback function. If you passed a NULL callback, this value is ignored.
The audio device starts out playing silence when it's opened, and should be enabled for playing by calling SDL_PauseAudio(0) when you are ready for your audio callback function to be called. Since the audio driver may modify the requested size of the audio buffer, you should allocate any local mixing buffers after you open the audio device. ↪ https://wiki.libsdl.org/SDL_OpenAudio
func PIXELLAYOUT ¶
func PIXELORDER ¶
func PauseAudioDevice ¶
func PauseAudioDevice(dev AudioDeviceID, pause_on int)
func PeepEvents ¶
func PeepEvents(events []Event, numevents int, action Eventaction, minType uint32, maxType uint32) int
Checks the event queue for messages and optionally returns them.
If action is SDL_ADDEVENT, up to numevents events will be added to the back of the event queue. numevents > len(events) is not an error, but only up to len(events) will be added, of course.
If action is SDL_PEEKEVENT, up to numevents events at the front of the event queue, with minType <= type <= maxType, will be copied to events and will not be removed from the queue. numevents > len(events) is not an error, but only up to len(events) will be copied.
If action is SDL_GETEVENT, up to numevents events at the front of the event queue, with minType <= type <= maxType, will be copied to events and will be removed from the queue. numevents > len(events) is not an error, but only up to len(events) will be copied.
Returns: The number of events actually stored, or -1 if there was an error.
This function is thread-safe.
func PixelFormatEnumToMasks ¶
func PixelFormatEnumToMasks(format uint32) (retval bool, bpp int, Rmask uint32, Gmask uint32, Bmask uint32, Amask uint32)
Convert one of the enumerated pixel formats to a bpp and RGBA masks.
Returns: SDL_TRUE, or SDL_FALSE if the conversion wasn't possible.
See also: SDL_MasksToPixelFormatEnum()
func PointInRect ¶
Returns true if point resides inside a rectangle. ↪ https://wiki.libsdl.org/SDL_PointInRect
func PollEvent ¶
Polls for currently pending events.
Returns: 1 if there are any pending events, or 0 if there are none available.
event If not NULL, the next event is removed from the queue and stored in that area.
func PumpEvents ¶
func PumpEvents()
Pumps the event loop, gathering events from the input devices.
This function updates the event queue and internal input device state.
This should only be run in the thread that sets the video mode. ↪ https://wiki.libsdl.org/SDL_PumpEvents
func QueueAudio ¶
func QueueAudio(dev AudioDeviceID, data []byte) (retval int)
Queue more audio on non-callback devices.
SDL offers two ways to feed audio to the device: you can either supply a callback that SDL triggers with some frequency to obtain more audio (pull method), or you can supply no callback, and then SDL will expect you to supply data at regular intervals (push method) with this function.
There are no limits on the amount of data you can queue, short of exhaustion of address space. Queued data will drain to the device as necessary without further intervention from you. If the device needs audio but there is not enough queued, it will play silence to make up the difference. This means you will have skips in your audio playback if you aren't routinely queueing sufficient data.
This function copies the supplied data, so you are safe to free it when the function returns. This function is thread-safe, but queueing to the same device from two threads at once does not promise which buffer will be queued first.
You may not queue audio on a device that is using an application- supplied callback; doing so returns an error. You have to use the audio callback or queue audio with this function, but not both.
You should not call SDL_LockAudio() on the device before queueing; SDL handles locking internally for this function.
Returns: zero on success, -1 on error.
See also: SDL_GetQueuedAudioSize
See also: SDL_ClearQueuedAudio
dev The device ID to which we will queue audio. data The data to queue to the device for later playback. len The number of bytes (not samples!) to which (data) points.
func Quit ¶
func Quit()
This function cleans up all initialized subsystems. You should call it upon all exit conditions. ↪ https://wiki.libsdl.org/SDL_Quit
func QuitSubSystem ¶
func QuitSubSystem(flags uint32)
This function cleans up specific SDL subsystems ↪ https://wiki.libsdl.org/SDL_QuitSubSystem
func RecordGesture ¶
Begin Recording a gesture on the specified touch, or all touches (-1) ↪ https://wiki.libsdl.org/SDL_RecordGesture
func RectEmpty ¶
Returns true if the rectangle has no area. ↪ https://wiki.libsdl.org/SDL_RectEmpty
func RectEquals ¶
Returns true if the two rectangles are equal. ↪ https://wiki.libsdl.org/SDL_RectEquals
func RegisterEvents ¶
This function allocates a set of user-defined events, and returns the beginning event number for that set of events.
If there aren't enough user-defined events left, this function returns (Uint32)-1 ↪ https://wiki.libsdl.org/SDL_RegisterEvents
func RemoveTimer ¶
Remove a timer knowing its ID.
Returns: A boolean value indicating success or failure.
Warning: It is not safe to remove a timer multiple times.
func SaveAllDollarTemplates ¶
Save all currently loaded Dollar Gesture templates. ↪ https://wiki.libsdl.org/SDL_SaveAllDollarTemplates
func SaveBMP_RW ¶
Save a surface to a seekable SDL data stream (memory or file).
If freedst is non-zero, the stream will be closed after being written.
Returns: 0 if successful or -1 if there was an error.
func SaveDollarTemplate ¶
Save a currently loaded Dollar Gesture template. ↪ https://wiki.libsdl.org/SDL_SaveDollarTemplate
func SetCursor ¶
func SetCursor(cursor *Cursor)
Set the active cursor. ↪ https://wiki.libsdl.org/SDL_SetCursor
func SetError ¶
SDL_SetError supports extra parameters. At present these are not supported. If you have a use case, file an issue. ↪ https://wiki.libsdl.org/SDL_SetError
func SetHint ¶
Set a hint with normal priority.
Returns: SDL_TRUE if the hint was set, SDL_FALSE otherwise
func SetHintWithPriority ¶
func SetHintWithPriority(name string, value string, priority HintPriority) (retval bool)
Set a hint with a specific priority.
The priority controls the behavior when setting a hint that already has a value. Hints will replace existing hints of their priority and lower. Environment variables are considered to have override priority.
Returns: SDL_TRUE if the hint was set, SDL_FALSE otherwise
func SetModState ¶
func SetModState(modstate Keymod)
Set the current key modifier state for the keyboard.
Note: This does not change the keyboard state, only the key modifier flags.
func SetRelativeMouseMode ¶
Set relative mouse mode.
Returns: 0 on success, or -1 if relative mode is not supported.
enabled Whether or not to enable relative mode
While the mouse is in relative mode, the cursor is hidden, and the driver will try to report continuous motion in the current window. Only relative motion events will be delivered, the mouse position will not change.
Note: This function will flush any pending mouse motion.
See also: SDL_GetRelativeMouseMode()
func SetTextInputRect ¶
func SetTextInputRect(rect Rect)
Set the rectangle used to type Unicode text inputs. This is used as a hint for IME and on-screen keyboard placement.
See also: SDL_StartTextInput()
func ShowCursor ¶
Toggle whether or not the cursor is shown.
Returns: 1 if the cursor is shown, or 0 if the cursor is hidden.
toggle 1 to show the cursor, 0 to hide it, -1 to query the current state.
func ShowMessageBox ¶
func ShowMessageBox(messageboxdata *MessageBoxData) (retval int, buttonid int)
Create a modal message box.
Returns: -1 on error, otherwise 0 and buttonid contains user id of button hit or -1 if dialog was closed.
Note: This function should be called on the thread that created the parent window, or on the main thread if the messagebox has no parent. It will block execution of that thread until the user clicks a button or closes the messagebox.
messageboxdata The SDL_MessageBoxData structure with title, text, etc. buttonid The pointer to which user id of hit button should be copied.
func ShowSimpleMessageBox ¶
Create a simple modal message box.
Returns: 0 on success, -1 on error
See also: SDL_ShowMessageBox
flags SDL_MessageBoxFlags title UTF-8 title text message UTF-8 message text window The parent window, or NULL for no parent
func SoftStretch ¶
Perform a fast, low quality, stretch blit between two surfaces of the same pixel format.
Note: This function uses a static buffer, and is not thread-safe.
func StartTextInput ¶
func StartTextInput()
Start accepting Unicode text input events. This function will show the on-screen keyboard if supported.
See also: SDL_StopTextInput()
See also: SDL_SetTextInputRect()
See also: SDL_HasScreenKeyboardSupport()
func StopTextInput ¶
func StopTextInput()
Stop receiving any text input events. This function will hide the on- screen keyboard if supported.
See also: SDL_StartTextInput()
See also: SDL_HasScreenKeyboardSupport()
func UnlockAudioDevice ¶
func UnlockAudioDevice(dev AudioDeviceID)
func UpperBlit ¶
This is the public blit function, SDL_BlitSurface(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlit() ↪ https://wiki.libsdl.org/SDL_UpperBlit
func UpperBlitScaled ¶
This is the public scaled blit function, SDL_BlitScaled(), and it performs rectangle validation and clipping before passing it to SDL_LowerBlitScaled() ↪ https://wiki.libsdl.org/SDL_UpperBlitScaled
func VideoInit ¶
Initialize the video subsystem, optionally specifying a video driver.
Returns: 0 on success, -1 on error
driver_name Initialize a specific driver by name, or NULL for the default video driver.
This function initializes the video subsystem; setting up a connection to the window manager, etc, and determines the available display modes and pixel formats, but does not initialize a window or graphics mode.
See also: SDL_VideoQuit()
func VideoQuit ¶
func VideoQuit()
Shuts down the video subsystem.
This function closes all windows, and restores the original video mode.
See also: SDL_VideoInit()
func WarpMouseGlobal ¶
Moves the mouse to the given position in global screen space.
Returns: 0 on success, -1 on error (usually: unsupported by a platform).
Note: This function generates a mouse motion event
x The x coordinate y The y coordinate
func WarpMouseInWindow ¶
Moves the mouse to the given position within the window.
Note: This function generates a mouse motion event
window The window to move the mouse into, or NULL for the current mouse focus x The x coordinate within the window y The y coordinate within the window
func WasInit ¶
This function returns a mask of the specified subsystems which have previously been initialized.
If flags is 0, it returns a mask of all initialized subsystems. ↪ https://wiki.libsdl.org/SDL_WasInit
Types ¶
type AudioCVT ¶
type AudioCVT struct { // Set to 1 if conversion possible Needed int // Source audio format Src_format AudioFormat // Target audio format Dst_format AudioFormat // Rate conversion increment (dst_rate/src_rate) Rate_incr float64 // Buffer to hold entire audio data Buf []byte // contains filtered or unexported fields }
A structure to hold a set of audio conversion filters and buffers. ↪ https://wiki.libsdl.org/SDL_AudioCVT
func BuildAudioCVT ¶
func BuildAudioCVT(src_format AudioFormat, src_channels uint8, src_rate int, dst_format AudioFormat, dst_channels uint8, dst_rate int) (retval int, cvt *AudioCVT)
This function takes a source format and rate and a destination format and rate, and initializes the cvt structure with information needed by SDL_ConvertAudio() to convert a buffer of audio data from one format to the other.
Returns: -1 if the format conversion is not supported, 0 if there's no conversion needed, or 1 if the audio filter is set up.
type AudioCallback ¶
type AudioCallback C.SDL_AudioCallback
This function is called when the audio device needs more data.
userdata An application-specific parameter saved in the SDL_AudioSpec structure stream A pointer to the audio data buffer. len The length of that buffer in bytes.
Once the callback returns, the buffer will no longer be valid. Stereo samples are stored in a LRLRLR ordering.
You can choose to avoid callbacks and use SDL_QueueAudio() instead, if you like. Just open your audio device with a NULL callback.
type AudioDeviceEvent ¶
type AudioDeviceEvent struct { // SDL_AUDIODEVICEADDED, or SDL_AUDIODEVICEREMOVED Type EventType Timestamp uint32 // The audio device index for the ADDED event (valid until next // SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED // event Which uint32 // zero if an output device, non-zero if a capture device. Iscapture uint8 Padding1 uint8 Padding2 uint8 Padding3 uint8 }
Audio device event structure (event.adevice.*) ↪ https://wiki.libsdl.org/SDL_AudioDeviceEvent
type AudioDeviceID ¶
type AudioDeviceID uint32
SDL Audio Device IDs.
A successful call to SDL_OpenAudio() is always device id 1, and legacy SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls always returns devices >= 2 on success. The legacy calls are good both for backwards compatibility and when you don't care about multiple, specific, or capture devices.
func OpenAudioDevice ¶
func OpenAudioDevice(device string, iscapture int, desired *AudioSpec, obtained *AudioSpec, allowed_changes int) (retval AudioDeviceID)
Open a specific audio device. Passing in a device name of NULL requests the most reasonable default (and is equivalent to calling SDL_OpenAudio()).
The device name is a UTF-8 string reported by SDL_GetAudioDeviceName(), but some drivers allow arbitrary and driver- specific strings, such as a hostname/IP address for a remote audio server, or a filename in the diskaudio driver.
Returns: 0 on error, a valid device ID that is >= 2 on success.
SDL_OpenAudio(), unlike this function, always acts on device ID 1. ↪ https://wiki.libsdl.org/SDL_OpenAudioDevice
type AudioFilter ¶
type AudioFilter C.SDL_AudioFilter
type AudioFormat ¶
type AudioFormat uint16
Audio format flags.
These are what the 16 bits in SDL_AudioFormat currently mean... (Unspecified bits are always zero).
++-----------------------sample is signed if set || || ++-----------sample is bigendian if set || || || || ++---sample is float if set || || || || || || +---sample bit size---+ || || || | | 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
There are macros in SDL 2.0 and later to query these bits.
type AudioSpec ¶
type AudioSpec struct { // DSP frequency -- samples per second Freq int // Audio data format Format AudioFormat // Number of channels: 1 mono, 2 stereo Channels uint8 // Audio buffer silence value (calculated) Silence uint8 // Audio buffer size in samples (power of 2) Samples uint16 // Necessary for some compile environments Padding uint16 // Audio buffer size in bytes (calculated) Size uint32 // Callback that feeds the audio device (NULL to use SDL_QueueAudio()). Callback AudioCallback // Userdata passed to callback (ignored for NULL callbacks). Userdata uintptr }
The calculated values in this structure are calculated by SDL_OpenAudio(). ↪ https://wiki.libsdl.org/SDL_AudioSpec
func LoadWAV_RW ¶
This function loads a WAVE from the data source, automatically freeing that source if freesrc is non-zero. For example, to load a WAVE file, you could do:
SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
If this function succeeds, it returns an SDL_AudioSpec, filled with the audio data format of the wave data, and sets audio_buf to a buffer containing the audio data
This function returns NULL and sets the SDL error message if the wave file cannot be opened, uses an unknown data format, or is corrupt. Currently raw and MS-ADPCM WAVE files are supported.
type AudioStatus ¶
type AudioStatus int
Audio state
Get the current audio state. ↪ https://wiki.libsdl.org/SDL_AudioStatus
const ( AUDIO_STOPPED AudioStatus = C.SDL_AUDIO_STOPPED AUDIO_PLAYING AudioStatus = C.SDL_AUDIO_PLAYING AUDIO_PAUSED AudioStatus = C.SDL_AUDIO_PAUSED )
func GetAudioDeviceStatus ¶
func GetAudioDeviceStatus(dev AudioDeviceID) (retval AudioStatus)
func GetAudioStatus ¶
func GetAudioStatus() (retval AudioStatus)
type BlendMode ¶
type BlendMode int
The blend mode used in SDL_RenderCopy() and drawing operations. ↪ https://wiki.libsdl.org/SDL_BlendMode
const ( // no blending dstRGBA = srcRGBA BLENDMODE_NONE BlendMode = C.SDL_BLENDMODE_NONE // alpha blending dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) dstA = // srcA + (dstA * (1-srcA)) BLENDMODE_BLEND BlendMode = C.SDL_BLENDMODE_BLEND // additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA BLENDMODE_ADD BlendMode = C.SDL_BLENDMODE_ADD // color modulate dstRGB = srcRGB * dstRGB dstA = dstA BLENDMODE_MOD BlendMode = C.SDL_BLENDMODE_MOD )
type CommonEvent ¶
Fields shared by every event.
type ControllerAxisEvent ¶
type ControllerAxisEvent struct { // SDL_CONTROLLERAXISMOTION Type EventType Timestamp uint32 // The joystick instance id Which JoystickID // The controller axis (SDL_GameControllerAxis) Axis uint8 Padding1 uint8 Padding2 uint8 Padding3 uint8 // The axis value (range: -32768 to 32767) Value int16 Padding4 uint16 }
Game controller axis motion event structure (event.caxis.*) ↪ https://wiki.libsdl.org/SDL_ControllerAxisEvent
type ControllerButtonEvent ¶
type ControllerButtonEvent struct { // SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP Type EventType Timestamp uint32 // The joystick instance id Which JoystickID // The controller button (SDL_GameControllerButton) Button uint8 // SDL_PRESSED or SDL_RELEASED State uint8 Padding1 uint8 Padding2 uint8 }
Game controller button event structure (event.cbutton.*) ↪ https://wiki.libsdl.org/SDL_ControllerButtonEvent
type ControllerDeviceEvent ¶
type ControllerDeviceEvent struct { // SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, or // SDL_CONTROLLERDEVICEREMAPPED Type EventType Timestamp uint32 // The joystick device index for the ADDED event, instance id for the // REMOVED or REMAPPED event Which int32 }
Controller device event structure (event.cdevice.*) ↪ https://wiki.libsdl.org/SDL_ControllerDeviceEvent
type Cursor ¶
type Cursor C.SDL_Cursor
func CreateCursor ¶
func CreateCursor(data []byte, mask []byte, width int, height int, hot_x int, hot_y int) (retval *Cursor)
Create a cursor, using the specified bitmap data and mask (in MSB format).
The cursor width must be a multiple of 8.
The cursor is created in black and white according to the following:
data | mask | resulting pixel on screen 0 | 1 | White 1 | 1 | Black 0 | 0 | Transparent 1 | 0 | Inverted color if possible, black if not.
See also: SDL_FreeCursor()
↪ https://wiki.libsdl.org/SDL_CreateCursor
func CreateSystemCursor ¶
func CreateSystemCursor(id SystemCursor) (retval *Cursor)
Create a system cursor.
See also: SDL_FreeCursor()
func GetCursor ¶
func GetCursor() (retval *Cursor)
Return the active cursor. ↪ https://wiki.libsdl.org/SDL_GetCursor
func GetDefaultCursor ¶
func GetDefaultCursor() (retval *Cursor)
Return the default cursor. ↪ https://wiki.libsdl.org/SDL_GetDefaultCursor
type CustomRWops ¶
type CustomRWops struct { Size Sizer Seek io.Seeker Read io.Reader Write io.Writer Close io.Closer // contains filtered or unexported fields }
Obtain this via sdl.AllocRW() and fill in at least Read or Write, then you can use CustomRWops.RWops() to get an *sdl.RWops which you can use with any of the SDL functions that use it.
NOTE: Unless you have special needs, you should use sdlutil.RWFromReader() or sdlutil.RWFromWriter() instead of rolling your own CustomRWops.
func AllocRW ¶
func AllocRW() *CustomRWops
NOTE: Unless you have special needs, use sdlutil.RWFromReader() or sdlutil.RWFromWriter() instead of sdl.AllocRW().
Many functions from SDL and related libraries accept *sdl.RWops as IO abstractions. AllocRW() builds a bridge between sdl.RWops and Go's io interfaces. Fill in the appropriate fields of the returned structure with your object(s) and leave the others nil.
ATTENTION: If you fill in Seek and leave Size empty, calls to Seek will be used to implement Size().
Make sure you call Free() on the returned object or Close() on its RWops() when you're done to avoid leaking memory. Alternatively many functions that accept *sdl.RWops arguments support a parameter that tells them to close the RWops when they're done. If you use this parameter that is sufficient. Unlike RWops.Close() CustomRWops.Free() may be called multiple times, so "defer customRW.Free()" is often a good idea.
If something goes wrong in the SDL library (such as an out of memory on the C heap), this function calls panic(sdl.GetError()).
func (*CustomRWops) Free ¶
func (rw *CustomRWops) Free()
Make sure you call Free() on the CustomRWops object or Close() on its RWops() when you're done to avoid leaking memory. Alternatively many functions that accept *sdl.RWops arguments support a parameter that tells them to close the RWops when they're done. If you use this parameter that is sufficient. Unlike RWops.Close() CustomRWops.Free() may be called multiple times, so "defer customRW.Free()" is often a good idea.
func (*CustomRWops) RWops ¶
func (rw *CustomRWops) RWops() *RWops
Returns a *RWops whose read/write/seek/close/size functions use rw's Read/Write/Seek/Close/Size.
type DisplayMode ¶
type DisplayMode struct { // pixel format Format uint32 // width, in screen coordinates W int // height, in screen coordinates H int // refresh rate (or zero for unspecified) Refresh_rate int // driver-specific data, initialize to 0 Driverdata uintptr }
The structure that defines a display mode.
See also: SDL_GetNumDisplayModes()
See also: SDL_GetDisplayMode()
See also: SDL_GetDesktopDisplayMode()
See also: SDL_GetCurrentDisplayMode()
See also: SDL_GetClosestDisplayMode()
See also: SDL_SetWindowDisplayMode()
See also: SDL_GetWindowDisplayMode()
↪ https://wiki.libsdl.org/SDL_DisplayMode
func GetCurrentDisplayMode ¶
func GetCurrentDisplayMode(displayIndex int) (retval int, mode *DisplayMode)
Fill in information about the current display mode. ↪ https://wiki.libsdl.org/SDL_GetCurrentDisplayMode
func GetDesktopDisplayMode ¶
func GetDesktopDisplayMode(displayIndex int) (retval int, mode *DisplayMode)
Fill in information about the desktop display mode. ↪ https://wiki.libsdl.org/SDL_GetDesktopDisplayMode
func GetDisplayMode ¶
func GetDisplayMode(displayIndex int, modeIndex int) (retval int, mode *DisplayMode)
Fill in information about a specific display mode.
Note: The display modes are sorted in this priority:
bits per pixel -> more colors to fewer colors
width -> largest to smallest
height -> largest to smallest
refresh rate -> highest to lowest
See also: SDL_GetNumDisplayModes()
type DollarGestureEvent ¶
type DollarGestureEvent struct { // SDL_DOLLARGESTURE or SDL_DOLLARRECORD Type EventType Timestamp uint32 // The touch device id TouchId TouchID GestureId GestureID NumFingers uint32 Error float32 // Normalized center of gesture X float32 // Normalized center of gesture Y float32 }
Dollar Gesture Event (event.dgesture.*) ↪ https://wiki.libsdl.org/SDL_DollarGestureEvent
type DropEvent ¶
type DropEvent struct { // SDL_DROPFILE Type EventType Timestamp uint32 // The file name, which should be freed with SDL_free() File string }
An event used to request a file open by the system (event.drop.*) This event is enabled by default, you can disable it with SDL_EventState().
Note: If this event is enabled, you must free the filename in the event.
type Errorcode ¶
type Errorcode int
Internal error functions
const ( ENOMEM Errorcode = C.SDL_ENOMEM EFREAD Errorcode = C.SDL_EFREAD EFWRITE Errorcode = C.SDL_EFWRITE EFSEEK Errorcode = C.SDL_EFSEEK UNSUPPORTED Errorcode = C.SDL_UNSUPPORTED LASTERROR Errorcode = C.SDL_LASTERROR )
type Event ¶
General event structure. ↪ https://wiki.libsdl.org/SDL_Event
func WaitEvent ¶
Waits indefinitely for the next available event.
Returns: 1, or 0 if there was an error while waiting for events.
event If not NULL, the next event is removed from the queue and stored in that area.
func WaitEventTimeout ¶
Waits until the specified timeout (in milliseconds) for the next available event.
Returns: 1, or 0 if there was an error while waiting for events.
event If not NULL, the next event is removed from the queue and stored in that area. timeout The timeout (in milliseconds) to wait for next event.
func (*Event) Cbutton ¶
func (u *Event) Cbutton() ControllerButtonEvent
Game Controller button event data
func (*Event) Cdevice ¶
func (u *Event) Cdevice() ControllerDeviceEvent
Game Controller device event data
func (*Event) Push ¶
Add an event to the event queue.
Returns: 1 on success, 0 if the event was filtered, or -1 if the event queue was full or there was some other error.
func (*Event) SetCaxis ¶
func (u *Event) SetCaxis(x ControllerAxisEvent)
Game Controller axis event data
func (*Event) SetCbutton ¶
func (u *Event) SetCbutton(x ControllerButtonEvent)
Game Controller button event data
func (*Event) SetCdevice ¶
func (u *Event) SetCdevice(x ControllerDeviceEvent)
Game Controller device event data
func (*Event) SetJdevice ¶
func (u *Event) SetJdevice(x JoyDeviceEvent)
Joystick device change event data
func (*Event) SetPadding ¶
type EventFilter ¶
type EventFilter C.SDL_EventFilter
type EventType ¶
type EventType uint32
The types of events that can be delivered. ↪ https://wiki.libsdl.org/SDL_EventType
const ( // Unused (do not remove) FIRSTEVENT EventType = C.SDL_FIRSTEVENT // User-requested quit QUIT EventType = C.SDL_QUIT // The application is being terminated by the OS Called on iOS in // applicationWillTerminate() Called on Android in onDestroy() APP_TERMINATING EventType = C.SDL_APP_TERMINATING // The application is low on memory, free memory if possible. Called on // iOS in applicationDidReceiveMemoryWarning() Called on Android in // onLowMemory() APP_LOWMEMORY EventType = C.SDL_APP_LOWMEMORY // The application is about to enter the background Called on iOS in // applicationWillResignActive() Called on Android in onPause() APP_WILLENTERBACKGROUND EventType = C.SDL_APP_WILLENTERBACKGROUND // The application did enter the background and may not get CPU for some // time Called on iOS in applicationDidEnterBackground() Called on // Android in onPause() APP_DIDENTERBACKGROUND EventType = C.SDL_APP_DIDENTERBACKGROUND // The application is about to enter the foreground Called on iOS in // applicationWillEnterForeground() Called on Android in onResume() APP_WILLENTERFOREGROUND EventType = C.SDL_APP_WILLENTERFOREGROUND // The application is now interactive Called on iOS in // applicationDidBecomeActive() Called on Android in onResume() APP_DIDENTERFOREGROUND EventType = C.SDL_APP_DIDENTERFOREGROUND // Window state change WINDOWEVENT EventType = C.SDL_WINDOWEVENT // System specific event SYSWMEVENT EventType = C.SDL_SYSWMEVENT // Key pressed KEYDOWN EventType = C.SDL_KEYDOWN // Key released KEYUP EventType = C.SDL_KEYUP // Keyboard text editing (composition) TEXTEDITING EventType = C.SDL_TEXTEDITING // Keyboard text input TEXTINPUT EventType = C.SDL_TEXTINPUT // Keymap changed due to a system event such as an input language or // keyboard layout change. KEYMAPCHANGED EventType = C.SDL_KEYMAPCHANGED // Mouse moved MOUSEMOTION EventType = C.SDL_MOUSEMOTION // Mouse button pressed MOUSEBUTTONDOWN EventType = C.SDL_MOUSEBUTTONDOWN // Mouse button released MOUSEBUTTONUP EventType = C.SDL_MOUSEBUTTONUP // Mouse wheel motion MOUSEWHEEL EventType = C.SDL_MOUSEWHEEL // Joystick axis motion JOYAXISMOTION EventType = C.SDL_JOYAXISMOTION // Joystick trackball motion JOYBALLMOTION EventType = C.SDL_JOYBALLMOTION // Joystick hat position change JOYHATMOTION EventType = C.SDL_JOYHATMOTION // Joystick button pressed JOYBUTTONDOWN EventType = C.SDL_JOYBUTTONDOWN // Joystick button released JOYBUTTONUP EventType = C.SDL_JOYBUTTONUP // A new joystick has been inserted into the system JOYDEVICEADDED EventType = C.SDL_JOYDEVICEADDED // An opened joystick has been removed JOYDEVICEREMOVED EventType = C.SDL_JOYDEVICEREMOVED // Game controller axis motion CONTROLLERAXISMOTION EventType = C.SDL_CONTROLLERAXISMOTION // Game controller button pressed CONTROLLERBUTTONDOWN EventType = C.SDL_CONTROLLERBUTTONDOWN // Game controller button released CONTROLLERBUTTONUP EventType = C.SDL_CONTROLLERBUTTONUP // A new Game controller has been inserted into the system CONTROLLERDEVICEADDED EventType = C.SDL_CONTROLLERDEVICEADDED // An opened Game controller has been removed CONTROLLERDEVICEREMOVED EventType = C.SDL_CONTROLLERDEVICEREMOVED // The controller mapping was updated CONTROLLERDEVICEREMAPPED EventType = C.SDL_CONTROLLERDEVICEREMAPPED FINGERDOWN EventType = C.SDL_FINGERDOWN FINGERUP EventType = C.SDL_FINGERUP FINGERMOTION EventType = C.SDL_FINGERMOTION DOLLARGESTURE EventType = C.SDL_DOLLARGESTURE DOLLARRECORD EventType = C.SDL_DOLLARRECORD MULTIGESTURE EventType = C.SDL_MULTIGESTURE // The clipboard changed CLIPBOARDUPDATE EventType = C.SDL_CLIPBOARDUPDATE // The system requests a file open DROPFILE EventType = C.SDL_DROPFILE // A new audio device is available AUDIODEVICEADDED EventType = C.SDL_AUDIODEVICEADDED // An audio device has been removed. AUDIODEVICEREMOVED EventType = C.SDL_AUDIODEVICEREMOVED // The render targets have been reset and their contents need to be // updated RENDER_TARGETS_RESET EventType = C.SDL_RENDER_TARGETS_RESET // The device has been reset and all textures need to be recreated RENDER_DEVICE_RESET EventType = C.SDL_RENDER_DEVICE_RESET // Events SDL_USEREVENT through SDL_LASTEVENT are for your use, and // should be allocated with SDL_RegisterEvents() USEREVENT EventType = C.SDL_USEREVENT // This last event is only for bounding internal arrays LASTEVENT EventType = C.SDL_LASTEVENT )
type Eventaction ¶
type Eventaction int
const ( ADDEVENT Eventaction = C.SDL_ADDEVENT PEEKEVENT Eventaction = C.SDL_PEEKEVENT GETEVENT Eventaction = C.SDL_GETEVENT )
type Finger ¶
↪ https://wiki.libsdl.org/SDL_Finger
func GetTouchFinger ¶
Get the finger object of the given touch, with the given index. ↪ https://wiki.libsdl.org/SDL_GetTouchFinger
type GLContext ¶
type GLContext C.SDL_GLContext
An opaque handle to an OpenGL context.
func GL_GetCurrentContext ¶
func GL_GetCurrentContext() (retval GLContext)
Get the currently active OpenGL context. ↪ https://wiki.libsdl.org/SDL_GL_GetCurrentContext
type GLattr ¶
type GLattr int
OpenGL configuration attributes. ↪ https://wiki.libsdl.org/SDL_GLattr
const ( GL_RED_SIZE GLattr = C.SDL_GL_RED_SIZE GL_GREEN_SIZE GLattr = C.SDL_GL_GREEN_SIZE GL_BLUE_SIZE GLattr = C.SDL_GL_BLUE_SIZE GL_ALPHA_SIZE GLattr = C.SDL_GL_ALPHA_SIZE GL_BUFFER_SIZE GLattr = C.SDL_GL_BUFFER_SIZE GL_DOUBLEBUFFER GLattr = C.SDL_GL_DOUBLEBUFFER GL_DEPTH_SIZE GLattr = C.SDL_GL_DEPTH_SIZE GL_STENCIL_SIZE GLattr = C.SDL_GL_STENCIL_SIZE GL_ACCUM_RED_SIZE GLattr = C.SDL_GL_ACCUM_RED_SIZE GL_ACCUM_GREEN_SIZE GLattr = C.SDL_GL_ACCUM_GREEN_SIZE GL_ACCUM_BLUE_SIZE GLattr = C.SDL_GL_ACCUM_BLUE_SIZE GL_ACCUM_ALPHA_SIZE GLattr = C.SDL_GL_ACCUM_ALPHA_SIZE GL_STEREO GLattr = C.SDL_GL_STEREO GL_MULTISAMPLEBUFFERS GLattr = C.SDL_GL_MULTISAMPLEBUFFERS GL_MULTISAMPLESAMPLES GLattr = C.SDL_GL_MULTISAMPLESAMPLES GL_ACCELERATED_VISUAL GLattr = C.SDL_GL_ACCELERATED_VISUAL GL_RETAINED_BACKING GLattr = C.SDL_GL_RETAINED_BACKING GL_CONTEXT_MAJOR_VERSION GLattr = C.SDL_GL_CONTEXT_MAJOR_VERSION GL_CONTEXT_MINOR_VERSION GLattr = C.SDL_GL_CONTEXT_MINOR_VERSION GL_CONTEXT_EGL GLattr = C.SDL_GL_CONTEXT_EGL GL_CONTEXT_FLAGS GLattr = C.SDL_GL_CONTEXT_FLAGS GL_CONTEXT_PROFILE_MASK GLattr = C.SDL_GL_CONTEXT_PROFILE_MASK GL_SHARE_WITH_CURRENT_CONTEXT GLattr = C.SDL_GL_SHARE_WITH_CURRENT_CONTEXT GL_FRAMEBUFFER_SRGB_CAPABLE GLattr = C.SDL_GL_FRAMEBUFFER_SRGB_CAPABLE GL_CONTEXT_RELEASE_BEHAVIOR GLattr = C.SDL_GL_CONTEXT_RELEASE_BEHAVIOR )
type GLcontextFlag ¶
type GLcontextFlag int
↪ https://wiki.libsdl.org/SDL_GLcontextFlag
const ( GL_CONTEXT_DEBUG_FLAG GLcontextFlag = C.SDL_GL_CONTEXT_DEBUG_FLAG GL_CONTEXT_FORWARD_COMPATIBLE_FLAG GLcontextFlag = C.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG GL_CONTEXT_ROBUST_ACCESS_FLAG GLcontextFlag = C.SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG GL_CONTEXT_RESET_ISOLATION_FLAG GLcontextFlag = C.SDL_GL_CONTEXT_RESET_ISOLATION_FLAG )
type GLcontextReleaseFlag ¶
type GLcontextReleaseFlag int
const ( GL_CONTEXT_RELEASE_BEHAVIOR_NONE GLcontextReleaseFlag = C.SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH GLcontextReleaseFlag = C.SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH )
type GLprofile ¶
type GLprofile int
↪ https://wiki.libsdl.org/SDL_GLprofile
const ( GL_CONTEXT_PROFILE_CORE GLprofile = C.SDL_GL_CONTEXT_PROFILE_CORE GL_CONTEXT_PROFILE_COMPATIBILITY GLprofile = C.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY GL_CONTEXT_PROFILE_ES GLprofile = C.SDL_GL_CONTEXT_PROFILE_ES )
type GameController ¶
type GameController C.SDL_GameController
func GameControllerFromInstanceID ¶
func GameControllerFromInstanceID(joyid JoystickID) (retval *GameController)
Return the SDL_GameController associated with an instance id. ↪ https://wiki.libsdl.org/SDL_GameControllerFromInstanceID
func GameControllerOpen ¶
func GameControllerOpen(joystick_index int) (retval *GameController)
Open a game controller for use. The index passed as an argument refers to the N'th game controller on the system. This index is not the value which will identify this controller in future controller events. The joystick's instance id (SDL_JoystickID) will be used there instead.
Returns: A controller identifier, or NULL if an error occurred.
func (*GameController) Close ¶
func (gamecontroller *GameController) Close()
Close a controller previously opened with SDL_GameControllerOpen(). ↪ https://wiki.libsdl.org/SDL_GameControllerClose
func (*GameController) GetAttached ¶
func (gamecontroller *GameController) GetAttached() (retval bool)
Returns SDL_TRUE if the controller has been opened and currently connected, or SDL_FALSE if it has not. ↪ https://wiki.libsdl.org/SDL_GameControllerGetAttached
func (*GameController) GetAxis ¶
func (gamecontroller *GameController) GetAxis(axis GameControllerAxis) (retval int16)
Get the current state of an axis control on a game controller.
The state is a value ranging from -32768 to 32767 (except for the triggers, which range from 0 to 32767).
The axis indices start at index 0. ↪ https://wiki.libsdl.org/SDL_GameControllerGetAxis
func (*GameController) GetBindForAxis ¶
func (gamecontroller *GameController) GetBindForAxis(axis GameControllerAxis) (retval GameControllerButtonBind)
Get the SDL joystick layer binding for this controller button mapping ↪ https://wiki.libsdl.org/SDL_GameControllerGetBindForAxis
func (*GameController) GetBindForButton ¶
func (gamecontroller *GameController) GetBindForButton(button GameControllerButton) (retval GameControllerButtonBind)
Get the SDL joystick layer binding for this controller button mapping ↪ https://wiki.libsdl.org/SDL_GameControllerGetBindForButton
func (*GameController) GetButton ¶
func (gamecontroller *GameController) GetButton(button GameControllerButton) (retval uint8)
Get the current state of a button on a game controller.
The button indices start at index 0. ↪ https://wiki.libsdl.org/SDL_GameControllerGetButton
func (*GameController) GetJoystick ¶
func (gamecontroller *GameController) GetJoystick() (retval *Joystick)
Get the underlying joystick object used by a controller ↪ https://wiki.libsdl.org/SDL_GameControllerGetJoystick
func (*GameController) Mapping ¶
func (gamecontroller *GameController) Mapping() (retval string)
Get a mapping string for an open GameController
Returns: the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available
func (*GameController) Name ¶
func (gamecontroller *GameController) Name() (retval string)
Return the name for this currently opened controller ↪ https://wiki.libsdl.org/SDL_GameControllerName
type GameControllerAxis ¶
type GameControllerAxis int
The list of axes available from a controller ↪ https://wiki.libsdl.org/SDL_GameControllerAxis
const ( CONTROLLER_AXIS_INVALID GameControllerAxis = C.SDL_CONTROLLER_AXIS_INVALID CONTROLLER_AXIS_LEFTX GameControllerAxis = C.SDL_CONTROLLER_AXIS_LEFTX CONTROLLER_AXIS_LEFTY GameControllerAxis = C.SDL_CONTROLLER_AXIS_LEFTY CONTROLLER_AXIS_RIGHTX GameControllerAxis = C.SDL_CONTROLLER_AXIS_RIGHTX CONTROLLER_AXIS_RIGHTY GameControllerAxis = C.SDL_CONTROLLER_AXIS_RIGHTY CONTROLLER_AXIS_TRIGGERLEFT GameControllerAxis = C.SDL_CONTROLLER_AXIS_TRIGGERLEFT CONTROLLER_AXIS_TRIGGERRIGHT GameControllerAxis = C.SDL_CONTROLLER_AXIS_TRIGGERRIGHT CONTROLLER_AXIS_MAX GameControllerAxis = C.SDL_CONTROLLER_AXIS_MAX )
func GameControllerGetAxisFromString ¶
func GameControllerGetAxisFromString(pchString string) (retval GameControllerAxis)
turn this string into a axis mapping ↪ https://wiki.libsdl.org/SDL_GameControllerGetAxisFromString
type GameControllerBindType ¶
type GameControllerBindType int
const ( CONTROLLER_BINDTYPE_NONE GameControllerBindType = C.SDL_CONTROLLER_BINDTYPE_NONE CONTROLLER_BINDTYPE_BUTTON GameControllerBindType = C.SDL_CONTROLLER_BINDTYPE_BUTTON CONTROLLER_BINDTYPE_AXIS GameControllerBindType = C.SDL_CONTROLLER_BINDTYPE_AXIS CONTROLLER_BINDTYPE_HAT GameControllerBindType = C.SDL_CONTROLLER_BINDTYPE_HAT )
type GameControllerButton ¶
type GameControllerButton int
The list of buttons available from a controller ↪ https://wiki.libsdl.org/SDL_GameControllerButton
const ( CONTROLLER_BUTTON_INVALID GameControllerButton = C.SDL_CONTROLLER_BUTTON_INVALID CONTROLLER_BUTTON_A GameControllerButton = C.SDL_CONTROLLER_BUTTON_A CONTROLLER_BUTTON_B GameControllerButton = C.SDL_CONTROLLER_BUTTON_B CONTROLLER_BUTTON_X GameControllerButton = C.SDL_CONTROLLER_BUTTON_X CONTROLLER_BUTTON_Y GameControllerButton = C.SDL_CONTROLLER_BUTTON_Y CONTROLLER_BUTTON_BACK GameControllerButton = C.SDL_CONTROLLER_BUTTON_BACK CONTROLLER_BUTTON_GUIDE GameControllerButton = C.SDL_CONTROLLER_BUTTON_GUIDE CONTROLLER_BUTTON_START GameControllerButton = C.SDL_CONTROLLER_BUTTON_START CONTROLLER_BUTTON_LEFTSTICK GameControllerButton = C.SDL_CONTROLLER_BUTTON_LEFTSTICK CONTROLLER_BUTTON_RIGHTSTICK GameControllerButton = C.SDL_CONTROLLER_BUTTON_RIGHTSTICK CONTROLLER_BUTTON_LEFTSHOULDER GameControllerButton = C.SDL_CONTROLLER_BUTTON_LEFTSHOULDER CONTROLLER_BUTTON_RIGHTSHOULDER GameControllerButton = C.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER CONTROLLER_BUTTON_DPAD_UP GameControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_UP CONTROLLER_BUTTON_DPAD_DOWN GameControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_DOWN CONTROLLER_BUTTON_DPAD_LEFT GameControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_LEFT CONTROLLER_BUTTON_DPAD_RIGHT GameControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_RIGHT CONTROLLER_BUTTON_MAX GameControllerButton = C.SDL_CONTROLLER_BUTTON_MAX )
func GameControllerGetButtonFromString ¶
func GameControllerGetButtonFromString(pchString string) (retval GameControllerButton)
turn this string into a button mapping ↪ https://wiki.libsdl.org/SDL_GameControllerGetButtonFromString
type GameControllerButtonBind ¶
type GameControllerButtonBind C.SDL_GameControllerButtonBind
type Haptic ¶
type Haptic C.SDL_Haptic
The haptic structure used to identify an SDL haptic.
See also: SDL_HapticOpen
See also: SDL_HapticOpenFromJoystick
See also: SDL_HapticClose
func HapticOpen ¶
Opens a Haptic device for usage.
The index passed as an argument refers to the N'th Haptic device on this system.
When opening a haptic device, its gain will be set to maximum and autocenter will be disabled. To modify these values use SDL_HapticSetGain() and SDL_HapticSetAutocenter().
Returns: Device identifier or NULL on error.
See also: SDL_HapticIndex
See also: SDL_HapticOpenFromMouse
See also: SDL_HapticOpenFromJoystick
See also: SDL_HapticClose
See also: SDL_HapticSetGain
See also: SDL_HapticSetAutocenter
See also: SDL_HapticPause
See also: SDL_HapticStopAll
device_index Index of the device to open.
func HapticOpenFromMouse ¶
func HapticOpenFromMouse() (retval *Haptic)
Tries to open a haptic device from the current mouse.
Returns: The haptic device identifier or NULL on error.
See also: SDL_MouseIsHaptic
See also: SDL_HapticOpen
func (*Haptic) Close ¶
func (haptic *Haptic) Close()
Closes a Haptic device previously opened with SDL_HapticOpen().
haptic Haptic device to close.
func (*Haptic) DestroyEffect ¶
Destroys a haptic effect on the device.
This will stop the effect if it's running. Effects are automatically destroyed when the device is closed.
See also: SDL_HapticNewEffect
haptic Device to destroy the effect on. effect Identifier of the effect to destroy.
func (*Haptic) EffectSupported ¶
func (haptic *Haptic) EffectSupported(effect *HapticEffect) (retval int)
Checks to see if effect is supported by haptic.
Returns: SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
See also: SDL_HapticQuery
See also: SDL_HapticNewEffect
haptic Haptic device to check on. effect Effect to check to see if it is supported.
func (*Haptic) GetEffectStatus ¶
Gets the status of the current effect on the haptic device.
Device must support the SDL_HAPTIC_STATUS feature.
Returns: 0 if it isn't playing, 1 if it is playing or -1 on error.
See also: SDL_HapticRunEffect
See also: SDL_HapticStopEffect
haptic Haptic device to query the effect status on. effect Identifier of the effect to query its status.
func (*Haptic) Index ¶
Gets the index of a haptic device.
Returns: The index of the haptic device or -1 on error.
See also: SDL_HapticOpen
See also: SDL_HapticOpened
haptic Haptic device to get the index of.
func (*Haptic) NewEffect ¶
func (haptic *Haptic) NewEffect(effect *HapticEffect) (retval int)
Creates a new haptic effect on the device.
Returns: The id of the effect on success or -1 on error.
See also: SDL_HapticUpdateEffect
See also: SDL_HapticRunEffect
See also: SDL_HapticDestroyEffect
haptic Haptic device to create the effect on. effect Properties of the effect to create.
func (*Haptic) NumAxes ¶
Gets the number of haptic axes the device has.
See also: SDL_HapticDirection
func (*Haptic) NumEffects ¶
Returns the number of effects a haptic device can store.
On some platforms this isn't fully supported, and therefore is an approximation. Always check to see if your created effect was actually created and do not rely solely on SDL_HapticNumEffects().
Returns: The number of effects the haptic device can store or -1 on error.
See also: SDL_HapticNumEffectsPlaying
See also: SDL_HapticQuery
haptic The haptic device to query effect max.
func (*Haptic) NumEffectsPlaying ¶
Returns the number of effects a haptic device can play at the same time.
This is not supported on all platforms, but will always return a value. Added here for the sake of completeness.
Returns: The number of effects the haptic device can play at the same time or -1 on error.
See also: SDL_HapticNumEffects
See also: SDL_HapticQuery
haptic The haptic device to query maximum playing effects.
func (*Haptic) Pause ¶
Pauses a haptic device.
Device must support the SDL_HAPTIC_PAUSE feature. Call SDL_HapticUnpause() to resume playback.
Do not modify the effects nor add new ones while the device is paused. That can cause all sorts of weird errors.
Returns: 0 on success or -1 on error.
See also: SDL_HapticUnpause
haptic Haptic device to pause.
func (*Haptic) Query ¶
Gets the haptic device's supported features in bitwise manner.
Example:
if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { printf("We have constant haptic effect!"); }
Returns: Haptic features in bitwise manner (OR'd).
See also: SDL_HapticNumEffects
See also: SDL_HapticEffectSupported
haptic The haptic device to query.
func (*Haptic) RumbleInit ¶
Initializes the haptic device for simple rumble playback.
Returns: 0 on success or -1 on error.
See also: SDL_HapticOpen
See also: SDL_HapticRumbleSupported
See also: SDL_HapticRumblePlay
See also: SDL_HapticRumbleStop
haptic Haptic device to initialize for simple rumble playback.
func (*Haptic) RumblePlay ¶
Runs simple rumble on a haptic device.
Returns: 0 on success or -1 on error.
See also: SDL_HapticRumbleSupported
See also: SDL_HapticRumbleInit
See also: SDL_HapticRumbleStop
haptic Haptic device to play rumble effect on. strength Strength of the rumble to play as a 0-1 float value. length Length of the rumble to play in milliseconds.
func (*Haptic) RumbleStop ¶
Stops the simple rumble on a haptic device.
Returns: 0 on success or -1 on error.
See also: SDL_HapticRumbleSupported
See also: SDL_HapticRumbleInit
See also: SDL_HapticRumblePlay
haptic Haptic to stop the rumble on.
func (*Haptic) RumbleSupported ¶
Checks to see if rumble is supported on a haptic device.
Returns: SDL_TRUE if effect is supported, SDL_FALSE if it isn't or -1 on error.
See also: SDL_HapticRumbleInit
See also: SDL_HapticRumblePlay
See also: SDL_HapticRumbleStop
haptic Haptic device to check to see if it supports rumble.
func (*Haptic) RunEffect ¶
Runs the haptic effect on its associated haptic device.
If iterations are SDL_HAPTIC_INFINITY, it'll run the effect over and over repeating the envelope (attack and fade) every time. If you only want the effect to last forever, set SDL_HAPTIC_INFINITY in the effect's length parameter.
Returns: 0 on success or -1 on error.
See also: SDL_HapticStopEffect
See also: SDL_HapticDestroyEffect
See also: SDL_HapticGetEffectStatus
haptic Haptic device to run the effect on. effect Identifier of the haptic effect to run. iterations Number of iterations to run the effect. Use SDL_HAPTIC_INFINITY for infinity.
func (*Haptic) SetAutocenter ¶
Sets the global autocenter of the device.
Autocenter should be between 0 and 100. Setting it to 0 will disable autocentering.
Device must support the SDL_HAPTIC_AUTOCENTER feature.
Returns: 0 on success or -1 on error.
See also: SDL_HapticQuery
haptic Haptic device to set autocentering on. autocenter Value to set autocenter to, 0 disables autocentering.
func (*Haptic) SetGain ¶
Sets the global gain of the device.
Device must support the SDL_HAPTIC_GAIN feature.
The user may specify the maximum gain by setting the environment variable SDL_HAPTIC_GAIN_MAX which should be between 0 and 100. All calls to SDL_HapticSetGain() will scale linearly using SDL_HAPTIC_GAIN_MAX as the maximum.
Returns: 0 on success or -1 on error.
See also: SDL_HapticQuery
haptic Haptic device to set the gain on. gain Value to set the gain to, should be between 0 and 100.
func (*Haptic) StopAll ¶
Stops all the currently playing effects on a haptic device.
Returns: 0 on success or -1 on error.
haptic Haptic device to stop.
func (*Haptic) StopEffect ¶
Stops the haptic effect on its associated haptic device.
Returns: 0 on success or -1 on error.
See also: SDL_HapticRunEffect
See also: SDL_HapticDestroyEffect
haptic Haptic device to stop the effect on. effect Identifier of the effect to stop.
func (*Haptic) Unpause ¶
Unpauses a haptic device.
Call to unpause after SDL_HapticPause().
Returns: 0 on success or -1 on error.
See also: SDL_HapticPause
haptic Haptic device to unpause.
func (*Haptic) UpdateEffect ¶
func (haptic *Haptic) UpdateEffect(effect int, data *HapticEffect) (retval int)
Updates the properties of an effect.
Can be used dynamically, although behaviour when dynamically changing direction may be strange. Specifically the effect may reupload itself and start playing from the start. You cannot change the type either when running SDL_HapticUpdateEffect().
Returns: 0 on success or -1 on error.
See also: SDL_HapticNewEffect
See also: SDL_HapticRunEffect
See also: SDL_HapticDestroyEffect
haptic Haptic device that has the effect. effect Effect to update. data New effect properties to use.
type HapticCondition ¶
type HapticCondition struct { // SDL_HAPTIC_SPRING, SDL_HAPTIC_DAMPER, SDL_HAPTIC_INERTIA or // SDL_HAPTIC_FRICTION Type uint16 // Direction of the effect - Not used ATM. Direction HapticDirection // Duration of the effect. Length uint32 // Delay before starting the effect. Delay uint16 // Button that triggers the effect. Button uint16 // How soon it can be triggered again after button. Interval uint16 // Level when joystick is to the positive side; max 0xFFFF. Right_sat [3]uint16 // Level when joystick is to the negative side; max 0xFFFF. Left_sat [3]uint16 // How fast to increase the force towards the positive side. Right_coeff [3]int16 // How fast to increase the force towards the negative side. Left_coeff [3]int16 // Size of the dead zone; max 0xFFFF: whole axis-range when 0-centered. Deadband [3]uint16 // Position of the dead zone. Center [3]int16 }
A structure containing a template for a Condition effect.
The struct handles the following effects:
- SDL_HAPTIC_SPRING: Effect based on axes position.
- SDL_HAPTIC_DAMPER: Effect based on axes velocity.
- SDL_HAPTIC_INERTIA: Effect based on axes acceleration.
- SDL_HAPTIC_FRICTION: Effect based on axes movement.
Direction is handled by condition internals instead of a direction member. The condition effect specific members have three parameters. The first refers to the X axis, the second refers to the Y axis and the third refers to the Z axis. The right terms refer to the positive side of the axis and the left terms refer to the negative side of the axis. Please refer to the SDL_HapticDirection diagram for which side is positive and which is negative.
See also: SDL_HapticDirection
See also: SDL_HAPTIC_SPRING
See also: SDL_HAPTIC_DAMPER
See also: SDL_HAPTIC_INERTIA
See also: SDL_HAPTIC_FRICTION
See also: SDL_HapticEffect
type HapticConstant ¶
type HapticConstant struct { // SDL_HAPTIC_CONSTANT Type uint16 // Direction of the effect. Direction HapticDirection // Duration of the effect. Length uint32 // Delay before starting the effect. Delay uint16 // Button that triggers the effect. Button uint16 // How soon it can be triggered again after button. Interval uint16 // Strength of the constant effect. Level int16 // Duration of the attack. Attack_length uint16 // Level at the start of the attack. Attack_level uint16 // Duration of the fade. Fade_length uint16 // Level at the end of the fade. Fade_level uint16 }
A structure containing a template for a Constant effect.
The struct is exclusive to the SDL_HAPTIC_CONSTANT effect.
A constant effect applies a constant force in the specified direction to the joystick.
See also: SDL_HAPTIC_CONSTANT
See also: SDL_HapticEffect
type HapticDirection ¶
type HapticDirection struct { // The type of encoding. Type uint8 // The encoded direction. Dir [3]int32 }
Structure that represents a haptic direction.
This is the direction where the force comes from, instead of the direction in which the force is exerted.
Directions can be specified by:
- SDL_HAPTIC_POLAR : Specified by polar coordinates.
- SDL_HAPTIC_CARTESIAN : Specified by cartesian coordinates.
- SDL_HAPTIC_SPHERICAL : Specified by spherical coordinates.
Cardinal directions of the haptic device are relative to the positioning of the device. North is considered to be away from the user.
The following diagram represents the cardinal directions:
.--. |__| .-------. |=.| |.-----.| |--| || || | | |'-----'| |__|~')_____(' [ COMPUTER ] North (0,-1) ^ | | (-1,0) West <----[ HAPTIC ]----> East (1,0) | | v South (0,1) [ USER ] \|||/ (o o) ---ooO-(_)-Ooo---
If type is SDL_HAPTIC_POLAR, direction is encoded by hundredths of a degree starting north and turning clockwise. SDL_HAPTIC_POLAR only uses the first dir parameter. The cardinal directions would be:
- North: 0 (0 degrees)
- East: 9000 (90 degrees)
- South: 18000 (180 degrees)
- West: 27000 (270 degrees)
If type is SDL_HAPTIC_CARTESIAN, direction is encoded by three positions (X axis, Y axis and Z axis (with 3 axes)). SDL_HAPTIC_CARTESIAN uses the first three dir parameters. The cardinal directions would be:
- North: 0,-1, 0
- East: 1, 0, 0
- South: 0, 1, 0
- West: -1, 0, 0
The Z axis represents the height of the effect if supported, otherwise it's unused. In cartesian encoding (1, 2) would be the same as (2, 4), you can use any multiple you want, only the direction matters.
If type is SDL_HAPTIC_SPHERICAL, direction is encoded by two rotations. The first two dir parameters are used. The dir parameters are as follows (all values are in hundredths of degrees):
- Degrees from (1, 0) rotated towards (0, 1).
- Degrees towards (0, 0, 1) (device needs at least 3 axes).
Example of force coming from the south with all encodings (force coming from the south means the user will have to pull the stick to counteract):
SDL_HapticDirection direction; // Cartesian directions direction.type = SDL_HAPTIC_CARTESIAN; // Using cartesian direction encoding. direction.dir[0] = 0; // X position direction.dir[1] = 1; // Y position // Assuming the device has 2 axes, we don't need to specify third parameter. // Polar directions direction.type = SDL_HAPTIC_POLAR; // We'll be using polar direction encoding. direction.dir[0] = 18000; // Polar only uses first parameter // Spherical coordinates direction.type = SDL_HAPTIC_SPHERICAL; // Spherical encoding direction.dir[0] = 9000; // Since we only have two axes we don't need more parameters.
See also: SDL_HAPTIC_POLAR
See also: SDL_HAPTIC_CARTESIAN
See also: SDL_HAPTIC_SPHERICAL
See also: SDL_HapticEffect
See also: SDL_HapticNumAxes
type HapticEffect ¶
type HapticEffect C.SDL_HapticEffect
The generic template for any haptic effect.
All values max at 32767 (0x7FFF). Signed values also can be negative. Time values unless specified otherwise are in milliseconds.
You can also pass SDL_HAPTIC_INFINITY to length instead of a 0-32767 value. Neither delay, interval, attack_length nor fade_length support SDL_HAPTIC_INFINITY. Fade will also not be used since effect never ends.
Additionally, the SDL_HAPTIC_RAMP effect does not support a duration of SDL_HAPTIC_INFINITY.
Button triggers may not be supported on all devices, it is advised to not use them if possible. Buttons start at index 1 instead of index 0 like the joystick.
If both attack_length and fade_level are 0, the envelope is not used, otherwise both values are used.
Common parts:
// Replay - All effects have this Uint32 length; // Duration of effect (ms). Uint16 delay; // Delay before starting effect. // Trigger - All effects have this Uint16 button; // Button that triggers effect. Uint16 interval; // How soon before effect can be triggered again. // Envelope - All effects except condition effects have this Uint16 attack_length; // Duration of the attack (ms). Uint16 attack_level; // Level at the start of the attack. Uint16 fade_length; // Duration of the fade out (ms). Uint16 fade_level; // Level at the end of the fade.
Here we have an example of a constant effect evolution in time:
Strength ^ | | effect level --> _________________ | / \ | / \ | / \ | / \ | attack_level --> | \ | | | <--- fade_level | +--------------------------------------------------> Time [--] [---] attack_length fade_length [------------------][-----------------------] delay length
Note either the attack_level or the fade_level may be above the actual effect level.
See also: SDL_HapticConstant
See also: SDL_HapticPeriodic
See also: SDL_HapticCondition
See also: SDL_HapticRamp
See also: SDL_HapticLeftRight
See also: SDL_HapticCustom
↪ https://wiki.libsdl.org/SDL_HapticEffect
func (*HapticEffect) Condition ¶
func (u *HapticEffect) Condition() HapticCondition
Condition effect.
func (*HapticEffect) Leftright ¶
func (u *HapticEffect) Leftright() HapticLeftRight
Left/Right effect.
func (*HapticEffect) SetCondition ¶
func (u *HapticEffect) SetCondition(x HapticCondition)
Condition effect.
func (*HapticEffect) SetConstant ¶
func (u *HapticEffect) SetConstant(x HapticConstant)
Constant effect.
func (*HapticEffect) SetLeftright ¶
func (u *HapticEffect) SetLeftright(x HapticLeftRight)
Left/Right effect.
func (*HapticEffect) SetPeriodic ¶
func (u *HapticEffect) SetPeriodic(x HapticPeriodic)
Periodic effect.
type HapticLeftRight ¶
type HapticLeftRight struct { // SDL_HAPTIC_LEFTRIGHT Type uint16 // Duration of the effect. Length uint32 // Control of the large controller motor. Large_magnitude uint16 // Control of the small controller motor. Small_magnitude uint16 }
A structure containing a template for a Left/Right effect.
This struct is exclusively for the SDL_HAPTIC_LEFTRIGHT effect.
The Left/Right effect is used to explicitly control the large and small motors, commonly found in modern game controllers. One motor is high frequency, the other is low frequency.
See also: SDL_HAPTIC_LEFTRIGHT
See also: SDL_HapticEffect
type HapticPeriodic ¶
type HapticPeriodic struct { // SDL_HAPTIC_SINE, SDL_HAPTIC_LEFTRIGHT, SDL_HAPTIC_TRIANGLE, // SDL_HAPTIC_SAWTOOTHUP or SDL_HAPTIC_SAWTOOTHDOWN Type uint16 // Direction of the effect. Direction HapticDirection // Duration of the effect. Length uint32 // Delay before starting the effect. Delay uint16 // Button that triggers the effect. Button uint16 // How soon it can be triggered again after button. Interval uint16 // Period of the wave. Period uint16 // Peak value; if negative, equivalent to 180 degrees extra phase shift. Magnitude int16 // Mean value of the wave. Offset int16 // Positive phase shift given by hundredth of a degree. Phase uint16 // Duration of the attack. Attack_length uint16 // Level at the start of the attack. Attack_level uint16 // Duration of the fade. Fade_length uint16 // Level at the end of the fade. Fade_level uint16 }
A structure containing a template for a Periodic effect.
The struct handles the following effects:
- SDL_HAPTIC_SINE
- SDL_HAPTIC_LEFTRIGHT
- SDL_HAPTIC_TRIANGLE
- SDL_HAPTIC_SAWTOOTHUP
- SDL_HAPTIC_SAWTOOTHDOWN
A periodic effect consists in a wave-shaped effect that repeats itself over time. The type determines the shape of the wave and the parameters determine the dimensions of the wave.
Phase is given by hundredth of a degree meaning that giving the phase a value of 9000 will displace it 25% of its period. Here are sample values:
- 0: No phase displacement.
- 9000: Displaced 25% of its period.
- 18000: Displaced 50% of its period.
- 27000: Displaced 75% of its period.
- 36000: Displaced 100% of its period, same as 0, but 0 is preferred.
Examples:
SDL_HAPTIC_SINE __ __ __ __ / \ / \ / \ / / \__/ \__/ \__/ SDL_HAPTIC_SQUARE __ __ __ __ __ | | | | | | | | | | | |__| |__| |__| |__| | SDL_HAPTIC_TRIANGLE /\ /\ /\ /\ /\ / \ / \ / \ / \ / / \/ \/ \/ \/ SDL_HAPTIC_SAWTOOTHUP /| /| /| /| /| /| /| / | / | / | / | / | / | / | / |/ |/ |/ |/ |/ |/ | SDL_HAPTIC_SAWTOOTHDOWN \ |\ |\ |\ |\ |\ |\ | \ | \ | \ | \ | \ | \ | \ | \| \| \| \| \| \| \|
See also: SDL_HAPTIC_SINE
See also: SDL_HAPTIC_LEFTRIGHT
See also: SDL_HAPTIC_TRIANGLE
See also: SDL_HAPTIC_SAWTOOTHUP
See also: SDL_HAPTIC_SAWTOOTHDOWN
See also: SDL_HapticEffect
type HapticRamp ¶
type HapticRamp struct { // SDL_HAPTIC_RAMP Type uint16 // Direction of the effect. Direction HapticDirection // Duration of the effect. Length uint32 // Delay before starting the effect. Delay uint16 // Button that triggers the effect. Button uint16 // How soon it can be triggered again after button. Interval uint16 // Beginning strength level. Start int16 // Ending strength level. End int16 // Duration of the attack. Attack_length uint16 // Level at the start of the attack. Attack_level uint16 // Duration of the fade. Fade_length uint16 // Level at the end of the fade. Fade_level uint16 }
A structure containing a template for a Ramp effect.
This struct is exclusively for the SDL_HAPTIC_RAMP effect.
The ramp effect starts at start strength and ends at end strength. It augments in linear fashion. If you use attack and fade with a ramp the effects get added to the ramp effect making the effect become quadratic instead of linear.
See also: SDL_HAPTIC_RAMP
See also: SDL_HapticEffect
type HintCallback ¶
type HintCallback C.SDL_HintCallback
Add a function to watch a particular hint.
name The hint to watch callback The function to call when the hint value changes userdata A pointer to pass to the callback function
type HintPriority ¶
type HintPriority int
An enumeration of hint priorities. ↪ https://wiki.libsdl.org/SDL_HintPriority
const ( HINT_DEFAULT HintPriority = C.SDL_HINT_DEFAULT HINT_NORMAL HintPriority = C.SDL_HINT_NORMAL HINT_OVERRIDE HintPriority = C.SDL_HINT_OVERRIDE )
type HitTest ¶
type HitTest C.SDL_HitTest
Callback used for hit-testing.
See also: SDL_SetWindowHitTest
type HitTestResult ¶
type HitTestResult int
Possible return values from the SDL_HitTest callback.
See also: SDL_HitTest
↪ https://wiki.libsdl.org/SDL_HitTestResult
const ( // Region is normal. No special properties. HITTEST_NORMAL HitTestResult = C.SDL_HITTEST_NORMAL // Region can drag entire window. HITTEST_DRAGGABLE HitTestResult = C.SDL_HITTEST_DRAGGABLE HITTEST_RESIZE_TOPLEFT HitTestResult = C.SDL_HITTEST_RESIZE_TOPLEFT HITTEST_RESIZE_TOP HitTestResult = C.SDL_HITTEST_RESIZE_TOP HITTEST_RESIZE_TOPRIGHT HitTestResult = C.SDL_HITTEST_RESIZE_TOPRIGHT HITTEST_RESIZE_RIGHT HitTestResult = C.SDL_HITTEST_RESIZE_RIGHT HITTEST_RESIZE_BOTTOMRIGHT HitTestResult = C.SDL_HITTEST_RESIZE_BOTTOMRIGHT HITTEST_RESIZE_BOTTOM HitTestResult = C.SDL_HITTEST_RESIZE_BOTTOM HITTEST_RESIZE_BOTTOMLEFT HitTestResult = C.SDL_HITTEST_RESIZE_BOTTOMLEFT HITTEST_RESIZE_LEFT HitTestResult = C.SDL_HITTEST_RESIZE_LEFT )
type JoyAxisEvent ¶
type JoyAxisEvent struct { // SDL_JOYAXISMOTION Type EventType Timestamp uint32 // The joystick instance id Which JoystickID // The joystick axis index Axis uint8 Padding1 uint8 Padding2 uint8 Padding3 uint8 // The axis value (range: -32768 to 32767) Value int16 Padding4 uint16 }
Joystick axis motion event structure (event.jaxis.*) ↪ https://wiki.libsdl.org/SDL_JoyAxisEvent
type JoyBallEvent ¶
type JoyBallEvent struct { // SDL_JOYBALLMOTION Type EventType Timestamp uint32 // The joystick instance id Which JoystickID // The joystick trackball index Ball uint8 Padding1 uint8 Padding2 uint8 Padding3 uint8 // The relative motion in the X direction Xrel int16 // The relative motion in the Y direction Yrel int16 }
Joystick trackball motion event structure (event.jball.*) ↪ https://wiki.libsdl.org/SDL_JoyBallEvent
type JoyButtonEvent ¶
type JoyButtonEvent struct { // SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP Type EventType Timestamp uint32 // The joystick instance id Which JoystickID // The joystick button index Button uint8 // SDL_PRESSED or SDL_RELEASED State uint8 Padding1 uint8 Padding2 uint8 }
Joystick button event structure (event.jbutton.*) ↪ https://wiki.libsdl.org/SDL_JoyButtonEvent
type JoyDeviceEvent ¶
type JoyDeviceEvent struct { // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED Type EventType Timestamp uint32 // The joystick device index for the ADDED event, instance id for the // REMOVED event Which int32 }
Joystick device event structure (event.jdevice.*) ↪ https://wiki.libsdl.org/SDL_JoyDeviceEvent
type JoyHatEvent ¶
type JoyHatEvent struct { // SDL_JOYHATMOTION Type EventType Timestamp uint32 // The joystick instance id Which JoystickID // The joystick hat index Hat uint8 // See also: SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP // // See also: SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT // // See also: SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN // // The hat position value. Note that zero means the POV is centered. Value uint8 Padding1 uint8 Padding2 uint8 }
Joystick hat position change event structure (event.jhat.*) ↪ https://wiki.libsdl.org/SDL_JoyHatEvent
type Joystick ¶
type Joystick C.SDL_Joystick
func JoystickFromInstanceID ¶
func JoystickFromInstanceID(joyid JoystickID) (retval *Joystick)
Return the SDL_Joystick associated with an instance id. ↪ https://wiki.libsdl.org/SDL_JoystickFromInstanceID
func JoystickOpen ¶
Open a joystick for use. The index passed as an argument refers to the N'th joystick on the system. This index is not the value which will identify this joystick in future joystick events. The joystick's instance id (SDL_JoystickID) will be used there instead.
Returns: A joystick identifier, or NULL if an error occurred.
func (*Joystick) Close ¶
func (joystick *Joystick) Close()
Close a joystick previously opened with SDL_JoystickOpen(). ↪ https://wiki.libsdl.org/SDL_JoystickClose
func (*Joystick) CurrentPowerLevel ¶
func (joystick *Joystick) CurrentPowerLevel() (retval JoystickPowerLevel)
Return the battery level of this joystick ↪ https://wiki.libsdl.org/SDL_JoystickCurrentPowerLevel
func (*Joystick) GetAttached ¶
Returns SDL_TRUE if the joystick has been opened and currently connected, or SDL_FALSE if it has not. ↪ https://wiki.libsdl.org/SDL_JoystickGetAttached
func (*Joystick) GetAxis ¶
Get the current state of an axis control on a joystick.
The state is a value ranging from -32768 to 32767.
The axis indices start at index 0. ↪ https://wiki.libsdl.org/SDL_JoystickGetAxis
func (*Joystick) GetBall ¶
Get the ball axis change since the last poll.
Returns: 0, or -1 if you passed it invalid parameters.
The ball indices start at index 0. ↪ https://wiki.libsdl.org/SDL_JoystickGetBall
func (*Joystick) GetButton ¶
Get the current state of a button on a joystick.
The button indices start at index 0. ↪ https://wiki.libsdl.org/SDL_JoystickGetButton
func (*Joystick) GetGUID ¶
func (joystick *Joystick) GetGUID() (retval JoystickGUID)
Return the GUID for this opened joystick ↪ https://wiki.libsdl.org/SDL_JoystickGetGUID
func (*Joystick) GetHat ¶
Get the current state of a POV hat on a joystick.
The hat indices start at index 0.
Returns: The return value is one of the following positions:
- SDL_HAT_CENTERED
- SDL_HAT_UP
- SDL_HAT_RIGHT
- SDL_HAT_DOWN
- SDL_HAT_LEFT
- SDL_HAT_RIGHTUP
- SDL_HAT_RIGHTDOWN
- SDL_HAT_LEFTUP
- SDL_HAT_LEFTDOWN
func (*Joystick) HapticOpenFrom ¶
Opens a Haptic device for usage from a Joystick device.
You must still close the haptic device separately. It will not be closed with the joystick.
When opening from a joystick you should first close the haptic device before closing the joystick device. If not, on some implementations the haptic device will also get unallocated and you'll be unable to use force feedback on that device.
Returns: A valid haptic device identifier on success or NULL on error.
See also: SDL_HapticOpen
See also: SDL_HapticClose
joystick Joystick to create a haptic device from.
func (*Joystick) InstanceID ¶
func (joystick *Joystick) InstanceID() (retval JoystickID)
Get the instance ID of an opened joystick or -1 if the joystick is invalid. ↪ https://wiki.libsdl.org/SDL_JoystickInstanceID
func (*Joystick) IsHaptic ¶
Checks to see if a joystick has haptic features.
Returns: 1 if the joystick is haptic, 0 if it isn't or -1 if an error ocurred.
See also: SDL_HapticOpenFromJoystick
joystick Joystick to test for haptic capabilities.
func (*Joystick) Name ¶
Return the name for this currently opened joystick. If no name can be found, this function returns NULL. ↪ https://wiki.libsdl.org/SDL_JoystickName
func (*Joystick) NumAxes ¶
Get the number of general axis controls on a joystick. ↪ https://wiki.libsdl.org/SDL_JoystickNumAxes
func (*Joystick) NumBalls ¶
Get the number of trackballs on a joystick.
Joystick trackballs have only relative motion events associated with them and their state cannot be polled. ↪ https://wiki.libsdl.org/SDL_JoystickNumBalls
func (*Joystick) NumButtons ¶
Get the number of buttons on a joystick. ↪ https://wiki.libsdl.org/SDL_JoystickNumButtons
func (*Joystick) NumHats ¶
Get the number of POV hats on a joystick. ↪ https://wiki.libsdl.org/SDL_JoystickNumHats
type JoystickGUID ¶
type JoystickGUID struct {
Data [16]uint8
}
func JoystickGetDeviceGUID ¶
func JoystickGetDeviceGUID(device_index int) (retval JoystickGUID)
Return the GUID for the joystick at this index ↪ https://wiki.libsdl.org/SDL_JoystickGetDeviceGUID
func JoystickGetGUIDFromString ¶
func JoystickGetGUIDFromString(pchGUID string) (retval JoystickGUID)
convert a string into a joystick formatted guid ↪ https://wiki.libsdl.org/SDL_JoystickGetGUIDFromString
type JoystickID ¶
type JoystickID int32
type JoystickPowerLevel ¶
type JoystickPowerLevel int
↪ https://wiki.libsdl.org/SDL_JoystickPowerLevel
const ( JOYSTICK_POWER_UNKNOWN JoystickPowerLevel = C.SDL_JOYSTICK_POWER_UNKNOWN JOYSTICK_POWER_EMPTY JoystickPowerLevel = C.SDL_JOYSTICK_POWER_EMPTY JOYSTICK_POWER_LOW JoystickPowerLevel = C.SDL_JOYSTICK_POWER_LOW JOYSTICK_POWER_MEDIUM JoystickPowerLevel = C.SDL_JOYSTICK_POWER_MEDIUM JOYSTICK_POWER_FULL JoystickPowerLevel = C.SDL_JOYSTICK_POWER_FULL JOYSTICK_POWER_WIRED JoystickPowerLevel = C.SDL_JOYSTICK_POWER_WIRED JOYSTICK_POWER_MAX JoystickPowerLevel = C.SDL_JOYSTICK_POWER_MAX )
type KeyboardEvent ¶
type KeyboardEvent struct { // SDL_KEYDOWN or SDL_KEYUP Type EventType Timestamp uint32 // The window with keyboard focus, if any WindowID uint32 // SDL_PRESSED or SDL_RELEASED State uint8 // Non-zero if this is a key repeat Repeat uint8 Padding2 uint8 Padding3 uint8 // The key that was pressed or released Keysym Keysym }
Keyboard button event structure (event.key.*) ↪ https://wiki.libsdl.org/SDL_KeyboardEvent
type Keycode ¶
type Keycode int32
The SDL virtual key representation.
Values of this type are used to represent keyboard keys using the current layout of the keyboard. These values include Unicode values representing the unmodified character that would be generated by pressing the key, or an SDLK_* constant for those keys that do not generate characters.
func GetKeyFromName ¶
Get a key code from a human-readable name.
Returns: key code, or SDLK_UNKNOWN if the name wasn't recognized
See also: SDL_Keycode
func GetKeyFromScancode ¶
Get the key code corresponding to the given scancode according to the current keyboard layout.
See SDL_Keycode for details.
See also: SDL_GetKeyName()
type Keymod ¶
type Keymod int
Enumeration of valid key mods (possibly OR'd together). ↪ https://wiki.libsdl.org/SDL_Keymod
const ( KMOD_NONE Keymod = C.KMOD_NONE KMOD_LSHIFT Keymod = C.KMOD_LSHIFT KMOD_RSHIFT Keymod = C.KMOD_RSHIFT KMOD_LCTRL Keymod = C.KMOD_LCTRL KMOD_RCTRL Keymod = C.KMOD_RCTRL KMOD_LALT Keymod = C.KMOD_LALT KMOD_RALT Keymod = C.KMOD_RALT KMOD_LGUI Keymod = C.KMOD_LGUI KMOD_RGUI Keymod = C.KMOD_RGUI KMOD_NUM Keymod = C.KMOD_NUM KMOD_CAPS Keymod = C.KMOD_CAPS KMOD_MODE Keymod = C.KMOD_MODE KMOD_RESERVED Keymod = C.KMOD_RESERVED )
func GetModState ¶
func GetModState() (retval Keymod)
Get the current key modifier state for the keyboard. ↪ https://wiki.libsdl.org/SDL_GetModState
type Keysym ¶
type Keysym struct { // SDL physical key code - see SDL_Scancode for details Scancode Scancode // SDL virtual key code - see SDL_Keycode for details Sym Keycode // current key modifiers Mod uint16 Unused uint32 }
The SDL keysym structure, used in key events.
Note: If you are looking for translated character input, see the SDL_TEXTINPUT event.
type MessageBoxButtonData ¶
type MessageBoxButtonData struct { // SDL_MessageBoxButtonFlags Flags uint32 // User defined button id (value returned via SDL_ShowMessageBox) Buttonid int // The UTF-8 button text Text string }
Individual button data. ↪ https://wiki.libsdl.org/SDL_MessageBoxButtonData
type MessageBoxButtonFlags ¶
type MessageBoxButtonFlags int
Flags for SDL_MessageBoxButtonData. ↪ https://wiki.libsdl.org/SDL_MessageBoxButtonFlags
const ( // Marks the default button when return is hit MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT MessageBoxButtonFlags = C.SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT // Marks the default button when escape is hit MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT MessageBoxButtonFlags = C.SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT )
type MessageBoxColor ¶
RGB value used in a message box color scheme. ↪ https://wiki.libsdl.org/SDL_MessageBoxColor
type MessageBoxColorScheme ¶
type MessageBoxColorScheme struct {
Colors [MESSAGEBOX_COLOR_MAX]MessageBoxColor
}
A set of colors to use for message box dialogs. ↪ https://wiki.libsdl.org/SDL_MessageBoxColorScheme
type MessageBoxColorType ¶
type MessageBoxColorType int
↪ https://wiki.libsdl.org/SDL_MessageBoxColorType
const ( MESSAGEBOX_COLOR_BACKGROUND MessageBoxColorType = C.SDL_MESSAGEBOX_COLOR_BACKGROUND MESSAGEBOX_COLOR_TEXT MessageBoxColorType = C.SDL_MESSAGEBOX_COLOR_TEXT MESSAGEBOX_COLOR_BUTTON_BORDER MessageBoxColorType = C.SDL_MESSAGEBOX_COLOR_BUTTON_BORDER MESSAGEBOX_COLOR_BUTTON_BACKGROUND MessageBoxColorType = C.SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND MESSAGEBOX_COLOR_BUTTON_SELECTED MessageBoxColorType = C.SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED MESSAGEBOX_COLOR_MAX MessageBoxColorType = C.SDL_MESSAGEBOX_COLOR_MAX )
type MessageBoxData ¶
type MessageBoxData struct { // SDL_MessageBoxFlags Flags uint32 // Parent window, can be NULL Window *Window // UTF-8 title Title string // UTF-8 message text Message string Buttons []MessageBoxButtonData // SDL_MessageBoxColorScheme, can be NULL to use system settings ColorScheme *MessageBoxColorScheme }
MessageBox structure containing title, text, window, etc. ↪ https://wiki.libsdl.org/SDL_MessageBoxData
type MessageBoxFlags ¶
type MessageBoxFlags int
SDL_MessageBox flags. If supported will display warning icon, etc. ↪ https://wiki.libsdl.org/SDL_MessageBoxFlags
const ( // error dialog MESSAGEBOX_ERROR MessageBoxFlags = C.SDL_MESSAGEBOX_ERROR // warning dialog MESSAGEBOX_WARNING MessageBoxFlags = C.SDL_MESSAGEBOX_WARNING // informational dialog MESSAGEBOX_INFORMATION MessageBoxFlags = C.SDL_MESSAGEBOX_INFORMATION )
type MouseButtonEvent ¶
type MouseButtonEvent struct { // SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP Type EventType Timestamp uint32 // The window with mouse focus, if any WindowID uint32 // The mouse instance id, or SDL_TOUCH_MOUSEID Which uint32 // The mouse button index Button uint8 // SDL_PRESSED or SDL_RELEASED State uint8 // 1 for single-click, 2 for double-click, etc. Clicks uint8 Padding1 uint8 // X coordinate, relative to window X int32 // Y coordinate, relative to window Y int32 }
Mouse button event structure (event.button.*) ↪ https://wiki.libsdl.org/SDL_MouseButtonEvent
type MouseMotionEvent ¶
type MouseMotionEvent struct { // SDL_MOUSEMOTION Type EventType Timestamp uint32 // The window with mouse focus, if any WindowID uint32 // The mouse instance id, or SDL_TOUCH_MOUSEID Which uint32 // The current button state State uint32 // X coordinate, relative to window X int32 // Y coordinate, relative to window Y int32 // The relative motion in the X direction Xrel int32 // The relative motion in the Y direction Yrel int32 }
Mouse motion event structure (event.motion.*) ↪ https://wiki.libsdl.org/SDL_MouseMotionEvent
type MouseWheelDirection ¶
type MouseWheelDirection int
Scroll direction types for the Scroll event.
const ( // The scroll direction is normal MOUSEWHEEL_NORMAL MouseWheelDirection = C.SDL_MOUSEWHEEL_NORMAL // The scroll direction is flipped / natural MOUSEWHEEL_FLIPPED MouseWheelDirection = C.SDL_MOUSEWHEEL_FLIPPED )
type MouseWheelEvent ¶
type MouseWheelEvent struct { // SDL_MOUSEWHEEL Type EventType Timestamp uint32 // The window with mouse focus, if any WindowID uint32 // The mouse instance id, or SDL_TOUCH_MOUSEID Which uint32 // The amount scrolled horizontally, positive to the right and negative // to the left X int32 // The amount scrolled vertically, positive away from the user and // negative toward the user Y int32 // Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in // X and Y will be opposite. Multiply by -1 to change them back Direction uint32 }
Mouse wheel event structure (event.wheel.*) ↪ https://wiki.libsdl.org/SDL_MouseWheelEvent
type MultiGestureEvent ¶
type MultiGestureEvent struct { // SDL_MULTIGESTURE Type EventType Timestamp uint32 // The touch device index TouchId TouchID DTheta float32 DDist float32 X float32 Y float32 NumFingers uint16 Padding uint16 }
Multiple Finger Gesture Event (event.mgesture.*) ↪ https://wiki.libsdl.org/SDL_MultiGestureEvent
type Palette ¶
type Palette C.SDL_Palette
↪ https://wiki.libsdl.org/SDL_Palette
func AllocPalette ¶
Create a palette structure with the specified number of color entries.
Returns: A new palette, or NULL if there wasn't enough memory.
Note: The palette entries are initialized to white.
See also: SDL_FreePalette()
func (*Palette) Free ¶
func (palette *Palette) Free()
Free a palette created with SDL_AllocPalette().
See also: SDL_AllocPalette()
func (*Palette) SetColors ¶
Set a range of colors in a palette.
Returns: 0 on success, or -1 if not all of the colors could be set.
palette The palette to modify. colors An array of colors to copy into the palette. firstcolor The index of the first palette entry to modify. ncolors The number of entries to modify.
type PixelFormat ¶
type PixelFormat C.SDL_PixelFormat
↪ https://wiki.libsdl.org/SDL_PixelFormat
func AllocFormat ¶
func AllocFormat(pixel_format uint32) (retval *PixelFormat)
Create an SDL_PixelFormat structure from a pixel format enum. ↪ https://wiki.libsdl.org/SDL_AllocFormat
func (*PixelFormat) FreeFormat ¶
func (format *PixelFormat) FreeFormat()
Free an SDL_PixelFormat structure. ↪ https://wiki.libsdl.org/SDL_FreeFormat
func (*PixelFormat) GetRGB ¶
func (format *PixelFormat) GetRGB(pixel uint32) (r byte, g byte, b byte)
Get the RGB components from a pixel of the specified format.
See also: SDL_GetRGBA
func (*PixelFormat) GetRGBA ¶
Get the RGBA components from a pixel of the specified format.
See also: SDL_GetRGB
func (*PixelFormat) MapRGB ¶
func (format *PixelFormat) MapRGB(r uint8, g uint8, b uint8) (retval uint32)
Maps an RGB triple to an opaque pixel value for a given pixel format.
See also: SDL_MapRGBA
func (*PixelFormat) MapRGBA ¶
Maps an RGBA quadruple to a pixel value for a given pixel format.
See also: SDL_MapRGB
func (*PixelFormat) SetPalette ¶
func (format *PixelFormat) SetPalette(palette *Palette) (retval int)
Set the palette for a pixel format structure. ↪ https://wiki.libsdl.org/SDL_SetPixelFormatPalette
type Point ¶
The structure that defines a point.
See also: SDL_EnclosePoints
See also: SDL_PointInRect
type PowerState ¶
type PowerState int
The basic state for the system's power supply. ↪ https://wiki.libsdl.org/SDL_PowerState
const ( // cannot determine power status POWERSTATE_UNKNOWN PowerState = C.SDL_POWERSTATE_UNKNOWN // Not plugged in, running on the battery POWERSTATE_ON_BATTERY PowerState = C.SDL_POWERSTATE_ON_BATTERY // Plugged in, no battery available POWERSTATE_NO_BATTERY PowerState = C.SDL_POWERSTATE_NO_BATTERY // Plugged in, charging battery POWERSTATE_CHARGING PowerState = C.SDL_POWERSTATE_CHARGING // Plugged in, battery charged POWERSTATE_CHARGED PowerState = C.SDL_POWERSTATE_CHARGED )
func GetPowerInfo ¶
func GetPowerInfo() (retval PowerState, secs int, pct int)
Get the current power supply details.
Returns: The state of the battery (if any).
secs Seconds of battery life left. You can pass a NULL here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery. pct Percentage of battery life left, between 0 and 100. You can pass a NULL here if you don't care. Will return -1 if we can't determine a value, or we're not running on a battery.
type QuitEvent ¶
The "quit requested" event. ↪ https://wiki.libsdl.org/SDL_QuitEvent
type RWops ¶
↪ https://wiki.libsdl.org/SDL_RWops
func RWFromFile ¶
func (*RWops) Close ¶
Make sure you call Close() when you're done with an RWops to avoid leaking memory. Alternatively many functions that accept *sdl.RWops arguments support a parameter that tells them to close the RWops when they're done. If you use this parameter that is sufficient.
WARNING! Calling Close() multiple times may cause your program to crash or worse may silently corrupt memory!
type Rect ¶
A rectangle, with the origin at the upper left.
See also: SDL_RectEmpty
See also: SDL_RectEquals
See also: SDL_HasIntersection
See also: SDL_IntersectRect
See also: SDL_UnionRect
See also: SDL_EnclosePoints
↪ https://wiki.libsdl.org/SDL_Rect
func EnclosePoints ¶
Calculate a minimal rectangle enclosing a set of points.
Returns: SDL_TRUE if any points were within the clipping rect
func GetDisplayBounds ¶
Get the desktop area represented by a display, with the primary display located at 0,0.
Returns: 0 on success, or -1 if the index is out of range.
See also: SDL_GetNumVideoDisplays()
func IntersectRect ¶
Calculate the intersection of two rectangles.
Returns: SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
type Renderer ¶
type Renderer C.SDL_Renderer
func (*Renderer) Clear ¶
Clear the current rendering target with the drawing color.
This function clears the entire rendering target, ignoring the viewport.
Returns: 0 on success, or -1 on error
func (*Renderer) Copy ¶
Copy a portion of the texture to the current rendering target.
Returns: 0 on success, or -1 on error
renderer The renderer which should copy parts of a texture. texture The source texture. srcrect A pointer to the source rectangle, or NULL for the entire texture. dstrect A pointer to the destination rectangle, or NULL for the entire rendering target.
func (*Renderer) CopyEx ¶
func (renderer *Renderer) CopyEx(texture *Texture, srcrect Rect, dstrect Rect, angle float64, center Point, flip RendererFlip) (retval int)
Copy a portion of the source texture to the current rendering target, rotating it by angle around the given center.
Returns: 0 on success, or -1 on error
renderer The renderer which should copy parts of a texture. texture The source texture. srcrect A pointer to the source rectangle, or NULL for the entire texture. dstrect A pointer to the destination rectangle, or NULL for the entire rendering target. angle An angle in degrees that indicates the rotation that will be applied to dstrect center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture
func (*Renderer) CreateTexture ¶
Create a texture for a rendering context.
Returns: The created texture is returned, or NULL if no rendering context was active, the format was unsupported, or the width or height were out of range.
See also: SDL_QueryTexture()
See also: SDL_UpdateTexture()
See also: SDL_DestroyTexture()
renderer The renderer. format The format of the texture. access One of the enumerated values in SDL_TextureAccess. w The width of the texture in pixels. h The height of the texture in pixels.
func (*Renderer) CreateTextureFromSurface ¶
Create a texture from an existing surface.
Returns: The created texture is returned, or NULL on error.
Note: The surface is not modified or freed by this function.
See also: SDL_QueryTexture()
See also: SDL_DestroyTexture()
renderer The renderer. surface The surface containing pixel data used to fill the texture.
func (*Renderer) Destroy ¶
func (renderer *Renderer) Destroy()
Destroy the rendering context for a window and free associated textures.
See also: SDL_CreateRenderer()
func (*Renderer) DrawLine ¶
Draw a line on the current rendering target.
Returns: 0 on success, or -1 on error
renderer The renderer which should draw a line. x1 The x coordinate of the start point. y1 The y coordinate of the start point. x2 The x coordinate of the end point. y2 The y coordinate of the end point.
func (*Renderer) DrawLines ¶
Draw a series of connected lines on the current rendering target.
Returns: 0 on success, or -1 on error
renderer The renderer which should draw multiple lines. points The points along the lines count The number of points, drawing count-1 lines
func (*Renderer) DrawPoint ¶
Draw a point on the current rendering target.
Returns: 0 on success, or -1 on error
renderer The renderer which should draw a point. x The x coordinate of the point. y The y coordinate of the point.
func (*Renderer) DrawPoints ¶
Draw multiple points on the current rendering target.
Returns: 0 on success, or -1 on error
renderer The renderer which should draw multiple points. points The points to draw count The number of points to draw
func (*Renderer) DrawRect ¶
Draw a rectangle on the current rendering target.
Returns: 0 on success, or -1 on error
renderer The renderer which should draw a rectangle. rect A pointer to the destination rectangle, or NULL to outline the entire rendering target.
func (*Renderer) DrawRects ¶
Draw some number of rectangles on the current rendering target.
Returns: 0 on success, or -1 on error
renderer The renderer which should draw multiple rectangles. rects A pointer to an array of destination rectangles. count The number of rectangles.
func (*Renderer) FillRect ¶
Fill a rectangle on the current rendering target with the drawing color.
Returns: 0 on success, or -1 on error
renderer The renderer which should fill a rectangle. rect A pointer to the destination rectangle, or NULL for the entire rendering target.
func (*Renderer) FillRects ¶
Fill some number of rectangles on the current rendering target with the drawing color.
Returns: 0 on success, or -1 on error
renderer The renderer which should fill multiple rectangles. rects A pointer to an array of destination rectangles. count The number of rectangles.
func (*Renderer) GetClipRect ¶
Get the clip rectangle for the current target.
See also: SDL_RenderSetClipRect()
renderer The renderer from which clip rectangle should be queried. rect A pointer filled in with the current clip rectangle, or an empty rectangle if clipping is disabled.
func (*Renderer) GetDrawBlendMode ¶
Get the blend mode used for drawing operations.
Returns: 0 on success, or -1 on error
See also: SDL_SetRenderDrawBlendMode()
renderer The renderer from which blend mode should be queried. blendMode A pointer filled in with the current blend mode.
func (*Renderer) GetDrawColor ¶
Get the color used for drawing operations (Rect, Line and Clear).
Returns: 0 on success, or -1 on error
renderer The renderer from which drawing color should be queried. r A pointer to the red value used to draw on the rendering target. g A pointer to the green value used to draw on the rendering target. b A pointer to the blue value used to draw on the rendering target. a A pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255).
func (*Renderer) GetInfo ¶
func (renderer *Renderer) GetInfo() (retval int, info *RendererInfo)
Get information about a rendering context. ↪ https://wiki.libsdl.org/SDL_GetRendererInfo
func (*Renderer) GetLogicalSize ¶
Get device independent resolution for rendering.
See also: SDL_RenderSetLogicalSize()
renderer The renderer from which resolution should be queried. w A pointer filled with the width of the logical resolution h A pointer filled with the height of the logical resolution
func (*Renderer) GetOutputSize ¶
Get the output size in pixels of a rendering context. ↪ https://wiki.libsdl.org/SDL_GetRendererOutputSize
func (*Renderer) GetScale ¶
Get the drawing scale for the current target.
See also: SDL_RenderSetScale()
renderer The renderer from which drawing scale should be queried. scaleX A pointer filled in with the horizontal scaling factor scaleY A pointer filled in with the vertical scaling factor
func (*Renderer) GetTarget ¶
Get the current render target or NULL for the default render target.
Returns: The current render target
See also: SDL_SetRenderTarget()
func (*Renderer) GetViewport ¶
Get the drawing area for the current target.
See also: SDL_RenderSetViewport()
func (*Renderer) IsClipEnabled ¶
Get whether clipping is enabled on the given renderer.
See also: SDL_RenderGetClipRect()
renderer The renderer from which clip state should be queried.
func (*Renderer) Present ¶
func (renderer *Renderer) Present()
Update the screen with rendering performed. ↪ https://wiki.libsdl.org/SDL_RenderPresent
func (*Renderer) ReadPixels ¶
func (renderer *Renderer) ReadPixels(rect *Rect, format uint32, pixels []byte, pitch int) (retval int)
Read pixels from the current rendering target.
Returns: 0 on success, or -1 if pixel reading is not supported.
Warning: This is a very slow operation, and should not be used frequently.
renderer The renderer from which pixels should be read. rect A pointer to the rectangle to read, or NULL for the entire render target. format The desired format of the pixel data, or 0 to use the format of the rendering target pixels A pointer to be filled in with the pixel data pitch The pitch of the pixels parameter.
func (*Renderer) SetClipRect ¶
Set the clip rectangle for the current target.
Returns: 0 on success, or -1 on error
See also: SDL_RenderGetClipRect()
renderer The renderer for which clip rectangle should be set. rect A pointer to the rectangle to set as the clip rectangle, or NULL to disable clipping.
func (*Renderer) SetDrawBlendMode ¶
Set the blend mode used for drawing operations (Fill and Line).
Returns: 0 on success, or -1 on error
Note: If the blend mode is not supported, the closest supported mode is chosen.
See also: SDL_GetRenderDrawBlendMode()
renderer The renderer for which blend mode should be set. blendMode SDL_BlendMode to use for blending.
func (*Renderer) SetDrawColor ¶
Set the color used for drawing operations (Rect, Line and Clear).
Returns: 0 on success, or -1 on error
renderer The renderer for which drawing color should be set. r The red value used to draw on the rendering target. g The green value used to draw on the rendering target. b The blue value used to draw on the rendering target. a The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255).
func (*Renderer) SetLogicalSize ¶
Set device independent resolution for rendering.
renderer The renderer for which resolution should be set. w The width of the logical resolution h The height of the logical resolution
This function uses the viewport and scaling functionality to allow a fixed logical resolution for rendering, regardless of the actual output resolution. If the actual output resolution doesn't have the same aspect ratio the output rendering will be centered within the output display.
If the output display is a window, mouse events in the window will be filtered and scaled so they seem to arrive within the logical resolution.
Note: If this function results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints.
See also: SDL_RenderGetLogicalSize()
See also: SDL_RenderSetScale()
See also: SDL_RenderSetViewport()
func (*Renderer) SetScale ¶
Set the drawing scale for rendering on the current target.
renderer The renderer for which the drawing scale should be set. scaleX The horizontal scaling factor scaleY The vertical scaling factor
The drawing coordinates are scaled by the x/y scaling factors before they are used by the renderer. This allows resolution independent drawing with a single coordinate system.
Note: If this results in scaling or subpixel drawing by the rendering backend, it will be handled using the appropriate quality hints. For best results use integer scaling factors.
See also: SDL_RenderGetScale()
See also: SDL_RenderSetLogicalSize()
func (*Renderer) SetTarget ¶
Set a texture as the current rendering target.
Returns: 0 on success, or -1 on error
See also: SDL_GetRenderTarget()
renderer The renderer. texture The targeted texture, which must be created with the SDL_TEXTUREACCESS_TARGET flag, or NULL for the default render target
func (*Renderer) SetViewport ¶
Set the drawing area for rendering on the current target.
renderer The renderer for which the drawing area should be set. rect The rectangle representing the drawing area, or NULL to set the viewport to the entire target.
The x,y of the viewport rect represents the origin for rendering.
Returns: 0 on success, or -1 on error
Note: If the window associated with the renderer is resized, the viewport is automatically reset.
See also: SDL_RenderGetViewport()
See also: SDL_RenderSetLogicalSize()
func (*Renderer) TargetSupported ¶
Determines whether a window supports the use of render targets.
Returns: SDL_TRUE if supported, SDL_FALSE if not.
renderer The renderer that will be checked
type RendererFlags ¶
type RendererFlags int
Flags used when creating a rendering context. ↪ https://wiki.libsdl.org/SDL_RendererFlags
const ( // The renderer is a software fallback RENDERER_SOFTWARE RendererFlags = C.SDL_RENDERER_SOFTWARE // The renderer uses hardware acceleration RENDERER_ACCELERATED RendererFlags = C.SDL_RENDERER_ACCELERATED // Present is synchronized with the refresh rate RENDERER_PRESENTVSYNC RendererFlags = C.SDL_RENDERER_PRESENTVSYNC // The renderer supports rendering to texture RENDERER_TARGETTEXTURE RendererFlags = C.SDL_RENDERER_TARGETTEXTURE )
type RendererFlip ¶
type RendererFlip int
Flip constants for SDL_RenderCopyEx. ↪ https://wiki.libsdl.org/SDL_RendererFlip
const ( // Do not flip FLIP_NONE RendererFlip = C.SDL_FLIP_NONE // flip horizontally FLIP_HORIZONTAL RendererFlip = C.SDL_FLIP_HORIZONTAL // flip vertically FLIP_VERTICAL RendererFlip = C.SDL_FLIP_VERTICAL )
type RendererInfo ¶
type RendererInfo struct { // The name of the renderer Name string // Supported SDL_RendererFlags Flags uint32 // The number of available texture formats Num_texture_formats uint32 // The available texture formats Texture_formats [16]uint32 // The maximum texture width Max_texture_width int // The maximum texture height Max_texture_height int }
Information on the capabilities of a render driver or context. ↪ https://wiki.libsdl.org/SDL_RendererInfo
func GetRenderDriverInfo ¶
func GetRenderDriverInfo(index int) (retval int, info *RendererInfo)
Get information about a specific 2D rendering driver for the current display.
Returns: 0 on success, -1 if the index was out of range.
See also: SDL_CreateRenderer()
index The index of the driver to query information about. info A pointer to an SDL_RendererInfo struct to be filled with information on the rendering driver.
type Scancode ¶
type Scancode int
The SDL keyboard scancode representation.
Values of this type are used to represent keyboard keys, among other places in the key.keysym.scancode field of the SDL_Event structure.
The values in this enumeration are based on the USB usage page standard: http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf ↪ https://wiki.libsdl.org/SDL_Scancode
const ( SCANCODE_UNKNOWN Scancode = C.SDL_SCANCODE_UNKNOWN SCANCODE_A Scancode = C.SDL_SCANCODE_A SCANCODE_B Scancode = C.SDL_SCANCODE_B SCANCODE_C Scancode = C.SDL_SCANCODE_C SCANCODE_D Scancode = C.SDL_SCANCODE_D SCANCODE_E Scancode = C.SDL_SCANCODE_E SCANCODE_F Scancode = C.SDL_SCANCODE_F SCANCODE_G Scancode = C.SDL_SCANCODE_G SCANCODE_H Scancode = C.SDL_SCANCODE_H SCANCODE_I Scancode = C.SDL_SCANCODE_I SCANCODE_J Scancode = C.SDL_SCANCODE_J SCANCODE_K Scancode = C.SDL_SCANCODE_K SCANCODE_L Scancode = C.SDL_SCANCODE_L SCANCODE_M Scancode = C.SDL_SCANCODE_M SCANCODE_N Scancode = C.SDL_SCANCODE_N SCANCODE_O Scancode = C.SDL_SCANCODE_O SCANCODE_P Scancode = C.SDL_SCANCODE_P SCANCODE_Q Scancode = C.SDL_SCANCODE_Q SCANCODE_R Scancode = C.SDL_SCANCODE_R SCANCODE_S Scancode = C.SDL_SCANCODE_S SCANCODE_T Scancode = C.SDL_SCANCODE_T SCANCODE_U Scancode = C.SDL_SCANCODE_U SCANCODE_V Scancode = C.SDL_SCANCODE_V SCANCODE_W Scancode = C.SDL_SCANCODE_W SCANCODE_X Scancode = C.SDL_SCANCODE_X SCANCODE_Y Scancode = C.SDL_SCANCODE_Y SCANCODE_Z Scancode = C.SDL_SCANCODE_Z SCANCODE_1 Scancode = C.SDL_SCANCODE_1 SCANCODE_2 Scancode = C.SDL_SCANCODE_2 SCANCODE_3 Scancode = C.SDL_SCANCODE_3 SCANCODE_4 Scancode = C.SDL_SCANCODE_4 SCANCODE_5 Scancode = C.SDL_SCANCODE_5 SCANCODE_6 Scancode = C.SDL_SCANCODE_6 SCANCODE_7 Scancode = C.SDL_SCANCODE_7 SCANCODE_8 Scancode = C.SDL_SCANCODE_8 SCANCODE_9 Scancode = C.SDL_SCANCODE_9 SCANCODE_0 Scancode = C.SDL_SCANCODE_0 SCANCODE_RETURN Scancode = C.SDL_SCANCODE_RETURN SCANCODE_ESCAPE Scancode = C.SDL_SCANCODE_ESCAPE SCANCODE_BACKSPACE Scancode = C.SDL_SCANCODE_BACKSPACE SCANCODE_TAB Scancode = C.SDL_SCANCODE_TAB SCANCODE_SPACE Scancode = C.SDL_SCANCODE_SPACE SCANCODE_MINUS Scancode = C.SDL_SCANCODE_MINUS SCANCODE_EQUALS Scancode = C.SDL_SCANCODE_EQUALS SCANCODE_LEFTBRACKET Scancode = C.SDL_SCANCODE_LEFTBRACKET SCANCODE_RIGHTBRACKET Scancode = C.SDL_SCANCODE_RIGHTBRACKET // Located at the lower left of the return key on ISO keyboards and at // the right end of the QWERTY row on ANSI keyboards. Produces REVERSE // SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS // and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK // Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, // NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND // SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French // Windows layout. SCANCODE_BACKSLASH Scancode = C.SDL_SCANCODE_BACKSLASH // ISO USB keyboards actually use this code instead of 49 for the same // key, but all OSes I've seen treat the two codes identically. So, as an // implementor, unless your keyboard generates both of those codes and // your OS treats them differently, you should generate // SDL_SCANCODE_BACKSLASH instead of this code. As a user, you should not // rely on this code because SDL will never generate it with most (all?) // keyboards. SCANCODE_NONUSHASH Scancode = C.SDL_SCANCODE_NONUSHASH SCANCODE_SEMICOLON Scancode = C.SDL_SCANCODE_SEMICOLON SCANCODE_APOSTROPHE Scancode = C.SDL_SCANCODE_APOSTROPHE // Located in the top left corner (on both ANSI and ISO keyboards). // Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and // UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK // Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac // layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss // German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and // DEGREE SIGN in a German layout (Mac: only on ISO keyboards), // SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT // and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN // SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac // layout on ANSI keyboards. SCANCODE_GRAVE Scancode = C.SDL_SCANCODE_GRAVE SCANCODE_COMMA Scancode = C.SDL_SCANCODE_COMMA SCANCODE_PERIOD Scancode = C.SDL_SCANCODE_PERIOD SCANCODE_SLASH Scancode = C.SDL_SCANCODE_SLASH SCANCODE_CAPSLOCK Scancode = C.SDL_SCANCODE_CAPSLOCK SCANCODE_F1 Scancode = C.SDL_SCANCODE_F1 SCANCODE_F2 Scancode = C.SDL_SCANCODE_F2 SCANCODE_F3 Scancode = C.SDL_SCANCODE_F3 SCANCODE_F4 Scancode = C.SDL_SCANCODE_F4 SCANCODE_F5 Scancode = C.SDL_SCANCODE_F5 SCANCODE_F6 Scancode = C.SDL_SCANCODE_F6 SCANCODE_F7 Scancode = C.SDL_SCANCODE_F7 SCANCODE_F8 Scancode = C.SDL_SCANCODE_F8 SCANCODE_F9 Scancode = C.SDL_SCANCODE_F9 SCANCODE_F10 Scancode = C.SDL_SCANCODE_F10 SCANCODE_F11 Scancode = C.SDL_SCANCODE_F11 SCANCODE_F12 Scancode = C.SDL_SCANCODE_F12 SCANCODE_PRINTSCREEN Scancode = C.SDL_SCANCODE_PRINTSCREEN SCANCODE_SCROLLLOCK Scancode = C.SDL_SCANCODE_SCROLLLOCK SCANCODE_PAUSE Scancode = C.SDL_SCANCODE_PAUSE // insert on PC, help on some Mac keyboards (but does send code 73, not // 117) SCANCODE_INSERT Scancode = C.SDL_SCANCODE_INSERT SCANCODE_HOME Scancode = C.SDL_SCANCODE_HOME SCANCODE_PAGEUP Scancode = C.SDL_SCANCODE_PAGEUP SCANCODE_DELETE Scancode = C.SDL_SCANCODE_DELETE SCANCODE_END Scancode = C.SDL_SCANCODE_END SCANCODE_PAGEDOWN Scancode = C.SDL_SCANCODE_PAGEDOWN SCANCODE_RIGHT Scancode = C.SDL_SCANCODE_RIGHT SCANCODE_LEFT Scancode = C.SDL_SCANCODE_LEFT SCANCODE_DOWN Scancode = C.SDL_SCANCODE_DOWN SCANCODE_UP Scancode = C.SDL_SCANCODE_UP // num lock on PC, clear on Mac keyboards SCANCODE_NUMLOCKCLEAR Scancode = C.SDL_SCANCODE_NUMLOCKCLEAR SCANCODE_KP_DIVIDE Scancode = C.SDL_SCANCODE_KP_DIVIDE SCANCODE_KP_MULTIPLY Scancode = C.SDL_SCANCODE_KP_MULTIPLY SCANCODE_KP_MINUS Scancode = C.SDL_SCANCODE_KP_MINUS SCANCODE_KP_PLUS Scancode = C.SDL_SCANCODE_KP_PLUS SCANCODE_KP_ENTER Scancode = C.SDL_SCANCODE_KP_ENTER SCANCODE_KP_1 Scancode = C.SDL_SCANCODE_KP_1 SCANCODE_KP_2 Scancode = C.SDL_SCANCODE_KP_2 SCANCODE_KP_3 Scancode = C.SDL_SCANCODE_KP_3 SCANCODE_KP_4 Scancode = C.SDL_SCANCODE_KP_4 SCANCODE_KP_5 Scancode = C.SDL_SCANCODE_KP_5 SCANCODE_KP_6 Scancode = C.SDL_SCANCODE_KP_6 SCANCODE_KP_7 Scancode = C.SDL_SCANCODE_KP_7 SCANCODE_KP_8 Scancode = C.SDL_SCANCODE_KP_8 SCANCODE_KP_9 Scancode = C.SDL_SCANCODE_KP_9 SCANCODE_KP_0 Scancode = C.SDL_SCANCODE_KP_0 SCANCODE_KP_PERIOD Scancode = C.SDL_SCANCODE_KP_PERIOD // This is the additional key that ISO keyboards have over ANSI ones, // located between left shift and Y. Produces GRAVE ACCENT and TILDE in a // US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in // a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in // a Swiss German, German, or French layout. SCANCODE_NONUSBACKSLASH Scancode = C.SDL_SCANCODE_NONUSBACKSLASH // windows contextual menu, compose SCANCODE_APPLICATION Scancode = C.SDL_SCANCODE_APPLICATION // The USB document says this is a status flag, not a physical key - but // some Mac keyboards do have a power key. SCANCODE_POWER Scancode = C.SDL_SCANCODE_POWER SCANCODE_KP_EQUALS Scancode = C.SDL_SCANCODE_KP_EQUALS SCANCODE_F13 Scancode = C.SDL_SCANCODE_F13 SCANCODE_F14 Scancode = C.SDL_SCANCODE_F14 SCANCODE_F15 Scancode = C.SDL_SCANCODE_F15 SCANCODE_F16 Scancode = C.SDL_SCANCODE_F16 SCANCODE_F17 Scancode = C.SDL_SCANCODE_F17 SCANCODE_F18 Scancode = C.SDL_SCANCODE_F18 SCANCODE_F19 Scancode = C.SDL_SCANCODE_F19 SCANCODE_F20 Scancode = C.SDL_SCANCODE_F20 SCANCODE_F21 Scancode = C.SDL_SCANCODE_F21 SCANCODE_F22 Scancode = C.SDL_SCANCODE_F22 SCANCODE_F23 Scancode = C.SDL_SCANCODE_F23 SCANCODE_F24 Scancode = C.SDL_SCANCODE_F24 SCANCODE_EXECUTE Scancode = C.SDL_SCANCODE_EXECUTE SCANCODE_HELP Scancode = C.SDL_SCANCODE_HELP SCANCODE_MENU Scancode = C.SDL_SCANCODE_MENU SCANCODE_SELECT Scancode = C.SDL_SCANCODE_SELECT SCANCODE_STOP Scancode = C.SDL_SCANCODE_STOP // redo SCANCODE_AGAIN Scancode = C.SDL_SCANCODE_AGAIN SCANCODE_UNDO Scancode = C.SDL_SCANCODE_UNDO SCANCODE_CUT Scancode = C.SDL_SCANCODE_CUT SCANCODE_COPY Scancode = C.SDL_SCANCODE_COPY SCANCODE_PASTE Scancode = C.SDL_SCANCODE_PASTE SCANCODE_FIND Scancode = C.SDL_SCANCODE_FIND SCANCODE_MUTE Scancode = C.SDL_SCANCODE_MUTE SCANCODE_VOLUMEUP Scancode = C.SDL_SCANCODE_VOLUMEUP SCANCODE_VOLUMEDOWN Scancode = C.SDL_SCANCODE_VOLUMEDOWN SCANCODE_KP_COMMA Scancode = C.SDL_SCANCODE_KP_COMMA SCANCODE_KP_EQUALSAS400 Scancode = C.SDL_SCANCODE_KP_EQUALSAS400 // used on Asian keyboards, see footnotes in USB doc SCANCODE_INTERNATIONAL1 Scancode = C.SDL_SCANCODE_INTERNATIONAL1 SCANCODE_INTERNATIONAL2 Scancode = C.SDL_SCANCODE_INTERNATIONAL2 // Yen SCANCODE_INTERNATIONAL3 Scancode = C.SDL_SCANCODE_INTERNATIONAL3 SCANCODE_INTERNATIONAL4 Scancode = C.SDL_SCANCODE_INTERNATIONAL4 SCANCODE_INTERNATIONAL5 Scancode = C.SDL_SCANCODE_INTERNATIONAL5 SCANCODE_INTERNATIONAL6 Scancode = C.SDL_SCANCODE_INTERNATIONAL6 SCANCODE_INTERNATIONAL7 Scancode = C.SDL_SCANCODE_INTERNATIONAL7 SCANCODE_INTERNATIONAL8 Scancode = C.SDL_SCANCODE_INTERNATIONAL8 SCANCODE_INTERNATIONAL9 Scancode = C.SDL_SCANCODE_INTERNATIONAL9 // Hangul/English toggle SCANCODE_LANG1 Scancode = C.SDL_SCANCODE_LANG1 // Hanja conversion SCANCODE_LANG2 Scancode = C.SDL_SCANCODE_LANG2 // Katakana SCANCODE_LANG3 Scancode = C.SDL_SCANCODE_LANG3 // Hiragana SCANCODE_LANG4 Scancode = C.SDL_SCANCODE_LANG4 // Zenkaku/Hankaku SCANCODE_LANG5 Scancode = C.SDL_SCANCODE_LANG5 // reserved SCANCODE_LANG6 Scancode = C.SDL_SCANCODE_LANG6 // reserved SCANCODE_LANG7 Scancode = C.SDL_SCANCODE_LANG7 // reserved SCANCODE_LANG8 Scancode = C.SDL_SCANCODE_LANG8 // reserved SCANCODE_LANG9 Scancode = C.SDL_SCANCODE_LANG9 // Erase-Eaze SCANCODE_ALTERASE Scancode = C.SDL_SCANCODE_ALTERASE SCANCODE_SYSREQ Scancode = C.SDL_SCANCODE_SYSREQ SCANCODE_CANCEL Scancode = C.SDL_SCANCODE_CANCEL SCANCODE_CLEAR Scancode = C.SDL_SCANCODE_CLEAR SCANCODE_PRIOR Scancode = C.SDL_SCANCODE_PRIOR SCANCODE_RETURN2 Scancode = C.SDL_SCANCODE_RETURN2 SCANCODE_SEPARATOR Scancode = C.SDL_SCANCODE_SEPARATOR SCANCODE_OUT Scancode = C.SDL_SCANCODE_OUT SCANCODE_OPER Scancode = C.SDL_SCANCODE_OPER SCANCODE_CLEARAGAIN Scancode = C.SDL_SCANCODE_CLEARAGAIN SCANCODE_CRSEL Scancode = C.SDL_SCANCODE_CRSEL SCANCODE_EXSEL Scancode = C.SDL_SCANCODE_EXSEL SCANCODE_KP_00 Scancode = C.SDL_SCANCODE_KP_00 SCANCODE_KP_000 Scancode = C.SDL_SCANCODE_KP_000 SCANCODE_THOUSANDSSEPARATOR Scancode = C.SDL_SCANCODE_THOUSANDSSEPARATOR SCANCODE_DECIMALSEPARATOR Scancode = C.SDL_SCANCODE_DECIMALSEPARATOR SCANCODE_CURRENCYUNIT Scancode = C.SDL_SCANCODE_CURRENCYUNIT SCANCODE_CURRENCYSUBUNIT Scancode = C.SDL_SCANCODE_CURRENCYSUBUNIT SCANCODE_KP_LEFTPAREN Scancode = C.SDL_SCANCODE_KP_LEFTPAREN SCANCODE_KP_RIGHTPAREN Scancode = C.SDL_SCANCODE_KP_RIGHTPAREN SCANCODE_KP_LEFTBRACE Scancode = C.SDL_SCANCODE_KP_LEFTBRACE SCANCODE_KP_RIGHTBRACE Scancode = C.SDL_SCANCODE_KP_RIGHTBRACE SCANCODE_KP_TAB Scancode = C.SDL_SCANCODE_KP_TAB SCANCODE_KP_BACKSPACE Scancode = C.SDL_SCANCODE_KP_BACKSPACE SCANCODE_KP_A Scancode = C.SDL_SCANCODE_KP_A SCANCODE_KP_B Scancode = C.SDL_SCANCODE_KP_B SCANCODE_KP_C Scancode = C.SDL_SCANCODE_KP_C SCANCODE_KP_D Scancode = C.SDL_SCANCODE_KP_D SCANCODE_KP_E Scancode = C.SDL_SCANCODE_KP_E SCANCODE_KP_F Scancode = C.SDL_SCANCODE_KP_F SCANCODE_KP_XOR Scancode = C.SDL_SCANCODE_KP_XOR SCANCODE_KP_POWER Scancode = C.SDL_SCANCODE_KP_POWER SCANCODE_KP_PERCENT Scancode = C.SDL_SCANCODE_KP_PERCENT SCANCODE_KP_LESS Scancode = C.SDL_SCANCODE_KP_LESS SCANCODE_KP_GREATER Scancode = C.SDL_SCANCODE_KP_GREATER SCANCODE_KP_AMPERSAND Scancode = C.SDL_SCANCODE_KP_AMPERSAND SCANCODE_KP_DBLAMPERSAND Scancode = C.SDL_SCANCODE_KP_DBLAMPERSAND SCANCODE_KP_VERTICALBAR Scancode = C.SDL_SCANCODE_KP_VERTICALBAR SCANCODE_KP_DBLVERTICALBAR Scancode = C.SDL_SCANCODE_KP_DBLVERTICALBAR SCANCODE_KP_COLON Scancode = C.SDL_SCANCODE_KP_COLON SCANCODE_KP_HASH Scancode = C.SDL_SCANCODE_KP_HASH SCANCODE_KP_SPACE Scancode = C.SDL_SCANCODE_KP_SPACE SCANCODE_KP_AT Scancode = C.SDL_SCANCODE_KP_AT SCANCODE_KP_EXCLAM Scancode = C.SDL_SCANCODE_KP_EXCLAM SCANCODE_KP_MEMSTORE Scancode = C.SDL_SCANCODE_KP_MEMSTORE SCANCODE_KP_MEMRECALL Scancode = C.SDL_SCANCODE_KP_MEMRECALL SCANCODE_KP_MEMCLEAR Scancode = C.SDL_SCANCODE_KP_MEMCLEAR SCANCODE_KP_MEMADD Scancode = C.SDL_SCANCODE_KP_MEMADD SCANCODE_KP_MEMSUBTRACT Scancode = C.SDL_SCANCODE_KP_MEMSUBTRACT SCANCODE_KP_MEMMULTIPLY Scancode = C.SDL_SCANCODE_KP_MEMMULTIPLY SCANCODE_KP_MEMDIVIDE Scancode = C.SDL_SCANCODE_KP_MEMDIVIDE SCANCODE_KP_PLUSMINUS Scancode = C.SDL_SCANCODE_KP_PLUSMINUS SCANCODE_KP_CLEAR Scancode = C.SDL_SCANCODE_KP_CLEAR SCANCODE_KP_CLEARENTRY Scancode = C.SDL_SCANCODE_KP_CLEARENTRY SCANCODE_KP_BINARY Scancode = C.SDL_SCANCODE_KP_BINARY SCANCODE_KP_OCTAL Scancode = C.SDL_SCANCODE_KP_OCTAL SCANCODE_KP_DECIMAL Scancode = C.SDL_SCANCODE_KP_DECIMAL SCANCODE_KP_HEXADECIMAL Scancode = C.SDL_SCANCODE_KP_HEXADECIMAL SCANCODE_LCTRL Scancode = C.SDL_SCANCODE_LCTRL SCANCODE_LSHIFT Scancode = C.SDL_SCANCODE_LSHIFT // alt, option SCANCODE_LALT Scancode = C.SDL_SCANCODE_LALT // windows, command (apple), meta SCANCODE_LGUI Scancode = C.SDL_SCANCODE_LGUI SCANCODE_RCTRL Scancode = C.SDL_SCANCODE_RCTRL SCANCODE_RSHIFT Scancode = C.SDL_SCANCODE_RSHIFT // alt gr, option SCANCODE_RALT Scancode = C.SDL_SCANCODE_RALT // windows, command (apple), meta SCANCODE_RGUI Scancode = C.SDL_SCANCODE_RGUI // I'm not sure if this is really not covered by any of the above, but // since there's a special KMOD_MODE for it I'm adding it here SCANCODE_MODE Scancode = C.SDL_SCANCODE_MODE SCANCODE_AUDIONEXT Scancode = C.SDL_SCANCODE_AUDIONEXT SCANCODE_AUDIOPREV Scancode = C.SDL_SCANCODE_AUDIOPREV SCANCODE_AUDIOSTOP Scancode = C.SDL_SCANCODE_AUDIOSTOP SCANCODE_AUDIOPLAY Scancode = C.SDL_SCANCODE_AUDIOPLAY SCANCODE_AUDIOMUTE Scancode = C.SDL_SCANCODE_AUDIOMUTE SCANCODE_MEDIASELECT Scancode = C.SDL_SCANCODE_MEDIASELECT SCANCODE_WWW Scancode = C.SDL_SCANCODE_WWW SCANCODE_MAIL Scancode = C.SDL_SCANCODE_MAIL SCANCODE_CALCULATOR Scancode = C.SDL_SCANCODE_CALCULATOR SCANCODE_COMPUTER Scancode = C.SDL_SCANCODE_COMPUTER SCANCODE_AC_SEARCH Scancode = C.SDL_SCANCODE_AC_SEARCH SCANCODE_AC_HOME Scancode = C.SDL_SCANCODE_AC_HOME SCANCODE_AC_BACK Scancode = C.SDL_SCANCODE_AC_BACK SCANCODE_AC_FORWARD Scancode = C.SDL_SCANCODE_AC_FORWARD SCANCODE_AC_STOP Scancode = C.SDL_SCANCODE_AC_STOP SCANCODE_AC_REFRESH Scancode = C.SDL_SCANCODE_AC_REFRESH SCANCODE_AC_BOOKMARKS Scancode = C.SDL_SCANCODE_AC_BOOKMARKS SCANCODE_BRIGHTNESSDOWN Scancode = C.SDL_SCANCODE_BRIGHTNESSDOWN SCANCODE_BRIGHTNESSUP Scancode = C.SDL_SCANCODE_BRIGHTNESSUP // display mirroring/dual display switch, video mode switch SCANCODE_DISPLAYSWITCH Scancode = C.SDL_SCANCODE_DISPLAYSWITCH SCANCODE_KBDILLUMTOGGLE Scancode = C.SDL_SCANCODE_KBDILLUMTOGGLE SCANCODE_KBDILLUMDOWN Scancode = C.SDL_SCANCODE_KBDILLUMDOWN SCANCODE_KBDILLUMUP Scancode = C.SDL_SCANCODE_KBDILLUMUP SCANCODE_EJECT Scancode = C.SDL_SCANCODE_EJECT SCANCODE_SLEEP Scancode = C.SDL_SCANCODE_SLEEP SCANCODE_APP1 Scancode = C.SDL_SCANCODE_APP1 SCANCODE_APP2 Scancode = C.SDL_SCANCODE_APP2 // not a key, just marks the number of scancodes for array bounds NUM_SCANCODES Scancode = C.SDL_NUM_SCANCODES )
func GetScancodeFromKey ¶
Get the scancode corresponding to the given key code according to the current keyboard layout.
See SDL_Scancode for details.
See also: SDL_GetScancodeName()
func GetScancodeFromName ¶
Get a scancode from a human-readable name.
Returns: scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
See also: SDL_Scancode
type ShapeMode ¶
type ShapeMode int
An enum denoting the specific type of contents present in an SDL_WindowShapeParams union.
const ( // The default mode, a binarized alpha cutoff of 1. ShapeModeDefault ShapeMode = C.ShapeModeDefault // A binarized alpha cutoff with a given integer value. ShapeModeBinarizeAlpha ShapeMode = C.ShapeModeBinarizeAlpha // A binarized alpha cutoff with a given integer value, but with the // opposite comparison. ShapeModeReverseBinarizeAlpha ShapeMode = C.ShapeModeReverseBinarizeAlpha // A color key is applied. ShapeModeColorKey ShapeMode = C.ShapeModeColorKey )
type Sizer ¶
type Sizer interface {
Size() int64
}
Sizer is an interface that complements io.Reader with the ability to determine the total size of the data. This must not be confused with a function like bytes.Buffer.Len() that returns the remaining number of bytes. The Size() method always returns the same number, even after reading parts of the data. If an object implements io.Seeker, it does not need to provide Size() because it can be emulated.
type Surface ¶
type Surface C.SDL_Surface
↪ https://wiki.libsdl.org/SDL_Surface
func CreateRGBSurface ¶
func CreateRGBSurface(flags uint32, width int, height int, depth int, Rmask uint32, Gmask uint32, Bmask uint32, Amask uint32) (retval *Surface)
Allocate and free an RGB surface.
If the depth is 4 or 8 bits, an empty palette is allocated for the surface. If the depth is greater than 8 bits, the pixel format is set using the flags '[RGB]mask'.
If the function runs out of memory, it will return NULL.
flags The flags are obsolete and should be set to 0. width The width in pixels of the surface to create. height The height in pixels of the surface to create. depth The depth in bits of the surface to create. Rmask The red mask of the surface to create. Gmask The green mask of the surface to create. Bmask The blue mask of the surface to create. Amask The alpha mask of the surface to create.
func CreateRGBSurfaceFrom ¶
func LoadBMP_RW ¶
Load a surface from a seekable SDL data stream (memory or file).
If freesrc is non-zero, the stream will be closed after being read.
The new surface should be freed with SDL_FreeSurface().
Returns: the new surface, or NULL if there was an error.
func (*Surface) Convert ¶
func (src *Surface) Convert(fmt *PixelFormat, flags uint32) (retval *Surface)
Creates a new surface of the specified format, and then copies and maps the given surface to it so the blit of the converted surface will be as fast as possible. If this function fails, it returns NULL.
The flags parameter is passed to SDL_CreateRGBSurface() and has those semantics. You can also pass SDL_RLEACCEL in the flags parameter and SDL will try to RLE accelerate colorkey and alpha blits in the resulting surface. ↪ https://wiki.libsdl.org/SDL_ConvertSurface
func (*Surface) ConvertFormat ¶
func (*Surface) CreateSoftwareRenderer ¶
Create a 2D software rendering context for a surface.
Returns: A valid rendering context or NULL if there was an error.
See also: SDL_CreateRenderer()
See also: SDL_DestroyRenderer()
surface The surface where rendering is done.
func (*Surface) FillRect ¶
Performs a fast fill of the given rectangle with color.
If rect is NULL, the whole surface will be filled with color.
The color should be a pixel of the format used by the surface, and can be generated by the SDL_MapRGB() function.
Returns: 0 on success, or -1 on error.
func (*Surface) GetAlphaMod ¶
Get the additional alpha value used in blit operations.
Returns: 0 on success, or -1 if the surface is not valid.
See also: SDL_SetSurfaceAlphaMod()
surface The surface to query. alpha A pointer filled in with the current alpha value.
func (*Surface) GetBlendMode ¶
Get the blend mode used for blit operations.
Returns: 0 on success, or -1 if the surface is not valid.
See also: SDL_SetSurfaceBlendMode()
surface The surface to query. blendMode A pointer filled in with the current blend mode.
func (*Surface) GetClipRect ¶
Gets the clipping rectangle for the destination surface in a blit.
rect must be a pointer to a valid rectangle which will be filled with the correct values. ↪ https://wiki.libsdl.org/SDL_GetClipRect
func (*Surface) GetColorKey ¶
Gets the color key (transparent pixel) in a blittable surface.
Returns: 0 on success, or -1 if the surface is not valid or colorkey is not enabled.
surface The surface to update key A pointer filled in with the transparent pixel in the native surface format
func (*Surface) GetColorMod ¶
Get the additional color value used in blit operations.
Returns: 0 on success, or -1 if the surface is not valid.
See also: SDL_SetSurfaceColorMod()
surface The surface to query. r A pointer filled in with the current red color value. g A pointer filled in with the current green color value. b A pointer filled in with the current blue color value.
func (*Surface) Lock ¶
Sets up a surface for directly accessing the pixels.
Between calls to SDL_LockSurface() / SDL_UnlockSurface(), you can write to and read from surface->pixels, using the pixel format stored in surface->format. Once you are done accessing the surface, you should use SDL_UnlockSurface() to release it.
Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates to 0, then you can read and write to the surface at any time, and the pixel format of the surface will not change.
No operating system or library calls should be made between lock/unlock pairs, as critical system locks may be held during this time.
SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
See also: SDL_UnlockSurface()
func (*Surface) SetAlphaMod ¶
Set an additional alpha value used in blit operations.
Returns: 0 on success, or -1 if the surface is not valid.
See also: SDL_GetSurfaceAlphaMod()
surface The surface to update. alpha The alpha value multiplied into blit operations.
func (*Surface) SetBlendMode ¶
Set the blend mode used for blit operations.
Returns: 0 on success, or -1 if the parameters are not valid.
See also: SDL_GetSurfaceBlendMode()
surface The surface to update. blendMode SDL_BlendMode to use for blit blending.
func (*Surface) SetClipRect ¶
Sets the clipping rectangle for the destination surface in a blit.
If the clip rectangle is NULL, clipping will be disabled.
If the clip rectangle doesn't intersect the surface, the function will return SDL_FALSE and blits will be completely clipped. Otherwise the function returns SDL_TRUE and blits to the surface will be clipped to the intersection of the surface area and the clipping rectangle.
Note that blits are automatically clipped to the edges of the source and destination surfaces. ↪ https://wiki.libsdl.org/SDL_SetClipRect
func (*Surface) SetColorKey ¶
Sets the color key (transparent pixel) in a blittable surface.
Returns: 0 on success, or -1 if the surface is not valid
surface The surface to update flag Non-zero to enable colorkey and 0 to disable colorkey key The transparent pixel in the native surface format
You can pass SDL_RLEACCEL to enable RLE accelerated blits. ↪ https://wiki.libsdl.org/SDL_SetColorKey
func (*Surface) SetColorMod ¶
Set an additional color value used in blit operations.
Returns: 0 on success, or -1 if the surface is not valid.
See also: SDL_GetSurfaceColorMod()
surface The surface to update. r The red color value multiplied into blit operations. g The green color value multiplied into blit operations. b The blue color value multiplied into blit operations.
func (*Surface) SetPalette ¶
Set the palette used by a surface.
Returns: 0, or -1 if the surface format doesn't use a palette.
Note: A single palette can be shared with many surfaces.
func (*Surface) SetRLE ¶
Sets the RLE acceleration hint for a surface.
Returns: 0 on success, or -1 if the surface is not valid
Note: If RLE is enabled, colorkey and alpha blending blits are much faster, but the surface must be locked before directly accessing the pixels.
type SysWMmsg ¶
type SysWMmsg C.SDL_SysWMmsg
type SystemCursor ¶
type SystemCursor int
Cursor types for SDL_CreateSystemCursor. ↪ https://wiki.libsdl.org/SDL_SystemCursor
const ( // Arrow SYSTEM_CURSOR_ARROW SystemCursor = C.SDL_SYSTEM_CURSOR_ARROW // I-beam SYSTEM_CURSOR_IBEAM SystemCursor = C.SDL_SYSTEM_CURSOR_IBEAM // Wait SYSTEM_CURSOR_WAIT SystemCursor = C.SDL_SYSTEM_CURSOR_WAIT // Crosshair SYSTEM_CURSOR_CROSSHAIR SystemCursor = C.SDL_SYSTEM_CURSOR_CROSSHAIR // Small wait cursor (or Wait if not available) SYSTEM_CURSOR_WAITARROW SystemCursor = C.SDL_SYSTEM_CURSOR_WAITARROW // Double arrow pointing northwest and southeast SYSTEM_CURSOR_SIZENWSE SystemCursor = C.SDL_SYSTEM_CURSOR_SIZENWSE // Double arrow pointing northeast and southwest SYSTEM_CURSOR_SIZENESW SystemCursor = C.SDL_SYSTEM_CURSOR_SIZENESW // Double arrow pointing west and east SYSTEM_CURSOR_SIZEWE SystemCursor = C.SDL_SYSTEM_CURSOR_SIZEWE // Double arrow pointing north and south SYSTEM_CURSOR_SIZENS SystemCursor = C.SDL_SYSTEM_CURSOR_SIZENS // Four pointed arrow pointing north, south, east, and west SYSTEM_CURSOR_SIZEALL SystemCursor = C.SDL_SYSTEM_CURSOR_SIZEALL // Slashed circle or crossbones SYSTEM_CURSOR_NO SystemCursor = C.SDL_SYSTEM_CURSOR_NO // Hand SYSTEM_CURSOR_HAND SystemCursor = C.SDL_SYSTEM_CURSOR_HAND NUM_SYSTEM_CURSORS SystemCursor = C.SDL_NUM_SYSTEM_CURSORS )
type TextEditingEvent ¶
type TextEditingEvent struct { // SDL_TEXTEDITING Type EventType Timestamp uint32 // The window with keyboard focus, if any WindowID uint32 // The editing text Text [TEXTEDITINGEVENT_TEXT_SIZE]int8 // The start cursor of selected editing text Start int32 // The length of selected editing text Length int32 }
Keyboard text editing event structure (event.edit.*) ↪ https://wiki.libsdl.org/SDL_TextEditingEvent
type TextInputEvent ¶
type TextInputEvent struct { // SDL_TEXTINPUT Type EventType Timestamp uint32 // The window with keyboard focus, if any WindowID uint32 // The input text Text [TEXTINPUTEVENT_TEXT_SIZE]int8 }
Keyboard text input event structure (event.text.*) ↪ https://wiki.libsdl.org/SDL_TextInputEvent
type Texture ¶
type Texture C.SDL_Texture
func (*Texture) Destroy ¶
func (texture *Texture) Destroy()
Destroy the specified texture.
See also: SDL_CreateTexture()
See also: SDL_CreateTextureFromSurface()
func (*Texture) GL_Bind ¶
Bind the texture to the current OpenGL/ES/ES2 context for use with OpenGL instructions.
Returns: 0 on success, or -1 if the operation is not supported
texture The SDL texture to bind texw A pointer to a float that will be filled with the texture width texh A pointer to a float that will be filled with the texture height
func (*Texture) GL_Unbind ¶
Unbind a texture from the current OpenGL/ES/ES2 context.
Returns: 0 on success, or -1 if the operation is not supported
texture The SDL texture to unbind
func (*Texture) GetAlphaMod ¶
Get the additional alpha value used in render copy operations.
Returns: 0 on success, or -1 if the texture is not valid.
See also: SDL_SetTextureAlphaMod()
texture The texture to query. alpha A pointer filled in with the current alpha value.
func (*Texture) GetBlendMode ¶
Get the blend mode used for texture copy operations.
Returns: 0 on success, or -1 if the texture is not valid.
See also: SDL_SetTextureBlendMode()
texture The texture to query. blendMode A pointer filled in with the current blend mode.
func (*Texture) GetColorMod ¶
Get the additional color value used in render copy operations.
Returns: 0 on success, or -1 if the texture is not valid.
See also: SDL_SetTextureColorMod()
texture The texture to query. r A pointer filled in with the current red color value. g A pointer filled in with the current green color value. b A pointer filled in with the current blue color value.
func (*Texture) Lock ¶
Lock a portion of the texture for write-only pixel access.
Returns: 0 on success, or -1 if the texture is not valid or was not created with SDL_TEXTUREACCESS_STREAMING.
See also: SDL_UnlockTexture()
texture The texture to lock for access, which was created with SDL_TEXTUREACCESS_STREAMING. rect A pointer to the rectangle to lock for access. If the rect is NULL, the entire texture will be locked. pixels This is filled in with a pointer to the locked pixels, appropriately offset by the locked area. pitch This is filled in with the pitch of the locked pixels.
func (*Texture) Query ¶
Query the attributes of a texture.
Returns: 0 on success, or -1 if the texture is not valid.
texture A texture to be queried. format A pointer filled in with the raw format of the texture. The actual format may differ, but pixel transfers will use this format. access A pointer filled in with the actual access to the texture. w A pointer filled in with the width of the texture in pixels. h A pointer filled in with the height of the texture in pixels.
func (*Texture) SetAlphaMod ¶
Set an additional alpha value used in render copy operations.
Returns: 0 on success, or -1 if the texture is not valid or alpha modulation is not supported.
See also: SDL_GetTextureAlphaMod()
texture The texture to update. alpha The alpha value multiplied into copy operations.
func (*Texture) SetBlendMode ¶
Set the blend mode used for texture copy operations.
Returns: 0 on success, or -1 if the texture is not valid or the blend mode is not supported.
Note: If the blend mode is not supported, the closest supported mode is chosen.
See also: SDL_GetTextureBlendMode()
texture The texture to update. blendMode SDL_BlendMode to use for texture blending.
func (*Texture) SetColorMod ¶
Set an additional color value used in render copy operations.
Returns: 0 on success, or -1 if the texture is not valid or color modulation is not supported.
See also: SDL_GetTextureColorMod()
texture The texture to update. r The red color value multiplied into copy operations. g The green color value multiplied into copy operations. b The blue color value multiplied into copy operations.
func (*Texture) Unlock ¶
func (texture *Texture) Unlock()
Unlock a texture, uploading the changes to video memory, if needed.
See also: SDL_LockTexture()
func (*Texture) Update ¶
Update the given texture rectangle with new pixel data.
Returns: 0 on success, or -1 if the texture is not valid.
Note: This is a fairly slow function.
texture The texture to update rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. pixels The raw pixel data. pitch The number of bytes in a row of pixel data, including padding between lines.
func (*Texture) UpdateYUV ¶
func (texture *Texture) UpdateYUV(rect *Rect, Yplane []byte, Ypitch int, Uplane []byte, Upitch int, Vplane []byte, Vpitch int) (retval int)
Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
Returns: 0 on success, or -1 if the texture is not valid.
Note: You can use SDL_UpdateTexture() as long as your pixel data is a contiguous block of Y and U/V planes in the proper order, but this function is available if your pixel data is not contiguous.
texture The texture to update rect A pointer to the rectangle of pixels to update, or NULL to update the entire texture. Yplane The raw pixel data for the Y plane. Ypitch The number of bytes between rows of pixel data for the Y plane. Uplane The raw pixel data for the U plane. Upitch The number of bytes between rows of pixel data for the U plane. Vplane The raw pixel data for the V plane. Vpitch The number of bytes between rows of pixel data for the V plane.
type TextureAccess ¶
type TextureAccess int
The access pattern allowed for a texture. ↪ https://wiki.libsdl.org/SDL_TextureAccess
const ( // Changes rarely, not lockable TEXTUREACCESS_STATIC TextureAccess = C.SDL_TEXTUREACCESS_STATIC // Changes frequently, lockable TEXTUREACCESS_STREAMING TextureAccess = C.SDL_TEXTUREACCESS_STREAMING // Texture can be used as a render target TEXTUREACCESS_TARGET TextureAccess = C.SDL_TEXTUREACCESS_TARGET )
type TextureModulate ¶
type TextureModulate int
The texture channel modulation used in SDL_RenderCopy(). ↪ https://wiki.libsdl.org/SDL_TextureModulate
const ( // No modulation TEXTUREMODULATE_NONE TextureModulate = C.SDL_TEXTUREMODULATE_NONE // srcC = srcC * color TEXTUREMODULATE_COLOR TextureModulate = C.SDL_TEXTUREMODULATE_COLOR // srcA = srcA * alpha TEXTUREMODULATE_ALPHA TextureModulate = C.SDL_TEXTUREMODULATE_ALPHA )
type TimerCallback ¶
type TimerCallback C.SDL_TimerCallback
Function prototype for the timer callback function.
The callback function is passed the current timer interval and returns the next timer interval. If the returned value is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled. If the callback returns 0, the periodic alarm is cancelled.
type TimerID ¶
type TimerID int
Definition of the timer ID type.
type TouchFingerEvent ¶
type TouchFingerEvent struct { // SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP Type EventType Timestamp uint32 // The touch device id TouchId TouchID FingerId FingerID // Normalized in the range 0...1 X float32 // Normalized in the range 0...1 Y float32 // Normalized in the range -1...1 Dx float32 // Normalized in the range -1...1 Dy float32 // Normalized in the range 0...1 Pressure float32 }
Touch finger event structure (event.tfinger.*) ↪ https://wiki.libsdl.org/SDL_TouchFingerEvent
type TouchID ¶
type TouchID int64
func GetTouchDevice ¶
Get the touch ID with the given index, or 0 if the index is invalid. ↪ https://wiki.libsdl.org/SDL_GetTouchDevice
type UserEvent ¶
type UserEvent struct { // SDL_USEREVENT through SDL_LASTEVENT-1 Type EventType Timestamp uint32 // The associated window if any WindowID uint32 // User defined event code Code int32 // User defined data pointer Data1 uintptr // User defined data pointer Data2 uintptr }
A user-defined event type (event.user.*) ↪ https://wiki.libsdl.org/SDL_UserEvent
type Version ¶
type Version struct { // major version Major uint8 // minor version Minor uint8 // update version Patch uint8 }
Information the version of SDL in use.
Represents the library's version as three levels: major revision (increments with massive changes, additions, and enhancements), minor revision (increments with backwards-compatible changes to the major revision), and patchlevel (increments with fixes to the minor revision).
See also: SDL_VERSION
See also: SDL_GetVersion
↪ https://wiki.libsdl.org/SDL_version
func GetVersion ¶
func GetVersion() (ver *Version)
Get the version of SDL that is linked against your program.
If you are linking to SDL dynamically, then it is possible that the current version will be different than the version you compiled against. This function returns the current version, while SDL_VERSION() is a macro that tells you what version you compiled with.
SDL_version compiled; SDL_version linked; SDL_VERSION(&compiled); SDL_GetVersion(&linked); printf("We compiled against SDL version %d.%d.%d ...\n", compiled.major, compiled.minor, compiled.patch); printf("But we linked against SDL version %d.%d.%d.\n", linked.major, linked.minor, linked.patch);
This function may be called safely at any time, even before SDL_Init().
See also: SDL_VERSION
type Window ¶
type Window C.SDL_Window
The type used to identify a window.
See also: SDL_CreateWindow()
See also: SDL_CreateWindowFrom()
See also: SDL_DestroyWindow()
See also: SDL_GetWindowData()
See also: SDL_GetWindowFlags()
See also: SDL_GetWindowGrab()
See also: SDL_GetWindowPosition()
See also: SDL_GetWindowSize()
See also: SDL_GetWindowTitle()
See also: SDL_HideWindow()
See also: SDL_MaximizeWindow()
See also: SDL_MinimizeWindow()
See also: SDL_RaiseWindow()
See also: SDL_RestoreWindow()
See also: SDL_SetWindowData()
See also: SDL_SetWindowFullscreen()
See also: SDL_SetWindowGrab()
See also: SDL_SetWindowIcon()
See also: SDL_SetWindowPosition()
See also: SDL_SetWindowSize()
See also: SDL_SetWindowBordered()
See also: SDL_SetWindowTitle()
See also: SDL_ShowWindow()
func CreateShapedWindow ¶
func CreateShapedWindow(title string, x uint, y uint, w uint, h uint, flags WindowFlags) (retval *Window)
Create a window that can be shaped with the specified position, dimensions, and flags.
Returns: The window created, or NULL if window creation failed.
See also: SDL_DestroyWindow()
title The title of the window, in UTF-8 encoding. x The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED. y The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED. w The width of the window. h The height of the window. flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with any of the following: SDL_WINDOW_OPENGL, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_BORDERLESS is always set, and SDL_WINDOW_FULLSCREEN is always unset.
func CreateWindow ¶
Create a window with the specified position, dimensions, and flags.
Returns: The id of the window created, or zero if window creation failed.
title The title of the window, in UTF-8 encoding. x The x position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED. y The y position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED. w The width of the window, in screen coordinates. h The height of the window, in screen coordinates. flags The flags for the window, a mask of any of the following: SDL_WINDOW_FULLSCREEN, SDL_WINDOW_OPENGL, SDL_WINDOW_HIDDEN, SDL_WINDOW_BORDERLESS, SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, SDL_WINDOW_MINIMIZED, SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_ALLOW_HIGHDPI.
If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size in pixels may differ from its size in screen coordinates on platforms with high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query the client area's size in screen coordinates, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to query the drawable size in pixels.
See also: SDL_DestroyWindow()
func CreateWindowFrom ¶
Create an SDL window from an existing native window.
Returns: The id of the window created, or zero if window creation failed.
See also: SDL_DestroyWindow()
data A pointer to driver-dependent window creation data
func GL_GetCurrentWindow ¶
func GL_GetCurrentWindow() (retval *Window)
Get the currently active OpenGL window. ↪ https://wiki.libsdl.org/SDL_GL_GetCurrentWindow
func GetGrabbedWindow ¶
func GetGrabbedWindow() (retval *Window)
Get the window that currently has an input grab enabled.
Returns: This returns the window if input is grabbed, and NULL otherwise.
See also: SDL_SetWindowGrab()
func GetKeyboardFocus ¶
func GetKeyboardFocus() (retval *Window)
Get the window which currently has keyboard focus. ↪ https://wiki.libsdl.org/SDL_GetKeyboardFocus
func GetMouseFocus ¶
func GetMouseFocus() (retval *Window)
Get the window which currently has mouse focus. ↪ https://wiki.libsdl.org/SDL_GetMouseFocus
func GetWindowFromID ¶
Get a window from a stored ID, or NULL if it doesn't exist. ↪ https://wiki.libsdl.org/SDL_GetWindowFromID
func (*Window) CreateRenderer ¶
func (window *Window) CreateRenderer(index int, flags RendererFlags) (retval *Renderer)
Create a 2D rendering context for a window.
Returns: A valid rendering context or NULL if there was an error.
See also: SDL_CreateSoftwareRenderer()
See also: SDL_GetRendererInfo()
See also: SDL_DestroyRenderer()
window The window where rendering is displayed. index The index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags. flags SDL_RendererFlags.
func (*Window) Destroy ¶
func (window *Window) Destroy()
Destroy a window. ↪ https://wiki.libsdl.org/SDL_DestroyWindow
func (*Window) GL_CreateContext ¶
Create an OpenGL context for use with an OpenGL window, and make it current.
See also: SDL_GL_DeleteContext()
func (*Window) GL_GetDrawableSize ¶
Get the size of a window's underlying drawable in pixels (for use with glViewport).
window Window from which the drawable size should be queried w Pointer to variable for storing the width in pixels, may be NULL h Pointer to variable for storing the height in pixels, may be NULL
This may differ from SDL_GetWindowSize() if we're rendering to a high- DPI drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-DPI support (Apple calls this "Retina"), and not disabled by the SDL_HINT_VIDEO_HIGHDPI_DISABLED hint.
See also: SDL_GetWindowSize()
See also: SDL_CreateWindow()
func (*Window) GL_MakeCurrent ¶
Set up an OpenGL context for rendering into an OpenGL window.
Note: The context must have been created with a compatible window.
func (*Window) GL_Swap ¶
func (window *Window) GL_Swap()
Swap the OpenGL buffers for a window, if double-buffering is supported. ↪ https://wiki.libsdl.org/SDL_GL_SwapWindow
func (*Window) GetBrightness ¶
Get the brightness (gamma correction) for a window.
Returns: The last brightness value passed to SDL_SetWindowBrightness()
See also: SDL_SetWindowBrightness()
func (*Window) GetData ¶
Retrieve the data pointer associated with a window.
Returns: The value associated with 'name'
See also: SDL_SetWindowData()
window The window to query. name The name of the pointer.
func (*Window) GetDisplayIndex ¶
Get the display index associated with a window.
Returns: the display index of the display containing the center of the window, or -1 on error.
func (*Window) GetDisplayMode ¶
func (window *Window) GetDisplayMode() (retval int, mode *DisplayMode)
Fill in information about the display mode used when a fullscreen window is visible.
See also: SDL_SetWindowDisplayMode()
See also: SDL_SetWindowFullscreen()
func (*Window) GetFlags ¶
Get the window flags. ↪ https://wiki.libsdl.org/SDL_GetWindowFlags
func (*Window) GetGammaRamp ¶
func (window *Window) GetGammaRamp(red *[256]uint16, green *[256]uint16, blue *[256]uint16) (retval int)
Get the gamma ramp for a window.
Returns: 0 on success, or -1 if gamma ramps are unsupported.
See also: SDL_SetWindowGammaRamp()
window The window from which the gamma ramp should be queried. red A pointer to a 256 element array of 16-bit quantities to hold the translation table for the red channel, or NULL. green A pointer to a 256 element array of 16-bit quantities to hold the translation table for the green channel, or NULL. blue A pointer to a 256 element array of 16-bit quantities to hold the translation table for the blue channel, or NULL.
func (*Window) GetGrab ¶
Get a window's input grab mode.
Returns: This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
See also: SDL_SetWindowGrab()
func (*Window) GetID ¶
Get the numeric ID of a window, for logging purposes. ↪ https://wiki.libsdl.org/SDL_GetWindowID
func (*Window) GetMaximumSize ¶
Get the maximum size of a window's client area.
See also: SDL_GetWindowMinimumSize()
See also: SDL_SetWindowMaximumSize()
window The window to query. w Pointer to variable for storing the maximum width, may be NULL h Pointer to variable for storing the maximum height, may be NULL
func (*Window) GetMinimumSize ¶
Get the minimum size of a window's client area.
See also: SDL_GetWindowMaximumSize()
See also: SDL_SetWindowMinimumSize()
window The window to query. w Pointer to variable for storing the minimum width, may be NULL h Pointer to variable for storing the minimum height, may be NULL
func (*Window) GetPixelFormat ¶
Get the pixel format associated with the window. ↪ https://wiki.libsdl.org/SDL_GetWindowPixelFormat
func (*Window) GetPosition ¶
Get the position of a window.
See also: SDL_SetWindowPosition()
window The window to query. x Pointer to variable for storing the x position, in screen coordinates. May be NULL. y Pointer to variable for storing the y position, in screen coordinates. May be NULL.
func (*Window) GetRenderer ¶
Get the renderer associated with a window. ↪ https://wiki.libsdl.org/SDL_GetRenderer
func (*Window) GetShapedMode ¶
func (window *Window) GetShapedMode() (retval int, shape_mode *WindowShapeMode)
Get the shape parameters of a shaped window.
Returns: 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if the SDL_Window* given is a shapeable window currently lacking a shape.
See also: SDL_WindowShapeMode
See also: SDL_SetWindowShape
window The shaped window whose parameters should be retrieved. shape_mode An empty shape-mode structure to fill, or NULL to check whether the window has a shape.
func (*Window) GetSize ¶
Get the size of a window's client area.
window The window to query. w Pointer to variable for storing the width, in screen coordinates. May be NULL. h Pointer to variable for storing the height, in screen coordinates. May be NULL.
The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.
See also: SDL_SetWindowSize()
func (*Window) GetSurface ¶
Get the SDL surface associated with the window.
Returns: The window's framebuffer surface, or NULL on error.
A new surface will be created with the optimal format for the window, if necessary. This surface will be freed when the window is destroyed.
Note: You may not combine this with 3D or the rendering API on this window.
See also: SDL_UpdateWindowSurface()
See also: SDL_UpdateWindowSurfaceRects()
func (*Window) GetTitle ¶
Get the title of a window, in UTF-8 format.
See also: SDL_SetWindowTitle()
func (*Window) IsScreenKeyboardShown ¶
Returns whether the screen keyboard is shown for given window.
Returns: SDL_TRUE if screen keyboard is shown else SDL_FALSE.
See also: SDL_HasScreenKeyboardSupport()
window The window for which screen keyboard should be queried.
func (*Window) IsShaped ¶
Return whether the given window is a shaped window.
Returns: SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL.
See also: SDL_CreateShapedWindow
window The window to query for being shaped.
func (*Window) Maximize ¶
func (window *Window) Maximize()
Make a window as large as possible.
See also: SDL_RestoreWindow()
func (*Window) Minimize ¶
func (window *Window) Minimize()
Minimize a window to an iconic representation.
See also: SDL_RestoreWindow()
func (*Window) Raise ¶
func (window *Window) Raise()
Raise a window above other windows and set the input focus. ↪ https://wiki.libsdl.org/SDL_RaiseWindow
func (*Window) Restore ¶
func (window *Window) Restore()
Restore the size and position of a minimized or maximized window.
See also: SDL_MaximizeWindow()
See also: SDL_MinimizeWindow()
func (*Window) SetBordered ¶
Set the border state of a window.
This will add or remove the window's SDL_WINDOW_BORDERLESS flag and add or remove the border from the actual window. This is a no-op if the window's border already matches the requested state.
Note: You can't change the border state of a fullscreen window.
See also: SDL_GetWindowFlags()
window The window of which to change the border state. bordered SDL_FALSE to remove border, SDL_TRUE to add border.
func (*Window) SetBrightness ¶
Set the brightness (gamma correction) for a window.
Returns: 0 on success, or -1 if setting the brightness isn't supported.
See also: SDL_GetWindowBrightness()
See also: SDL_SetWindowGammaRamp()
func (*Window) SetData ¶
Associate an arbitrary named pointer with a window.
Returns: The previous value associated with 'name'
Note: The name is case-sensitive.
See also: SDL_GetWindowData()
window The window to associate with the pointer. name The name of the pointer. userdata The associated pointer.
func (*Window) SetDisplayMode ¶
func (window *Window) SetDisplayMode(mode *DisplayMode) (retval int)
Set the display mode used when a fullscreen window is visible.
By default the window's dimensions and the desktop format and refresh rate are used.
Returns: 0 on success, or -1 if setting the display mode failed.
See also: SDL_GetWindowDisplayMode()
See also: SDL_SetWindowFullscreen()
window The window for which the display mode should be set. mode The mode to use, or NULL for the default mode.
func (*Window) SetFullscreen ¶
Set a window's fullscreen state.
Returns: 0 on success, or -1 if setting the display mode failed.
See also: SDL_SetWindowDisplayMode()
See also: SDL_GetWindowDisplayMode()
func (*Window) SetGammaRamp ¶
func (window *Window) SetGammaRamp(red *[256]uint16, green *[256]uint16, blue *[256]uint16) (retval int)
Set the gamma ramp for a window.
Returns: 0 on success, or -1 if gamma ramps are unsupported.
window The window for which the gamma ramp should be set. red The translation table for the red channel, or NULL. green The translation table for the green channel, or NULL. blue The translation table for the blue channel, or NULL.
Set the gamma translation table for the red, green, and blue channels of the video hardware. Each table is an array of 256 16-bit quantities, representing a mapping between the input and output for that channel. The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision.
See also: SDL_GetWindowGammaRamp()
func (*Window) SetGrab ¶
Set a window's input grab mode.
window The window for which the input grab mode should be set. grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
If the caller enables a grab while another window is currently grabbed, the other window loses its grab in favor of the caller's window.
See also: SDL_GetWindowGrab()
func (*Window) SetHitTest ¶
Provide a callback that decides if a window region has special properties.
Normally windows are dragged and resized by decorations provided by the system window manager (a title bar, borders, etc), but for some apps, it makes sense to drag them from somewhere else inside the window itself; for example, one might have a borderless window that wants to be draggable from any part, or simulate its own title bar, etc.
This function lets the app provide a callback that designates pieces of a given window as special. This callback is run during event processing if we need to tell the OS to treat a region of the window specially; the use of this callback is known as "hit testing."
Mouse input may not be delivered to your application if it is within a special area; the OS will often apply that input to moving the window or resizing the window and not deliver it to the application.
Specifying NULL for a callback disables hit-testing. Hit-testing is disabled by default.
Platforms that don't support this functionality will return -1 unconditionally, even if you're attempting to disable hit-testing.
Your callback may fire at any time, and its firing does not indicate any specific behavior (for example, on Windows, this certainly might fire when the OS is deciding whether to drag your window, but it fires for lots of other reasons, too, some unrelated to anything you probably care about and when the mouse isn't actually at the location it is testing). Since this can fire at any time, you should try to keep your callback efficient, devoid of allocations, etc.
Returns: 0 on success, -1 on error (including unsupported).
window The window to set hit-testing on. callback The callback to call when doing a hit-test. callback_data An app-defined void pointer passed to the callback.
func (*Window) SetIcon ¶
Set the icon for a window.
window The window for which the icon should be set. icon The icon for the window.
func (*Window) SetMaximumSize ¶
Set the maximum size of a window's client area.
Note: You can't change the maximum size of a fullscreen window, it automatically matches the size of the display mode.
See also: SDL_GetWindowMaximumSize()
See also: SDL_SetWindowMinimumSize()
window The window to set a new maximum size. max_w The maximum width of the window, must be >0 max_h The maximum height of the window, must be >0
func (*Window) SetMinimumSize ¶
Set the minimum size of a window's client area.
Note: You can't change the minimum size of a fullscreen window, it automatically matches the size of the display mode.
See also: SDL_GetWindowMinimumSize()
See also: SDL_SetWindowMaximumSize()
window The window to set a new minimum size. min_w The minimum width of the window, must be >0 min_h The minimum height of the window, must be >0
func (*Window) SetPosition ¶
Set the position of a window.
Note: The window coordinate origin is the upper left of the display.
See also: SDL_GetWindowPosition()
window The window to reposition. x The x coordinate of the window in screen coordinates, or SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_UNDEFINED. y The y coordinate of the window in screen coordinates, or SDL_WINDOWPOS_CENTERED or SDL_WINDOWPOS_UNDEFINED.
func (*Window) SetShape ¶
func (window *Window) SetShape(shape *Surface, shape_mode *WindowShapeMode) (retval int)
Set the shape and parameters of a shaped window.
Returns: 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW if the SDL_Window* given does not reference a valid shaped window.
See also: SDL_WindowShapeMode
See also: SDL_GetShapedWindowMode.
window The shaped window whose parameters should be set. shape A surface encoding the desired shape for the window. shape_mode The parameters to set for the shaped window.
func (*Window) SetSize ¶
Set the size of a window's client area.
Note: You can't change the size of a fullscreen window, it automatically matches the size of the display mode.
window The window to resize. w The width of the window, in screen coordinates. Must be >0. h The height of the window, in screen coordinates. Must be >0.
The window size in screen coordinates may differ from the size in pixels, if the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with high-dpi support (e.g. iOS or OS X). Use SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() to get the real client area size in pixels.
See also: SDL_GetWindowSize()
func (*Window) SetTitle ¶
Set the title of a window, in UTF-8 format.
See also: SDL_GetWindowTitle()
func (*Window) UpdateSurface ¶
Copy the window surface to the screen.
Returns: 0 on success, or -1 on error.
See also: SDL_GetWindowSurface()
See also: SDL_UpdateWindowSurfaceRects()
func (*Window) UpdateSurfaceRects ¶
Copy a number of rectangles on the window surface to the screen.
Returns: 0 on success, or -1 on error.
See also: SDL_GetWindowSurface()
See also: SDL_UpdateWindowSurfaceRect()
type WindowEvent ¶
type WindowEvent struct { // SDL_WINDOWEVENT Type EventType Timestamp uint32 // The associated window WindowID uint32 // SDL_WindowEventID Event uint8 Padding1 uint8 Padding2 uint8 Padding3 uint8 // event dependent data Data1 int32 // event dependent data Data2 int32 }
Window state change event data (event.window.*) ↪ https://wiki.libsdl.org/SDL_WindowEvent
type WindowEventID ¶
type WindowEventID int
Event subtype for window events. ↪ https://wiki.libsdl.org/SDL_WindowEventID
const ( // Never used WINDOWEVENT_NONE WindowEventID = C.SDL_WINDOWEVENT_NONE // Window has been shown WINDOWEVENT_SHOWN WindowEventID = C.SDL_WINDOWEVENT_SHOWN // Window has been hidden WINDOWEVENT_HIDDEN WindowEventID = C.SDL_WINDOWEVENT_HIDDEN // Window has been exposed and should be redrawn WINDOWEVENT_EXPOSED WindowEventID = C.SDL_WINDOWEVENT_EXPOSED // Window has been moved to data1, data2 WINDOWEVENT_MOVED WindowEventID = C.SDL_WINDOWEVENT_MOVED // Window has been resized to data1xdata2 WINDOWEVENT_RESIZED WindowEventID = C.SDL_WINDOWEVENT_RESIZED // The window size has changed, either as a result of an API call or // through the system or user changing the window size. WINDOWEVENT_SIZE_CHANGED WindowEventID = C.SDL_WINDOWEVENT_SIZE_CHANGED // Window has been minimized WINDOWEVENT_MINIMIZED WindowEventID = C.SDL_WINDOWEVENT_MINIMIZED // Window has been maximized WINDOWEVENT_MAXIMIZED WindowEventID = C.SDL_WINDOWEVENT_MAXIMIZED // Window has been restored to normal size and position WINDOWEVENT_RESTORED WindowEventID = C.SDL_WINDOWEVENT_RESTORED // Window has gained mouse focus WINDOWEVENT_ENTER WindowEventID = C.SDL_WINDOWEVENT_ENTER // Window has lost mouse focus WINDOWEVENT_LEAVE WindowEventID = C.SDL_WINDOWEVENT_LEAVE // Window has gained keyboard focus WINDOWEVENT_FOCUS_GAINED WindowEventID = C.SDL_WINDOWEVENT_FOCUS_GAINED // Window has lost keyboard focus WINDOWEVENT_FOCUS_LOST WindowEventID = C.SDL_WINDOWEVENT_FOCUS_LOST // The window manager requests that the window be closed WINDOWEVENT_CLOSE WindowEventID = C.SDL_WINDOWEVENT_CLOSE )
type WindowFlags ¶
type WindowFlags int
The flags on a window.
See also: SDL_GetWindowFlags()
↪ https://wiki.libsdl.org/SDL_WindowFlags
const ( // fullscreen window WINDOW_FULLSCREEN WindowFlags = C.SDL_WINDOW_FULLSCREEN // window usable with OpenGL context WINDOW_OPENGL WindowFlags = C.SDL_WINDOW_OPENGL // window is visible WINDOW_SHOWN WindowFlags = C.SDL_WINDOW_SHOWN // window is not visible WINDOW_HIDDEN WindowFlags = C.SDL_WINDOW_HIDDEN // no window decoration WINDOW_BORDERLESS WindowFlags = C.SDL_WINDOW_BORDERLESS // window can be resized WINDOW_RESIZABLE WindowFlags = C.SDL_WINDOW_RESIZABLE // window is minimized WINDOW_MINIMIZED WindowFlags = C.SDL_WINDOW_MINIMIZED // window is maximized WINDOW_MAXIMIZED WindowFlags = C.SDL_WINDOW_MAXIMIZED // window has grabbed input focus WINDOW_INPUT_GRABBED WindowFlags = C.SDL_WINDOW_INPUT_GRABBED // window has input focus WINDOW_INPUT_FOCUS WindowFlags = C.SDL_WINDOW_INPUT_FOCUS // window has mouse focus WINDOW_MOUSE_FOCUS WindowFlags = C.SDL_WINDOW_MOUSE_FOCUS WINDOW_FULLSCREEN_DESKTOP WindowFlags = C.SDL_WINDOW_FULLSCREEN_DESKTOP // window not created by SDL WINDOW_FOREIGN WindowFlags = C.SDL_WINDOW_FOREIGN // window should be created in high-DPI mode if supported WINDOW_ALLOW_HIGHDPI WindowFlags = C.SDL_WINDOW_ALLOW_HIGHDPI // window has mouse captured (unrelated to INPUT_GRABBED) WINDOW_MOUSE_CAPTURE WindowFlags = C.SDL_WINDOW_MOUSE_CAPTURE )
type WindowShapeMode ¶
type WindowShapeMode struct { // The mode of these window-shape parameters. Mode ShapeMode // Window-shape parameters. Parameters WindowShapeParams }
A struct that tags the SDL_WindowShapeParams union with an enum describing the type of its contents.
type WindowShapeParams ¶
type WindowShapeParams C.SDL_WindowShapeParams
A union containing parameters for shaped windows.
func (*WindowShapeParams) BinarizationCutoff ¶
func (u *WindowShapeParams) BinarizationCutoff() uint8
a cutoff alpha value for binarization of the window shape's alpha channel.
func (*WindowShapeParams) ColorKey ¶
func (u *WindowShapeParams) ColorKey() Color
func (*WindowShapeParams) SetBinarizationCutoff ¶
func (u *WindowShapeParams) SetBinarizationCutoff(x uint8)
a cutoff alpha value for binarization of the window shape's alpha channel.
func (*WindowShapeParams) SetColorKey ¶
func (u *WindowShapeParams) SetColorKey(x Color)
Source Files ¶
- SDL.h.go
- SDL_audio.h.go
- SDL_blendmode.h.go
- SDL_clipboard.h.go
- SDL_cpuinfo.h.go
- SDL_error.h.go
- SDL_events.h.go
- SDL_filesystem.h.go
- SDL_gamecontroller.h.go
- SDL_gesture.h.go
- SDL_haptic.h.go
- SDL_hints.h.go
- SDL_joystick.h.go
- SDL_keyboard.h.go
- SDL_keycode.h.go
- SDL_messagebox.h.go
- SDL_mouse.h.go
- SDL_pixels.h.go
- SDL_power.h.go
- SDL_rect.h.go
- SDL_render.h.go
- SDL_rwops.h.go
- SDL_scancode.h.go
- SDL_shape.h.go
- SDL_surface.h.go
- SDL_timer.h.go
- SDL_touch.h.go
- SDL_version.h.go
- SDL_video.h.go
- cflags.go
- handwritten.go
- rwops-export.go
- rwops.go