sdl package - github.com/veandco/go-sdl2/sdl - Go Packages (original) (raw)

Package sdl is SDL2 wrapped for Go users. It enables interoperability between Go and the SDL2 library which is written in C. That means the original SDL2 installation is required for this to work. SDL2 is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.

Audio format masks. (https://wiki.libsdl.org/SDL_AudioFormat)

Audio format values. (https://wiki.libsdl.org/SDL_AudioFormat)

AllowedChanges flags specify how SDL should behave when a device cannot offer a specific feature. If the application requests a feature that the hardware doesn't offer, SDL will always try to get the closest equivalent. Used in OpenAudioDevice(). (https://wiki.libsdl.org/SDL_OpenAudioDevice)

An enumeration of audio device states used in GetAudioDeviceStatus() and GetAudioStatus(). (https://wiki.libsdl.org/SDL_AudioStatus)

Endian-specific values. (https://wiki.libsdl.org/CategoryEndian)

SDL error codes with their corresponding predefined strings.

Enumeration of the types of events that can be delivered. (https://wiki.libsdl.org/SDL_EventType)

Actions for PeepEvents(). (https://wiki.libsdl.org/SDL_PeepEvents)

Toggles for different event state functions.

Types of game controller inputs.

An enumeration of axes available from a controller. (https://wiki.libsdl.org/SDL_GameControllerAxis)

An enumeration of buttons available from a controller. (https://wiki.libsdl.org/SDL_GameControllerButton)

Haptic effects. (https://wiki.libsdl.org/SDL_HapticEffect)

Direction encodings. (https://wiki.libsdl.org/SDL_HapticDirection)

Configuration hints (https://wiki.libsdl.org/CategoryHints)

An enumeration of hint priorities. (https://wiki.libsdl.org/SDL_HintPriority)

Hat positions. (https://wiki.libsdl.org/SDL_JoystickGetHat)

Types of a joystick.

An enumeration of battery levels of a joystick. (https://wiki.libsdl.org/SDL_JoystickPowerLevel)

The SDL virtual key representation. (https://wiki.libsdl.org/SDL_Keycode) (https://wiki.libsdl.org/SDLKeycodeLookup)

An enumeration of key modifier masks. (https://wiki.libsdl.org/SDL_Keymod)

View Source

const ( LOG_CATEGORY_APPLICATION = iota LOG_CATEGORY_ERROR
LOG_CATEGORY_ASSERT
LOG_CATEGORY_SYSTEM
LOG_CATEGORY_AUDIO
LOG_CATEGORY_VIDEO
LOG_CATEGORY_RENDER
LOG_CATEGORY_INPUT
LOG_CATEGORY_TEST
LOG_CATEGORY_RESERVED1
LOG_CATEGORY_RESERVED2
LOG_CATEGORY_RESERVED3
LOG_CATEGORY_RESERVED4
LOG_CATEGORY_RESERVED5
LOG_CATEGORY_RESERVED6
LOG_CATEGORY_RESERVED7
LOG_CATEGORY_RESERVED8
LOG_CATEGORY_RESERVED9
LOG_CATEGORY_RESERVED10
LOG_CATEGORY_CUSTOM
)

An enumeration of the predefined log categories. (https://wiki.libsdl.org/SDL_LOG_CATEGORY)

View Source

const ( LOG_PRIORITY_VERBOSE = iota + 1 LOG_PRIORITY_DEBUG
LOG_PRIORITY_INFO
LOG_PRIORITY_WARN
LOG_PRIORITY_ERROR
LOG_PRIORITY_CRITICAL
NUM_LOG_PRIORITIES
)

An enumeration of the predefined log priorities. (https://wiki.libsdl.org/SDL_LogPriority)

Cursor types for CreateSystemCursor()

Scroll direction types for the Scroll event

Used as a mask when testing buttons in buttonstate.

Pixel types.

Bitmap pixel order high bit -> low bit.

Packed component order high bit -> low bit.

Array component order low byte -> high byte.

Packed component layout.

Pixel format values.

These define alpha as the opacity of a surface.

An enumeration of the basic state of the system's power supply. (https://wiki.libsdl.org/SDL_PowerState)

An enumeration of flags used when creating a rendering context. (https://wiki.libsdl.org/SDL_RendererFlags)

The scaling mode for a texture.

An enumeration of texture access patterns.. (https://wiki.libsdl.org/SDL_TextureAccess)

An enumeration of the texture channel modulation used in Renderer.Copy(). (https://wiki.libsdl.org/SDL_TextureModulate)

An enumeration of flags that can be used in the flip parameter for Renderer.CopyEx(). (https://wiki.libsdl.org/SDL_RendererFlip)

View Source

const ( RWOPS_UNKNOWN = 0 RWOPS_WINFILE = 1 RWOPS_STDFILE = 2 RWOPS_JNIFILE = 3 RWOPS_MEMORY = 4 RWOPS_MEMORY_RO = 5 )

RWops types

RWops seek from

The SDL keyboard scancode representation. (https://wiki.libsdl.org/SDL_Scancode) (https://wiki.libsdl.org/SDLScancodeLookup)

These are the flags which may be passed to SDL_Init(). (https://wiki.libsdl.org/SDL_Init)

Surface flags (internal use)

YUV Conversion Modes

Various supported windowing subsystems.

The version of SDL in use.

An enumeration of window states. (https://wiki.libsdl.org/SDL_WindowFlags)

An enumeration of window events. (https://wiki.libsdl.org/SDL_WindowEventID)

Window position flags. (https://wiki.libsdl.org/SDL_CreateWindow)

An enumeration of message box flags (e.g. if supported message box will display warning icon). (https://wiki.libsdl.org/SDL_MessageBoxFlags)

Flags for MessageBoxButtonData.

OpenGL configuration attributes. (https://wiki.libsdl.org/SDL_GL_SetAttribute)

An enumeration of OpenGL profiles. (https://wiki.libsdl.org/SDL_GLprofile)

An enumeration of OpenGL context configuration flags. (https://wiki.libsdl.org/SDL_GLcontextFlag)

Window flash operation

CACHELINE_SIZE is a cacheline size used for padding.

MIX_MAXVOLUME is the full audio volume value used in MixAudioFormat() and AudioFormat(). (https://wiki.libsdl.org/SDL_MixAudioFormat)

TOUCH_MOUSEID is the device ID for mouse events simulated with touch input

Pixel format variables.

BitsPerPixel returns the number of bits per pixel for the given format

Btoi returns 0 or 1 according to the value of b.

Button is used as a mask when testing buttons in buttonstate.

ButtonLMask is used as a mask when testing buttons in buttonstate.

ButtonMMask is used as a mask when testing buttons in buttonstate.

ButtonRMask is used as a mask when testing buttons in buttonstate.

ButtonX1Mask is used as a mask when testing buttons in buttonstate.

ButtonX2Mask is used as a mask when testing buttons in buttonstate.

BytesPerPixel returns the number of bytes per pixel for the given format

Do the specified function in the main thread. For this function to work, you must have correctly used sdl.Main(..) in your main() function. Calling this function before/without sdl.Main(..) will cause a panic.

func Error(code ErrorCode)

Error sets the SDL error message to the specified error code.

func FilterEvents(filter EventFilter, userdata interface{})

FilterEvents run a specific filter function on the current event queue, removing any events for which the filter returns 0. (https://wiki.libsdl.org/SDL_FilterEvents)

func FilterEventsFunc(filter eventFilterFunc, userdata interface{})

FilterEventsFunc run a specific function on the current event queue, removing any events for which the filter returns 0. (https://wiki.libsdl.org/SDL_FilterEvents)

func GameControllerMappingForDeviceIndex(index int) string

GameControllerMappingForDeviceIndex returns the game controller mapping string at a particular index.

func GameControllerMappingForIndex(index int) string

GameControllerMappingForIndex returns the game controller mapping string at a particular index.

func GameControllerNumMappings() int

GameControllerNumMappings returns the number of mappings installed.

GetError returns the last error that occurred, or an empty string if there hasn't been an error message set since the last call to ClearError(). (https://wiki.libsdl.org/SDL_GetError)

GetPrefPath returns the "pref dir". This is meant to be where the application can write personal files (Preferences and save games, etc.) that are specific to the application. This directory is unique per user and per application. (https://wiki.libsdl.org/SDL_GetPrefPath)

func GetRevisionNumber() int

Deprecated: GetRevisionNumber is deprecated in SDL2 2.0.16 and will return 0. Users should use GetRevision instead.

GetTicks returns the number of milliseconds since the SDL library initialization.

Deprecated: This function is not recommended as of SDL 2.0.18; use GetTicks64() instead, where the value doesn't wrap every ~49 days. There are places in SDL where we provide a 32-bit timestamp that can not change without breaking binary compatibility, though, so this function isn't officially deprecated.

(https://wiki.libsdl.org/SDL_GetTicks)

func JoystickGetDeviceProduct(index int) int

JoystickGetDeviceProduct returns the USB product ID of a joystick, if available, 0 otherwise.

func JoystickGetDeviceProductVersion(index int) int

JoystickGetDeviceProductVersion returns the product version of a joystick, if available, 0 otherwise.

func JoystickGetDeviceVendor(index int) int

JoystickGetDeviceVendor returns the USB vendor ID of a joystick, if available, 0 otherwise.

func Main

Main entry point. Run this function at the beginning of main(), and pass your own main body to it as a function. E.g.:

func main() { sdl.Main(func() { // Your code here.... // [....]

    // Calls to SDL can be made by any goroutine, but always guarded by sdl.Do()
    sdl.Do(func() {
        sdl.Init(0)
    })
})

}

Avoid calling functions like os.Exit(..) within your passed-in function since they don't respect deferred calls. Instead, do this:

func main() { var exitcode int sdl.Main(func() { exitcode = run()) // assuming run has signature func() int }) os.Exit(exitcode) }

OutOfMemory sets SDL error message to ENOMEM (out of memory).

PremultiplyAlpha premultiplies the alpha on a block of pixels.

This is safe to use with src == dst, but not for other overlapping areas.

This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.

(https://wiki.libsdl.org/SDL_PremultiplyAlpha)

func SensorGetDeviceName(deviceIndex int) (name string)

SensorGetDeviceName gets the implementation dependent name of a sensor.

This can be called before any sensors are opened.

Returns the sensor name, or empty string if deviceIndex is out of range. (https://wiki.libsdl.org/SDL_SensorGetDeviceName)

func SensorGetDeviceNonPortableType(deviceIndex int) (typ int)

SensorGetDeviceNonPortableType gets the platform dependent type of a sensor.

This can be called before any sensors are opened.

Returns the sensor platform dependent type, or -1 if deviceIndex is out of range. (https://wiki.libsdl.org/SDL_SensorGetDeviceNonPortableType)

SensorUpdate updates the current state of the open sensors.

This is called automatically by the event loop if sensor events are enabled.

This needs to be called from the thread that initialized the sensor subsystem. (https://wiki.libsdl.org/SDL_SensorUpdate)

func SetEventFilter(filter EventFilter, userdata interface{})

SetEventFilter sets up a filter to process all events before they change internal state and are posted to the internal event queue. (https://wiki.libsdl.org/SDL_SetEventFilter)

func SetEventFilterFunc(filterFunc eventFilterFunc, userdata interface{})

SetEventFilterFunc sets up a function to process all events before they change internal state and are posted to the internal event queue. (https://wiki.libsdl.org/SDL_SetEventFilter)

Unsupported sets SDL error message to UNSUPPORTED (that operation is not supported).

type ABGR1555 struct { A, R, G, B byte }

func (c ABGR1555) RGBA() (r, g, b, a uint32)

type ABGR4444 struct { A, B, G, R byte }

func (c ABGR4444) RGBA() (r, g, b, a uint32)

type ARGB1555 struct { A, R, G, B byte }

func (c ARGB1555) RGBA() (r, g, b, a uint32)

type ARGB4444 struct { A, R, G, B byte }

func (c ARGB4444) RGBA() (r, g, b, a uint32)

AudioCVT contains audio data conversion information. (https://wiki.libsdl.org/SDL_AudioCVT)

AllocBuf allocates the requested memory for AudioCVT buffer.

func (cvt AudioCVT) BufAsSlice() []byte

BufAsSlice returns AudioCVT.buf as byte slice. NOTE: Must be used after ConvertAudio() because it uses LenCVT as slice length.

func (cvt *AudioCVT) FreeBuf()

FreeBuf deallocates the memory previously allocated from AudioCVT buffer.

type BGR555 struct { B, G, R byte }

func (c BGR555) RGBA() (r, g, b, a uint32)

type BGR565 struct { B, G, R byte }

func (c BGR565) RGBA() (r, g, b, a uint32)

type BGRA4444 struct { B, G, R, A byte }

func (c BGRA4444) RGBA() (r, g, b, a uint32)

type BGRA5551 struct { B, G, R, A byte }

func (c BGRA5551) RGBA() (r, g, b, a uint32)

type BGRA8888 struct { B, G, R, A byte }

func (c BGRA8888) RGBA() (r, g, b, a uint32)

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

func ComposeCustomBlendMode(srcColorFactor, dstColorFactor BlendFactor, colorOperation BlendOperation, srcAlphaFactor, dstAlphaFactor BlendFactor, alphaOperation BlendOperation) BlendMode

ComposeCustomBlendMode creates a custom blend mode, which may or may not be supported by a given renderer The result of the blend mode operation will be:

dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor

and

dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor

(https://wiki.libsdl.org/SDL_ComposeCustomBlendMode)

CocoaInfo contains Apple Mac OS X window information.

type Cond struct { Lock *Mutex Waiting int Signals int WaitSem *Sem WaitDone *Sem }

Cond is the SDL condition variable structure.

Cursor is a custom cursor created by CreateCursor() or CreateColorCursor().

DFBInfo contains DirectFB window information.

DropEvent contains an event used to request a file open by the system. (https://wiki.libsdl.org/SDL_DropEvent)

GetTimestamp returns the timestamp of the event.

GetType returns the event type.

ErrorCode is an error code used in SDL error messages.

type EventWatchHandle

EventWatchHandle is an event watch callback added with AddEventWatch().

func AddEventWatchFunc(filterFunc eventFilterFunc, userdata interface{}) EventWatchHandle

AddEventWatchFunc adds a callback function to be triggered when an event is added to the event queue. (https://wiki.libsdl.org/SDL_AddEventWatch)

Finger contains touch information.

GLContext is an opaque handle to an OpenGL context.

GameController used to identify an SDL game controller.

func (ctrl *GameController) Joystick() *Joystick

Joystick returns the Joystick ID from a Game Controller. The game controller builds on the Joystick API, but to be able to use the Joystick's functions with a gamepad, you need to use this first to get the joystick object. (https://wiki.libsdl.org/SDL_GameControllerGetJoystick)

func (ctrl *GameController) Product() int

Product returns the USB product ID of an opened controller, if available, 0 otherwise.

func (ctrl *GameController) ProductVersion() int

ProductVersion returns the product version of an opened controller, if available, 0 otherwise.

func (ctrl *GameController) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error

Rumble triggers a rumble effect Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.

lowFrequencyRumble - The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF highFrequencyRumble - The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF durationMS - The duration of the rumble effect, in milliseconds

Returns error if rumble isn't supported on this joystick.

TODO: (https://wiki.libsdl.org/SDL_GameControllerRumble)

func (ctrl *GameController) Vendor() int

Vendor returns the USB vendor ID of an opened controller, if available, 0 otherwise.

GameControllerBindType is a type of game controller input.

GameControllerButtonBind SDL joystick layer binding for controller button/axis mapping.

Axis returns axis mapped for this SDL joystick layer binding.

Button returns button mapped for this SDL joystick layer binding.

Hat returns hat mapped for this SDL joystick layer binding.

func (bind *GameControllerButtonBind) HatMask() int

HatMask returns hat mask for this SDL joystick layer binding.

Type returns the type of game controller input for this SDL joystick layer binding.

GestureID is the unique id of the closest gesture to the performed stroke.

type HintCallback func(data interface{}, name, oldValue, newValue string)

HintCallback is the function to call when the hint value changes.

type HintCallbackAndData added in v0.2.0

type HintCallbackAndData struct {

}

HintCallbackAndData contains a callback function and userdata.

Joystick is an SDL joystick.

AxisInitialState returns the initial state of an axis control on a joystick, ok is true if this axis has any initial value.

func (joy *Joystick) Product() int

Product returns the USB product ID of an opened joystick, if available, 0 otherwise.

func (joy *Joystick) ProductVersion() int

ProductVersion returns the product version of an opened joystick, if available, 0 otherwise.

func (joy *Joystick) Rumble(lowFrequencyRumble, highFrequencyRumble uint16, durationMS uint32) error

Rumble triggers a rumble effect Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling.

lowFrequencyRumble - The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF highFrequencyRumble - The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF durationMS - The duration of the rumble effect, in milliseconds

Returns error if rumble isn't supported on this joystick.

TODO: (https://wiki.libsdl.org/SDL_JoystickRumble)

func (joy *Joystick) Type() JoystickType

Type returns the the type of an opened joystick.

func (joy *Joystick) Vendor() int

Vendor returns the USB vendor ID of an opened joystick, if available, 0 otherwise.

JoystickGUID is a stable unique id for a joystick device.

JoystickID is joystick's instance id.

func JoystickGetDeviceInstanceID(index int) JoystickID

JoystickGetDeviceInstanceID returns the instance ID of a joystick.

JoystickPowerLevel is a battery level of a joystick.

JoystickType is a type of a joystick.

func JoystickGetDeviceType(index int) JoystickType

JoystickGetDeviceType returns the type of a joystick.

type LogOutputFunction func(data interface{}, category int, pri LogPriority, message string)

LogOutputFunction is the function to call instead of the default

type Mutex struct { Recursive int Owner ThreadID Sem *Sem }

Mutex is the SDL mutex structure.

OSEvent contains OS specific event information.

GetTimestamp returns the timestamp of the event.

GetType returns the event type.

type RGB332 struct { R, G, B byte }

func (c RGB332) RGBA() (r, g, b, a uint32)

type RGB444 struct { R, G, B byte }

func (c RGB444) RGBA() (r, g, b, a uint32)

type RGB555 struct { R, G, B byte }

func (c RGB555) RGBA() (r, g, b, a uint32)

type RGB565 struct { R, G, B byte }

func (c RGB565) RGBA() (r, g, b, a uint32)

type RGBA4444 struct { R, G, B, A byte }

func (c RGBA4444) RGBA() (r, g, b, a uint32)

type RGBA5551 struct { R, G, B, A byte }

func (c RGBA5551) RGBA() (r, g, b, a uint32)

type RGBA8888 struct { R, G, B, A byte }

func (c RGBA8888) RGBA() (r, g, b, a uint32)

RWops provides an abstract interface to stream I/O. Applications can generally ignore the specifics of this structure's internals and treat them as opaque pointers. The details are important to lower-level code that might need to implement one of these, however. (https://wiki.libsdl.org/SDL_RWops)

Renderer contains a rendering state. (https://wiki.libsdl.org/SDL_Renderer)

func (renderer *Renderer) CopyEx(texture *Texture, src, dst *Rect, angle float64, center *Point, flip RendererFlip) error

CopyEx copies a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right. (https://wiki.libsdl.org/SDL_RenderCopyEx)

func (renderer *Renderer) CopyExF(texture *Texture, src *Rect, dst *FRect, angle float64, center *FPoint, flip RendererFlip) error

CopyExF copies a portion of the texture to the current rendering target, optionally rotating it by angle around the given center and also flipping it top-bottom and/or left-right. TODO: (https://wiki.libsdl.org/SDL_RenderCopyExF)

func (renderer *Renderer) RenderGeometry(texture *Texture, vertices []Vertex, indices []int32) (err error)

RenderGeometry renders a list of triangles, optionally using a texture and indices into the vertex array Color and alpha modulation is done per vertex (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). (https://wiki.libsdl.org/SDL_RenderGeometry)

func (renderer *Renderer) RenderGeometryRaw(texture *Texture, xy *float32, xy_stride int, color *Color, color_stride int, uv *float32, uv_stride int, num_vertices int, indices interface{}) (err error)

RenderGeomtryRaw renders a list of triangles, optionally using a texture and indices into the vertex arrays Color and alpha modulation is done per vertex (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored). (https://wiki.libsdl.org/SDL_RenderGeometryRaw)

func (renderer *Renderer) RenderLogicalToWindow(logicalX, logicalY float32) (windowX, windowY int)

RenderLogicalToWindow gets real coordinates of point in window when given logical coordinates of point in renderer. Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set. (https://wiki.libsdl.org/SDL_RenderLogicalToWindow)

func (renderer *Renderer) RenderWindowToLogical(windowX, windowY int) (logicalX, logicalY float32)

RenderWindowToLogical gets logical coordinates of point in renderer when given real coordinates of point in window.

Logical coordinates will differ from real coordinates when render is scaled and logical renderer size set

(https://wiki.libsdl.org/SDL_RenderWindowToLogical)

func (renderer *Renderer) SetDrawColorArray(bs ...uint8) error

SetDrawColorArray is a custom variant of SetDrawColor.

SetIntegerScale sets whether to force integer scales for resolution-independent rendering.

This function restricts the logical viewport to integer values - that is, when a resolution is between two multiples of a logical size, the viewport size is rounded down to the lower multiple.

(https://wiki.libsdl.org/SDL_RenderSetIntegerScale)

type Sem struct { Count uint32 WaitersCount uint32 CountLock *Mutex CountNonzero *Cond }

Sem is the SDL semaphore structure.

func SensorOpen(deviceIndex int) (sensor *Sensor)

SensorOpen opens a sensor for use.

The index passed as an argument refers to the N'th sensor on the system.

Returns a sensor identifier, or nil if an error occurred. (https://wiki.libsdl.org/SDL_SensorOpen)

func (sensor *Sensor) GetInstanceID() (id SensorID)

GetInstanceID gets the instance ID of a sensor.

This can be called before any sensors are opened.

Returns the sensor instance ID, or -1 if the sensor is nil. (https://wiki.libsdl.org/SDL_SensorGetInstanceID)

func (sensor *Sensor) GetNonPortableType() (typ int)

GetNonPortableType gets the platform dependent type of a sensor.

This can be called before any sensors are opened.

Returns the sensor platform dependent type, or -1 if the sensor is nil. (https://wiki.libsdl.org/SDL_SensorGetNonPortableType)

func (sensor *Sensor) GetType() (typ SensorType)

GetType gets the type of a sensor.

This can be called before any sensors are opened.

Returns the sensor type, or SENSOR_INVALID if the sensor is nil. (https://wiki.libsdl.org/SDL_SensorGetType)

SensorEvent contains data from sensors such as accelerometer and gyroscope (https://wiki.libsdl.org/SDL_SensorEvent)

GetTimestamp returns the timestamp of the event.

GetType returns the event type.

func SensorGetDeviceInstanceID(deviceIndex int) (id SensorID)

SensorGetDeviceInstanceID gets the instance ID of a sensor.

This can be called before any sensors are opened.

Returns the sensor instance ID, or -1 if deviceIndex is out of range. (https://wiki.libsdl.org/SDL_SensorGetDeviceInstanceID)

func SensorGetDeviceType(deviceIndex int) (typ SensorType)

SensorGetDeviceType gets the type of a sensor.

This can be called before any sensors are opened.

Returns the sensor type, or SDL_SENSOR_INVALID if deviceIndex is out of range.

(https://wiki.libsdl.org/SDL_SensorGetDeviceType)

SharedObject is a pointer to the object handle.

Surface contains a collection of pixels used in software blitting. (https://wiki.libsdl.org/SDL_Surface)

At returns the pixel color at (x, y)

Bounds return the bounds of this surface. Currently, it always starts at (0,0), but this is not guaranteed in the future so don't rely on it.

func (surface *Surface) BytesPerPixel() int

BytesPerPixel return the number of significant bits in a pixel values of the surface.

ColorModel returns the color model used by this Surface.

Data returns the pointer to the actual pixel data of the surface.

func (surface *Surface) Duplicate() (newSurface *Surface, err error)

Duplicate creates a new surface identical to the existing surface

func (surface *Surface) PixelNum() int

PixelNum returns the number of pixels stored in the surface.

func (surface *Surface) Pixels() []byte

Pixels returns the actual pixel data of the surface.

Set the color of the pixel at (x, y) using this surface's color model to convert c to the appropriate color. This method is required for the draw.Image interface. The surface may require locking before calling Set.

type SysWMInfo struct { Version Version Subsystem uint32

}

SysWMInfo contains system-dependent information about a window. (https://wiki.libsdl.org/SDL_SysWMinfo)

func (info *SysWMInfo) GetCocoaInfo() *CocoaInfo

GetCocoaInfo returns Apple Mac OS X window information.

func (info *SysWMInfo) GetDFBInfo() *DFBInfo

GetDFBInfo returns DirectFB window information.

func (info *SysWMInfo) GetUIKitInfo() *UIKitInfo

GetUIKitInfo returns Apple iOS window information.

func (info *SysWMInfo) GetWindowsInfo() *WindowsInfo

GetWindowsInfo returns Microsoft Windows window information.

func (info *SysWMInfo) GetX11Info() *X11Info

GetX11Info returns X Window System window information.

SystemCursor is a system cursor created by CreateSystemCursor().

TextEditingEvent contains keyboard text editing event information. (https://wiki.libsdl.org/SDL_TextEditingEvent)

GetText returns the text as string

GetTimestamp returns the timestamp of the event.

GetType returns the event type.

TextInputEvent contains keyboard text input event information. (https://wiki.libsdl.org/SDL_TextInputEvent)

GetText returns the text as string

GetTimestamp returns the timestamp of the event.

GetType returns the event type.

ThreadID is the thread identifier for a thread.

TouchDeviceType is a touch device type.

TouchID is the ID of a touch device.

UIKitInfo contains Apple iOS window information.

type Vertex struct { Position FPoint Color Color
TexCoord FPoint }

Vertex structure

Window is a type used to identify a window.

GetID returns the numeric ID of the window, for logging purposes.

(https://wiki.libsdl.org/SDL_GetWindowID)

func (window *Window) SetMouseRect(rect Rect) (err error)

SetMouseRect confines the cursor to the specified area of a window.

Note that this does NOT grab the cursor, it only defines the area a cursor is restricted to when the window has mouse focus.

(https://wiki.libsdl.org/SDL_SetWindowMouseRect)

WindowsInfo contains Microsoft Windows window information.

X11Info contains X Window System window information.