Documentation ¶
Overview ¶
Package go-sdl2/sdl provides access to the SDL2 library.
Index ¶
- Constants
- Variables
- func Button(button uint32) uint32
- func CalculateGammaRamp(gamma float32, ramp *[256]uint16)
- func ClearError()
- func ClearHints()
- func CopyEventToEventUnion(ev Event, evu *EventUnion) error
- func CreateWindowAndRenderer(width, height int, window_flags WindowFlags) (Window, Renderer, error)
- func DisableScreenSaver()
- func EnableScreenSaver()
- func EventState(typ EventType, state int) uint8
- func FlushEvent(typ EventType)
- func FlustEvents(minType, maxType EventType)
- func GL_GetAttribute(attr GLattr) (int, error)
- func GL_GetSwapInterval() int
- func GL_SetAttribute(attr GLattr, value int) error
- func GL_SetSwapInterval(interval int) error
- func GameControllerAddMapping(mappingString string) error
- func GameControllerEventState(state int) int
- func GameControllerGetStringForAxis(axis ControllerAxis) string
- func GameControllerGetStringForButton(button ControllerButton) string
- func GameControllerNameForIndex(joystick_index int) string
- func GameControllerUpdate()
- func GetClipboardText() string
- func GetCurrentVideoDriver() string
- func GetDisplayName(displayIndex int) (string, error)
- func GetError() string
- func GetEventState(typ EventType) uint8
- func GetHint(name string) string
- func GetKeyName(key Keycode) string
- func GetKeyboardState() []uint8
- func GetMouseState() (x, y int, state uint32)
- func GetNumDisplayModes(displayIndex int) int
- func GetNumRenderDrivers() int
- func GetNumVideoDisplays() int
- func GetNumVideoDrivers() int
- func GetPixelFormatName(format PixelFormatEnum) string
- func GetRGB(pixel uint32, format *PixelFormat) (r, g, b uint8)
- func GetRGBA(pixel uint32, format *PixelFormat) (r, g, b, a uint8)
- func GetRelativeMouseMode() bool
- func GetRelativeMouseState() (x, y int, state uint32)
- func GetRevision() string
- func GetRevisionNumber() int
- func GetScancodeName(scancode Scancode) string
- func GetVideoDriver(index int) string
- func HasClipboardText() bool
- func HasEvent(typ EventType) bool
- func HasEvents(minType, maxType EventType) bool
- func HasScreenKeyboardSupport() bool
- func Init(flags InitFlags) error
- func InitSubSystem(flags InitFlags) error
- func IntersectRectAndLine(rect *Rect, x1, y1, x2, y2 *int) bool
- func IsGameController(joystick_index int) bool
- func IsScreenSaverEnabled() bool
- func IsTextInputActive() bool
- func JoystickEventState(state int) int
- func JoystickGetGUIDString(guid JoystickGUID) string
- func JoystickNameForIndex(device_index int) string
- func JoystickUpdate()
- func MapRGB(format *PixelFormat, r, g, b uint8) uint32
- func MapRGBA(format *PixelFormat, r, g, b, a uint8) uint32
- func NumJoysticks() int
- func PeepEvents(events []EventUnion, action EventAction, minType, maxType EventType) (int, error)
- func PixelFormatEnumToMasks(format PixelFormatEnum) (bpp int, rmask, gmask, bmask, amask uint32, err error)
- func PollEvent(event *EventUnion) int
- func PumpEvents()
- func PushEvent(event *EventUnion) (int, error)
- func Quit()
- func QuitSubSystem(flags InitFlags)
- func SetClipboardText(text string) int
- func SetError(msg string)
- func SetHint(name, value string) bool
- func SetHintWithPriority(name, value string, priority HintPriority) bool
- func SetModState(modstate Keymod)
- func SetRelativeMouseMode(enabled bool) error
- func SetTextInputRect(rect *Rect)
- func ShowCursor(toggle int) int
- func ShowSimpleMessageBox(flags MessageBoxFlags, title, message string, window *C.SDL_Window) error
- func StartTextInput()
- func StopTextInput()
- func VERSION(v *Version)
- func VersionAtleast(x, y, z int) bool
- func VersionNum(x, y, z int) int
- func VideoInit(driver_name string) error
- func VideoQuit()
- func WaitEvent(event *EventUnion) error
- func WaitEventTimeout(event *EventUnion, timeout int) error
- type BlendMode
- type Color
- type ControllerAxis
- type ControllerAxisEvent
- type ControllerBindtype
- type ControllerButton
- type ControllerButtonEvent
- type ControllerDeviceEvent
- type Cursor
- type DisplayMode
- type DollarGestureEvent
- type DropEvent
- type Event
- type EventAction
- type EventType
- type EventUnion
- type GLContext
- type GLattr
- type GLcontextFlag
- type GLprofile
- type GameController
- func (c GameController) Close()
- func (c GameController) GetAttached() bool
- func (c GameController) GetAxis(axis ControllerAxis) int16
- func (c GameController) GetBindForAxis(axis ControllerAxis) interface{}
- func (c GameController) GetBindForButton(button ControllerButton) interface{}
- func (c GameController) GetButton(button ControllerButton) uint8
- func (c GameController) GetJoystick() Joystick
- func (c GameController) Mapping() (string, error)
- func (c GameController) Name() string
- type GameControllerAxisBind
- type GameControllerButtonBind
- type GameControllerHatBind
- type HatPosition
- type HintPriority
- type InitFlags
- type JoyAxisEvent
- type JoyBallEvent
- type JoyButtonEvent
- type JoyDeviceEvent
- type JoyHatEvent
- type Joystick
- func (j Joystick) Close()
- func (j Joystick) GetAttached() bool
- func (j Joystick) GetAxis(axis int) int16
- func (j Joystick) GetBall(ball int) (dx, dy, err error)
- func (j Joystick) GetButton(button int) uint8
- func (j Joystick) GetGUID() JoystickGUID
- func (j Joystick) GetHat(hat int) HatPosition
- func (j Joystick) InstanceID() JoystickID
- func (j Joystick) Name() string
- func (j Joystick) NumAxes() int
- func (j Joystick) NumBalls() int
- func (j Joystick) NumButtons() int
- func (j Joystick) NumHats() int
- type JoystickGUID
- type JoystickID
- 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 MouseWheelEvent
- type MultiGestureEvent
- type Palette
- type PixelFormat
- type PixelFormatEnum
- type Point
- type QuitEvent
- type Rect
- type Renderer
- func (renderer Renderer) Clear() error
- func (renderer Renderer) Copy(texture Texture, srcrect, dstrect *Rect) error
- func (renderer Renderer) CopyEx(texture Texture, srcrect, dstrect *Rect, angle float64, center *Point, ...) error
- func (renderer Renderer) CreateTexture(format PixelFormatEnum, access TextureAccess, w, h int) (Texture, error)
- func (renderer Renderer) CreateTextureFromSurface(surface *Surface) (Texture, error)
- func (renderer Renderer) Destroy()
- func (renderer Renderer) DrawLine(x1, y1, x2, y2 int) error
- func (renderer Renderer) DrawLines(points []Point) error
- func (renderer Renderer) DrawPoint(x, y int) error
- func (renderer Renderer) DrawPoints(points []Point) error
- func (renderer Renderer) DrawRect(rect *Rect) error
- func (renderer Renderer) DrawRects(rects []Rect) error
- func (renderer Renderer) FillRect(rect *Rect) error
- func (renderer Renderer) FillRects(rects []Rect) error
- func (renderer Renderer) GetDrawBlendMode() (BlendMode, error)
- func (renderer Renderer) GetDrawColor() (r, g, b, a uint8, err error)
- func (renderer Renderer) GetInfo() (*RendererInfo, error)
- func (renderer Renderer) GetLogicalSize() (w, h int32)
- func (renderer Renderer) GetRenderTarget() Texture
- func (renderer Renderer) GetScale() (scaleX, scaleY float32)
- func (renderer Renderer) GetViewport() (*Rect, error)
- func (renderer Renderer) Present()
- func (renderer Renderer) RenderTargetSupported() bool
- func (renderer Renderer) SetDrawBlendMode(blendMode BlendMode) error
- func (renderer Renderer) SetDrawColor(r, g, b, a uint8) error
- func (renderer Renderer) SetLogicalSize(w, h int32) error
- func (renderer Renderer) SetRenderTarget(texture Texture) error
- func (renderer Renderer) SetScale(scaleX, scaleY float32) error
- func (renderer Renderer) SetViewport(rect *Rect) error
- type RendererFlags
- type RendererFlip
- type RendererInfo
- type SDLError
- type Scancode
- type Surface
- func (dst *Surface) Blit(src *Surface, srcrect, dstrect *Rect) error
- func (dst *Surface) BlitScaled(src *Surface, srcrect, dstrect *Rect) error
- func (surf *Surface) Convert(fmt *PixelFormat) (*Surface, error)
- func (surf *Surface) ConvertFormat(pixel_format PixelFormatEnum) (*Surface, error)
- func (surface *Surface) CreateSoftwareRenderer() (Renderer, error)
- func (surf *Surface) FillRect(rect *Rect, color uint32) error
- func (surf *Surface) FillRects(rects []Rect, color uint32) error
- func (surf *Surface) Free()
- func (surf *Surface) GetAlphaMod() (alpha uint8, err error)
- func (surf *Surface) GetBlendMode() (blendMode BlendMode, err error)
- func (surf *Surface) GetClipRect() *Rect
- func (surf *Surface) GetColorKey() (key uint32, err error)
- func (surf *Surface) GetColorMod() (r, g, b uint8, err error)
- func (surf *Surface) Lock() error
- func (surf *Surface) MustLock() bool
- func (surf *Surface) Pixels() []byte
- func (surf *Surface) SetAlphaMod(alpha uint8) error
- func (surf *Surface) SetBlendMode(blendMode BlendMode) error
- func (surf *Surface) SetClipRect(rect *Rect) bool
- func (surf *Surface) SetColorKey(flag bool, key uint32) error
- func (surf *Surface) SetColorMod(r, g, b uint8) error
- func (surf *Surface) SetPalette(palette *Palette) error
- func (surf *Surface) SetRLE(flag bool) error
- func (surf *Surface) Unlock()
- type SysWMEvent
- type SysWMType
- type SysWMinfo
- func (info SysWMinfo) CocoaWindow() (uintptr, error)
- func (info SysWMinfo) DFBSurface() (uintptr, error)
- func (info SysWMinfo) DFBWindow() (uintptr, error)
- func (info SysWMinfo) DFBdfb() (uintptr, error)
- func (info SysWMinfo) Subsystem() SysWMType
- func (info SysWMinfo) UIKitWindow() (uintptr, error)
- func (info SysWMinfo) WinWindow() (uintptr, error)
- func (info SysWMinfo) X11Display() (uintptr, error)
- func (info SysWMinfo) X11Window() (uintptr, error)
- type SysWMmsg
- func (msg *SysWMmsg) DFBEvent() (uintptr, error)
- func (msg *SysWMmsg) Subsystem() SysWMType
- func (msg *SysWMmsg) WinHwnd() (uintptr, error)
- func (msg *SysWMmsg) WinLParam() (uintptr, error)
- func (msg *SysWMmsg) WinMsg() (uintptr, error)
- func (msg *SysWMmsg) WinWParam() (uintptr, error)
- func (msg *SysWMmsg) X11Event() (uintptr, error)
- type SystemCursor
- type TextEditingEvent
- type TextInputEvent
- type Texture
- func (texture Texture) Destroy()
- func (texture Texture) GLBind() (w, h float32, err error)
- func (texture Texture) GLUnbind() error
- func (texture Texture) GetAlphaMod() (alpha uint8, err error)
- func (texture Texture) GetBlendMode() (BlendMode, error)
- func (texture Texture) GetColorMod() (r, g, b uint8, err error)
- func (texture Texture) Lock(rect *Rect) (pixels []byte, pitch int, err error)
- func (texture Texture) Query() (format PixelFormatEnum, access TextureAccess, w, h int, err error)
- func (texture Texture) SetAlphaMod(alpha uint8) error
- func (texture Texture) SetBlendMode(blendMode BlendMode) error
- func (texture Texture) SetColorMod(r, g, b uint8) error
- func (texture Texture) Unlock()
- func (texture Texture) Update(rect *Rect, pixels unsafe.Pointer, pitch int) error
- type TextureAccess
- type TextureModulate
- type TouchFingerEvent
- type UserEvent
- type Version
- type Window
- func (window Window) CreateRenderer(index int, flags RendererFlags) (Renderer, error)
- func (window Window) Destroy()
- func (window Window) GL_CreateContext() (GLContext, error)
- func (window Window) GL_MakeCurrent(context GLContext) error
- func (window Window) GL_Swap()
- func (window Window) GetBrightness() float32
- func (window Window) GetDisplayIndex() (int, error)
- func (window Window) GetDisplayMode() (*DisplayMode, error)
- func (window Window) GetFlags() WindowFlags
- func (window Window) GetGammaRamp(red, green, blue *[256]uint16) error
- func (window Window) GetGrab() bool
- func (window Window) GetID() uint32
- func (window Window) GetMaximumSize() (w, h int)
- func (window Window) GetMinimumSize() (w, h int)
- func (window Window) GetPixelFormat() uint32
- func (window Window) GetPosition() (x, y int)
- func (window Window) GetRenderer() (Renderer, error)
- func (window Window) GetSize() (w, h int)
- func (window Window) GetSurface() (*Surface, error)
- func (window Window) GetTitle() string
- func (window Window) GetWMInfo() (SysWMinfo, error)
- func (window Window) Hide()
- func (window Window) IsScreenKeyboardShown() 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) error
- func (window Window) SetDisplayMode(mode *DisplayMode) error
- func (window Window) SetFullscreen(flags uint32) error
- func (window Window) SetGamaRamp(red, green, blue *[256]uint16) error
- func (window Window) SetGrab(grab bool)
- func (window Window) SetIcon(icon *Surface)
- func (window Window) SetMaximumSize(max_w, max_h int)
- func (window Window) SetMinimumSize(min_w, min_h int)
- func (window Window) SetPosition(x, y int)
- func (window Window) SetSize(w, h int)
- func (window Window) SetTitle(title string)
- func (window Window) Show()
- func (window Window) UpdateSurface() error
- func (window Window) UpdateSurfaceRects(rects []Rect) error
- func (window Window) WarpMouse(x, y int)
- type WindowEvent
- type WindowEventID
- type WindowFlags
Constants ¶
const ( RELEASED = C.SDL_RELEASED PRESSED = C.SDL_PRESSED )
const ( QUERY = C.SDL_QUERY IGNORE = C.SDL_IGNORE DISABLE = C.SDL_DISABLE ENABLE = C.SDL_ENABLE )
const ( // HINT_FRAMEBUFFER_ACCELERATION controls how 3D acceleration is used to accelerate // the screen surface. // // HINT_FRAMEBUFFER_ACCELERATION 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 drivers. // (e.g. "direct3d", "opengl", etc.) // // By default SDL tries to make a best guess for each platform whether to use // acceleration or not. HINT_FRAMEBUFFER_ACCELERATION = C.SDL_HINT_FRAMEBUFFER_ACCELERATION // HINT_RENDER_DRIVER specifies which render driver to use. // // If the application doesn't pick a specific renderer to use, HINT_RENDER_DRIVER // specifies the name of the preferred renderer. If the preferred renderer can't // be initialized, the normal default renderer is used. // // HINT_RENDER_DRIVER 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. HINT_RENDER_DRIVER = C.SDL_HINT_RENDER_DRIVER // HINT_RENDER_OPENGL_SHADERS controls whether the OpenGL render driver uses shaders // if they are available. // // HINT_RENDER_OPENGL_SHADERS can be set to the following values: // "0" - Disable shaders // "1" - Enable shaders // // By default shaders are used if OpenGL supports them. HINT_RENDER_OPENGL_SHADERS = C.SDL_HINT_RENDER_OPENGL_SHADERS // HINT_RENDER_SCALE_QUALITY controles the scaling quality. // // HINT_RENDER_SCALE_QUALITY 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" - Anisotropic filtering (supported by Direct3D) // // By default nearest pixel sampling is used. HINT_RENDER_SCALE_QUALITY = C.SDL_HINT_RENDER_SCALE_QUALITY // HINT_RENDER_VSYNC controls whether updates to the screen surface should be // synchronized with the vertical refresh, to avoid tearing. // // HINT_RENDER_VSYNC 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. HINT_RENDER_VSYNC = C.SDL_HINT_RENDER_VSYNC // HINT_VIDEO_X11_XVIDMODE controls whether the X11 VidMode extension should // be used // // HINT_VIDEO_X11_XVIDMODE can be set to the following values: // "0" - Disable XVidMode // "1" - Enable XVidMode // // By default SDL will use XVidMode if it is available. HINT_VIDEO_X11_XVIDMODE = C.SDL_HINT_VIDEO_X11_XVIDMODE // HINT_VIDEO_X11_XINERAMA controls whether the X11 Xinerama extension should // be used // // HINT_VIDEO_X11_XINERAMA can be set to the following values: // "0" - Disable Xinerama // "1" - Enable Xinerama // // By default SDL will use Xinerama if it is available. HINT_VIDEO_X11_XINERAMA = C.SDL_HINT_VIDEO_X11_XINERAMA // HINT_VIDEO_X11_XRANDR controls whether the X11 XRandR extension should // be used // // HINT_VIDEO_X11_XRANDR 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. HINT_VIDEO_X11_XRANDR = C.SDL_HINT_VIDEO_X11_XRANDR // HINT_GRAB_KEYBOARD controls whether grabbing input grabs the keyboard. // // HINT_GRAB_KEYBOARD 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. HINT_GRAB_KEYBOARD = C.SDL_HINT_GRAB_KEYBOARD // HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS controls if Windows will minimize if they // lose key focus when in Fullscreen mode. // // Defaults to true. HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS = C.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS // HINT_IDLE_TIMER_DISABLED controls 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. // // HINT_IDLE_TIMER_DISABLED can be set to the following values: // "0" - Enable idle timer // "1" - Disable idle timer HINT_IDLE_TIMER_DISABLED = C.SDL_HINT_IDLE_TIMER_DISABLED // HINT_ORIENTATIONS controls which orientations are allowed on iOS. // // In some circumstances it is necessary to be able to explicitly control which UI // orientations are allowed. // // HINT-ORIENTATIONS is a space delimited list of the following values: // "LandscapeLeft", "LandscapeRight", "Portrait", "PortraitUpsideDown" HINT_ORIENTATIONS = C.SDL_HINT_ORIENTATIONS // HINT_XINPUT_ENABLED lets you disable the detection and use of Xinput gamepad // devices. // // HINT_XINPUT_ENABLED can be set to the following values: // "0" - Disable XInput timer (only uses direct input) // "1" - Enable XInput timer (the default) HINT_XINPUT_ENABLED = C.SDL_HINT_XINPUT_ENABLED // HINT_GAMECONTROLLERCONFIG lets you manually hint extra gamecontroller db entries. // // The variable expected newline delimited rows of gamecontroller config data. HINT_GAMECONTROLLERCONFIG = C.SDL_HINT_GAMECONTROLLERCONFIG // If HINT_ALLOW_TOPMOST is 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". // // HINT_ALLOW_TOPMOST can be set to the following values: // "0" - don't allow topmost // "1" - allow topmost HINT_ALLOW_TOPMOST = C.SDL_HINT_ALLOW_TOPMOST )
These come from SDL_hints.h. Use them as the name argument in the Hint functions.
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 )
Define alpha as the opacity of a surface
const ( MAJOR_VERSION = C.SDL_MAJOR_VERSION MINOR_VERSION = C.SDL_MINOR_VERSION PATCHLEVEL = C.SDL_PATCHLEVEL )
const ( // WINDOWPOS_UNDEFINED is used to indicate that you don't care what the // window position is. WINDOWPOS_UNDEFINED = C.SDL_WINDOWPOS_UNDEFINED // WINDOWPOS_CENTERED is used to indicate that you want the window to be // centered. WINDOWPOS_CENTERED = C.SDL_WINDOWPOS_CENTERED )
Variables ¶
var COMPILEDVERSION int = VersionNum(MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL)
Functions ¶
func CalculateGammaRamp ¶
CalculateGammaRamp calculates a 256 entry gamma ramp for a gamma value.
func ClearHints ¶
func ClearHints()
ClearHints clears all hints. It is called during Quit() to free stored hints.
func CopyEventToEventUnion ¶
func CopyEventToEventUnion(ev Event, evu *EventUnion) error
func CreateWindowAndRenderer ¶
func CreateWindowAndRenderer(width, height int, window_flags WindowFlags) (Window, Renderer, error)
CreateWindowAndRenderer creates a window and default renderer.
func DisableScreenSaver ¶
func DisableScreenSaver()
DisableScreenSaver prevents the screen from being blanked by a screensaver.
func EnableScreenSaver ¶
func EnableScreenSaver()
EnableScreenSaver allows the screen to be blanked by a screensaver.
func EventState ¶
EventState allows you to set the state of processing certain events. If state is IGNORE, that event will be automatically dropped from the queue and will not even be filtered. If state is ENABLE, that event will be processed normally. If state is QUERY EventState will return the current processing state of the specified event.
func FlushEvent ¶
func FlushEvent(typ EventType)
FlushEvent clears events of type typ from the event queue.
func FlustEvents ¶
func FlustEvents(minType, maxType EventType)
FlushEvents clears events between minType and maxType from the event queue.
func GL_GetAttribute ¶
GL_GetAttribute gets the actual value for an attribute from the current context.
func GL_GetSwapInterval ¶
func GL_GetSwapInterval() int
GL_GetSwapInterval gets the swap interval for the current OpenGL context. It 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, 0 will be returned as a safe default.
func GL_SetAttribute ¶
GL_SetAttribute sets and OpenGL window attribute before creation.
func GL_SetSwapInterval ¶
GL_SetSwapInterval sets the swap interval for the current OpenGL context.
interval = 0 -> immediate updates interval = 1 -> updates synchronized with the vertical retrace interval = -1 -> allow late swaps to happen immediately instead of waiting for the next retrace.
func GameControllerAddMapping ¶
GameControllerAddMapping adds or updates an existing mapping configuration.
func GameControllerEventState ¶
GameControllerEventState enables or disables controller event polling.
If controller events are disabled, you must call GameControllerLUpdate() yourself and check the state of the controller when you want controller information.
The state can be one of QUERY, ENABLE, OR IGNORE.
func GameControllerGetStringForAxis ¶
func GameControllerGetStringForAxis(axis ControllerAxis) string
GameControllerGetStringForAxis returns a string mapping for axis.
func GameControllerGetStringForButton ¶
func GameControllerGetStringForButton(button ControllerButton) string
GameControllerGetStringForButton gets a string mapping for button.
func GameControllerNameForIndex ¶
GameControllerNameForIndex gets 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 an empty string.
func GameControllerUpdate ¶
func GameControllerUpdate()
GameControllerUpdate updates the current state of the open game controllers.
This is called automatically by the event loop if any game controller events are enabled.
func GetClipboardText ¶
func GetClipboardText() string
GetClipboardText gets UTF-8 text from the clipboard.
func GetCurrentVideoDriver ¶
func GetCurrentVideoDriver() string
GetCurrentVideoDriver returns the name of the currently initialized video driver.
func GetDisplayName ¶
GetDisplayName gets the name of a display in UTF-8 encoding.
func GetError ¶
func GetError() string
GetError gets the SDL error message. The returned string will contain information about the last error that occurred, or be empty if no error has occurred since the last call to ClearError.
You should not have to call this in most cases as SDL functions that can return an error should return a SDLError, which already contains the SDL error message.
func GetEventState ¶
GetEventState returns current processing state for events of type typ.
func GetKeyName ¶
GetKeyName gets a human-readable name for key. If key does not have a name an empty string is returned.
func GetKeyboardState ¶
func GetKeyboardState() []uint8
GetKeyboardState gets a snapshot of the current state of the keyboard. Indexes into the returned slice are obtained by use Scancode values.
func GetMouseState ¶
GetMouseState gets the current state of the mouse.
The current button state is returned as a button bitmask, which can be tested using the Button function, and x and y are the mouse cursor position relative to the focus window for the currently selected mouse.
func GetNumDisplayModes ¶
GetNumDisplayModes returns the number of available display modes.
func GetNumRenderDrivers ¶
func GetNumRenderDrivers() int
GetNumRenderDrivers returns the number of 2D rendering drivers available for the current display.
func GetNumVideoDisplays ¶
func GetNumVideoDisplays() int
GetNumVideoDisplays returns the number of available video displays.
func GetNumVideoDrivers ¶
func GetNumVideoDrivers() int
GetNumVideoDrivers returns the number of video drivers compiled into SDL.
func GetPixelFormatName ¶
func GetPixelFormatName(format PixelFormatEnum) string
GetPixelFormatName gets the human readable name of a pixel format
func GetRGB ¶
func GetRGB(pixel uint32, format *PixelFormat) (r, g, b uint8)
GetRGB gets the RGB components from a pixel of the specified format.
func GetRGBA ¶
func GetRGBA(pixel uint32, format *PixelFormat) (r, g, b, a uint8)
GetRGBA gets the RGBA components from a pixel of the specified format.
func GetRelativeMouseMode ¶
func GetRelativeMouseMode() bool
GetRelativeMouseMode returns whether relative mouse mode is enabled.
func GetRelativeMouseState ¶
GetRelativeMouseState get relative state of the mouse.
The current button state is returned as a bitmask, which can be tested using the Button function, and x and y are the mouse deltas since the last call to GetRelativeMouseState.
func GetRevision ¶
func GetRevision() string
GetRvision returns an arbitrary string (a hash value) uniquely identifying the exact revision of the SDL library in use. It is only useful in comparing against other revisions. It is NOT an incrementing number.
func GetRevisionNumber ¶
func GetRevisionNumber() int
GetRevisionNumber returns the number uniquely identifying the exact revision of the SDL library in use. It is an incrementing number based on commits to hg.libsdl.org.
func GetScancodeName ¶
GetScancodeName gets a human-readable name for a scancode. If scancode does not have a name an empty string is returned.
func GetVideoDriver ¶
GetVideoDriver returns the name of a built in video driver.
func HasClipboardText ¶
func HasClipboardText() bool
HasClipboardText returns whether or not the clipboard exists and contains a text string that is non-empty.
func HasScreenKeyboardSupport ¶
func HasScreenKeyboardSupport() bool
HasScreenKeyboardSupport returns whether the platform has some screen keyboard support.
Note: Not all screen keyboard functions are supported on all platforms.
func Init ¶
Init initializes the subsystems specified by flags. Unless the INIT_NOPARACHUTE flag is set, Init will install cleanup signal handlers for some commonly ignored fatel signals (like SIGSEGV).
func InitSubSystem ¶
InitSubSystem initializes specific SDL subsystems.
func IntersectRectAndLine ¶
IntersectRectAndLine calculates the intersection of a rectangle and line segment.
func IsGameController ¶
IsGameController checks if the joystick on this index is supported by the game controller interface.
func IsScreenSaverEnabled ¶
func IsScreenSaverEnabled() bool
IsScreenSaverEnabled returns whether the screensaver is currently enabled (default on).
func IsTextInputActive ¶
func IsTextInputActive() bool
IsTextInputActive returns whether or not Unicode text input events are enabled.
func JoystickEventState ¶
JoystickEventState enables/disables joystick event polling.
If joystick events are disabled, you must call JoystickUpdate yourself and check the state of the joystick when you want joystick information.
The state can be one of QUERY, ENABLE, or IGNORE.
func JoystickGetGUIDString ¶
func JoystickGetGUIDString(guid JoystickGUID) string
JoystickGetGUIDString returns a string representation for guid.
func JoystickNameForIndex ¶
JoystickNameForIndex gets 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 and empty string.
func JoystickUpdate ¶
func JoystickUpdate()
JoystickUpdate updates the current state of the open joysticks.
This is called automatically by the event loop if any joystick events are enabled.
func MapRGB ¶
func MapRGB(format *PixelFormat, r, g, b uint8) uint32
MapRGB maps an RGB triple to an opaque pixel value for a given pixel format.
func MapRGBA ¶
func MapRGBA(format *PixelFormat, r, g, b, a uint8) uint32
MapRGBA maps an RGBA quadruple to a pixel value for a given pixel format.
func NumJoysticks ¶
func NumJoysticks() int
NumJoysticks counts the number of joysticks attached to the system right now.
func PeepEvents ¶
func PeepEvents(events []EventUnion, action EventAction, minType, maxType EventType) (int, error)
PeepEvents checks the event queue for messages and optionally returns them. The length of the EventUnion slice determines how many events are added or possibly returned from the event queue.
If action is ADDEVENT, events will be added to the back of the event queue.
If action is PEEKEVENT, events at the front of the event queue, within the specified minimum and maximum type, will be returned and will not be removed from the queue.
If action is GETEVENT, events at the front of the event queue, within the specified minimum and maximum type, will be returned and will be removed from the queue.
func PixelFormatEnumToMasks ¶
func PixelFormatEnumToMasks(format PixelFormatEnum) (bpp int, rmask, gmask, bmask, amask uint32, err error)
PixelFormatEnumToMasks converts format into a bpp and RGBA masks.
func PollEvent ¶
func PollEvent(event *EventUnion) int
PollEvent polls for currently pending events. It returns 1 if there are any pending events, or 0 if there are none available. If event is nil the next event will not be removed from the queue.
func PumpEvents ¶
func PumpEvents()
PumpEvents pumps the event loop, gathering events from the input devices. It updates the event queue and internal input device state.
On windows this will need to be run in each OS thread that creates a windows. For this reason you will likely want to call runtime.LockOSThread() before creating a window.
func PushEvent ¶
func PushEvent(event *EventUnion) (int, error)
PushEvent adds an event to the event queue. It returns 1 on succes or 0 if the event was filtered.
func Quit ¶
func Quit()
Quit cleans up all initialized subsystems. You should call it upon all exit conditions.
func QuitSubSystem ¶
func QuitSubSystem(flags InitFlags)
QuitSubSystem cleans up a specific SDL subsystems.
func SetClipboardText ¶
SetClipboardText puts text into the clipboard.
func SetError ¶
func SetError(msg string)
SetError sets the SDL error message to msg. SetError will replace any previous error message.
func SetHint ¶
SetHint sets a hint with normal priority. It returns true if the hint was set or false otherwise.
func SetHintWithPriority ¶
func SetHintWithPriority(name, value string, priority HintPriority) bool
SetHintWithPriority sets 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.
SetHintWithPriority returns true if the hint was set or false otherwise.
func SetModState ¶
func SetModState(modstate Keymod)
SetModState set the current key modifier state for the keyboard. This does not change the keyboard state, only the modifier flags.
func SetRelativeMouseMode ¶
SetRelativeMouseMode set the relative mouse 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
func SetTextInputRect ¶
func SetTextInputRect(rect *Rect)
SetTextInputRect sets the rectangle used to type Unicode text inputs.
func ShowCursor ¶
ShowCursor toggles whether or not the cursor is shown. If toggle is 1 this will show the cursor, if toggle is 0 this will hide the cursor, and if toggle is -1 this will return the current state of the cursor. Returns 1 if the cursor is shown, or 0 if the cursor is hidden.
func ShowSimpleMessageBox ¶
func ShowSimpleMessageBox(flags MessageBoxFlags, title, message string, window *C.SDL_Window) error
ShowSimpleMessageBox creates a simple modal message box.
func StartTextInput ¶
func StartTextInput()
StartTextInput enables text input events. It will show the on-screen keyboard if supported.
func StopTextInput ¶
func StopTextInput()
StopTextInput disables text input events. It will hide the on-screen keyboard if supported.
func VERSION ¶
func VERSION(v *Version)
VERSION sets v to the version of SDL compiled against. It is based on the header the compiler used.
func VersionAtleast ¶
VersionAtleast returns true if the COMPILEDVERSION is >= X.Y.Z
func VersionNum ¶
VersionNum turns the version numbers into a numeric value.
i := VersionNum(1, 2, 3) i == 1203
func VideoInit ¶
VideoInit initializes the video subsystem, optionally specifying a video driver. If driver_name is an empty string ("") the default video driver is used. It does not initialize a window or graphics mode.
func VideoQuit ¶
func VideoQuit()
VideoQuit shuts down the video subsystem. It closes all windows, and restores the original video mode.
func WaitEvent ¶
func WaitEvent(event *EventUnion) error
WaitEvent waits indefinitely for the next available event. If event is nil the next event will not be removed from the queue.
func WaitEventTimeout ¶
func WaitEventTimeout(event *EventUnion, timeout int) error
WaitEventTimeout waits until the specified timeout (in milliseconds) for the next available event. If event is nil the next event will not be removed from the queue.
Types ¶
type BlendMode ¶
type BlendMode uint32
const ( // No blending BLENDMODE_NONE BlendMode = C.SDL_BLENDMODE_NONE // dst = (src * A) + (dst * (1-A)) BLENDMODE_BLEND BlendMode = C.SDL_BLENDMODE_BLEND // dst = (src * A) + dst BLENDMODE_ADD BlendMode = C.SDL_BLENDMODE_ADD // dst = src * dst BLENDMODE_MOD BlendMode = C.SDL_BLENDMODE_MOD )
type ControllerAxis ¶
type ControllerAxis int32
const ( CONTROLLER_AXIS_INVALID ControllerAxis = C.SDL_CONTROLLER_AXIS_INVALID CONTROLLER_AXIS_LEFTX ControllerAxis = C.SDL_CONTROLLER_AXIS_LEFTX CONTROLLER_AXIS_LEFTY ControllerAxis = C.SDL_CONTROLLER_AXIS_LEFTY CONTROLLER_AXIS_RIGHTX ControllerAxis = C.SDL_CONTROLLER_AXIS_RIGHTX CONTROLLER_AXIS_RIGHTY ControllerAxis = C.SDL_CONTROLLER_AXIS_RIGHTY CONTROLLER_AXIS_TRIGGERLEFT ControllerAxis = C.SDL_CONTROLLER_AXIS_TRIGGERLEFT CONTROLLER_AXIS_TRIGGERRIGHT ControllerAxis = C.SDL_CONTROLLER_AXIS_TRIGGERRIGHT CONTROLLER_AXIS_MAX ControllerAxis = C.SDL_CONTROLLER_AXIS_MAX )
func GameControllerGetAxisFromString ¶
func GameControllerGetAxisFromString(pchString string) ControllerAxis
GameControllerGetAxisFromString turns pchString into an axis mapping.
type ControllerAxisEvent ¶
type ControllerAxisEvent struct { Type EventType // CONTROLLERAXISMOTION Timestamp uint32 Which int32 // The joystick instance id Axis uint8 // The joystick axis index Value int16 // The axis value (range: -32768 to 32767) // contains filtered or unexported fields }
Game controller axis motion event structure
func (*ControllerAxisEvent) GetType ¶
func (e *ControllerAxisEvent) GetType() EventType
type ControllerBindtype ¶
type ControllerBindtype int32
const ( CONTROLLER_BINDTYPE_NONE ControllerBindtype = C.SDL_CONTROLLER_BINDTYPE_NONE CONTROLLER_BINDTYPE_BUTTON ControllerBindtype = C.SDL_CONTROLLER_BINDTYPE_BUTTON CONTROLLER_BINDTYPE_AXIS ControllerBindtype = C.SDL_CONTROLLER_BINDTYPE_AXIS CONTROLLER_BINDTYPE_HAT ControllerBindtype = C.SDL_CONTROLLER_BINDTYPE_HAT )
type ControllerButton ¶
type ControllerButton int32
const ( CONTROLLER_BUTTON_INVALID ControllerButton = C.SDL_CONTROLLER_BUTTON_INVALID CONTROLLER_BUTTON_A ControllerButton = C.SDL_CONTROLLER_BUTTON_A CONTROLLER_BUTTON_B ControllerButton = C.SDL_CONTROLLER_BUTTON_B CONTROLLER_BUTTON_X ControllerButton = C.SDL_CONTROLLER_BUTTON_X CONTROLLER_BUTTON_Y ControllerButton = C.SDL_CONTROLLER_BUTTON_Y CONTROLLER_BUTTON_BACK ControllerButton = C.SDL_CONTROLLER_BUTTON_BACK CONTROLLER_BUTTON_GUIDE ControllerButton = C.SDL_CONTROLLER_BUTTON_GUIDE CONTROLLER_BUTTON_START ControllerButton = C.SDL_CONTROLLER_BUTTON_START CONTROLLER_BUTTON_LEFTSTICK ControllerButton = C.SDL_CONTROLLER_BUTTON_LEFTSTICK CONTROLLER_BUTTON_RIGHTSTICK ControllerButton = C.SDL_CONTROLLER_BUTTON_RIGHTSTICK CONTROLLER_BUTTON_LEFTSHOULDER ControllerButton = C.SDL_CONTROLLER_BUTTON_LEFTSHOULDER CONTROLLER_BUTTON_RIGHTSHOULDER ControllerButton = C.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER CONTROLLER_BUTTON_DPAD_UP ControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_UP CONTROLLER_BUTTON_DPAD_DOWN ControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_DOWN CONTROLLER_BUTTON_DPAD_LEFT ControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_LEFT CONTROLLER_BUTTON_DPAD_RIGHT ControllerButton = C.SDL_CONTROLLER_BUTTON_DPAD_RIGHT CONTROLLER_BUTTON_MAX ControllerButton = C.SDL_CONTROLLER_BUTTON_MAX )
func GameControllerGetButtonFromString ¶
func GameControllerGetButtonFromString(pchString string) ControllerButton
GameControllerGetButtonFromString turns pchString into a button mapping.
type ControllerButtonEvent ¶
type ControllerButtonEvent struct { Type EventType // CONTROLLERBUTTONDOWN or CONTROLLERBUTTONUP Timestamp uint32 Which int32 // The joystick instance id Button uint8 // The joystick button index State uint8 // PRESSED or RELEASED // contains filtered or unexported fields }
Game controller button event structure
func (*ControllerButtonEvent) GetType ¶
func (e *ControllerButtonEvent) GetType() EventType
type ControllerDeviceEvent ¶
type ControllerDeviceEvent struct { Type EventType // CONTROLLERDEVICEADDED or CONTROLLERDEVICEREMOVED Timestamp uint32 Which int32 // The joystick device index for ADD, instance_id for REMOVE }
Controller device event structure
func (*ControllerDeviceEvent) GetType ¶
func (e *ControllerDeviceEvent) GetType() EventType
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
func CreateColorCursor ¶
CreateColorCursor creates a color cursor.
func CreateCursor ¶
CreateCursor creates a cursor, using the specified bitmap data and mask (in MSB format). The cursor width must be a multiple of 8 bits.
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
func CreateSystemCursor ¶
func CreateSystemCursor(id SystemCursor) Cursor
CreateSystemCursor creates a system cursor.
type DisplayMode ¶
type DisplayMode struct { Format uint32 // pixel format W int32 // width H int32 // height RefreshRate int32 // refresh rate (or zero for unspecified) Driverdata *byte // driver-specific data, initialize to 0 }
DisplayMode defines a display mode.
func GetClosestDisplayMode ¶
func GetClosestDisplayMode(displayIndex int, requested *DisplayMode) (*DisplayMode, error)
GetClosestDisplayMode returns the closest display mode to the requested display mode.
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 nil is returned.
func GetCurrentDisplayMode ¶
func GetCurrentDisplayMode(displayIndex int) (*DisplayMode, error)
GetCurrentDisplayMode returns the current display mode for displayIndex.
func GetDesktopDisplayMode ¶
func GetDesktopDisplayMode(displayIndex int) (*DisplayMode, error)
GetDesktopDisplayMode returns the desktop display mode.
func GetDisplayMode ¶
func GetDisplayMode(displayIndex, modeIndex int) (*DisplayMode, error)
GetDisplayMode returns the display mode for the given indexes.
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
type DollarGestureEvent ¶
type DollarGestureEvent struct { Type EventType // DOLLARGESTURE Timestamp uint32 TouchId int64 // The touch device index GestureId int64 NumFingers uint32 Error float32 X float32 Y float32 }
func (*DollarGestureEvent) GetType ¶
func (e *DollarGestureEvent) GetType() EventType
type DropEvent ¶
type DropEvent struct { Type EventType // DROPFILE Timestamp uint32 // contains filtered or unexported fields }
An event used to request a file open by the system. This event is disabled by default, you can enable it with EventState.
If you enable this event, you must call FreeFile for all DropEvents.
type EventAction ¶
type EventAction uint32
const ( ADDEVENT EventAction = C.SDL_ADDEVENT PEEKEVENT EventAction = C.SDL_PEEKEVENT GETEVENT EventAction = C.SDL_GETEVENT )
type EventType ¶
type EventType uint32
const ( FIRSTEVENT EventType = C.SDL_FIRSTEVENT QUIT EventType = C.SDL_QUIT WINDOWEVENT EventType = C.SDL_WINDOWEVENT SYSWMEVENT EventType = C.SDL_SYSWMEVENT KEYDOWN EventType = C.SDL_KEYDOWN KEYUP EventType = C.SDL_KEYUP TEXTEDITING EventType = C.SDL_TEXTEDITING TEXTINPUT EventType = C.SDL_TEXTINPUT MOUSEMOTION EventType = C.SDL_MOUSEMOTION MOUSEBUTTONDOWN EventType = C.SDL_MOUSEBUTTONDOWN MOUSEBUTTONUP EventType = C.SDL_MOUSEBUTTONUP MOUSEWHEEL EventType = C.SDL_MOUSEWHEEL JOYAXISMOTION EventType = C.SDL_JOYAXISMOTION JOYBALLMOTION EventType = C.SDL_JOYBALLMOTION JOYHATMOTION EventType = C.SDL_JOYHATMOTION JOYBUTTONDOWN EventType = C.SDL_JOYBUTTONDOWN JOYBUTTONUP EventType = C.SDL_JOYBUTTONUP JOYDEVICEADDED EventType = C.SDL_JOYDEVICEADDED JOYDEVICEREMOVED EventType = C.SDL_JOYDEVICEREMOVED CONTROLLERAXISMOTION EventType = C.SDL_CONTROLLERAXISMOTION CONTROLLERBUTTONDOWN EventType = C.SDL_CONTROLLERBUTTONDOWN CONTROLLERBUTTONUP EventType = C.SDL_CONTROLLERBUTTONUP CONTROLLERDEVICEADDED EventType = C.SDL_CONTROLLERDEVICEADDED CONTROLLERDEVICEREMOVED EventType = C.SDL_CONTROLLERDEVICEREMOVED 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 CLIPBOARDUPDATE EventType = C.SDL_CLIPBOARDUPDATE DROPFILE EventType = C.SDL_DROPFILE USEREVENT EventType = C.SDL_USEREVENT LASTEVENT EventType = C.SDL_LASTEVENT )
func RegisterEvents ¶
RegisterEvents allocates a set of user-defined events, and returns the beginning event number for that set of events. It there aren't enough user-defined events left, it returns (Uint32)-1.
type EventUnion ¶
type EventUnion struct { Type EventType // contains filtered or unexported fields }
EventUnion is used to hold a SDL_Event and is used for transferring events between go and C. To gain access to the other fields of an event you will have to call the Convert method.
func (*EventUnion) Convert ¶
func (event *EventUnion) Convert() Event
Convert converts event form an EventUnion into one of the *Event types. Use it to gain access to all the fields of event.
If Convert can not figure out what type to convert event into then Convert will return event without converting it. This should only happen if this package has fallen out of sync with SDL2 and should be reported if possible.
func (*EventUnion) GetType ¶
func (e *EventUnion) GetType() EventType
type GLContext ¶
type GLContext struct {
// contains filtered or unexported fields
}
An opaque handle to an OpenGl context.
type GLattr ¶
type GLattr uint32
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 )
type GLcontextFlag ¶
type GLcontextFlag uint32
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 GLprofile ¶
type GLprofile uint32
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 struct {
// contains filtered or unexported fields
}
func GameControllerOpen ¶
func GameControllerOpen(joystick_index int) (GameController, error)
GameControllerOpen opens a game controller for use. The index passed as an argument refres to the N'th game controller on the system. This index is the value which will identify this controller in future controller events.
func (GameController) GetAttached ¶
func (c GameController) GetAttached() bool
GetAttached return true if the controller has been opened and is currently connected, or false otherwise.
func (GameController) GetAxis ¶
func (c GameController) GetAxis(axis ControllerAxis) int16
GetAxis gets the current state of an axis control on c. The state is a a value ranging from -32768 to 32767.
func (GameController) GetBindForAxis ¶
func (c GameController) GetBindForAxis(axis ControllerAxis) interface{}
GetBindForAxis gets the joystick layer binding for this controller axis mapping. This returns a GameControllerButtonBind, GameControllerAxisBind or GameControllerHatBind.
func (GameController) GetBindForButton ¶
func (c GameController) GetBindForButton(button ControllerButton) interface{}
GetBindForButton gets the sdl joystick layer binding for this controller button mapping. This returns a GameControllerButtonBind, GameControllerAxisBind or GameControllerHatBind.
func (GameController) GetButton ¶
func (c GameController) GetButton(button ControllerButton) uint8
GetButton gets the current state of a button on c.
func (GameController) GetJoystick ¶
func (c GameController) GetJoystick() Joystick
GetJoystick gets the underlying joystick object used by c
func (GameController) Mapping ¶
func (c GameController) Mapping() (string, error)
Mapping returns a mapping string for c.
type GameControllerAxisBind ¶
type GameControllerAxisBind struct { BindType ControllerBindtype Axis int32 }
type GameControllerButtonBind ¶
type GameControllerButtonBind struct { BindType ControllerBindtype Button int32 }
type GameControllerHatBind ¶
type GameControllerHatBind struct { BindType ControllerBindtype Hat int32 HatMask int32 }
type HatPosition ¶
type HatPosition uint8
const ( HAT_CENTERED HatPosition = C.SDL_HAT_CENTERED HAT_UP HatPosition = C.SDL_HAT_UP HAT_RIGHT HatPosition = C.SDL_HAT_RIGHT HAT_DOWN HatPosition = C.SDL_HAT_DOWN HAT_LEFT HatPosition = C.SDL_HAT_LEFT HAT_RIGHTUP HatPosition = C.SDL_HAT_RIGHTUP HAT_RIGHTDOWN HatPosition = C.SDL_HAT_RIGHTDOWN HAT_LEFTUP HatPosition = C.SDL_HAT_LEFTUP HAT_LEFTDOWN HatPosition = C.SDL_HAT_LEFTDOWN )
type HintPriority ¶
type HintPriority uint32
const ( HINT_DEFAULT HintPriority = C.SDL_HINT_DEFAULT HINT_NORMAL HintPriority = C.SDL_HINT_NORMAL HINT_OVERRIDE HintPriority = C.SDL_HINT_OVERRIDE )
type InitFlags ¶
type InitFlags uint32
const ( INIT_TIMER InitFlags = C.SDL_INIT_TIMER INIT_AUDIO InitFlags = C.SDL_INIT_AUDIO INIT_VIDEO InitFlags = C.SDL_INIT_VIDEO INIT_JOYSTICK InitFlags = C.SDL_INIT_JOYSTICK INIT_GAMECONTROLLER InitFlags = C.SDL_INIT_GAMECONTROLLER // Turn on game controller also implicitly does INIT_JOYSTICK INIT_NOPARACHUTE InitFlags = C.SDL_INIT_NOPARACHUTE // Don't catch fatal signals INIT_EVERYTHING InitFlags = C.SDL_INIT_EVERYTHING )
type JoyAxisEvent ¶
type JoyAxisEvent struct { Type EventType // JOYAXISMOTION Timestamp uint32 Which int32 // The joystick device index Axis uint8 // The joystick axis index Value int16 // The axis value (range: -32768 to 32767) // contains filtered or unexported fields }
Joystick axis motion event structure
func (*JoyAxisEvent) GetType ¶
func (e *JoyAxisEvent) GetType() EventType
type JoyBallEvent ¶
type JoyBallEvent struct { Type EventType // JOYBALLMOTION Timestamp uint32 Which int32 // The joystick device index Ball uint8 // The joystick trackball index Xrel int16 // The relative motion in the X direction Yrel int16 // The relative motion in the Y direction // contains filtered or unexported fields }
Joystick ball event structure
func (*JoyBallEvent) GetType ¶
func (e *JoyBallEvent) GetType() EventType
type JoyButtonEvent ¶
type JoyButtonEvent struct { Type EventType // JOYBUTTONDOWN or JOYBUTTONUP Timestamp uint32 Which int32 // The joystick device index Button uint8 // The joystick button index State uint8 // PRESSED or RELEASED // contains filtered or unexported fields }
Joystick button event structure
func (*JoyButtonEvent) GetType ¶
func (e *JoyButtonEvent) GetType() EventType
type JoyDeviceEvent ¶
type JoyDeviceEvent struct { Type EventType // JOYDEVICEADDED or JOYDEVICEREMOVED Timestamp uint32 Which int32 // The joystick device index for ADD, instance_id for REMOVE }
Joystick device event structure
func (*JoyDeviceEvent) GetType ¶
func (e *JoyDeviceEvent) GetType() EventType
type JoyHatEvent ¶
type JoyHatEvent struct { Type EventType // JOYHATMOTION Timestamp uint32 Which int32 // The joystick device index Hat uint8 // The joystick hat index // The hat position value. // HAT_LEFTUP, HAT_UP, HAT_RIGHTUP // HAT_LEFT, HAT_CENTER, HAT_RIGHT // HAT_LEFTDOWN, HAT_DOWN, HAT_RIGHTDOWN // // Note: zero means the POV is centered. Value uint8 // contains filtered or unexported fields }
Joystick hat postion change event structure
func (*JoyHatEvent) GetType ¶
func (e *JoyHatEvent) GetType() EventType
type Joystick ¶
type Joystick struct {
// contains filtered or unexported fields
}
Joystick is used to identify an SDL joystick.
func JoystickOpen ¶
JoystickOpen opens a joystick for use. device_index refers to the N'th joystick on the system. device_index is the value which will identify this joystick in future joystick events.
func (Joystick) GetAttached ¶
GetAttached returns true if the joystick has been opened and is currently connected, or false otherwise.
func (Joystick) GetAxis ¶
GetAxis gets the current state of an axis control on j.
The state is a value ranging from -32768 to 32767.
The axis indices start at index 0.
func (Joystick) GetBall ¶
GetBall gets the ball axis change since the last poll.
The ball indices start at index 0.
func (Joystick) GetButton ¶
GetButton gets the current state of a button on j.
The button indices start at index 0.
func (Joystick) GetHat ¶
func (j Joystick) GetHat(hat int) HatPosition
GetHat gets the current state of a POV hat on j.
The hat indices start at index 0.
func (Joystick) InstanceID ¶
func (j Joystick) InstanceID() JoystickID
InstanceID gets the device index of j.
func (Joystick) Name ¶
Name gets the name for j. If no name can be found, Name returns an empty string.
func (Joystick) NumBalls ¶
NumBalls gets the number of trackballs on j.
Joystick trackballs have only relative motion events associated with them and their state cannot be polled.
func (Joystick) NumButtons ¶
NumButtons gets the number of buttons on j.
type JoystickGUID ¶
type JoystickGUID struct {
Data [16]uint8
}
JoystickGUID encodes the stable unique id for a joystick device.
func JoystickGetDeviceGUID ¶
func JoystickGetDeviceGUID(device_index int) JoystickGUID
JoystickGetDeviceGUID returns the GUID for the joystick at device_index.
func JoystickGetGUIDFromString ¶
func JoystickGetGUIDFromString(pchGUID string) JoystickGUID
JoystickGetGUIDFromString converts a string into a joystick formatted guid.
func (JoystickGUID) GameControllerMapping ¶
func (guid JoystickGUID) GameControllerMapping() (string, error)
GameControllerMapping returns a mapping string for guid.
type JoystickID ¶
type JoystickID int32
type KeyboardEvent ¶
type KeyboardEvent struct { Type EventType // KEYDOWN OR KEYUP Timestamp uint32 WindowID uint32 // The window with keyboard focus, if any State uint8 // PRESSED or RELEASED Repeat uint8 // Non-zero if this is a key repeat Keysym Keysym // The key that was pressed or released // contains filtered or unexported fields }
Keyboard button event structure
func (*KeyboardEvent) GetType ¶
func (e *KeyboardEvent) GetType() EventType
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 K_* constant for those keys that do not generate characters.
const ( K_UNKNOWN Keycode = C.SDLK_UNKNOWN K_RETURN Keycode = C.SDLK_RETURN K_ESCAPE Keycode = C.SDLK_ESCAPE K_BACKSPACE Keycode = C.SDLK_BACKSPACE K_TAB Keycode = C.SDLK_TAB K_SPACE Keycode = C.SDLK_SPACE K_EXCLAIM Keycode = C.SDLK_EXCLAIM K_QUOTEDBL Keycode = C.SDLK_QUOTEDBL K_HASH Keycode = C.SDLK_HASH K_PERCENT Keycode = C.SDLK_PERCENT K_DOLLAR Keycode = C.SDLK_DOLLAR K_AMPERSAND Keycode = C.SDLK_AMPERSAND K_QUOTE Keycode = C.SDLK_QUOTE K_LEFTPAREN Keycode = C.SDLK_LEFTPAREN K_RIGHTPAREN Keycode = C.SDLK_RIGHTPAREN K_ASTERISK Keycode = C.SDLK_ASTERISK K_PLUS Keycode = C.SDLK_PLUS K_COMMA Keycode = C.SDLK_COMMA K_MINUS Keycode = C.SDLK_MINUS K_PERIOD Keycode = C.SDLK_PERIOD K_SLASH Keycode = C.SDLK_SLASH K_0 Keycode = C.SDLK_0 K_1 Keycode = C.SDLK_1 K_2 Keycode = C.SDLK_2 K_3 Keycode = C.SDLK_3 K_4 Keycode = C.SDLK_4 K_5 Keycode = C.SDLK_5 K_6 Keycode = C.SDLK_6 K_7 Keycode = C.SDLK_7 K_8 Keycode = C.SDLK_8 K_9 Keycode = C.SDLK_9 K_COLON Keycode = C.SDLK_COLON K_SEMICOLON Keycode = C.SDLK_SEMICOLON K_LESS Keycode = C.SDLK_LESS K_EQUALS Keycode = C.SDLK_EQUALS K_GREATER Keycode = C.SDLK_GREATER K_QUESTION Keycode = C.SDLK_QUESTION K_AT Keycode = C.SDLK_AT K_LEFTBRACKET Keycode = C.SDLK_LEFTBRACKET K_BACKSLASH Keycode = C.SDLK_BACKSLASH K_RIGHTBRACKET Keycode = C.SDLK_RIGHTBRACKET K_CARET Keycode = C.SDLK_CARET K_UNDERSCORE Keycode = C.SDLK_UNDERSCORE K_BACKQUOTE Keycode = C.SDLK_BACKQUOTE K_a Keycode = C.SDLK_a K_b Keycode = C.SDLK_b K_c Keycode = C.SDLK_c K_d Keycode = C.SDLK_d K_e Keycode = C.SDLK_e K_f Keycode = C.SDLK_f K_g Keycode = C.SDLK_g K_h Keycode = C.SDLK_h K_i Keycode = C.SDLK_i K_j Keycode = C.SDLK_j K_k Keycode = C.SDLK_k K_l Keycode = C.SDLK_l K_m Keycode = C.SDLK_m K_n Keycode = C.SDLK_n K_o Keycode = C.SDLK_o K_p Keycode = C.SDLK_p K_q Keycode = C.SDLK_q K_r Keycode = C.SDLK_r K_s Keycode = C.SDLK_s K_t Keycode = C.SDLK_t K_u Keycode = C.SDLK_u K_v Keycode = C.SDLK_v K_w Keycode = C.SDLK_w K_x Keycode = C.SDLK_x K_y Keycode = C.SDLK_y K_z Keycode = C.SDLK_z K_CAPSLOCK Keycode = C.SDLK_CAPSLOCK K_F1 Keycode = C.SDLK_F1 K_F2 Keycode = C.SDLK_F2 K_F3 Keycode = C.SDLK_F3 K_F4 Keycode = C.SDLK_F4 K_F5 Keycode = C.SDLK_F5 K_F6 Keycode = C.SDLK_F6 K_F7 Keycode = C.SDLK_F7 K_F8 Keycode = C.SDLK_F8 K_F9 Keycode = C.SDLK_F9 K_F10 Keycode = C.SDLK_F10 K_F11 Keycode = C.SDLK_F11 K_F12 Keycode = C.SDLK_F12 K_PRINTSCREEN Keycode = C.SDLK_PRINTSCREEN K_SCROLLLOCK Keycode = C.SDLK_SCROLLLOCK K_PAUSE Keycode = C.SDLK_PAUSE K_INSERT Keycode = C.SDLK_INSERT K_HOME Keycode = C.SDLK_HOME K_PAGEUP Keycode = C.SDLK_PAGEUP K_DELETE Keycode = C.SDLK_DELETE K_END Keycode = C.SDLK_END K_PAGEDOWN Keycode = C.SDLK_PAGEDOWN K_RIGHT Keycode = C.SDLK_RIGHT K_LEFT Keycode = C.SDLK_LEFT K_DOWN Keycode = C.SDLK_DOWN K_UP Keycode = C.SDLK_UP K_NUMLOCKCLEAR Keycode = C.SDLK_NUMLOCKCLEAR K_KP_DIVIDE Keycode = C.SDLK_KP_DIVIDE K_KP_MULTIPLY Keycode = C.SDLK_KP_MULTIPLY K_KP_MINUS Keycode = C.SDLK_KP_MINUS K_KP_PLUS Keycode = C.SDLK_KP_PLUS K_KP_ENTER Keycode = C.SDLK_KP_ENTER K_KP_1 Keycode = C.SDLK_KP_1 K_KP_2 Keycode = C.SDLK_KP_2 K_KP_3 Keycode = C.SDLK_KP_3 K_KP_4 Keycode = C.SDLK_KP_4 K_KP_5 Keycode = C.SDLK_KP_5 K_KP_6 Keycode = C.SDLK_KP_6 K_KP_7 Keycode = C.SDLK_KP_7 K_KP_8 Keycode = C.SDLK_KP_8 K_KP_9 Keycode = C.SDLK_KP_9 K_KP_0 Keycode = C.SDLK_KP_0 K_KP_PERIOD Keycode = C.SDLK_KP_PERIOD K_APPLICATION Keycode = C.SDLK_APPLICATION K_POWER Keycode = C.SDLK_POWER K_KP_EQUALS Keycode = C.SDLK_KP_EQUALS K_F13 Keycode = C.SDLK_F13 K_F14 Keycode = C.SDLK_F14 K_F15 Keycode = C.SDLK_F15 K_F16 Keycode = C.SDLK_F16 K_F17 Keycode = C.SDLK_F17 K_F18 Keycode = C.SDLK_F18 K_F19 Keycode = C.SDLK_F19 K_F20 Keycode = C.SDLK_F20 K_F21 Keycode = C.SDLK_F21 K_F22 Keycode = C.SDLK_F22 K_F23 Keycode = C.SDLK_F23 K_F24 Keycode = C.SDLK_F24 K_EXECUTE Keycode = C.SDLK_EXECUTE K_HELP Keycode = C.SDLK_HELP K_MENU Keycode = C.SDLK_MENU K_SELECT Keycode = C.SDLK_SELECT K_STOP Keycode = C.SDLK_STOP K_AGAIN Keycode = C.SDLK_AGAIN K_UNDO Keycode = C.SDLK_UNDO K_CUT Keycode = C.SDLK_CUT K_COPY Keycode = C.SDLK_COPY K_PASTE Keycode = C.SDLK_PASTE K_FIND Keycode = C.SDLK_FIND K_MUTE Keycode = C.SDLK_MUTE K_VOLUMEUP Keycode = C.SDLK_VOLUMEUP K_VOLUMEDOWN Keycode = C.SDLK_VOLUMEDOWN K_KP_COMMA Keycode = C.SDLK_KP_COMMA K_KP_EQUALSAS400 Keycode = C.SDLK_KP_EQUALSAS400 K_ALTERASE Keycode = C.SDLK_ALTERASE K_SYSREQ Keycode = C.SDLK_SYSREQ K_CANCEL Keycode = C.SDLK_CANCEL K_CLEAR Keycode = C.SDLK_CLEAR K_PRIOR Keycode = C.SDLK_PRIOR K_RETURN2 Keycode = C.SDLK_RETURN2 K_SEPARATOR Keycode = C.SDLK_SEPARATOR K_OUT Keycode = C.SDLK_OUT K_OPER Keycode = C.SDLK_OPER K_CLEARAGAIN Keycode = C.SDLK_CLEARAGAIN K_CRSEL Keycode = C.SDLK_CRSEL K_EXSEL Keycode = C.SDLK_EXSEL K_KP_00 Keycode = C.SDLK_KP_00 K_KP_000 Keycode = C.SDLK_KP_000 K_THOUSANDSSEPARATOR Keycode = C.SDLK_THOUSANDSSEPARATOR K_DECIMALSEPARATOR Keycode = C.SDLK_DECIMALSEPARATOR K_CURRENCYUNIT Keycode = C.SDLK_CURRENCYUNIT K_CURRENCYSUBUNIT Keycode = C.SDLK_CURRENCYSUBUNIT K_KP_LEFTPAREN Keycode = C.SDLK_KP_LEFTPAREN K_KP_RIGHTPAREN Keycode = C.SDLK_KP_RIGHTPAREN K_KP_LEFTBRACE Keycode = C.SDLK_KP_LEFTBRACE K_KP_RIGHTBRACE Keycode = C.SDLK_KP_RIGHTBRACE K_KP_TAB Keycode = C.SDLK_KP_TAB K_KP_BACKSPACE Keycode = C.SDLK_KP_BACKSPACE K_KP_A Keycode = C.SDLK_KP_A K_KP_B Keycode = C.SDLK_KP_B K_KP_C Keycode = C.SDLK_KP_C K_KP_D Keycode = C.SDLK_KP_D K_KP_E Keycode = C.SDLK_KP_E K_KP_F Keycode = C.SDLK_KP_F K_KP_XOR Keycode = C.SDLK_KP_XOR K_KP_POWER Keycode = C.SDLK_KP_POWER K_KP_PERCENT Keycode = C.SDLK_KP_PERCENT K_KP_LESS Keycode = C.SDLK_KP_LESS K_KP_GREATER Keycode = C.SDLK_KP_GREATER K_KP_AMPERSAND Keycode = C.SDLK_KP_AMPERSAND K_KP_DBLAMPERSAND Keycode = C.SDLK_KP_DBLAMPERSAND K_KP_VERTICALBAR Keycode = C.SDLK_KP_VERTICALBAR K_KP_DBLVERTICALBAR Keycode = C.SDLK_KP_DBLVERTICALBAR K_KP_COLON Keycode = C.SDLK_KP_COLON K_KP_HASH Keycode = C.SDLK_KP_HASH K_KP_SPACE Keycode = C.SDLK_KP_SPACE K_KP_AT Keycode = C.SDLK_KP_AT K_KP_EXCLAM Keycode = C.SDLK_KP_EXCLAM K_KP_MEMSTORE Keycode = C.SDLK_KP_MEMSTORE K_KP_MEMRECALL Keycode = C.SDLK_KP_MEMRECALL K_KP_MEMCLEAR Keycode = C.SDLK_KP_MEMCLEAR K_KP_MEMADD Keycode = C.SDLK_KP_MEMADD K_KP_MEMSUBTRACT Keycode = C.SDLK_KP_MEMSUBTRACT K_KP_MEMMULTIPLY Keycode = C.SDLK_KP_MEMMULTIPLY K_KP_MEMDIVIDE Keycode = C.SDLK_KP_MEMDIVIDE K_KP_PLUSMINUS Keycode = C.SDLK_KP_PLUSMINUS K_KP_CLEAR Keycode = C.SDLK_KP_CLEAR K_KP_CLEARENTRY Keycode = C.SDLK_KP_CLEARENTRY K_KP_BINARY Keycode = C.SDLK_KP_BINARY K_KP_OCTAL Keycode = C.SDLK_KP_OCTAL K_KP_DECIMAL Keycode = C.SDLK_KP_DECIMAL K_KP_HEXADECIMAL Keycode = C.SDLK_KP_HEXADECIMAL K_LCTRL Keycode = C.SDLK_LCTRL K_LSHIFT Keycode = C.SDLK_LSHIFT K_LALT Keycode = C.SDLK_LALT K_LGUI Keycode = C.SDLK_LGUI K_RCTRL Keycode = C.SDLK_RCTRL K_RSHIFT Keycode = C.SDLK_RSHIFT K_RALT Keycode = C.SDLK_RALT K_RGUI Keycode = C.SDLK_RGUI K_MODE Keycode = C.SDLK_MODE K_AUDIONEXT Keycode = C.SDLK_AUDIONEXT K_AUDIOPREV Keycode = C.SDLK_AUDIOPREV K_AUDIOSTOP Keycode = C.SDLK_AUDIOSTOP K_AUDIOPLAY Keycode = C.SDLK_AUDIOPLAY K_AUDIOMUTE Keycode = C.SDLK_AUDIOMUTE K_MEDIASELECT Keycode = C.SDLK_MEDIASELECT K_WWW Keycode = C.SDLK_WWW K_MAIL Keycode = C.SDLK_MAIL K_CALCULATOR Keycode = C.SDLK_CALCULATOR K_COMPUTER Keycode = C.SDLK_COMPUTER K_AC_SEARCH Keycode = C.SDLK_AC_SEARCH K_AC_HOME Keycode = C.SDLK_AC_HOME K_AC_BACK Keycode = C.SDLK_AC_BACK K_AC_FORWARD Keycode = C.SDLK_AC_FORWARD K_AC_STOP Keycode = C.SDLK_AC_STOP K_AC_REFRESH Keycode = C.SDLK_AC_REFRESH K_AC_BOOKMARKS Keycode = C.SDLK_AC_BOOKMARKS K_BRIGHTNESSDOWN Keycode = C.SDLK_BRIGHTNESSDOWN K_BRIGHTNESSUP Keycode = C.SDLK_BRIGHTNESSUP K_DISPLAYSWITCH Keycode = C.SDLK_DISPLAYSWITCH K_KBDILLUMTOGGLE Keycode = C.SDLK_KBDILLUMTOGGLE K_KBDILLUMDOWN Keycode = C.SDLK_KBDILLUMDOWN K_KBDILLUMUP Keycode = C.SDLK_KBDILLUMUP K_EJECT Keycode = C.SDLK_EJECT K_SLEEP Keycode = C.SDLK_SLEEP )
func GetKeyFromName ¶
GetKeyFromName gets a key code from a human-readable name. If name is not recognized K_UNKNOWN is returned.
func GetKeyFromScancode ¶
GetKeyFromScancode gets the key code corresponding to the given scancode according to the current keyboard layout.
type Keymod ¶
type Keymod uint16
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 KMOD_CTRL Keymod = C.KMOD_CTRL KMOD_SHIFT Keymod = C.KMOD_SHIFT KMOD_ALT Keymod = C.KMOD_ALT KMOD_GUI Keymod = C.KMOD_GUI )
func GetModState ¶
func GetModState() Keymod
GetModState gets the current modifier state for the keyboard.
type Keysym ¶
type Keysym struct { Scancode Scancode // SDL physical key code - see Scancode for details Sym Keycode // SDL virtual key code - see Keycode for details Mod Keymod // current key modifiers // contains filtered or unexported fields }
Keysym is used in key events.
type MessageBoxButtonData ¶
type MessageBoxButtonData struct { Flags MessageBoxButtonFlags Buttonid int32 // User defined button id Text string // Button text (UTF-8) }
MessageBoxButtonData contains the data for a button in a message box.
type MessageBoxButtonFlags ¶
type MessageBoxButtonFlags uint32
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 ¶
MessageBoxColor contains the RGB value used in message box color scheme.
type MessageBoxColorScheme ¶
type MessageBoxColorScheme [5]MessageBoxColor
MessageBoxColorScheme is a set of colors to use for message box dialogs.
type MessageBoxColorType ¶
type MessageBoxColorType uint32
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 )
type MessageBoxData ¶
type MessageBoxData struct { Flags MessageBoxFlags Window Window // The parent window, or a zero value Window for no parent. Title string // Title text (UTF-8) Message string // Mesage text (UTF-8) Buttons []MessageBoxButtonData ColorScheme *MessageBoxColorScheme // Can be nil }
MessageBoxData contains all the information needed to create a message box dialog.
func (*MessageBoxData) Show ¶
func (box *MessageBoxData) Show() (buttonid int32, err error)
Show creates a modal messagebox, buttonid is the id of the button pressed by the user.
Note: Show should be called on the thread that created the parent winow, 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.
type MessageBoxFlags ¶
type MessageBoxFlags uint32
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 { Type EventType // MOUSEBUTTONDOWN or MOUSEBUTTONUP Timestamp uint32 WindowID uint32 // The window with mouse focus, if any Which uint32 Button uint8 // The mouse button index State uint8 // PRESSED or RELEASED X int32 // X coordinate, relative to window Y int32 // Y coordinate, relative to window // contains filtered or unexported fields }
Mouse button event structure
func (*MouseButtonEvent) GetType ¶
func (e *MouseButtonEvent) GetType() EventType
type MouseMotionEvent ¶
type MouseMotionEvent struct { Type EventType // MOUSEMOTION Timestamp uint32 WindowID uint32 // The window with mouse focus, if any Which uint32 State uint8 // The current button state X int32 // X coordinate, relative to window Y int32 // Y coordinate, relative to window Xrel int32 // The relative motion in the X direction Yrel int32 // The relative motion in the Y direction // contains filtered or unexported fields }
Mouse motion event structure
func (*MouseMotionEvent) GetType ¶
func (e *MouseMotionEvent) GetType() EventType
type MouseWheelEvent ¶
type MouseWheelEvent struct { Type EventType // MOUSEWHEEL Timestamp uint32 WindowID uint32 // The window with mouse focus, if any Which uint32 X int32 // The amount scrolled horizontally Y int32 // The amount scrolled vertically }
Mouse wheel event structure
func (*MouseWheelEvent) GetType ¶
func (e *MouseWheelEvent) GetType() EventType
type MultiGestureEvent ¶
type MultiGestureEvent struct { Type EventType // MULTIGESTURE Timestamp uint32 TouchId int64 // The touch device index DTheta float32 DDist float32 X float32 // currently 0...1. Y float32 NumFingers uint16 // contains filtered or unexported fields }
Multiple Finger Gesture Event
func (*MultiGestureEvent) GetType ¶
func (e *MultiGestureEvent) GetType() EventType
type Palette ¶
type Palette struct {
// contains filtered or unexported fields
}
Palette contains palette information. You should never need to create a palette manually. It is automatically created when SDL allocates a PixelFormat for a surface.
func AllocPalette ¶
AllocPalette create a palette structure with the specified number of color entries.
func (*Palette) Colors ¶
Colors gives you access to palette's color data as a Color slice. The slice is backed by palettes color data and should not be appended to.
type PixelFormat ¶
type PixelFormat struct { Format uint32 Palette *Palette BitsPerPixel uint8 BytesPerPixel uint8 Rmask uint32 Gmask uint32 Bmask uint32 Amask uint32 Rloss uint8 Gloss uint8 Bloss uint8 Aloss uint8 Rshift uint8 Gshift uint8 Bshift uint8 Ashift uint8 // contains filtered or unexported fields }
Everything in PixelFormat is read-only.
func AllocFormat ¶
func AllocFormat(format PixelFormatEnum) (*PixelFormat, error)
AllocFormat creates a PixelFormat structure from a PixelFormatEnum.
func (*PixelFormat) Free ¶
func (format *PixelFormat) Free()
Free frees a PixelFormat created by AllocFormat.
func (*PixelFormat) SetPalette ¶
func (format *PixelFormat) SetPalette(palette *Palette) error
SetPalette sets the palette for format.
type PixelFormatEnum ¶
type PixelFormatEnum uint32
var ( PIXELFORMAT_UNKNOWN PixelFormatEnum = C.SDL_PIXELFORMAT_UNKNOWN PIXELFORMAT_INDEX1LSB PixelFormatEnum = C.SDL_PIXELFORMAT_INDEX1LSB PIXELFORMAT_INDEX1MSB PixelFormatEnum = C.SDL_PIXELFORMAT_INDEX1MSB PIXELFORMAT_INDEX4LSB PixelFormatEnum = C.SDL_PIXELFORMAT_INDEX4LSB PIXELFORMAT_INDEX4MSB PixelFormatEnum = C.SDL_PIXELFORMAT_INDEX4MSB PIXELFORMAT_INDEX8 PixelFormatEnum = C.SDL_PIXELFORMAT_INDEX8 PIXELFORMAT_RGB332 PixelFormatEnum = C.SDL_PIXELFORMAT_RGB332 PIXELFORMAT_RGB444 PixelFormatEnum = C.SDL_PIXELFORMAT_RGB444 PIXELFORMAT_RGB555 PixelFormatEnum = C.SDL_PIXELFORMAT_RGB555 PIXELFORMAT_BGR555 PixelFormatEnum = C.SDL_PIXELFORMAT_BGR555 PIXELFORMAT_ARGB4444 PixelFormatEnum = C.SDL_PIXELFORMAT_ARGB4444 PIXELFORMAT_RGBA4444 PixelFormatEnum = C.SDL_PIXELFORMAT_RGBA4444 PIXELFORMAT_ABGR4444 PixelFormatEnum = C.SDL_PIXELFORMAT_ABGR4444 PIXELFORMAT_BGRA4444 PixelFormatEnum = C.SDL_PIXELFORMAT_BGRA4444 PIXELFORMAT_ARGB1555 PixelFormatEnum = C.SDL_PIXELFORMAT_ARGB1555 PIXELFORMAT_RGBA5551 PixelFormatEnum = C.SDL_PIXELFORMAT_RGBA5551 PIXELFORMAT_ABGR1555 PixelFormatEnum = C.SDL_PIXELFORMAT_ABGR1555 PIXELFORMAT_BGRA5551 PixelFormatEnum = C.SDL_PIXELFORMAT_BGRA5551 PIXELFORMAT_RGB565 PixelFormatEnum = C.SDL_PIXELFORMAT_RGB565 PIXELFORMAT_BGR565 PixelFormatEnum = C.SDL_PIXELFORMAT_BGR565 PIXELFORMAT_RGB24 PixelFormatEnum = C.SDL_PIXELFORMAT_RGB24 PIXELFORMAT_BGR24 PixelFormatEnum = C.SDL_PIXELFORMAT_BGR24 PIXELFORMAT_RGB888 PixelFormatEnum = C.SDL_PIXELFORMAT_RGB888 PIXELFORMAT_RGBX8888 PixelFormatEnum = C.SDL_PIXELFORMAT_RGBX8888 PIXELFORMAT_BGR888 PixelFormatEnum = C.SDL_PIXELFORMAT_BGR888 PIXELFORMAT_BGRX8888 PixelFormatEnum = C.SDL_PIXELFORMAT_BGRX8888 PIXELFORMAT_ARGB8888 PixelFormatEnum = C.SDL_PIXELFORMAT_ARGB8888 PIXELFORMAT_RGBA8888 PixelFormatEnum = C.SDL_PIXELFORMAT_RGBA8888 PIXELFORMAT_ABGR8888 PixelFormatEnum = C.SDL_PIXELFORMAT_ABGR8888 PIXELFORMAT_BGRA8888 PixelFormatEnum = C.SDL_PIXELFORMAT_BGRA8888 PIXELFORMAT_ARGB2101010 PixelFormatEnum = C.SDL_PIXELFORMAT_ARGB2101010 PIXELFORMAT_YV12 PixelFormatEnum = C.SDL_PIXELFORMAT_YV12 PIXELFORMAT_IYUV PixelFormatEnum = C.SDL_PIXELFORMAT_IYUV PIXELFORMAT_YUY2 PixelFormatEnum = C.SDL_PIXELFORMAT_YUY2 PIXELFORMAT_UYVY PixelFormatEnum = C.SDL_PIXELFORMAT_UYVY PIXELFORMAT_YVYU PixelFormatEnum = C.SDL_PIXELFORMAT_YVYU )
func MasksToPixelFormatEnum ¶
func MasksToPixelFormatEnum(bpp int, rmask, gmask, bmask, amask uint32) PixelFormatEnum
MasksToPixelFormatEnum converts a bpp and RGBA masks to a PixelFormatEnum.
type Rect ¶
Rect is a rectangle, with the origin at the upper left.
func EnclosePoints ¶
EclosedPoints calculates a minimal rectangle enclosing a set of points.
func GetDisplayBounds ¶
GetDisplayBounds returns the desktop area represented by a display, with the primary display located at 0,0.
func (*Rect) HasIntersection ¶
HasIntersection determines whether a and b intersect.
func (*Rect) IntersectRect ¶
IntersectRect calculates the intersection of a and b.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
A structure representing rendering state
func (Renderer) Clear ¶
Clear clears the current rendering target with the drawing color. It clears the entire rendering target, ignoring the viewport.
func (Renderer) Copy ¶
Copy copies a portion of the texture to the current rendering target. If srcrect is nil the entire texture is copied. If dstrect is nil the entire rendering target is filled.
func (Renderer) CopyEx ¶
func (renderer Renderer) CopyEx(texture Texture, srcrect, dstrect *Rect, angle float64, center *Point, flip RendererFlip) error
CopyEx copies a portion of the source texture to the current rendering target, rotating it by angle around the given center. If srcrect is nil the entire texture is copied. If dstrect is nil the entire rendering target is filled. If center is nil rotation will be done around (dstrect.W/2, dstrect.H/2).
func (Renderer) CreateTexture ¶
func (renderer Renderer) CreateTexture(format PixelFormatEnum, access TextureAccess, w, h int) (Texture, error)
CreateTexture creates a texture for the rendering context.
func (Renderer) CreateTextureFromSurface ¶
CreateTextureFromSurface creates a texture from an existing surface.
func (Renderer) Destroy ¶
func (renderer Renderer) Destroy()
Destroy destroys the rendering context and frees associated textures.
func (Renderer) DrawLines ¶
DrawLines draws a series of connected lines on the current rendering target.
func (Renderer) DrawPoints ¶
DrawPoints draws multiple points on the current rendering target.
func (Renderer) DrawRect ¶
DrawRect draws a rectangle on the current rendering target. If rect is nil the entire rendering target is outlined.
func (Renderer) DrawRects ¶
DrawRects draws some number of rectangles on the current rendering target.
func (Renderer) FillRect ¶
FillRect fills a rectangle on the current rendering target with the drawing color. If rect is nil the entire rendering target is filled.
func (Renderer) FillRects ¶
FillRects fills some number of rectangles on the current rendering target with the drawing color.
func (Renderer) GetDrawBlendMode ¶
GetDrawBlendMode returns the blend mode used for drawing operations.
func (Renderer) GetDrawColor ¶
GetDrawColor returns the color used for drawing operations (Rect, Line and Clear).
func (Renderer) GetInfo ¶
func (renderer Renderer) GetInfo() (*RendererInfo, error)
GetRendererInfo returns information about the rendering context.
func (Renderer) GetLogicalSize ¶
GetLogicalSize gets device independent resolution for rendering
func (Renderer) GetRenderTarget ¶
GetRenderTarget gets the current render target.
FIXME: A nil texture means default render target.
func (Renderer) GetViewport ¶
GetViewport returns the drawing area for the current target.
func (Renderer) Present ¶
func (renderer Renderer) Present()
Present updates the screen with the rendering performed.
func (Renderer) RenderTargetSupported ¶
RenderTragetSupported determines whether the renderer supports the use of render targets.
func (Renderer) SetDrawBlendMode ¶
SetDrawBlendMode sets the blend mode used for drawing operations (Fill and Line).
func (Renderer) SetDrawColor ¶
SetDrawColor sets the color used for drawing operations (Rect, Line and Clear).
func (Renderer) SetLogicalSize ¶
SetLogicalSize sets device independent resolution for rendering.
This function uses teh 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.
func (Renderer) SetRenderTarget ¶
SetRenderTarget sets the texture to as the current rendering target. If texture is nil the default render target is used.
func (Renderer) SetScale ¶
SetScale sets teh drawing scale for rendering on the current target.
The drawing coordinates are scaled by the x/w scaling factors before they are used by the renderer. This allow 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.
func (Renderer) SetViewport ¶
SetViewport sets the drawing area for rendering on the current target. If rect is nil the viewport is set to the entire target.
type RendererFlags ¶
type RendererFlags uint32
Information on the capabilities of a render driver or context.
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 uint32
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 { Name string // The name of the renderer Flags uint32 // Supported RendererFlags Num_texture_formats uint32 // The number of available texture formats Texture_formats [16]PixelFormatEnum // The available texture formats Max_texture_width int32 // The maximimum texture width Max_texture_height int32 // The maximimum texture height }
func GetRenderDriverInfo ¶
func GetRenderDriverInfo(index int) (*RendererInfo, error)
GetRenderDriverInfo returns information about the 2D rendering driver specified by index for the current display.
type SDLError ¶
SDLError is returned when sdl returns an error. Msg is the message from GetError() and Value is the error code or 0 for nil pointers.
type Scancode ¶
type Scancode uint32
The SDL keyboard scancode representation.
Values of this type are used to represent keyboard keys. The values of this type are based on the USB usage page standard: http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
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 SCANCODE_BACKSLASH Scancode = C.SDL_SCANCODE_BACKSLASH SCANCODE_NONUSHASH Scancode = C.SDL_SCANCODE_NONUSHASH SCANCODE_SEMICOLON Scancode = C.SDL_SCANCODE_SEMICOLON SCANCODE_APOSTROPHE Scancode = C.SDL_SCANCODE_APOSTROPHE 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 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 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 SCANCODE_NONUSBACKSLASH Scancode = C.SDL_SCANCODE_NONUSBACKSLASH SCANCODE_APPLICATION Scancode = C.SDL_SCANCODE_APPLICATION 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 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 SCANCODE_INTERNATIONAL1 Scancode = C.SDL_SCANCODE_INTERNATIONAL1 SCANCODE_INTERNATIONAL2 Scancode = C.SDL_SCANCODE_INTERNATIONAL2 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 SCANCODE_LANG1 Scancode = C.SDL_SCANCODE_LANG1 SCANCODE_LANG2 Scancode = C.SDL_SCANCODE_LANG2 SCANCODE_LANG3 Scancode = C.SDL_SCANCODE_LANG3 SCANCODE_LANG4 Scancode = C.SDL_SCANCODE_LANG4 SCANCODE_LANG5 Scancode = C.SDL_SCANCODE_LANG5 SCANCODE_LANG6 Scancode = C.SDL_SCANCODE_LANG6 SCANCODE_LANG7 Scancode = C.SDL_SCANCODE_LANG7 SCANCODE_LANG8 Scancode = C.SDL_SCANCODE_LANG8 SCANCODE_LANG9 Scancode = C.SDL_SCANCODE_LANG9 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 SCANCODE_LALT Scancode = C.SDL_SCANCODE_LALT SCANCODE_LGUI Scancode = C.SDL_SCANCODE_LGUI SCANCODE_RCTRL Scancode = C.SDL_SCANCODE_RCTRL SCANCODE_RSHIFT Scancode = C.SDL_SCANCODE_RSHIFT SCANCODE_RALT Scancode = C.SDL_SCANCODE_RALT SCANCODE_RGUI Scancode = C.SDL_SCANCODE_RGUI 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 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 NUM_SCANCODES Scancode = C.SDL_NUM_SCANCODES )
func GetScancodeFromKey ¶
GetScancodeFromKey gets teh scancode corresponding to the given key code according to the current keyboard layout.
func GetScancodeFromName ¶
GetScancodeFromName gets a scancode from a human-readable name. If the name is not recognized SCANCODE_UNKNOWN is returned.
type Surface ¶
type Surface struct { Format *PixelFormat // Read-only W int32 // Read-only H int32 // Read-only // The length of a row pixels in bytes Pitch int32 // Read-only // Application data associated with the surface Userdata uintptr // Read-write // Clipping information Clip_rect Rect // Read-only Refcount int32 // Read-mostly // contains filtered or unexported fields }
Surface is a collection of pixels used in software blitting.
Note: This structure should be treated as read-only, except for Pixels, which, if not nil, contains the raw pixel data for the surface.
func CreateRGBSurface ¶
func CreateRGBSurface(width, height, depth int, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error)
CreateRGBSurface allocates an RGB surface. If the depth is 4 or 8 bits, an empty palette is allocated for the surface. If the depth is greater then 8 bits, the pixel format is set using the flags '[RGB]mask'. Using zeros for '[RGB]mask' will set them to their default value based on depth. However, using zero for the Amask results in an Amask of zero.
func CreateRGBSurfaceFrom ¶
func CreateRGBSurfaceFrom(pixels unsafe.Pointer, width, height, depth, pitch int, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error)
CreateRGBSurfaceFrom allocates an RGB surface with existing pixel data. If the depth is 4 or 8, an empty palette is allocated for the surface. If the depth is greater then 8 bits, the pixel format is set using the flags '[RGB]mask'. Using zeros for '[RGB]mask' will set them to their default value based on depth. However, using zero for the Amask results in an Amask of zero.
The pixel data is not copied and it is your responsibility to keep pixels from being garbage collected too early.
func CreateRGBSurfaceFromImage ¶
CreateRGBSurfaceFromImage creates an RGB surface from a image.Image.
If img is an *image.RGBA, *image.RGBA64, *image.NRGBA, or *image.NRGBA64, CreateRGBSurfaceFromImage will create a 32 bit surface with an alpha channel.
If img is an *image.Paletted, CreateRGBSurfaceFromImage will create an 8 bit surface and copy the image palette to the surface palette. If the colors in img.Palette are color.NRGBA, or color.NRGBA64 the colors in the surface's palette will not be alpha-premultiplied otherwise they will.
If img is any other type an error is returned.
The pixel data is copied to the surface.
func (*Surface) Blit ¶
Blit preforms a fast blit from src to dst, srcrect is the rectangle copied from src to dst, dstrect positions the blit on dst. Blit will change dstrects W and H to match the width and height of the blit.
Blit should not be called on a locked surface.
func (*Surface) BlitScaled ¶
BlitScaled performs a scaled blit from src to dst, srcrect is the rectangle copied from src to dst, dstrect is the rectangle copied to. The area copied from src will be scaled to the width and height of dstrect. BlitScaled does not modify dstrect.
BlitScaled should not be called on a locked surface.
func (*Surface) Convert ¶
func (surf *Surface) Convert(fmt *PixelFormat) (*Surface, error)
Convert creates a new surface of the specified PixelFormat, and then copies and maps the given surface to it so the blit of the converted surface will be as fast as possible.
func (*Surface) ConvertFormat ¶
func (surf *Surface) ConvertFormat(pixel_format PixelFormatEnum) (*Surface, error)
ConvertFormat creates a new surface of the specified PixelFormatEnum, and then copies and maps the given surface to it so the blit of the converted surface will be as fast as possible.
func (*Surface) CreateSoftwareRenderer ¶
CreateSoftwareRenderer creates a 2D software rendering context for a surface.
func (*Surface) FillRect ¶
FillRect performs a fast fill of the given rectangle with color.
If rect is nil, 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 MapRGB function.
func (*Surface) FillRects ¶
FillRect performs a fast fill of the given rectangles with color.
The color should be a pixel of the format used by the surface, and can be generated by the MapRGB function.
func (*Surface) GetAlphaMod ¶
GetAlphaMod gets the additional alpha value used in blit operations.
func (*Surface) GetBlendMode ¶
GetBlendMode gets the blend mode used for blit operations.
func (*Surface) GetClipRect ¶
GetClipRect gets the clipping rectangle for the destination surface in a blit.
func (*Surface) GetColorKey ¶
GetColorKey gets the color key (transparent pixel) in surf.
func (*Surface) GetColorMod ¶
GetColorMod gets the additional color value used in blit operations.
func (*Surface) Lock ¶
Lock sets up surf for directly accessing the pixels.
Between calls to Lock and Unlock, you can write to and read from surf pixel data, using the pixel format stored in surf.Format. Once you are done accessing the surface, you should use Unlock to release surf.
Not all surfaces require locking. If MUSTLOCK(surf) evaluates to true, 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.
func (*Surface) Pixels ¶
Pixels gives you access to surf's pixel data as a byte slice. This slice should not be appended too. Before accessing the pixel data you may need to lock surf. Pixels returns an empty slice if surf has no pixel data.
func (*Surface) SetAlphaMod ¶
SetAlphaMod sets an additional alpha value used in blit operations.
func (*Surface) SetBlendMode ¶
SetBlendMode sets the blend mode used for blit operations.
func (*Surface) SetClipRect ¶
SetClipRect sets the clipping rectangle for the destination surface in a blit.
If rect is nil, clipping will be disabled.
If the clip rectangle does not intersect the surface, SetClipRect will return false, and blits will be completely clipped. Otherwise SetClipRect returns true and blits to surf will be clipped to the intersection of the surface area and clipping rectangle.
Note: Blits are automatically clipped to the edges of the source and destination surfaces.
func (*Surface) SetColorKey ¶
SetColorKey the color key (transparent pixel) in surf. If flag is true colorkey is enabled, pixels matching key will be transparent on blit, if flag is false colorkey is disabled. You can use MapRGB to generate key.
func (*Surface) SetColorMod ¶
SetColorMod sets an additional color value used in blit operations.
func (*Surface) SetPalette ¶
SetPalette sets the palette used by surf. SetPalette returns an error if surf's pixel format does not use a palette.
Note: A single palette can be shared with many surfaces.
type SysWMEvent ¶
type SysWMEvent struct { Type EventType // SYSWMEVENT Timestamp uint32 Msg *SysWMmsg //driver dependent data }
A video driver dependent system event. This event is disabled by default, you can enable it with EventState.
func (*SysWMEvent) GetType ¶
func (e *SysWMEvent) GetType() EventType
type SysWMType ¶
type SysWMType uint32
const ( SYSWM_UNKNOWN SysWMType = C.SDL_SYSWM_UNKNOWN SYSWM_WINDOWS SysWMType = C.SDL_SYSWM_WINDOWS SYSWM_X11 SysWMType = C.SDL_SYSWM_X11 SYSWM_DIRECTFB SysWMType = C.SDL_SYSWM_DIRECTFB SYSWM_COCOA SysWMType = C.SDL_SYSWM_COCOA SYSWM_UIKIT SysWMType = C.SDL_SYSWM_UIKIT )
type SysWMinfo ¶
type SysWMinfo struct {
// contains filtered or unexported fields
}
SysWMinfo contains system-dependent information about a window.
The types of the fields in SysWMinfo are:
win.window HWND x11.display *Display x11.window Window dfb.dfb *IDirectFB dfb.window *IDirectFBWindow dfb.surface *IDirectFBSurface cocoa.window *NSWindow uikit.window *UIWindow
func (SysWMinfo) CocoaWindow ¶
CocoaWindow returns a pointer to info.cocoa.window. If info.Subsystem is not SYSWM_COCOA, CocoaWindow will return an error.
func (SysWMinfo) DFBSurface ¶
DFBSurface returns a pointer to info.dfb.surface. If info.Subsystem is not SYSWM_DIRECTFB, DFBSurface will return an error.
func (SysWMinfo) DFBWindow ¶
DFBWindow returns a pointer to info.dfb.window. If info.Subsystem is not SYSWM_DIRECTFB, DFBWindow will return an error.
func (SysWMinfo) DFBdfb ¶
DFBdfb returns a pointer to info.dfb.dfb. If info.Subsystem is not SYSWM_DIRECTFB, DFBdfb will return an error.
func (SysWMinfo) UIKitWindow ¶
UIKITWindow returns a pointer to info.uikit.window. If info.Subsystem is not SYSWM_UIKIT, UIKITWindow will return an error.
func (SysWMinfo) WinWindow ¶
WinWindow returns a pointer to info.win.window. If info.Subsystem is not SYSWM_WINDOWS, WinWindow will return an error.
func (SysWMinfo) X11Display ¶
X11Display returns a pointer to info.x11.display. If info.Subsystem is not SYSWM_X11, X11Display will return an error.
type SysWMmsg ¶
type SysWMmsg C.SDL_SysWMmsg
SysWMmsg contains system-dependent window manager messages.
The types of the fields in SysWMmsg are:
win.hwnd HWND win.msg UINT win.wParam WPARAM win.lParam LPARAM x11.event XEvent dfb.event DFBEvent
func (*SysWMmsg) DFBEvent ¶
DFBEvent returns a pointer to msg.dfb.event. If msg.Subsystem is not SYSWM_DIRECTFB, DFBEvent will return an error.
func (*SysWMmsg) WinHwnd ¶
WinHwnd returns a pointer to msg.win.hwnd. If msg.Subsystem is not SYSWM_WINDOWS, WinHwnd will return an error.
func (*SysWMmsg) WinLParam ¶
WinLParam returns a pointer to msg.win.lParam. If msg.Subsystem is not SYSWM_WINDOWS, WinLParam will return an error.
func (*SysWMmsg) WinMsg ¶
WinMsg returns a pointer to msg.win.msg. If msg.Subsystem is not SYSWM_WINDOWS, WinMsg will return an error.
type SystemCursor ¶
type SystemCursor int32
const ( SYSTEM_CURSOR_ARROW SystemCursor = C.SDL_SYSTEM_CURSOR_ARROW // Arrow SYSTEM_CURSOR_IBEAM SystemCursor = C.SDL_SYSTEM_CURSOR_IBEAM // I-beam SYSTEM_CURSOR_WAIT SystemCursor = C.SDL_SYSTEM_CURSOR_WAIT // Wait SYSTEM_CURSOR_CROSSHAIR SystemCursor = C.SDL_SYSTEM_CURSOR_CROSSHAIR // Crosshair SYSTEM_CURSOR_WAITARROW SystemCursor = C.SDL_SYSTEM_CURSOR_WAITARROW // Small wait cursor (or Wait if not available) SYSTEM_CURSOR_SIZENWSE SystemCursor = C.SDL_SYSTEM_CURSOR_SIZENWSE // Double arrow pointing northwest and southeast SYSTEM_CURSOR_SIZENESW SystemCursor = C.SDL_SYSTEM_CURSOR_SIZENESW // Double arrow pointing northeast and southwest SYSTEM_CURSOR_SIZEWE SystemCursor = C.SDL_SYSTEM_CURSOR_SIZEWE // Double arrow pointing west and east SYSTEM_CURSOR_SIZENS SystemCursor = C.SDL_SYSTEM_CURSOR_SIZENS // Double arrow pointing north and south SYSTEM_CURSOR_SIZEALL SystemCursor = C.SDL_SYSTEM_CURSOR_SIZEALL // Four pointed arrow pointing north, south, east, and west SYSTEM_CURSOR_NO SystemCursor = C.SDL_SYSTEM_CURSOR_NO // Slashed circle or crossbones SYSTEM_CURSOR_HAND SystemCursor = C.SDL_SYSTEM_CURSOR_HAND // Hand )
type TextEditingEvent ¶
type TextEditingEvent struct { Type EventType // TEXTEDITING Timestamp uint32 WindowID uint32 // The window with keyboard focus, if any Text [32]int8 // The editing text Start int32 // The start cursor of selected editing text Length int32 // The length of selected editing text }
Keyboard text editing event structure
func (*TextEditingEvent) GetType ¶
func (e *TextEditingEvent) GetType() EventType
type TextInputEvent ¶
type TextInputEvent struct { Type EventType // TEXTINPUT Timestamp uint32 WindowID uint32 // The window with keyboard focus, if any Text [32]int8 // The input text }
Keyboard text input event structure
func (*TextInputEvent) GetType ¶
func (e *TextInputEvent) GetType() EventType
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
An efficient driver-specific representation of pixel data
func (Texture) GLBind ¶
GLBind binds the texture to the current OpenGL/ES/ES2 context for use with OpenGL instructions.
func (Texture) GetAlphaMod ¶
GetAlphaMod returns the additional alpha value used in render copy operations.
func (Texture) GetBlendMode ¶
GetBlendMode returns the blend mode used for texture copy operations.
func (Texture) GetColorMod ¶
GetColorMod returns the additional color value used in render copy operations.
func (Texture) Lock ¶
Lock locks a portion of the texture for write-only pixel access. If rect is nil the entire texture will be locked. It returns the locked pixels and the pitch for the pixels. Lock only works if texture was created with TEXTUREACCESS_STREAMING.
func (Texture) Query ¶
func (texture Texture) Query() (format PixelFormatEnum, access TextureAccess, w, h int, err error)
Query returns the attributes of a texture.
func (Texture) SetAlphaMod ¶
SetAlphaMod sets an additional alpha value used in render copy operations.
func (Texture) SetBlendMode ¶
SetBlendMode sets the blend mode used for texture copy operations.
func (Texture) SetColorMod ¶
SetColorMod sets an additional color value used in render copy operations.
type TextureAccess ¶
type TextureAccess uint32
The access pattern allowed for a texture
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 uint32
The texture channel modulation used in renderer.Copy
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 TouchFingerEvent ¶
type TouchFingerEvent struct { Type EventType // FINGERMOTION or FINGERDOWN or FINGERUP Timestamp uint32 TouchId int64 // The touch device id FingerId int64 X float32 Y float32 Dx float32 Dy float32 Pressure float32 // contains filtered or unexported fields }
Touch finger motion/finger event structure
func (*TouchFingerEvent) GetType ¶
func (e *TouchFingerEvent) GetType() EventType
type UserEvent ¶
type UserEvent struct { Type EventType // USEREVENT through LASTEVENT Timestamp uint32 WindowID uint32 // The associated window if any Code int32 // User defined event code Data1 uintptr // User defined data pointer Data2 uintptr // User defined data pointer }
A user-defined event type
type Version ¶
type Version struct { Major uint8 // major version Minor uint8 // minor version Patch uint8 // update version }
Version defines a SDL version.
func GetVersion ¶
func GetVersion() *Version
GetVersion returns the version of SDL that is linked against your program.
GetVersion may be called safely at any time, even before Init().
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is used to identify a window.
func CreateWindow ¶
func CreateWindow(title string, x, y, w, h int, flags WindowFlags) (Window, error)
CreateWindow creates a window. If you want the window to be centered set x and/or y to WINDOWPOS_CENTERED, if you don't care about the window position you can set x and/or y to WINDOWPOS_UNDEFINED. On error CreateWindow returns nil.
func CreateWindowFrom ¶
CreateWindowFrom creates and SDL window from an existing native window.
func GetKeyboardFocus ¶
GetKeyboardFocus gets the window which currently has keyboard focus. focus is false if no window has focus.
func GetMouseFocus ¶
GetMouseFocus gets the window which currently has mouse focus. focus is false if no window has focus.
func GetWindowFromID ¶
GetWindowFromID returns a window from a stored ID, or nil if it doesn't exist.
func (Window) CreateRenderer ¶
func (window Window) CreateRenderer(index int, flags RendererFlags) (Renderer, error)
Create a 2D rendering context for the window. index is the index of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags.
func (Window) GL_CreateContext ¶
GL_CreateContext creates an OpenGL context for use with an OpenGL window, and makes it current.
func (Window) GL_MakeCurrent ¶
GL_MakeCurrent sets 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()
GL_Swap swaps the OpenGL buffers for a window, if double-buffering is supported.
func (Window) GetBrightness ¶
GetWindowBrightness gets the window's brightness (gamma correction).
func (Window) GetDisplayIndex ¶
GetDisplayIndex gets the display index associated with window.
func (Window) GetDisplayMode ¶
func (window Window) GetDisplayMode() (*DisplayMode, error)
GetDisplayMode gets the display mode used if the window is fullscreen and visible.
func (Window) GetFlags ¶
func (window Window) GetFlags() WindowFlags
GetFlags returns the windows flags.
func (Window) GetGammaRamp ¶
GetGammaRamp gets the gamma ramp for a window. If you do not want to get a channel you can use nil instead.
func (Window) GetMaximumSize ¶
GetMaximumSize gets the maximum size of a window's client area.
func (Window) GetMinimumSize ¶
GetMinimumSize gets the minimum size of window's client area.
func (Window) GetPixelFormat ¶
GetPixelFormat returns the pixel format of the Window.
func (Window) GetPosition ¶
GetPosition returns the position of a window.
func (Window) GetRenderer ¶
GetRenderer returns the renderer associated with the window.
func (Window) GetSurface ¶
GetSurface gets the SDL surface associated with the window. 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.
func (Window) IsScreenKeyboardShown ¶
IsScreenKeyboardShown returns whether the screen keyboard is shown for window.
Note: May always return false on some platforms (not implemented there).
func (Window) Maximize ¶
func (window Window) Maximize()
Maximize makes the window as large as possible.
func (Window) Minimize ¶
func (window Window) Minimize()
Minimize minimizes the window to an iconic representation.
func (Window) Raise ¶
func (window Window) Raise()
Raise will raise the window above the other windows and set the input focus.
func (Window) Restore ¶
func (window Window) Restore()
Restore restores the size and position of a minimized or maximized window.
func (Window) SetBordered ¶
SetBordered will add or remove the window's WINDOW_BORDERLESS flag and add or remove the border from the actual window. This is a no-op if the window's border already match the requested state. If bordered is false the border will be removed, if it is true the border will be added.
Note: You can't change the border state of a fullscreen window.
func (Window) SetBrightness ¶
SetBrightness sets the window's brightness (gamma correction).
func (Window) SetDisplayMode ¶
func (window Window) SetDisplayMode(mode *DisplayMode) error
SetDisplayMode sets the display mode used when the window is fullscreen and visible. If mode is nil the window's dimensions and the desktop format and refresh rate are used.
func (Window) SetFullscreen ¶
SetFullscreen sets the windows fullscreen state.
func (Window) SetGamaRamp ¶
SetGammaRamp sets 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 the index, scaled to the output color precision. If you do not want to set a channel you can use nil instead.
func (Window) SetGrab ¶
SetGrab sets the window's input grab mode. If grab is true input is grabbed, if it is false input is released.
func (Window) SetMaximumSize ¶
SetMaximumSize sets 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.
func (Window) SetMinimumSize ¶
SetMinimumSize sets the minimum size of window's client area.
Note: You can't change the minimum size of a fullscreen window, it automatically matches the size of the displace mode.
func (Window) SetPosition ¶
SetPosition sets the position of the window.
func (Window) SetSize ¶
SetSize sets the size of the window's client area. You can't change the size of a fullscreen window, it automatically matches the size of the display mode.
func (Window) UpdateSurface ¶
UpdateSurface copies the window surface to the screen.
func (Window) UpdateSurfaceRects ¶
UpdateSurfaceRects copies rectangles on the window surface to the screen.
type WindowEvent ¶
type WindowEvent struct { Type EventType // WINDOWEVENT Timestamp uint32 WindowID uint32 // The asscociated window Event WindowEventID Data1 int32 // Event dependent data Data2 int32 // Event dependent data // contains filtered or unexported fields }
Window state change event data
func (*WindowEvent) GetType ¶
func (e *WindowEvent) GetType() EventType
type WindowEventID ¶
type WindowEventID uint8
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 the 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 // Window manager requests that the window be closed. WINDOWEVENT_CLOSE WindowEventID = C.SDL_WINDOWEVENT_CLOSE )
type WindowFlags ¶
type WindowFlags uint32
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_INPUTGRABBED 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 = C.SDL_WINDOW_FULLSCREEN_DESKTOP // Window was not created by SDL WINDOW_FOREIGN WindowFlags = C.SDL_WINDOW_FOREIGN )