sdl

package
v0.5.0-alpha.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 12 Imported by: 1,590

Documentation

Overview

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

Index

Constants

View Source
const (
	BYTEORDER  = C.SDL_BYTEORDER  // macro that corresponds to the byte order used by the processor type it was compiled for
	LIL_ENDIAN = C.SDL_LIL_ENDIAN // byte order is 1234, where the least significant byte is stored first
	BIG_ENDIAN = C.SDL_BIG_ENDIAN // byte order is 4321, where the most significant byte is stored first
)

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

View Source
const (
	HAPTIC_CONSTANT     = C.SDL_HAPTIC_CONSTANT     // constant haptic effect
	HAPTIC_SINE         = C.SDL_HAPTIC_SINE         // periodic haptic effect that simulates sine waves
	HAPTIC_LEFTRIGHT    = C.SDL_HAPTIC_LEFTRIGHT    // haptic effect for direct control over high/low frequency motors
	HAPTIC_TRIANGLE     = C.SDL_HAPTIC_TRIANGLE     // periodic haptic effect that simulates triangular waves
	HAPTIC_SAWTOOTHUP   = C.SDL_HAPTIC_SAWTOOTHUP   // periodic haptic effect that simulates saw tooth up waves
	HAPTIC_SAWTOOTHDOWN = C.SDL_HAPTIC_SAWTOOTHDOWN // periodic haptic effect that simulates saw tooth down waves
	HAPTIC_RAMP         = C.SDL_HAPTIC_RAMP         // ramp haptic effect
	HAPTIC_SPRING       = C.SDL_HAPTIC_SPRING       // condition haptic effect that simulates a spring.  Effect is based on the axes position
	HAPTIC_DAMPER       = C.SDL_HAPTIC_DAMPER       // condition haptic effect that simulates dampening.  Effect is based on the axes velocity
	HAPTIC_INERTIA      = C.SDL_HAPTIC_INERTIA      // condition haptic effect that simulates inertia.  Effect is based on the axes acceleration
	HAPTIC_FRICTION     = C.SDL_HAPTIC_FRICTION     // condition haptic effect that simulates friction.  Effect is based on the axes movement
	HAPTIC_CUSTOM       = C.SDL_HAPTIC_CUSTOM       // user defined custom haptic effect
	HAPTIC_GAIN         = C.SDL_HAPTIC_GAIN         // device supports setting the global gain
	HAPTIC_AUTOCENTER   = C.SDL_HAPTIC_AUTOCENTER   // device supports setting autocenter
	HAPTIC_STATUS       = C.SDL_HAPTIC_STATUS       // device can be queried for effect status
	HAPTIC_PAUSE        = C.SDL_HAPTIC_PAUSE        // device can be paused

)

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

View Source
const (
	HAPTIC_POLAR         = C.SDL_HAPTIC_POLAR         // uses polar coordinates for the direction
	HAPTIC_CARTESIAN     = C.SDL_HAPTIC_CARTESIAN     // uses cartesian coordinates for the direction
	HAPTIC_SPHERICAL     = C.SDL_HAPTIC_SPHERICAL     // uses spherical coordinates for the direction
	HAPTIC_INFINITY      = C.SDL_HAPTIC_INFINITY      // used to play a device an infinite number of times
	HAPTIC_STEERING_AXIS = C.SDL_HAPTIC_STEERING_AXIS // Use this value to play an effect on the steering wheel axis. This provides better compatibility across platforms and devices as SDL will guess.
)

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

View Source
const (
	HINT_FRAMEBUFFER_ACCELERATION                 = C.SDL_HINT_FRAMEBUFFER_ACCELERATION                 // specifies how 3D acceleration is used with Window.GetSurface()
	HINT_RENDER_DRIVER                            = C.SDL_HINT_RENDER_DRIVER                            // specifies which render driver to use
	HINT_RENDER_OPENGL_SHADERS                    = C.SDL_HINT_RENDER_OPENGL_SHADERS                    // specifies whether the OpenGL render driver uses shaders
	HINT_RENDER_DIRECT3D_THREADSAFE               = C.SDL_HINT_RENDER_DIRECT3D_THREADSAFE               // specifies whether the Direct3D device is initialized for thread-safe operations
	HINT_RENDER_DIRECT3D11_DEBUG                  = C.SDL_HINT_RENDER_DIRECT3D11_DEBUG                  // specifies a variable controlling whether to enable Direct3D 11+'s Debug Layer
	HINT_RENDER_SCALE_QUALITY                     = C.SDL_HINT_RENDER_SCALE_QUALITY                     // specifies scaling quality
	HINT_RENDER_VSYNC                             = C.SDL_HINT_RENDER_VSYNC                             // specifies whether sync to vertical refresh is enabled or disabled in CreateRenderer() to avoid tearing
	HINT_VIDEO_ALLOW_SCREENSAVER                  = C.SDL_HINT_VIDEO_ALLOW_SCREENSAVER                  // specifies whether the screensaver is enabled
	HINT_VIDEO_X11_NET_WM_PING                    = C.SDL_HINT_VIDEO_X11_NET_WM_PING                    // specifies whether the X11 _NET_WM_PING protocol should be supported
	HINT_VIDEO_X11_XVIDMODE                       = C.SDL_HINT_VIDEO_X11_XVIDMODE                       // specifies whether the X11 VidMode extension should be used
	HINT_VIDEO_X11_XINERAMA                       = C.SDL_HINT_VIDEO_X11_XINERAMA                       // specifies whether the X11 Xinerama extension should be used
	HINT_VIDEO_X11_XRANDR                         = C.SDL_HINT_VIDEO_X11_XRANDR                         // specifies whether the X11 XRandR extension should be used
	HINT_GRAB_KEYBOARD                            = C.SDL_HINT_GRAB_KEYBOARD                            // specifies whether grabbing input grabs the keyboard
	HINT_MOUSE_DOUBLE_CLICK_TIME                  = C.SDL_HINT_MOUSE_DOUBLE_CLICK_TIME                  // specifies the double click time, in milliseconds
	HINT_MOUSE_DOUBLE_CLICK_RADIUS                = C.SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS                // specifies the double click radius, in pixels.
	HINT_MOUSE_RELATIVE_MODE_WARP                 = C.SDL_HINT_MOUSE_RELATIVE_MODE_WARP                 // specifies whether relative mouse mode is implemented using mouse warping
	HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS             = C.SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS             // specifies if a Window is minimized if it loses key focus when in fullscreen mode
	HINT_IDLE_TIMER_DISABLED                      = C.SDL_HINT_IDLE_TIMER_DISABLED                      // specifies a variable controlling whether the idle timer is disabled on iOS
	HINT_IME_INTERNAL_EDITING                     = C.SDL_HINT_IME_INTERNAL_EDITING                     // specifies whether certain IMEs should handle text editing internally instead of sending TextEditingEvents
	HINT_ORIENTATIONS                             = C.SDL_HINT_ORIENTATIONS                             // specifies a variable controlling which orientations are allowed on iOS
	HINT_ACCELEROMETER_AS_JOYSTICK                = C.SDL_HINT_ACCELEROMETER_AS_JOYSTICK                // specifies whether the Android / iOS built-in accelerometer should be listed as a joystick device, rather than listing actual joysticks only
	HINT_XINPUT_ENABLED                           = C.SDL_HINT_XINPUT_ENABLED                           // specifies if Xinput gamepad devices are detected
	HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING          = C.SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING          // specifies that SDL should use the old axis and button mapping for XInput devices
	HINT_GAMECONTROLLERCONFIG                     = C.SDL_HINT_GAMECONTROLLERCONFIG                     // specifies extra gamecontroller db entries
	HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS         = C.SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS         // specifies if joystick (and gamecontroller) events are enabled even when the application is in the background
	HINT_ALLOW_TOPMOST                            = C.SDL_HINT_ALLOW_TOPMOST                            // specifies if top most bit on an SDL Window can be set
	HINT_THREAD_STACK_SIZE                        = C.SDL_HINT_THREAD_STACK_SIZE                        // specifies a variable specifying SDL's threads stack size in bytes or "0" for the backend's default size
	HINT_TIMER_RESOLUTION                         = C.SDL_HINT_TIMER_RESOLUTION                         // specifies the timer resolution in milliseconds
	HINT_VIDEO_HIGHDPI_DISABLED                   = C.SDL_HINT_VIDEO_HIGHDPI_DISABLED                   // specifies if high-DPI windows ("Retina" on Mac and iOS) are not allowed
	HINT_MAC_BACKGROUND_APP                       = C.SDL_HINT_MAC_BACKGROUND_APP                       // specifies if the SDL app should not be forced to become a foreground process on Mac OS X
	HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK       = C.SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK       // specifies whether ctrl+click should generate a right-click event on Mac
	HINT_VIDEO_WIN_D3DCOMPILER                    = C.SDL_HINT_VIDEO_WIN_D3DCOMPILER                    // specifies which shader compiler to preload when using the Chrome ANGLE binaries
	HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT          = C.SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT          // specifies the address of another Window* (as a hex string formatted with "%p")
	HINT_WINRT_PRIVACY_POLICY_URL                 = C.SDL_HINT_WINRT_PRIVACY_POLICY_URL                 // specifies a URL to a WinRT app's privacy policy
	HINT_WINRT_PRIVACY_POLICY_LABEL               = C.SDL_HINT_WINRT_PRIVACY_POLICY_LABEL               // specifies a label text for a WinRT app's privacy policy link
	HINT_WINRT_HANDLE_BACK_BUTTON                 = C.SDL_HINT_WINRT_HANDLE_BACK_BUTTON                 // specifies a variable to allow back-button-press events on Windows Phone to be marked as handled
	HINT_VIDEO_MAC_FULLSCREEN_SPACES              = C.SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES              // specifies policy for fullscreen Spaces on Mac OS X
	HINT_NO_SIGNAL_HANDLERS                       = C.SDL_HINT_NO_SIGNAL_HANDLERS                       // specifies not to catch the SIGINT or SIGTERM signals
	HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN  = C.SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN  // specifies whether the window frame and title bar are interactive when the cursor is hidden
	HINT_WINDOWS_ENABLE_MESSAGELOOP               = C.SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP               // specifies whether the windows message loop is processed by SDL
	HINT_WINDOWS_NO_CLOSE_ON_ALT_F4               = C.SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4               // specifies that SDL should not to generate WINDOWEVENT_CLOSE events for Alt+F4 on Microsoft Windows
	HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH         = C.SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH         // specifies a variable to control whether mouse and touch events are to be treated together or separately
	HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION  = C.SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION  // specifies the Android APK expansion main file version
	HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION = C.SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION // specifies the Android APK expansion patch file version
	HINT_AUDIO_RESAMPLING_MODE                    = C.SDL_HINT_AUDIO_RESAMPLING_MODE                    // specifies a variable controlling speed/quality tradeoff of audio resampling
	HINT_RENDER_LOGICAL_SIZE_MODE                 = C.SDL_HINT_RENDER_LOGICAL_SIZE_MODE                 // specifies a variable controlling the scaling policy for SDL_RenderSetLogicalSize
	HINT_MOUSE_NORMAL_SPEED_SCALE                 = C.SDL_HINT_MOUSE_NORMAL_SPEED_SCALE                 // specifies a variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode
	HINT_MOUSE_RELATIVE_SPEED_SCALE               = C.SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE               // specifies a variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode
	HINT_MOUSE_TOUCH_EVENTS                       = C.SDL_HINT_MOUSE_TOUCH_EVENTS                       // specifies a variable to control whether mouse events should generate synthetic touch events
	HINT_TOUCH_MOUSE_EVENTS                       = C.SDL_HINT_TOUCH_MOUSE_EVENTS                       // specifies a variable controlling whether touch events should generate synthetic mouse events
	HINT_WINDOWS_INTRESOURCE_ICON                 = C.SDL_HINT_WINDOWS_INTRESOURCE_ICON                 // specifies a variable to specify custom icon resource id from RC file on Windows platform
	HINT_WINDOWS_INTRESOURCE_ICON_SMALL           = C.SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL           // specifies a variable to specify custom icon resource id from RC file on Windows platform
	HINT_IOS_HIDE_HOME_INDICATOR                  = C.SDL_HINT_IOS_HIDE_HOME_INDICATOR                  // specifies a variable controlling whether the home indicator bar on iPhone X should be hidden.
	HINT_RETURN_KEY_HIDES_IME                     = C.SDL_HINT_RETURN_KEY_HIDES_IME                     // specifies a variable to control whether the return key on the soft keyboard should hide the soft keyboard on Android and iOS.
	HINT_TV_REMOTE_AS_JOYSTICK                    = C.SDL_HINT_TV_REMOTE_AS_JOYSTICK                    // specifies a variable controlling whether the Android / tvOS remotes  should be listed as joystick devices, instead of sending keyboard events.
	HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR       = C.SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR       // specifies a variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used.
	HINT_VIDEO_DOUBLE_BUFFER                      = C.SDL_HINT_VIDEO_DOUBLE_BUFFER                      // specifies a variable that tells the video driver that we only want a double buffer.
	HINT_RENDER_BATCHING                          = C.SDL_HINT_RENDER_BATCHING                          // specifies a variable controlling whether the 2D render API is compatible or efficient.
	HINT_EVENT_LOGGING                            = C.SDL_HINT_EVENT_LOGGING                            // specifies a variable controlling whether SDL logs all events pushed onto its internal queue.
	HINT_GAMECONTROLLERCONFIG_FILE                = C.SDL_HINT_GAMECONTROLLERCONFIG_FILE                // specifies a variable that lets you provide a file with extra gamecontroller db entries.
	HINT_ANDROID_BLOCK_ON_PAUSE                   = C.SDL_HINT_ANDROID_BLOCK_ON_PAUSE                   // specifies a variable to control whether the event loop will block itself when the app is paused.
	HINT_DISPLAY_USABLE_BOUNDS                    = C.SDL_HINT_DISPLAY_USABLE_BOUNDS                    // Override for SDL_GetDisplayUsableBounds().
	HINT_GAMECONTROLLERTYPE                       = C.SDL_HINT_GAMECONTROLLERTYPE                       // Overrides the automatic controller type detection.
	HINT_GAMECONTROLLER_USE_BUTTON_LABELS         = C.SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS         // If set, game controller face buttons report their values according to their labels instead of their positional layout.
	HINT_JOYSTICK_HIDAPI_GAMECUBE                 = C.SDL_HINT_JOYSTICK_HIDAPI_GAMECUBE                 // A variable controlling whether the HIDAPI driver for Nintendo GameCube controllers should be used.
	HINT_VIDEO_X11_WINDOW_VISUALID                = C.SDL_HINT_VIDEO_X11_WINDOW_VISUALID                // A variable forcing the visual ID chosen for new X11 windows.
	HINT_VIDEO_X11_FORCE_EGL                      = C.SDL_HINT_VIDEO_X11_FORCE_EGL                      // A variable controlling whether X11 should use GLX or EGL by default.
	HINT_MOUSE_RELATIVE_SCALING                   = C.SDL_HINT_MOUSE_RELATIVE_SCALING                   // A variable controlling whether relative mouse motion is affected by renderer scaling.
	HINT_PREFERRED_LOCALES                        = C.SDL_HINT_PREFERRED_LOCALES                        // Override for SDL_GetPreferredLocales().
	HINT_JOYSTICK_RAWINPUT                        = C.SDL_HINT_JOYSTICK_RAWINPUT                        // A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
	HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT       = C.SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT       // A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated data from XInput.
	HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT         = C.SDL_HINT_JOYSTICK_HIDAPI_CORRELATE_XINPUT         // A variable controlling whether the HIDAPI driver for XBox controllers on Windows should pull correlated data from XInput.
	HINT_AUDIO_DEVICE_APP_NAME                    = C.SDL_HINT_AUDIO_DEVICE_APP_NAME                    // Specify an application name for an audio device.
	HINT_AUDIO_DEVICE_STREAM_NAME                 = C.SDL_HINT_AUDIO_DEVICE_STREAM_NAME                 // Specify an application name for an audio device.
	HINT_LINUX_JOYSTICK_DEADZONES                 = C.SDL_HINT_LINUX_JOYSTICK_DEADZONES                 // A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values.
	HINT_THREAD_PRIORITY_POLICY                   = C.SDL_HINT_THREAD_PRIORITY_POLICY                   // A string specifying additional information to use with SDL_SetThreadPriority.
	HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL      = C.SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL      // Specifies whether SDL_THREAD_PRIORITY_TIME_CRITICAL should be treated as realtime.
	HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO        = C.SDL_HINT_ANDROID_BLOCK_ON_PAUSE_PAUSEAUDIO        // A variable to control whether SDL will pause audio in background (Requires SDL_ANDROID_BLOCK_ON_PAUSE as "Non blocking").
	HINT_EMSCRIPTEN_ASYNCIFY                      = C.SDL_HINT_EMSCRIPTEN_ASYNCIFY                      // Disable giving back control to the browser automatically when running with asyncify.
	HINT_AUDIO_INCLUDE_MONITORS                   = C.SDL_HINT_AUDIO_INCLUDE_MONITORS                   // Control whether PulseAudio recording should include monitor devices
	HINT_AUDIO_DEVICE_STREAM_ROLE                 = C.SDL_HINT_AUDIO_DEVICE_STREAM_ROLE                 // Describe the role of your application for audio control panels
	HINT_APP_NAME                                 = C.SDL_HINT_APP_NAME                                 // Lets you specify the application name sent to the OS when required
	HINT_VIDEO_EGL_ALLOW_TRANSPARENCY             = C.SDL_HINT_VIDEO_EGL_ALLOW_TRANSPARENCY             // A variable controlling whether the EGL window is allowed to be composited as transparent, rather than opaque
	HINT_IME_SHOW_UI                              = C.SDL_HINT_IME_SHOW_UI                              // A variable to control whether certain IMEs should show native UI components (such as the Candidate List) instead of suppressing them
	HINT_IME_SUPPORT_EXTENDED_TEXT                = C.SDL_HINT_IME_SUPPORT_EXTENDED_TEXT                // A variable to control if extended IME text support is enabled.
	HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME        = C.SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME        // This hint lets you specify the "activity name" sent to the OS when SDL_DisableScreenSaver() is used (or the screensaver is automatically disabled)
	HINT_LINUX_JOYSTICK_CLASSIC                   = C.SDL_HINT_LINUX_JOYSTICK_CLASSIC                   // A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux
	HINT_JOYSTICK_DEVICE                          = C.SDL_HINT_JOYSTICK_DEVICE                          // This variable is currently only used by the Linux joystick driver
	HINT_JOYSTICK_HIDAPI_STEAM                    = C.SDL_HINT_JOYSTICK_HIDAPI_STEAM                    // A variable controlling whether the HIDAPI driver for Steam Controllers should be used
	HINT_RENDER_LINE_METHOD                       = C.SDL_HINT_RENDER_LINE_METHOD                       // A variable controlling how the 2D render API renders lines
	HINT_MOUSE_RELATIVE_MODE_CENTER               = C.SDL_HINT_MOUSE_RELATIVE_MODE_CENTER               // A variable controlling whether relative mouse mode constrains the mouse to the center of the window
	HINT_MOUSE_AUTO_CAPTURE                       = C.SDL_HINT_MOUSE_AUTO_CAPTURE                       // A variable controlling whether the mouse is captured while mouse buttons are pressed
	HINT_VIDEO_FOREIGN_WINDOW_OPENGL              = C.SDL_HINT_VIDEO_FOREIGN_WINDOW_OPENGL              // When calling SDL_CreateWindowFrom(), make the window compatible with OpenGL
	HINT_VIDEO_FOREIGN_WINDOW_VULKAN              = C.SDL_HINT_VIDEO_FOREIGN_WINDOW_VULKAN              // When calling SDL_CreateWindowFrom(), make the window compatible with Vulkan
	HINT_QUIT_ON_LAST_WINDOW_CLOSE                = C.SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE                // A variable that decides whether to send SDL_QUIT when closing the final window
	HINT_JOYSTICK_ROG_CHAKRAM                     = C.SDL_HINT_JOYSTICK_ROG_CHAKRAM                     // A variable controlling whether the ROG Chakram mice should show up as joysticks
	HINT_X11_WINDOW_TYPE                          = C.SDL_HINT_X11_WINDOW_TYPE                          // A variable that forces X11 windows to create as a custom type
	HINT_VIDEO_WAYLAND_PREFER_LIBDECOR            = C.SDL_HINT_VIDEO_WAYLAND_PREFER_LIBDECOR            // A variable controlling whether the libdecor Wayland backend is preferred over native decrations
	HINT_VIDEODRIVER                              = C.SDL_HINT_VIDEODRIVER                              // A variable that decides what video backend to use
	HINT_JOYSTICK_HIDAPI_PS4                      = C.SDL_HINT_JOYSTICK_HIDAPI_PS4                      // A variable controlling whether the HIDAPI driver for PS4 controllers should be used
	HINT_JOYSTICK_HIDAPI_PS4_RUMBLE               = C.SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE               // A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver
	HINT_JOYSTICK_HIDAPI_PS5                      = C.SDL_HINT_JOYSTICK_HIDAPI_PS5                      // A variable controlling whether the HIDAPI driver for PS5 controllers should be used
	HINT_JOYSTICK_HIDAPI_PS5_RUMBLE               = C.SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE               // A variable controlling whether extended input reports should be used for PS5 controllers when using the HIDAPI driver
	HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED           = C.SDL_HINT_JOYSTICK_HIDAPI_PS5_PLAYER_LED           // A variable controlling whether the player LEDs should be lit to indicate which player is associated with a PS5 controller

	// 2.24.0
	HINT_MOUSE_RELATIVE_WARP_MOTION        = C.SDL_HINT_MOUSE_RELATIVE_WARP_MOTION        // A variable controlling whether a motion event should be generated for mouse warping in relative mode
	HINT_TRACKPAD_IS_TOUCH_ONLY            = C.SDL_HINT_TRACKPAD_IS_TOUCH_ONLY            // A variable that treats trackpads as touch devices
	HINT_JOYSTICK_HIDAPI_JOY_CONS          = C.SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS          // A variable controlling whether the HIDAPI driver for Nintendo Switch Joy-Cons should be used
	HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS  = C.SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS  // A variable controlling whether Nintendo Switch Joy-Con controllers will be combined into a single Pro-like controller when using the HIDAPI driver
	HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED   = C.SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED   // A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Pro controller is opened
	HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED   = C.SDL_HINT_JOYSTICK_HIDAPI_JOYCON_HOME_LED   // A variable controlling whether the Home button LED should be turned on when a Nintendo Switch Joy-Con controller is opened
	HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED = C.SDL_HINT_JOYSTICK_HIDAPI_SWITCH_PLAYER_LED // A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Nintendo Switch controller
	HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC  = C.SDL_HINT_JOYSTICK_HIDAPI_NINTENDO_CLASSIC  // A variable controlling whether the HIDAPI driver for Nintendo Online classic controllers should be used
	HINT_JOYSTICK_HIDAPI_SHIELD            = C.SDL_HINT_JOYSTICK_HIDAPI_SHIELD            // A variable controlling whether the HIDAPI driver for NVIDIA SHIELD controllers should be used
	HINT_WINDOWS_DPI_AWARENESS             = C.SDL_HINT_WINDOWS_DPI_AWARENESS             // Controls whether SDL will declare the process to be DPI aware
	HINT_WINDOWS_DPI_SCALING               = C.SDL_HINT_WINDOWS_DPI_SCALING               // Uses DPI-scaled points as the SDL coordinate system on Windows
	HINT_DIRECTINPUT_ENABLED               = C.SDL_HINT_DIRECTINPUT_ENABLED               // A variable that lets you disable the detection and use of DirectInput gamepad devices
	HINT_VIDEO_WAYLAND_MODE_EMULATION      = C.SDL_HINT_VIDEO_WAYLAND_MODE_EMULATION      // A variable controlling whether video mode emulation is enabled under Wayland
	HINT_KMSDRM_DEVICE_INDEX               = C.SDL_HINT_KMSDRM_DEVICE_INDEX               // A variable that decides what KMSDRM device to use
	HINT_LINUX_DIGITAL_HATS                = C.SDL_HINT_LINUX_DIGITAL_HATS                // A variable controlling whether joysticks on Linux will always treat 'hat' axis inputs (ABS_HAT0X - ABS_HAT3Y) as 8-way digital hats without checking whether they may be analog
	HINT_LINUX_HAT_DEADZONES               = C.SDL_HINT_LINUX_HAT_DEADZONES               // A variable controlling whether digital hats on Linux will apply deadzones to their underlying input axes or use unfiltered values
	HINT_MAC_OPENGL_ASYNC_DISPATCH         = C.SDL_HINT_MAC_OPENGL_ASYNC_DISPATCH         // A variable controlling whether dispatching OpenGL context updates should block the dispatching thread until the main thread finishes processing

	// 2.26.0
	HINT_JOYSTICK_HIDAPI_WII                 = C.SDL_HINT_JOYSTICK_HIDAPI_WII                 // A variable controlling whether the HIDAPI driver for Nintendo Wii and Wii U controllers should be used
	HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED      = C.SDL_HINT_JOYSTICK_HIDAPI_WII_PLAYER_LED      // A variable controlling whether the player LEDs should be lit to indicate which player is associated with a Wii controller
	HINT_JOYSTICK_HIDAPI_XBOX                = C.SDL_HINT_JOYSTICK_HIDAPI_XBOX                // A variable controlling whether the HIDAPI driver for XBox controllers should be used
	HINT_JOYSTICK_HIDAPI_XBOX_360            = C.SDL_HINT_JOYSTICK_HIDAPI_XBOX_360            // A variable controlling whether the HIDAPI driver for XBox 360 controllers should be used
	HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED = C.SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_PLAYER_LED // A variable controlling whether the player LEDs should be lit to indicate which player is associated with an Xbox 360 controller
	HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS   = C.SDL_HINT_JOYSTICK_HIDAPI_XBOX_360_WIRELESS   // A variable controlling whether the HIDAPI driver for XBox 360 wireless controllers should be used
	HINT_JOYSTICK_HIDAPI_XBOX_ONE            = C.SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE            // A variable controlling whether the HIDAPI driver for XBox One controllers should be used
	HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED   = C.SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED   // A variable controlling whether the Home button LED should be turned on when an Xbox One controller is opened
	HINT_JOYSTICK_HIDAPI_PS3                 = C.SDL_HINT_JOYSTICK_HIDAPI_PS3                 // A variable controlling whether the HIDAPI driver for PS3 controllers should be used
	HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS   = C.SDL_HINT_JOYSTICK_HIDAPI_VERTICAL_JOY_CONS   // A variable controlling whether Nintendo Switch Joy-Con controllers will be in vertical mode when using the HIDAPI driver
	HINT_HIDAPI_IGNORE_DEVICES               = C.SDL_HINT_HIDAPI_IGNORE_DEVICES               // A variable containing a list of devices to ignore in SDL_hid_enumerate()
	HINT_MOUSE_RELATIVE_SYSTEM_SCALE         = C.SDL_HINT_MOUSE_RELATIVE_SYSTEM_SCALE         // A variable controlling whether the system mouse acceleration curve is used for relative mouse motion
	HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP    = C.SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP    // Enable or disable mouse pointer warp emulation, needed by some older games

	// 2.28.0
	HINT_ENABLE_SCREEN_KEYBOARD = C.SDL_HINT_ENABLE_SCREEN_KEYBOARD // A variable that controls whether the on-screen keyboard should be shown when text input is active
)

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

View Source
const (
	MOUSEWHEEL_NORMAL  = C.SDL_MOUSEWHEEL_NORMAL  // the scroll direction is normal
	MOUSEWHEEL_FLIPPED = C.SDL_MOUSEWHEEL_FLIPPED // the scroll direction is flipped / natural
)

Scroll direction types for the Scroll event

View Source
const (
	PIXELTYPE_UNKNOWN  = C.SDL_PIXELTYPE_UNKNOWN
	PIXELTYPE_INDEX1   = C.SDL_PIXELTYPE_INDEX1
	PIXELTYPE_INDEX4   = C.SDL_PIXELTYPE_INDEX4
	PIXELTYPE_INDEX8   = C.SDL_PIXELTYPE_INDEX8
	PIXELTYPE_PACKED8  = C.SDL_PIXELTYPE_PACKED8
	PIXELTYPE_PACKED16 = C.SDL_PIXELTYPE_PACKED16
	PIXELTYPE_PACKED32 = C.SDL_PIXELTYPE_PACKED32
	PIXELTYPE_ARRAYU8  = C.SDL_PIXELTYPE_ARRAYU8
	PIXELTYPE_ARRAYU16 = C.SDL_PIXELTYPE_ARRAYU16
	PIXELTYPE_ARRAYU32 = C.SDL_PIXELTYPE_ARRAYU32
	PIXELTYPE_ARRAYF16 = C.SDL_PIXELTYPE_ARRAYF16
	PIXELTYPE_ARRAYF32 = C.SDL_PIXELTYPE_ARRAYF32
)

Pixel types.

View Source
const (
	BITMAPORDER_NONE = C.SDL_BITMAPORDER_NONE
	BITMAPORDER_4321 = C.SDL_BITMAPORDER_4321
	BITMAPORDER_1234 = C.SDL_BITMAPORDER_1234
)

Bitmap pixel order high bit -> low bit.

View Source
const (
	PACKEDORDER_NONE = C.SDL_PACKEDORDER_NONE
	PACKEDORDER_XRGB = C.SDL_PACKEDORDER_XRGB
	PACKEDORDER_RGBX = C.SDL_PACKEDORDER_RGBX
	PACKEDORDER_ARGB = C.SDL_PACKEDORDER_ARGB
	PACKEDORDER_RGBA = C.SDL_PACKEDORDER_RGBA
	PACKEDORDER_XBGR = C.SDL_PACKEDORDER_XBGR
	PACKEDORDER_BGRX = C.SDL_PACKEDORDER_BGRX
	PACKEDORDER_ABGR = C.SDL_PACKEDORDER_ABGR
	PACKEDORDER_BGRA = C.SDL_PACKEDORDER_BGRA
)

Packed component order high bit -> low bit.

View Source
const (
	ARRAYORDER_NONE = C.SDL_ARRAYORDER_NONE
	ARRAYORDER_RGB  = C.SDL_ARRAYORDER_RGB
	ARRAYORDER_RGBA = C.SDL_ARRAYORDER_RGBA
	ARRAYORDER_ARGB = C.SDL_ARRAYORDER_ARGB
	ARRAYORDER_BGR  = C.SDL_ARRAYORDER_BGR
	ARRAYORDER_BGRA = C.SDL_ARRAYORDER_BGRA
	ARRAYORDER_ABGR = C.SDL_ARRAYORDER_ABGR
)

Array component order low byte -> high byte.

View Source
const (
	PACKEDLAYOUT_NONE    = C.SDL_PACKEDLAYOUT_NONE
	PACKEDLAYOUT_332     = C.SDL_PACKEDLAYOUT_332
	PACKEDLAYOUT_4444    = C.SDL_PACKEDLAYOUT_4444
	PACKEDLAYOUT_1555    = C.SDL_PACKEDLAYOUT_1555
	PACKEDLAYOUT_5551    = C.SDL_PACKEDLAYOUT_5551
	PACKEDLAYOUT_565     = C.SDL_PACKEDLAYOUT_565
	PACKEDLAYOUT_8888    = C.SDL_PACKEDLAYOUT_8888
	PACKEDLAYOUT_2101010 = C.SDL_PACKEDLAYOUT_2101010
	PACKEDLAYOUT_1010102 = C.SDL_PACKEDLAYOUT_1010102
)

Packed component layout.

View Source
const (
	ALPHA_OPAQUE      = C.SDL_ALPHA_OPAQUE
	ALPHA_TRANSPARENT = C.SDL_ALPHA_TRANSPARENT
)

These define alpha as the opacity of a surface.

View Source
const (
	INIT_TIMER          = C.SDL_INIT_TIMER          // timer subsystem
	INIT_AUDIO          = C.SDL_INIT_AUDIO          // audio subsystem
	INIT_VIDEO          = C.SDL_INIT_VIDEO          // video subsystem; automatically initializes the events subsystem
	INIT_JOYSTICK       = C.SDL_INIT_JOYSTICK       // joystick subsystem; automatically initializes the events subsystem
	INIT_HAPTIC         = C.SDL_INIT_HAPTIC         // haptic (force feedback) subsystem
	INIT_GAMECONTROLLER = C.SDL_INIT_GAMECONTROLLER // controller subsystem; automatically initializes the joystick subsystem
	INIT_EVENTS         = C.SDL_INIT_EVENTS         // events subsystem
	INIT_NOPARACHUTE    = C.SDL_INIT_NOPARACHUTE    // compatibility; this flag is ignored
	INIT_SENSOR         = C.SDL_INIT_SENSOR         // sensor subsystem
	INIT_EVERYTHING     = C.SDL_INIT_EVERYTHING     // all of the above subsystems
)

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

View Source
const (
	NONSHAPEABLE_WINDOW    = C.SDL_NONSHAPEABLE_WINDOW
	INVALID_SHAPE_ARGUMENT = C.SDL_INVALID_SHAPE_ARGUMENT
	WINDOW_LACKS_SHAPE     = C.SDL_WINDOW_LACKS_SHAPE
)
View Source
const (
	SWSURFACE = C.SDL_SWSURFACE // just here for compatibility
	PREALLOC  = C.SDL_PREALLOC  // surface uses preallocated memory
	RLEACCEL  = C.SDL_RLEACCEL  // surface is RLE encoded
	DONTFREE  = C.SDL_DONTFREE  // surface is referenced internally
)

Surface flags (internal use)

View Source
const (
	MAJOR_VERSION = C.SDL_MAJOR_VERSION // major version
	MINOR_VERSION = C.SDL_MINOR_VERSION // minor version
	PATCHLEVEL    = C.SDL_PATCHLEVEL    // update version (patchlevel)
)

The version of SDL in use.

View Source
const (
	WINDOWPOS_UNDEFINED_MASK = C.SDL_WINDOWPOS_UNDEFINED_MASK // used to indicate that you don't care what the window position is
	WINDOWPOS_UNDEFINED      = C.SDL_WINDOWPOS_UNDEFINED      // used to indicate that you don't care what the window position is
	WINDOWPOS_CENTERED_MASK  = C.SDL_WINDOWPOS_CENTERED_MASK  // used to indicate that the window position should be centered
	WINDOWPOS_CENTERED       = C.SDL_WINDOWPOS_CENTERED       // used to indicate that the window position should be centered
)

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

View Source
const (
	GL_CONTEXT_PROFILE_CORE          = C.SDL_GL_CONTEXT_PROFILE_CORE          // OpenGL core profile - deprecated functions are disabled
	GL_CONTEXT_PROFILE_COMPATIBILITY = C.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY // OpenGL compatibility profile - deprecated functions are allowed
	GL_CONTEXT_PROFILE_ES            = C.SDL_GL_CONTEXT_PROFILE_ES            // OpenGL ES profile - only a subset of the base OpenGL functionality is available
)

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

View Source
const (
	GL_CONTEXT_DEBUG_FLAG              = C.SDL_GL_CONTEXT_DEBUG_FLAG              // intended to put the GL into a "debug" mode which might offer better developer insights, possibly at a loss of performance
	GL_CONTEXT_FORWARD_COMPATIBLE_FLAG = C.SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG // intended to put the GL into a "forward compatible" mode, which means that no deprecated functionality will be supported, possibly at a gain in performance, and only applies to GL 3.0 and later contexts
	GL_CONTEXT_ROBUST_ACCESS_FLAG      = C.SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG      // intended to require a GL context that supports the GL_ARB_robustness extension--a mode that offers a few APIs that are safer than the usual defaults (think snprintf() vs sprintf())
	GL_CONTEXT_RESET_ISOLATION_FLAG    = C.SDL_GL_CONTEXT_RESET_ISOLATION_FLAG    // intended to require the GL to make promises about what to do in the face of driver or hardware failure
)

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

View Source
const CACHELINE_SIZE = C.SDL_CACHELINE_SIZE

CACHELINE_SIZE is a cacheline size used for padding.

View Source
const K_SCANCODE_MASK = 1 << 30
View Source
const MIX_MAXVOLUME = C.SDL_MIX_MAXVOLUME // full audio volume

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

View Source
const (
	STANDARD_GRAVITY = 9.80665
)
View Source
const TOUCH_MOUSEID = C.SDL_TOUCH_MOUSEID

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

Variables

View Source
var (
	RGB444Model   color.Model = color.ModelFunc(rgb444Model)
	RGB332Model   color.Model = color.ModelFunc(rgb332Model)
	RGB565Model   color.Model = color.ModelFunc(rgb565Model)
	RGB555Model   color.Model = color.ModelFunc(rgb555Model)
	BGR565Model   color.Model = color.ModelFunc(bgr565Model)
	BGR555Model   color.Model = color.ModelFunc(bgr555Model)
	RGB888Model   color.Model = color.ModelFunc(rgb888Model)
	BGR888Model   color.Model = color.ModelFunc(bgr888Model)
	ARGB4444Model color.Model = color.ModelFunc(argb4444Model)
	ABGR4444Model color.Model = color.ModelFunc(abgr4444Model)
	RGBA4444Model color.Model = color.ModelFunc(rgba4444Model)
	BGRA4444Model color.Model = color.ModelFunc(bgra4444Model)
	ARGB1555Model color.Model = color.ModelFunc(argb1555Model)
	RGBA5551Model color.Model = color.ModelFunc(rgba5551Model)
	ABGR1555Model color.Model = color.ModelFunc(abgr1555Model)
	BGRA5551Model color.Model = color.ModelFunc(bgra5551Model)
	RGBA8888Model color.Model = color.ModelFunc(rgba8888Model)
	BGRA8888Model color.Model = color.ModelFunc(bgra8888Model)
	ARGB8888Model color.Model = color.ModelFunc(argb8888Model)
	ABGR8888Model color.Model = color.ModelFunc(abgr8888Model)
)
View Source
var ErrInvalidParameters = errors.New("Invalid Parameters")

Functions

func AddHintCallback added in v0.2.0

func AddHintCallback(name string, fn HintCallback, data interface{})

AddHintCallback adds a function to watch a particular hint. (https://wiki.libsdl.org/SDL_AddHintCallback)

func AudioInit

func AudioInit(driverName string) error

AudioInit initializes a particular audio driver. (https://wiki.libsdl.org/SDL_AudioInit)

func AudioQuit

func AudioQuit()

AudioQuit shuts down audio if you initialized it with AudioInit(). (https://wiki.libsdl.org/SDL_AudioQuit)

func BitsPerPixel added in v0.4.0

func BitsPerPixel(format uint32) int

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

func Btoi

func Btoi(b bool) int

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

func BuildAudioCVT

func BuildAudioCVT(cvt *AudioCVT, srcFormat AudioFormat, srcChannels uint8, srcRate int, dstFormat AudioFormat, dstChannels uint8, dstRate int) (converted bool, err error)

BuildAudioCVT initializes an AudioCVT structure for conversion. (https://wiki.libsdl.org/SDL_BuildAudioCVT)

func BytesPerPixel added in v0.4.0

func BytesPerPixel(format uint32) int

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

func COMPILEDVERSION

func COMPILEDVERSION() int

COMPILEDVERSION returns the SDL version number that you compiled against. (https://wiki.libsdl.org/SDL_COMPILEDVERSION)

func CalculateGammaRamp

func CalculateGammaRamp(gamma float32, ramp *[256]uint16)

CalculateGammaRamp calculates a 256 entry gamma ramp for a gamma value. (https://wiki.libsdl.org/SDL_CalculateGammaRamp)

func CaptureMouse

func CaptureMouse(toggle bool) error

CaptureMouse captures the mouse and tracks input outside an SDL window. (https://wiki.libsdl.org/SDL_CaptureMouse)

func ClearComposition added in v0.4.24

func ClearComposition()

ClearComposition dismisses the composition window/IME without disabling the subsystem. (https://wiki.libsdl.org/SDL_ClearComposition)

func ClearError

func ClearError()

ClearError clears any previous error message. (https://wiki.libsdl.org/SDL_ClearError)

func ClearHints

func ClearHints()

ClearHints clears all hints. (https://wiki.libsdl.org/SDL_ClearHints)

func ClearQueuedAudio

func ClearQueuedAudio(dev AudioDeviceID)

ClearQueuedAudio drops any queued audio data waiting to be sent to the hardware. (https://wiki.libsdl.org/SDL_ClearQueuedAudio)

func CloseAudio

func CloseAudio()

CloseAudio closes the audio device. New programs might want to use CloseAudioDevice() instead. (https://wiki.libsdl.org/SDL_CloseAudio)

func CloseAudioDevice

func CloseAudioDevice(dev AudioDeviceID)

CloseAudioDevice shuts down audio processing and closes the audio device. (https://wiki.libsdl.org/SDL_CloseAudioDevice)

func ConvertAudio

func ConvertAudio(cvt *AudioCVT) error

ConvertAudio converts audio data to a desired audio format. (https://wiki.libsdl.org/SDL_ConvertAudio)

func ConvertPixels

func ConvertPixels(width, height int32, srcFormat uint32, src unsafe.Pointer, srcPitch int,
	dstFormat uint32, dst unsafe.Pointer, dstPitch int) error

ConvertPixels copies a block of pixels of one format to another format. (https://wiki.libsdl.org/SDL_ConvertPixels)

func CreateWindowAndRenderer

func CreateWindowAndRenderer(w, h int32, flags WindowFlags) (*Window, *Renderer, error)

CreateWindowAndRenderer returns a new window and default renderer. (https://wiki.libsdl.org/SDL_CreateWindowAndRenderer)

func CurrentThreadID added in v0.4.0

func CurrentThreadID() uint

CurrentThreadID gets the thread identifier for the current thread. (https://wiki.libsdl.org/SDL_ThreadID)

func DelEventWatch

func DelEventWatch(handle EventWatchHandle)

DelEventWatch removes an event watch callback added with AddEventWatch(). (https://wiki.libsdl.org/SDL_DelEventWatch)

func DelHintCallback added in v0.2.0

func DelHintCallback(name string)

DelHintCallback removes a function watching a particular hint. (https://wiki.libsdl.org/SDL_DelHintCallback)

func Delay

func Delay(ms uint32)

Delay waits a specified number of milliseconds before returning. (https://wiki.libsdl.org/SDL_Delay)

func DequeueAudio

func DequeueAudio(dev AudioDeviceID, data []byte) (n int, err error)

DequeueAudio dequeues more audio on non-callback devices. Returns the number of bytes dequeued, which could be less than requested (https://wiki.libsdl.org/SDL_DequeueAudio)

func DisableScreenSaver

func DisableScreenSaver()

DisableScreenSaver prevents the screen from being blanked by a screen saver. (https://wiki.libsdl.org/SDL_DisableScreenSaver)

func Do

func Do(f func())

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

func EnableScreenSaver

func EnableScreenSaver()

EnableScreenSaver allows the screen to be blanked by a screen saver. (https://wiki.libsdl.org/SDL_EnableScreenSaver)

func Error

func Error(code ErrorCode)

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

func EventState

func EventState(type_ EventType, state EventStateConstant) uint8

EventState sets the state of processing events by type. (https://wiki.libsdl.org/SDL_EventState)

func FilterEvents

func FilterEvents(filter EventFilter, userdata interface{})

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

func FilterEventsFunc

func FilterEventsFunc(filter eventFilterFunc, userdata interface{})

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

func FlushEvent

func FlushEvent(type_ uint32)

FlushEvent clears events from the event queue. (https://wiki.libsdl.org/SDL_FlushEvent)

func FlushEvents

func FlushEvents(minType, maxType EventType)

FlushEvents clears events from the event queue. (https://wiki.libsdl.org/SDL_FlushEvents)

func FreeCursor

func FreeCursor(cursor *Cursor)

FreeCursor frees a cursor created with CreateCursor(), CreateColorCursor() or CreateSystemCursor(). (https://wiki.libsdl.org/SDL_FreeCursor)

func FreeWAV

func FreeWAV(audioBuf []uint8)

FreeWAV frees data previously allocated with LoadWAV() or LoadWAVRW(). (https://wiki.libsdl.org/SDL_FreeWAV)

func GLDeleteContext added in v0.3.0

func GLDeleteContext(context GLContext)

GLDeleteContext deletes an OpenGL context. (https://wiki.libsdl.org/SDL_GL_DeleteContext)

func GLExtensionSupported added in v0.3.0

func GLExtensionSupported(extension string) bool

GLExtensionSupported reports whether an OpenGL extension is supported for the current context. (https://wiki.libsdl.org/SDL_GL_ExtensionSupported)

func GLGetAttribute added in v0.3.0

func GLGetAttribute(attr GLattr) (int, error)

GLGetAttribute returns the actual value for an attribute from the current context. (https://wiki.libsdl.org/SDL_GL_GetAttribute)

func GLGetProcAddress added in v0.3.0

func GLGetProcAddress(proc string) unsafe.Pointer

GLGetProcAddress returns an OpenGL function by name. (https://wiki.libsdl.org/SDL_GL_GetProcAddress)

func GLGetSwapInterval added in v0.3.0

func GLGetSwapInterval() (int, error)

GLGetSwapInterval returns the swap interval for the current OpenGL context. (https://wiki.libsdl.org/SDL_GL_GetSwapInterval)

func GLLoadLibrary added in v0.3.0

func GLLoadLibrary(path string) error

GLLoadLibrary dynamically loads an OpenGL library. (https://wiki.libsdl.org/SDL_GL_LoadLibrary)

func GLSetAttribute added in v0.3.0

func GLSetAttribute(attr GLattr, value int) error

GLSetAttribute sets an OpenGL window attribute before window creation. (https://wiki.libsdl.org/SDL_GL_SetAttribute)

func GLSetSwapInterval added in v0.3.0

func GLSetSwapInterval(interval int) error

GLSetSwapInterval sets the swap interval for the current OpenGL context. (https://wiki.libsdl.org/SDL_GL_SetSwapInterval)

func GLUnloadLibrary added in v0.3.0

func GLUnloadLibrary()

GLUnloadLibrary unloads the OpenGL library previously loaded by GLLoadLibrary(). (https://wiki.libsdl.org/SDL_GL_UnloadLibrary)

func GameControllerAddMapping

func GameControllerAddMapping(mappingString string) int

GameControllerAddMapping adds support for controllers that SDL is unaware of or to cause an existing controller to have a different binding. (https://wiki.libsdl.org/SDL_GameControllerAddMapping)

func GameControllerEventState

func GameControllerEventState(state int) int

GameControllerEventState returns the current state of, enable, or disable events dealing with Game Controllers. This will not disable Joystick events, which can also be fired by a controller (see https://wiki.libsdl.org/SDL_JoystickEventState). (https://wiki.libsdl.org/SDL_GameControllerEventState)

func GameControllerGetStringForAxis

func GameControllerGetStringForAxis(axis GameControllerAxis) string

GameControllerGetStringForAxis converts from an axis enum to a string. (https://wiki.libsdl.org/SDL_GameControllerGetStringForAxis)

func GameControllerGetStringForButton

func GameControllerGetStringForButton(btn GameControllerButton) string

GameControllerGetStringForButton turns a button enum into a string mapping. (https://wiki.libsdl.org/SDL_GameControllerGetStringForButton)

func GameControllerMappingForDeviceIndex added in v0.4.0

func GameControllerMappingForDeviceIndex(index int) string

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

func GameControllerMappingForGUID

func GameControllerMappingForGUID(guid JoystickGUID) string

GameControllerMappingForGUID returns the game controller mapping string for a given GUID. (https://wiki.libsdl.org/SDL_GameControllerMappingForGUID)

func GameControllerMappingForIndex added in v0.3.0

func GameControllerMappingForIndex(index int) string

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

func GameControllerNameForIndex

func GameControllerNameForIndex(index int) string

GameControllerNameForIndex returns the implementation dependent name for the game controller. (https://wiki.libsdl.org/SDL_GameControllerNameForIndex)

func GameControllerNumMappings added in v0.3.0

func GameControllerNumMappings() int

GameControllerNumMappings returns the number of mappings installed.

func GameControllerPathForIndex

func GameControllerPathForIndex(index int) string

GameControllerPathForIndex returns the implementation dependent path for the game controller. (https://wiki.libsdl.org/SDL_GameControllerPathForIndex)

func GameControllerUpdate

func GameControllerUpdate()

GameControllerUpdate manually pumps game controller updates if not using the loop. (https://wiki.libsdl.org/SDL_GameControllerUpdate)

func GetAudioDeviceName

func GetAudioDeviceName(index int, isCapture bool) string

GetAudioDeviceName returns the name of a specific audio device. (https://wiki.libsdl.org/SDL_GetAudioDeviceName)

func GetAudioDriver

func GetAudioDriver(index int) string

GetAudioDriver returns the name of a built in audio driver. (https://wiki.libsdl.org/SDL_GetAudioDriver)

func GetBasePath

func GetBasePath() string

GetBasePath returns the directory where the application was run from. This is where the application data directory is. (https://wiki.libsdl.org/SDL_GetBasePath)

func GetCPUCacheLineSize

func GetCPUCacheLineSize() int

GetCPUCacheLineSize returns the L1 cache line size of the CPU. (https://wiki.libsdl.org/SDL_GetCPUCacheLineSize)

func GetCPUCount

func GetCPUCount() int

GetCPUCount returns the number of CPU cores available. (https://wiki.libsdl.org/SDL_GetCPUCount)

func GetClipboardText

func GetClipboardText() (string, error)

GetClipboardText returns UTF-8 text from the clipboard. (https://wiki.libsdl.org/SDL_GetClipboardText)

func GetCurrentAudioDriver

func GetCurrentAudioDriver() string

GetCurrentAudioDriver returns the name of the current audio driver. (https://wiki.libsdl.org/SDL_GetCurrentAudioDriver)

func GetCurrentVideoDriver

func GetCurrentVideoDriver() (string, error)

GetCurrentVideoDriver returns the name of the currently initialized video driver. (https://wiki.libsdl.org/SDL_GetCurrentVideoDriver)

func GetDisplayDPI added in v0.3.0

func GetDisplayDPI(displayIndex int) (ddpi, hdpi, vdpi float32, err error)

GetDisplayDPI returns the dots/pixels-per-inch for a display. (https://wiki.libsdl.org/SDL_GetDisplayDPI)

func GetDisplayName

func GetDisplayName(displayIndex int) (string, error)

GetDisplayName returns the name of a display in UTF-8 encoding. (https://wiki.libsdl.org/SDL_GetDisplayName)

func GetError

func GetError() error

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

func GetErrorMsg

func GetErrorMsg(maxlen int) error

GetErrorMsg returns the last error message that was set for the current thread. (https://wiki.libsdl.org/SDL_GetErrorMsg)

func GetEventState

func GetEventState(type_ EventType) uint8

GetEventState returns the current processing state of the specified event (https://wiki.libsdl.org/SDL_EventState)

func GetHint

func GetHint(name string) string

GetHint returns the value of a hint. (https://wiki.libsdl.org/SDL_GetHint)

func GetKeyName

func GetKeyName(code Keycode) string

GetKeyName returns a human-readable name for a key. (https://wiki.libsdl.org/SDL_GetKeyName)

func GetKeyboardState

func GetKeyboardState() []uint8

GetKeyboardState returns a snapshot of the current state of the keyboard. (https://wiki.libsdl.org/SDL_GetKeyboardState)

func GetNumAudioDevices

func GetNumAudioDevices(isCapture bool) int

GetNumAudioDevices returns the number of built-in audio devices. (https://wiki.libsdl.org/SDL_GetNumAudioDevices)

func GetNumAudioDrivers

func GetNumAudioDrivers() int

GetNumAudioDrivers returns the number of built-in audio drivers. (https://wiki.libsdl.org/SDL_GetNumAudioDrivers)

func GetNumDisplayModes

func GetNumDisplayModes(displayIndex int) (int, error)

GetNumDisplayModes returns the number of available display modes. (https://wiki.libsdl.org/SDL_GetNumDisplayModes)

func GetNumRenderDrivers

func GetNumRenderDrivers() (int, error)

GetNumRenderDrivers returns the number of 2D rendering drivers available for the current display. (https://wiki.libsdl.org/SDL_GetNumRenderDrivers)

func GetNumTouchDevices

func GetNumTouchDevices() int

GetNumTouchDevices returns the number of registered touch devices. (https://wiki.libsdl.org/SDL_GetNumTouchDevices)

func GetNumTouchFingers

func GetNumTouchFingers(t TouchID) int

GetNumTouchFingers returns the number of active fingers for a given touch device. (https://wiki.libsdl.org/SDL_GetNumTouchFingers)

func GetNumVideoDisplays

func GetNumVideoDisplays() (int, error)

GetNumVideoDisplays returns the number of available video displays. (https://wiki.libsdl.org/SDL_GetNumVideoDisplays)

func GetNumVideoDrivers

func GetNumVideoDrivers() (int, error)

GetNumVideoDrivers returns the number of video drivers compiled into SDL. (https://wiki.libsdl.org/SDL_GetNumVideoDrivers)

func GetPerformanceCounter

func GetPerformanceCounter() uint64

GetPerformanceCounter returns the current value of the high resolution counter. (https://wiki.libsdl.org/SDL_GetPerformanceCounter)

func GetPerformanceFrequency

func GetPerformanceFrequency() uint64

GetPerformanceFrequency returns the count per second of the high resolution counter. (https://wiki.libsdl.org/SDL_GetPerformanceFrequency)

func GetPixelFormatName

func GetPixelFormatName(format uint) string

GetPixelFormatName returns the human readable name of a pixel format. (https://wiki.libsdl.org/SDL_GetPixelFormatName)

func GetPlatform

func GetPlatform() string

GetPlatform returns the name of the platform. (https://wiki.libsdl.org/SDL_GetPlatform)

func GetPointDisplayIndex

func GetPointDisplayIndex(p Point) (index int, err error)

GetPointDisplayIndex returns the index of the display containing a point. (https://wiki.libsdl.org/SDL_GetPointDisplayIndex)

func GetPrefPath

func GetPrefPath(org, app string) string

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

func GetPrimarySelectionText

func GetPrimarySelectionText() (string, error)

GetPrimarySelectionText gets UTF-8 text from the primary selection. (https://wiki.libsdl.org/SDL_GetPrimarySelectionText)

func GetQueuedAudioSize

func GetQueuedAudioSize(dev AudioDeviceID) uint32

GetQueuedAudioSize returns the number of bytes of still-queued audio. (https://wiki.libsdl.org/SDL_GetQueuedAudioSize)

func GetRGB

func GetRGB(pixel uint32, format *PixelFormat) (r, g, b uint8)

GetRGB returns RGB values from a pixel in the specified format. (https://wiki.libsdl.org/SDL_GetRGB)

func GetRGBA

func GetRGBA(pixel uint32, format *PixelFormat) (r, g, b, a uint8)

GetRGBA returns RGBA values from a pixel in the specified format. (https://wiki.libsdl.org/SDL_GetRGBA)

func GetRectDisplayIndex

func GetRectDisplayIndex(r Rect) (index int, err error)

GetRectDisplayIndex returns the index of the display containing a point. (https://wiki.libsdl.org/SDL_GetPointDisplayIndex)

func GetRelativeMouseMode

func GetRelativeMouseMode() bool

GetRelativeMouseMode reports where relative mouse mode is enabled. (https://wiki.libsdl.org/SDL_GetRelativeMouseMode)

func GetRenderDriverInfo

func GetRenderDriverInfo(index int, info *RendererInfo) (int, error)

GetRenderDriverInfo returns information about a specific 2D rendering driver for the current display. (https://wiki.libsdl.org/SDL_GetRenderDriverInfo)

func GetRevision

func GetRevision() string

GetRevision returns the code revision of SDL that is linked against your program. (https://wiki.libsdl.org/SDL_GetRevision)

func GetRevisionNumber deprecated

func GetRevisionNumber() int

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

func GetScancodeName

func GetScancodeName(code Scancode) string

GetScancodeName returns a human-readable name for a scancode (https://wiki.libsdl.org/SDL_GetScancodeName)

func GetSystemRAM

func GetSystemRAM() int

GetSystemRAM returns the amount of RAM configured in the system. (https://wiki.libsdl.org/SDL_GetSystemRAM)

func GetTicks deprecated

func GetTicks() uint32

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

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

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

func GetTicks64 added in v0.4.15

func GetTicks64() uint64

GetTicks64 returns the number of milliseconds since the SDL library initialization. (https://wiki.libsdl.org/SDL_GetTicks64)

func GetVersion

func GetVersion(v *Version)

GetVersion returns the version of SDL that is linked against your program. (https://wiki.libsdl.org/SDL_GetVersion)

func GetVideoDriver

func GetVideoDriver(index int) string

GetVideoDriver returns the name of a built in video driver. (https://wiki.libsdl.org/SDL_GetVideoDriver)

func HIDDeviceChangeCount added in v0.4.11

func HIDDeviceChangeCount() (n uint32)

HIDDeviceChangeCount checks to see if devices may have been added or removed. (https://wiki.libsdl.org/SDL_hid_device_change_count)

func HIDExit added in v0.4.11

func HIDExit() (err error)

HIDExit finalizes the HIDAPI library. (https://wiki.libsdl.org/SDL_hid_exit)

func HIDFreeEnumeration added in v0.4.11

func HIDFreeEnumeration(info *HIDDeviceInfo)

HIDFreeEnumeration frees an enumeration Linked List. (https://wiki.libsdl.org/SDL_hid_free_enumeration)

func HIDInit added in v0.4.11

func HIDInit() (err error)

HIDInit initializes the HIDAPI library. (https://wiki.libsdl.org/SDL_hid_init)

func HapticIndex

func HapticIndex(h *Haptic) (int, error)

HapticIndex returns the index of a haptic device. (https://wiki.libsdl.org/SDL_HapticIndex)

func HapticName

func HapticName(index int) (string, error)

HapticName returns the implementation dependent name of a haptic device. (https://wiki.libsdl.org/SDL_HapticName)

func HapticOpened

func HapticOpened(index int) (bool, error)

HapticOpened reports whether the haptic device at the designated index has been opened. (https://wiki.libsdl.org/SDL_HapticOpened)

func Has3DNow

func Has3DNow() bool

Has3DNow reports whether the CPU has 3DNow! features. (https://wiki.libsdl.org/SDL_Has3DNow)

func HasARMSIMD

func HasARMSIMD() bool

HasARMSIMD reports whether the CPU has ARM SIMD (ARMv6) features. (https://wiki.libsdl.org/SDL_HasARMSIMD)

func HasAVX

func HasAVX() bool

HasAVX reports whether the CPU has AVX features. (https://wiki.libsdl.org/SDL_HasAVX)

func HasAVX2 added in v0.4.0

func HasAVX2() bool

HasAVX2 reports whether the CPU has AVX2 features. (https://wiki.libsdl.org/SDL_HasAVX2)

func HasAVX512F added in v0.4.0

func HasAVX512F() bool

HasAVX512F reports whether the CPU has AVX-512F (foundation) features. (https://wiki.libsdl.org/SDL_HasAVX512F)

func HasAltiVec

func HasAltiVec() bool

HasAltiVec reports whether the CPU has AltiVec features. (https://wiki.libsdl.org/SDL_HasAltiVec)

func HasClipboardText

func HasClipboardText() bool

HasClipboardText reports whether the clipboard exists and contains a text string that is non-empty. (https://wiki.libsdl.org/SDL_HasClipboardText)

func HasEvent

func HasEvent(type_ EventType) bool

HasEvent checks for the existence of certain event types in the event queue. (https://wiki.libsdl.org/SDL_HasEvent)

func HasEvents

func HasEvents(minType, maxType EventType) bool

HasEvents checks for the existence of a range of event types in the event queue. (https://wiki.libsdl.org/SDL_HasEvents)

func HasMMX

func HasMMX() bool

HasMMX reports whether the CPU has MMX features. (https://wiki.libsdl.org/SDL_HasMMX)

func HasNEON added in v0.4.0

func HasNEON() bool

HasNEON reports whether the CPU has NEON features. (https://wiki.libsdl.org/SDL_HasNEON)

func HasPrimarySelectionText

func HasPrimarySelectionText() bool

HasPrimarySelectionText queries whether the primary selection exists and contains a non-empty text string. (https://wiki.libsdl.org/SDL_HasPrimarySelectionText)

func HasRDTSC

func HasRDTSC() bool

HasRDTSC reports whether the CPU has the RDTSC instruction. (https://wiki.libsdl.org/SDL_HasRDTSC)

func HasSSE

func HasSSE() bool

HasSSE reports whether the CPU has SSE features. (https://wiki.libsdl.org/SDL_HasSSE)

func HasSSE2

func HasSSE2() bool

HasSSE2 reports whether the CPU has SSE2 features. (https://wiki.libsdl.org/SDL_HasSSE2)

func HasSSE3

func HasSSE3() bool

HasSSE3 reports whether the CPU has SSE3 features. (https://wiki.libsdl.org/SDL_HasSSE3)

func HasSSE41

func HasSSE41() bool

HasSSE41 reports whether the CPU has SSE4.1 features. (https://wiki.libsdl.org/SDL_HasSSE41)

func HasSSE42

func HasSSE42() bool

HasSSE42 reports whether the CPU has SSE4.2 features. (https://wiki.libsdl.org/SDL_HasSSE42)

func HasScreenKeyboardSupport

func HasScreenKeyboardSupport() bool

HasScreenKeyboardSupport reports whether the platform has some screen keyboard support. (https://wiki.libsdl.org/SDL_HasScreenKeyboardSupport)

func Init

func Init(flags uint32) error

Init initialize the SDL library. This must be called before using most other SDL functions. (https://wiki.libsdl.org/SDL_Init)

func InitSubSystem

func InitSubSystem(flags uint32) error

InitSubSystem initializes specific SDL subsystems. (https://wiki.libsdl.org/SDL_InitSubSystem)

func IsGameController

func IsGameController(index int) bool

IsGameController reports whether the given joystick is supported by the game controller interface. (https://wiki.libsdl.org/SDL_IsGameController)

func IsScreenKeyboardShown

func IsScreenKeyboardShown(window *Window) bool

IsScreenKeyboardShown reports whether the screen keyboard is shown for given window. (https://wiki.libsdl.org/SDL_IsScreenKeyboardShown)

func IsScreenSaverEnabled

func IsScreenSaverEnabled() bool

IsScreenSaverEnabled reports whether the screensaver is currently enabled. (https://wiki.libsdl.org/SDL_IsScreenSaverEnabled)

func IsTablet added in v0.4.0

func IsTablet() bool

IsTablet returns true if the current device is a tablet (https://wiki.libsdl.org/SDL_IsTablet)

func IsTextInputActive

func IsTextInputActive() bool

IsTextInputActive checks whether or not Unicode text input events are enabled. (https://wiki.libsdl.org/SDL_IsTextInputActive)

func IsTextInputShown added in v0.4.24

func IsTextInputShown() bool

IsTextInputShown returns if an IME Composite or Candidate window is currently shown. (https://wiki.libsdl.org/SDL_IsTextInputShown)

func JoystickAttachVirtual

func JoystickAttachVirtual(typ JoystickType, naxes, nbuttons, nhats int) (deviceIndex int, err error)

JoystickAttachVirtual attaches a new virtual joystick. (https://wiki.libsdl.org/SDL_JoystickAttachVirtual)

func JoystickAttachVirtualEx

func JoystickAttachVirtualEx(desc *C.SDL_VirtualJoystickDesc) (deviceIndex int, err error)

JoystickAttachVirtualEx attaches a new virtual joystick with extended properties. (https://wiki.libsdl.org/SDL_JoystickAttachVirtualEx)

func JoystickDetachVirtual

func JoystickDetachVirtual(deviceIndex int) error

JoystickDetachVirtual detaches a virtual joystick. (https://wiki.libsdl.org/SDL_JoystickDetachVirtual)

func JoystickEventState

func JoystickEventState(state int) int

JoystickEventState enables or disables joystick event polling. (https://wiki.libsdl.org/SDL_JoystickEventState)

func JoystickGetDevicePlayerIndex added in v0.4.0

func JoystickGetDevicePlayerIndex(index int) int

JoystickGetDevicePlayerIndex returns the player index of a joystick, or -1 if it's not available (https://wiki.libsdl.org/SDL_JoystickGetDevicePlayerIndex)

func JoystickGetDeviceProduct added in v0.3.0

func JoystickGetDeviceProduct(index int) int

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

func JoystickGetDeviceProductVersion added in v0.3.0

func JoystickGetDeviceProductVersion(index int) int

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

func JoystickGetDeviceVendor added in v0.3.0

func JoystickGetDeviceVendor(index int) int

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

func JoystickGetGUIDString

func JoystickGetGUIDString(guid JoystickGUID) string

JoystickGetGUIDString returns an ASCII string representation for a given JoystickGUID. (https://wiki.libsdl.org/SDL_JoystickGetGUIDString)

func JoystickIsHaptic

func JoystickIsHaptic(joy *Joystick) (bool, error)

JoystickIsHaptic reports whether a joystick has haptic features. (https://wiki.libsdl.org/SDL_JoystickIsHaptic)

func JoystickIsVirtual

func JoystickIsVirtual(deviceIndex int) bool

JoystickIsVirtual indicates whether or not a virtual-joystick is at a given device index. (https://wiki.libsdl.org/SDL_JoystickIsVirtual)

func JoystickNameForIndex

func JoystickNameForIndex(index int) string

JoystickNameForIndex returns the implementation dependent name of a joystick. (https://wiki.libsdl.org/SDL_JoystickNameForIndex)

func JoystickPathForIndex

func JoystickPathForIndex(index int) string

JoystickPathForIndex returns the implementation dependent path of a joystick. (https://wiki.libsdl.org/SDL_JoystickPathForIndex)

func JoystickUpdate added in v0.2.0

func JoystickUpdate()

JoystickUpdate updates the current state of the open joysticks. (https://wiki.libsdl.org/SDL_JoystickUpdate)

func LinuxSetThreadPriority added in v0.4.11

func LinuxSetThreadPriority(threadID int64, priority int) (err error)

LinuxSetThreadPriority sets the UNIX nice value for a thread.

This uses setpriority() if possible, and RealtimeKit if available.

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

func LinuxSetThreadPriorityAndPolicy added in v0.4.11

func LinuxSetThreadPriorityAndPolicy(threadID int64, sdlPriority, schedPolicy int) (err error)

LinuxSetThreadPriority sets the priority (not nice level) and scheduling policy for a thread.

This uses setpriority() if possible, and RealtimeKit if available.

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

func LoadDollarTemplates

func LoadDollarTemplates(t TouchID, src *RWops) int

LoadDollarTemplates loads Dollar Gesture templates from a file. (https://wiki.libsdl.org/SDL_LoadDollarTemplates)

func LoadFile added in v0.4.0

func LoadFile(file string) (data []byte, size int)

LoadFile loads an entire file (https://wiki.libsdl.org/SDL_LoadFile)

func LockAudio

func LockAudio()

LockAudio locks the audio device. New programs might want to use LockAudioDevice() instead. (https://wiki.libsdl.org/SDL_LockAudio)

func LockAudioDevice

func LockAudioDevice(dev AudioDeviceID)

LockAudioDevice locks out the audio callback function for a specified device. (https://wiki.libsdl.org/SDL_LockAudioDevice)

func LockJoysticks added in v0.4.0

func LockJoysticks()

LockJoysticks locks joysticks for multi-threaded access to the joystick API (https://wiki.libsdl.org/SDL_LockJoysticks)

func LockSensors

func LockSensors()

LockSensors locks sensors for multi-threaded access to the sensor API (https://wiki.libsdl.org/SDL_LockSensors)

func Log

func Log(str string, args ...interface{})

Log logs a message with LOG_CATEGORY_APPLICATION and LOG_PRIORITY_INFO. (https://wiki.libsdl.org/SDL_Log)

func LogCritical

func LogCritical(category LogCategory, str string, args ...interface{})

LogCritical logs a message with LOG_PRIORITY_CRITICAL. (https://wiki.libsdl.org/SDL_LogCritical)

func LogDebug

func LogDebug(category LogCategory, str string, args ...interface{})

LogDebug logs a message with LOG_PRIORITY_DEBUG. (https://wiki.libsdl.org/SDL_LogDebug)

func LogError

func LogError(category LogCategory, str string, args ...interface{})

LogError logs a message with LOG_PRIORITY_ERROR. (https://wiki.libsdl.org/SDL_LogError)

func LogInfo

func LogInfo(category LogCategory, str string, args ...interface{})

LogInfo logs a message with LOG_PRIORITY_INFO. (https://wiki.libsdl.org/SDL_LogInfo)

func LogMessage

func LogMessage(category LogCategory, pri LogPriority, str string, args ...interface{})

LogMessage logs a message with the specified category and priority. (https://wiki.libsdl.org/SDL_LogMessage)

func LogResetPriorities

func LogResetPriorities()

LogResetPriorities resets all priorities to default. (https://wiki.libsdl.org/SDL_LogResetPriorities)

func LogSetAllPriority

func LogSetAllPriority(p LogPriority)

LogSetAllPriority sets the priority of all log categories. (https://wiki.libsdl.org/SDL_LogSetAllPriority)

func LogSetOutputFunction

func LogSetOutputFunction(f LogOutputFunction, data interface{})

LogSetOutputFunction replaces the default log output function with one of your own. (https://wiki.libsdl.org/SDL_LogSetOutputFunction)

func LogSetPriority

func LogSetPriority(category LogCategory, p LogPriority)

LogSetPriority sets the priority of a particular log category. (https://wiki.libsdl.org/SDL_LogSetPriority)

func LogVerbose

func LogVerbose(category LogCategory, str string, args ...interface{})

LogVerbose logs a message with LOG_PRIORITY_VERBOSE. (https://wiki.libsdl.org/SDL_LogVerbose)

func LogWarn

func LogWarn(category LogCategory, str string, args ...interface{})

LogWarn logs a message with LOG_PRIORITY_WARN. (https://wiki.libsdl.org/SDL_LogWarn)

func Main

func Main(main func())

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

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

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

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

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

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. (https://wiki.libsdl.org/SDL_MapRGB)

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. (https://wiki.libsdl.org/SDL_MapRGBA)

func MasksToPixelFormatEnum

func MasksToPixelFormatEnum(bpp int, rmask, gmask, bmask, amask uint32) uint

MasksToPixelFormatEnum converts a bpp value and RGBA masks to an enumerated pixel format. (https://wiki.libsdl.org/SDL_MasksToPixelFormatEnum)

func Metal_DestroyView

func Metal_DestroyView(metalView MetalView)

Metal_DestroyView Destroy an existing SDL_MetalView object. (https://wiki.libsdl.org/SDL_Metal_DestroyView)

func Metal_GetDrawableSize

func Metal_GetDrawableSize(window *Window) (w, h int)

Metal_GetDrawableSize Get the size of a window's underlying drawable in pixels (for use with setting viewport, scissor & etc). (https://wiki.libsdl.org/SDL_Metal_GetDrawableSize)

func Metal_GetLayer

func Metal_GetLayer(metalView MetalView) unsafe.Pointer

Metal_GetLayer gets a pointer to the backing CAMetalLayer for the given view. (https://wiki.libsdl.org/SDL_Metal_GetLayer)

func MixAudio

func MixAudio(dst, src *uint8, len uint32, volume int)

MixAudio mixes audio data. New programs might want to use MixAudioFormat() instead. (https://wiki.libsdl.org/SDL_MixAudio)

func MixAudioFormat

func MixAudioFormat(dst, src *uint8, format AudioFormat, len uint32, volume int)

MixAudioFormat mixes audio data in a specified format. (https://wiki.libsdl.org/SDL_MixAudioFormat)

func MouseIsHaptic

func MouseIsHaptic() (bool, error)

MouseIsHaptic reports whether or not the current mouse has haptic capabilities. (https://wiki.libsdl.org/SDL_MouseIsHaptic)

func NumHaptics

func NumHaptics() (int, error)

NumHaptics returns the number of haptic devices attached to the system. (https://wiki.libsdl.org/SDL_NumHaptics)

func NumJoysticks

func NumJoysticks() int

NumJoysticks returns the number of joysticks attached to the system. (https://wiki.libsdl.org/SDL_NumJoysticks)

func NumSensors added in v0.4.0

func NumSensors() int

NumSensors counts the number of sensors attached to the system right now (https://wiki.libsdl.org/SDL_NumSensors)

func OpenAudio

func OpenAudio(desired, obtained *AudioSpec) error

OpenAudio opens the audio device. New programs might want to use OpenAudioDevice() instead. (https://wiki.libsdl.org/SDL_OpenAudio)

func OpenURL

func OpenURL(url string) error

OpenURL opens an URL / URI in the browser or other (https://wiki.libsdl.org/SDL_OpenURL)

func OutOfMemory

func OutOfMemory()

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

func PauseAudio

func PauseAudio(pauseOn bool)

PauseAudio pauses and unpauses the audio device. New programs might want to use SDL_PauseAudioDevice() instead. (https://wiki.libsdl.org/SDL_PauseAudio)

func PauseAudioDevice

func PauseAudioDevice(dev AudioDeviceID, pauseOn bool)

PauseAudioDevice pauses and unpauses audio playback on a specified device. (https://wiki.libsdl.org/SDL_PauseAudioDevice)

func PeepEvents

func PeepEvents(events []Event, action EventAction, minType, maxType EventType) (storedEvents int, err error)

PeepEvents checks the event queue for messages and optionally return them. (https://wiki.libsdl.org/SDL_PeepEvents)

func PixelFormatEnumToMasks

func PixelFormatEnumToMasks(format uint) (bpp int, rmask, gmask, bmask, amask uint32, err error)

PixelFormatEnumToMasks converts one of the enumerated pixel formats to a bpp value and RGBA masks. (https://wiki.libsdl.org/SDL_PixelFormatEnumToMasks)

func PremultiplyAlpha added in v0.4.11

func PremultiplyAlpha(width, height int, srcFormat uint32, src []byte, srcPitch int, dstFormat uint32, dst []byte, dstPitch int) (err error)

PremultiplyAlpha premultiplies the alpha on a block of pixels.

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

This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.

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

func PumpEvents

func PumpEvents()

PumpEvents pumps the event loop, gathering events from the input devices. (https://wiki.libsdl.org/SDL_PumpEvents)

func PushEvent

func PushEvent(event Event) (filtered bool, err error)

PushEvent adds an event to the event queue. (https://wiki.libsdl.org/SDL_PushEvent)

func QueueAudio

func QueueAudio(dev AudioDeviceID, data []byte) error

QueueAudio queues more audio on non-callback devices. (https://wiki.libsdl.org/SDL_QueueAudio)

func Quit

func Quit()

Quit cleans up all initialized subsystems. You should call it upon all exit conditions. (https://wiki.libsdl.org/SDL_Quit)

func QuitSubSystem

func QuitSubSystem(flags uint32)

QuitSubSystem shuts down specific SDL subsystems. (https://wiki.libsdl.org/SDL_QuitSubSystem)

func RecordGesture

func RecordGesture(t TouchID) int

RecordGesture begins recording a gesture on a specified touch device or all touch devices. (https://wiki.libsdl.org/SDL_RecordGesture)

func RegisterEvents

func RegisterEvents(numEvents int) uint32

RegisterEvents allocates a set of user-defined events, and return the beginning event number for that set of events. (https://wiki.libsdl.org/SDL_RegisterEvents)

func ResetHint

func ResetHint(name string) bool

ResetHint resets a hint to the default value. (https://wiki.libsdl.org/SDL_ResetHint)

func ResetHints

func ResetHints()

ResetHints resets all hints to the default values. (https://wiki.libsdl.org/SDL_ResetHints)

func SHAPEMODEALPHA added in v0.4.31

func SHAPEMODEALPHA(mode WindowShapeModeKind) bool

func SIMDAlloc added in v0.4.0

func SIMDAlloc(_len int) unsafe.Pointer

SIMDAlloc allocates memory in a SIMD-friendly way. (https://wiki.libsdl.org/SDL_SIMDAlloc)

func SIMDFree added in v0.4.0

func SIMDFree(p unsafe.Pointer)

SIMDFree deallocates memory obtained from SDL_SIMDAlloc. (https://wiki.libsdl.org/SDL_SIMDFree)

func SIMDGetAlignment added in v0.4.0

func SIMDGetAlignment() int

SIMDGetAlignment reports the alignment this system needs for SIMD allocations. (https://wiki.libsdl.org/SDL_SIMDGetAlignment)

func SIMDRealloc

func SIMDRealloc(mem unsafe.Pointer, _len int) unsafe.Pointer

SIMDRealloc reallocates memory obtained from SDL_SIMDAlloc. (https://wiki.libsdl.org/SDL_SIMDRealloc)

func SaveAllDollarTemplates

func SaveAllDollarTemplates(src *RWops) int

SaveAllDollarTemplates saves all currently loaded Dollar Gesture templates. (https://wiki.libsdl.org/SDL_SaveAllDollarTemplates)

func SaveDollarTemplate

func SaveDollarTemplate(g GestureID, src *RWops) int

SaveDollarTemplate saves a currently loaded Dollar Gesture template. (https://wiki.libsdl.org/SDL_SaveDollarTemplate)

func SensorGetDeviceName added in v0.4.0

func SensorGetDeviceName(deviceIndex int) (name string)

SensorGetDeviceName gets the implementation dependent name of a sensor.

This can be called before any sensors are opened.

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

func SensorGetDeviceNonPortableType added in v0.4.0

func SensorGetDeviceNonPortableType(deviceIndex int) (typ int)

SensorGetDeviceNonPortableType gets the platform dependent type of a sensor.

This can be called before any sensors are opened.

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

func SensorUpdate added in v0.4.0

func SensorUpdate()

SensorUpdate updates the current state of the open sensors.

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

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

func SetClipboardText

func SetClipboardText(text string) error

SetClipboardText puts UTF-8 text into the clipboard. (https://wiki.libsdl.org/SDL_SetClipboardText)

func SetCursor

func SetCursor(cursor *Cursor)

SetCursor sets the active cursor. (https://wiki.libsdl.org/SDL_SetCursor)

func SetError added in v0.3.0

func SetError(err error)

SetError set the SDL error message. (https://wiki.libsdl.org/SDL_SetError)

func SetEventFilter

func SetEventFilter(filter EventFilter, userdata interface{})

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

func SetEventFilterFunc

func SetEventFilterFunc(filterFunc eventFilterFunc, userdata interface{})

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

func SetHint

func SetHint(name, value string) bool

SetHint sets a hint with normal priority. (https://wiki.libsdl.org/SDL_SetHint)

func SetHintWithPriority

func SetHintWithPriority(name, value string, hp HintPriority) bool

SetHintWithPriority sets a hint with a specific priority. (https://wiki.libsdl.org/SDL_SetHintWithPriority)

func SetModState

func SetModState(mod Keymod)

SetModState sets the current key modifier state for the keyboard. (https://wiki.libsdl.org/SDL_SetModState)

func SetPrimarySelectionText

func SetPrimarySelectionText(text string) error

SetPrimarySelectionText puts UTF-8 text into the primary selection. (https://wiki.libsdl.org/SDL_SetPrimarySelectionText)

func SetRelativeMouseMode

func SetRelativeMouseMode(enabled bool) int

SetRelativeMouseMode sets relative mouse mode. (https://wiki.libsdl.org/SDL_SetRelativeMouseMode)

func SetTextInputRect

func SetTextInputRect(rect *Rect)

SetTextInputRect sets the rectangle used to type Unicode text inputs. (https://wiki.libsdl.org/SDL_SetTextInputRect)

func SetYUVConversionMode added in v0.4.0

func SetYUVConversionMode(mode YUV_CONVERSION_MODE)

SetYUVConversionMode sets the YUV conversion mode (https://wiki.libsdl.org/SDL_SetYUVConversionMode)

func ShowCursor

func ShowCursor(toggle EventStateConstant) (int, error)

ShowCursor toggles whether or not the cursor is shown. (https://wiki.libsdl.org/SDL_ShowCursor)

func ShowMessageBox

func ShowMessageBox(data *MessageBoxData) (buttonid int32, err error)

ShowMessageBox creates a modal message box. (https://wiki.libsdl.org/SDL_ShowMessageBox)

func ShowSimpleMessageBox

func ShowSimpleMessageBox(flags MessageBoxFlags, title, message string, window *Window) error

ShowSimpleMessageBox displays a simple modal message box. (https://wiki.libsdl.org/SDL_ShowSimpleMessageBox)

func StartTextInput

func StartTextInput()

StartTextInput starts accepting Unicode text input events. (https://wiki.libsdl.org/SDL_StartTextInput)

func StopTextInput

func StopTextInput()

StopTextInput stops receiving any text input events. (https://wiki.libsdl.org/SDL_StopTextInput)

func UnlockAudio

func UnlockAudio()

UnlockAudio unlocks the audio device. New programs might want to use UnlockAudioDevice() instead. (https://wiki.libsdl.org/SDL_UnlockAudio)

func UnlockAudioDevice

func UnlockAudioDevice(dev AudioDeviceID)

UnlockAudioDevice unlocks the audio callback function for a specified device. (https://wiki.libsdl.org/SDL_UnlockAudioDevice)

func UnlockJoysticks added in v0.4.0

func UnlockJoysticks()

UnlockJoysticks unlocks joysticks for multi-threaded access to the joystick API (https://wiki.libsdl.org/SDL_UnlockJoysticks)

func UnlockSensors

func UnlockSensors()

UnlockSensors unlocks sensors for multi-threaded access to the sensor API (https://wiki.libsdl.org/SDL_UnlockSensors)

func Unsupported

func Unsupported()

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

func VERSION

func VERSION(v *Version)

VERSION fills the selected struct with the version of SDL in use. (https://wiki.libsdl.org/SDL_VERSION)

func VERSIONNUM

func VERSIONNUM(x, y, z int) int

VERSIONNUM converts separate version components into a single numeric value. (https://wiki.libsdl.org/SDL_VERSIONNUM)

func VERSION_ATLEAST

func VERSION_ATLEAST(x, y, z int) bool

VERSION_ATLEAST reports whether the SDL version compiled against is at least as new as the specified version. (https://wiki.libsdl.org/SDL_VERSION_ATLEAST)

func VideoInit

func VideoInit(driverName string) error

VideoInit initializes the video subsystem, optionally specifying a video driver. (https://wiki.libsdl.org/SDL_VideoInit)

func VideoQuit

func VideoQuit()

VideoQuit shuts down the video subsystem, if initialized with VideoInit(). (https://wiki.libsdl.org/SDL_VideoQuit)

func VulkanGetVkGetInstanceProcAddr added in v0.4.0

func VulkanGetVkGetInstanceProcAddr() unsafe.Pointer

VulkanGetVkGetInstanceProcAddr gets the address of the vkGetInstanceProcAddr function. (https://wiki.libsdl.org/SDL_Vulkan_GetVkInstanceProcAddr)

func VulkanLoadLibrary added in v0.4.0

func VulkanLoadLibrary(path string) error

VulkanLoadLibrary dynamically loads a Vulkan loader library. (https://wiki.libsdl.org/SDL_Vulkan_LoadLibrary)

func VulkanUnloadLibrary added in v0.4.0

func VulkanUnloadLibrary()

VulkanUnloadLibrary unloads the Vulkan loader library previously loaded by VulkanLoadLibrary(). (https://wiki.libsdl.org/SDL_Vulkan_UnloadLibrary)

func WarpMouseGlobal added in v0.4.0

func WarpMouseGlobal(x, y int32) error

WarpMouseGlobal moves the mouse to the given position in global screen space. (https://wiki.libsdl.org/SDL_WarpMouseGlobal)

func WasInit

func WasInit(flags uint32) uint32

WasInit returns a mask of the specified subsystems which have previously been initialized. (https://wiki.libsdl.org/SDL_WasInit)

Types

type ABGR1555 added in v0.4.0

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

func (ABGR1555) RGBA added in v0.4.0

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

type ABGR4444 added in v0.4.0

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

func (ABGR4444) RGBA added in v0.4.0

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

type ABGR8888 added in v0.4.36

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

func (ABGR8888) RGBA added in v0.4.36

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

type ARGB1555 added in v0.4.0

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

func (ARGB1555) RGBA added in v0.4.0

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

type ARGB4444 added in v0.4.0

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

func (ARGB4444) RGBA added in v0.4.0

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

type ARGB8888 added in v0.4.36

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

func (ARGB8888) RGBA added in v0.4.36

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

type AudioCVT

type AudioCVT struct {
	Needed    int32          // set to 1 if conversion possible
	SrcFormat AudioFormat    // source audio format
	DstFormat AudioFormat    // target audio format
	RateIncr  float64        // rate conversion increment
	Buf       unsafe.Pointer // the buffer to hold entire audio data. Use AudioCVT.BufAsSlice() for access via a Go slice
	Len       int32          // length of original audio buffer
	LenCVT    int32          // length of converted audio buffer
	LenMult   int32          // buf must be len*len_mult big
	LenRatio  float64        // given len, final size is len*len_ratio
	// contains filtered or unexported fields
}

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

func (*AudioCVT) AllocBuf

func (cvt *AudioCVT) AllocBuf(size uintptr)

AllocBuf allocates the requested memory for AudioCVT buffer.

func (AudioCVT) BufAsSlice

func (cvt AudioCVT) BufAsSlice() []byte

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

func (*AudioCVT) FreeBuf

func (cvt *AudioCVT) FreeBuf()

FreeBuf deallocates the memory previously allocated from AudioCVT buffer.

type AudioCallback

type AudioCallback C.SDL_AudioCallback

AudioCallback is a function to call when the audio device needs more data.` (https://wiki.libsdl.org/SDL_AudioSpec)

type AudioDeviceAllowFlags

type AudioDeviceAllowFlags int

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

type AudioDeviceEvent added in v0.3.0

type AudioDeviceEvent struct {
	Type      EventType // AUDIODEVICEADDED, AUDIODEVICEREMOVED
	Timestamp uint32    // the timestamp of the event
	Which     uint32    // the audio device index for the AUDIODEVICEADDED event (valid until next GetNumAudioDevices() call), AudioDeviceID for the AUDIODEVICEREMOVED event
	IsCapture uint8     // zero if an audio output device, non-zero if an audio capture device
}

AudioDeviceEvent contains audio device event information. (https://wiki.libsdl.org/SDL_AudioDeviceEvent)

func (AudioDeviceEvent) GetTimestamp added in v0.3.0

func (e AudioDeviceEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (AudioDeviceEvent) GetType added in v0.3.0

func (e AudioDeviceEvent) GetType() EventType

GetType returns the event type.

type AudioDeviceID

type AudioDeviceID uint32

AudioDeviceID is ID of an audio device previously opened with OpenAudioDevice(). (https://wiki.libsdl.org/SDL_OpenAudioDevice)

func OpenAudioDevice

func OpenAudioDevice(device string, isCapture bool, desired, obtained *AudioSpec, allowedChanges AudioDeviceAllowFlags) (AudioDeviceID, error)

OpenAudioDevice opens a specific audio device. (https://wiki.libsdl.org/SDL_OpenAudioDevice)

type AudioFilter

type AudioFilter C.SDL_AudioFilter

AudioFilter is the filter list used in AudioCVT() (internal use) (https://wiki.libsdl.org/SDL_AudioCVT)

type AudioFormat

type AudioFormat uint16

AudioFormat is an enumeration of audio formats. (https://wiki.libsdl.org/SDL_AudioFormat)

const (
	AUDIO_MASK_BITSIZE  AudioFormat = C.SDL_AUDIO_MASK_BITSIZE  // (0xFF)
	AUDIO_MASK_DATATYPE AudioFormat = C.SDL_AUDIO_MASK_DATATYPE // (1<<8)
	AUDIO_MASK_ENDIAN   AudioFormat = C.SDL_AUDIO_MASK_ENDIAN   // (1<<12)
	AUDIO_MASK_SIGNED   AudioFormat = C.SDL_AUDIO_MASK_SIGNED   // (1<<15)
)

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

const (
	AUDIO_S8 AudioFormat = C.AUDIO_S8 // signed 8-bit samples
	AUDIO_U8 AudioFormat = C.AUDIO_U8 // unsigned 8-bit samples

	AUDIO_S16LSB AudioFormat = C.AUDIO_S16LSB // signed 16-bit samples in little-endian byte order
	AUDIO_S16MSB AudioFormat = C.AUDIO_S16MSB // signed 16-bit samples in big-endian byte order
	AUDIO_S16SYS AudioFormat = C.AUDIO_S16SYS // signed 16-bit samples in native byte order
	AUDIO_S16    AudioFormat = C.AUDIO_S16    // AUDIO_S16LSB
	AUDIO_U16LSB AudioFormat = C.AUDIO_U16LSB // unsigned 16-bit samples in little-endian byte order
	AUDIO_U16MSB AudioFormat = C.AUDIO_U16MSB // unsigned 16-bit samples in big-endian byte order
	AUDIO_U16SYS AudioFormat = C.AUDIO_U16SYS // unsigned 16-bit samples in native byte order
	AUDIO_U16    AudioFormat = C.AUDIO_U16    // AUDIO_U16LSB

	AUDIO_S32LSB AudioFormat = C.AUDIO_S32LSB // 32-bit integer samples in little-endian byte order
	AUDIO_S32MSB AudioFormat = C.AUDIO_S32MSB // 32-bit integer samples in big-endian byte order
	AUDIO_S32SYS AudioFormat = C.AUDIO_S32SYS // 32-bit integer samples in native byte order
	AUDIO_S32    AudioFormat = C.AUDIO_S32    // AUDIO_S32LSB

	AUDIO_F32LSB AudioFormat = C.AUDIO_F32LSB // 32-bit floating point samples in little-endian byte order
	AUDIO_F32MSB AudioFormat = C.AUDIO_F32MSB // 32-bit floating point samples in big-endian byte order
	AUDIO_F32SYS AudioFormat = C.AUDIO_F32SYS // 32-bit floating point samples in native byte order
	AUDIO_F32    AudioFormat = C.AUDIO_F32    // AUDIO_F32LSB
)

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

func (AudioFormat) BitSize

func (fmt AudioFormat) BitSize() uint8

BitSize returns audio formats bit size. (https://wiki.libsdl.org/SDL_AudioFormat)

func (AudioFormat) IsBigEndian

func (fmt AudioFormat) IsBigEndian() bool

IsBigEndian reports whether audio format is big-endian. (https://wiki.libsdl.org/SDL_AudioFormat)

func (AudioFormat) IsFloat

func (fmt AudioFormat) IsFloat() bool

IsFloat reports whether audio format is float. (https://wiki.libsdl.org/SDL_AudioFormat)

func (AudioFormat) IsInt

func (fmt AudioFormat) IsInt() bool

IsInt reports whether audio format is integer. (https://wiki.libsdl.org/SDL_AudioFormat)

func (AudioFormat) IsLittleEndian

func (fmt AudioFormat) IsLittleEndian() bool

IsLittleEndian reports whether audio format is little-endian. (https://wiki.libsdl.org/SDL_AudioFormat)

func (AudioFormat) IsSigned

func (fmt AudioFormat) IsSigned() bool

IsSigned reports whether audio format is signed. (https://wiki.libsdl.org/SDL_AudioFormat)

func (AudioFormat) IsUnsigned

func (fmt AudioFormat) IsUnsigned() bool

IsUnsigned reports whether audio format is unsigned. (https://wiki.libsdl.org/SDL_AudioFormat)

type AudioSpec

type AudioSpec struct {
	Freq     int32       // DSP frequency (samples per second)
	Format   AudioFormat // audio data format
	Channels uint8       // number of separate sound channels
	Silence  uint8       // audio buffer silence value (calculated)
	Samples  uint16      // audio buffer size in samples (power of 2)

	Size     uint32         // audio buffer size in bytes (calculated)
	Callback AudioCallback  // the function to call when the audio device needs more data
	UserData unsafe.Pointer // a pointer that is passed to callback (otherwise ignored by SDL)
	// contains filtered or unexported fields
}

AudioSpec contains the audio output format. It also contains a callback that is called when the audio device needs more data. (https://wiki.libsdl.org/SDL_AudioSpec)

func GetAudioDeviceSpec added in v0.4.11

func GetAudioDeviceSpec(index int, isCapture bool) (spec *AudioSpec, err error)

GetAudioDeviceSpec returns the preferred audio format of a specific audio device. (https://wiki.libsdl.org/SDL_GetAudioDeviceSpec)

func GetDefaultAudioInfo

func GetDefaultAudioInfo(isCapture bool) (name string, spec *AudioSpec, err error)

GetDefaultAudioInfo returns the name and preferred format of the default audio device. (https://wiki.libsdl.org/SDL_GetDefaultAudioInfo)

func LoadWAV

func LoadWAV(file string) ([]byte, *AudioSpec)

LoadWAV loads a WAVE from a file. (https://wiki.libsdl.org/SDL_LoadWAV)

func LoadWAVRW added in v0.3.0

func LoadWAVRW(src *RWops, freeSrc bool) ([]byte, *AudioSpec)

LoadWAVRW loads a WAVE from the data source, automatically freeing that source if freeSrc is true. (https://wiki.libsdl.org/SDL_LoadWAV_RW)

type AudioStatus

type AudioStatus uint32

AudioStatus is an enumeration of audio device states. (https://wiki.libsdl.org/SDL_AudioStatus)

const (
	AUDIO_STOPPED AudioStatus = C.SDL_AUDIO_STOPPED // audio device is stopped
	AUDIO_PLAYING AudioStatus = C.SDL_AUDIO_PLAYING // audio device is playing
	AUDIO_PAUSED  AudioStatus = C.SDL_AUDIO_PAUSED  // audio device is paused
)

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

func GetAudioDeviceStatus

func GetAudioDeviceStatus(dev AudioDeviceID) AudioStatus

GetAudioDeviceStatus returns the current audio state of an audio device. (https://wiki.libsdl.org/SDL_GetAudioDeviceStatus)

func GetAudioStatus

func GetAudioStatus() AudioStatus

GetAudioStatus returns the current audio state of the audio device. New programs might want to use GetAudioDeviceStatus() instead. (https://wiki.libsdl.org/SDL_GetAudioStatus)

type AudioStream added in v0.4.0

type AudioStream C.SDL_AudioStream

AudioStream is a new audio conversion interface. (https://wiki.libsdl.org/SDL_AudioStream)

func NewAudioStream added in v0.4.0

func NewAudioStream(srcFormat AudioFormat, srcChannels uint8, srcRate int, dstFormat AudioFormat, dstChannels uint8, dstRate int) (stream *AudioStream, err error)

NewAudioStream creates a new audio stream (https://wiki.libsdl.org/SDL_NewAudioStream)

func (*AudioStream) Available added in v0.4.0

func (stream *AudioStream) Available() (n int)

Available gets the number of converted/resampled bytes available (https://wiki.libsdl.org/SDL_AudioStreamAvailable)

func (*AudioStream) Clear added in v0.4.0

func (stream *AudioStream) Clear()

Clear clears any pending data in the stream without converting it (https://wiki.libsdl.org/SDL_AudioStreamClear)

func (*AudioStream) Flush added in v0.4.0

func (stream *AudioStream) Flush() (err error)

Flush tells the stream that you're done sending data, and anything being buffered should be converted/resampled and made available immediately. (https://wiki.libsdl.org/SDL_AudioStreamFlush)

func (*AudioStream) Free added in v0.4.0

func (stream *AudioStream) Free()

Free frees the audio stream TODO: (https://wiki.libsdl.org/SDL_AudoiStreamFree)

func (*AudioStream) Get added in v0.4.0

func (stream *AudioStream) Get(buf []byte) (n int, err error)

Get gets converted/resampled data from the stream. Returns the number of bytes read from the stream. (https://wiki.libsdl.org/SDL_AudioStreamGet)

func (*AudioStream) Put added in v0.4.0

func (stream *AudioStream) Put(buf []byte) (err error)

Put adds data to be converted/resampled to the stream (https://wiki.libsdl.org/SDL_AudioStreamPut)

type BGR555 added in v0.4.0

type BGR555 struct {
	B, G, R byte
}

func (BGR555) RGBA added in v0.4.0

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

type BGR565 added in v0.4.0

type BGR565 struct {
	B, G, R byte
}

func (BGR565) RGBA added in v0.4.0

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

type BGR888 added in v0.4.36

type BGR888 struct {
	B, G, R byte
}

func (BGR888) RGBA added in v0.4.36

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

type BGRA4444 added in v0.4.0

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

func (BGRA4444) RGBA added in v0.4.0

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

type BGRA5551 added in v0.4.0

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

func (BGRA5551) RGBA added in v0.4.0

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

type BGRA8888 added in v0.4.0

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

func (BGRA8888) RGBA added in v0.4.0

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

type BlendFactor added in v0.4.0

type BlendFactor C.SDL_BlendFactor

BlendFactor is an enumeration of blend factors used when creating a custom blend mode with ComposeCustomBlendMode(). (https://wiki.libsdl.org/SDL_BlendFactor)

const (
	BLENDFACTOR_ZERO                BlendFactor = C.SDL_BLENDFACTOR_ZERO                // 0, 0, 0, 0
	BLENDFACTOR_ONE                 BlendFactor = C.SDL_BLENDFACTOR_ONE                 // 1, 1, 1, 1
	BLENDFACTOR_SRC_COLOR           BlendFactor = C.SDL_BLENDFACTOR_SRC_COLOR           // srcR, srcG, srcB, srcA
	BLENDFACTOR_ONE_MINUS_SRC_COLOR BlendFactor = C.SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR // 1-srcR, 1-srcG, 1-srcB, 1-srcA
	BLENDFACTOR_SRC_ALPHA           BlendFactor = C.SDL_BLENDFACTOR_SRC_ALPHA           // srcA, srcA, srcA, srcA
	BLENDFACTOR_ONE_MINUS_SRC_ALPHA BlendFactor = C.SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA // 1-srcA, 1-srcA, 1-srcA, 1-srcA
	BLENDFACTOR_DST_COLOR           BlendFactor = C.SDL_BLENDFACTOR_DST_COLOR           // dstR, dstG, dstB, dstA
	BLENDFACTOR_ONE_MINUS_DST_COLOR BlendFactor = C.SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR // 1-dstR, 1-dstG, 1-dstB, 1-dstA
	BLENDFACTOR_DST_ALPHA           BlendFactor = C.SDL_BLENDFACTOR_DST_ALPHA           // dstA, dstA, dstA, dstA
	BLENDFACTOR_ONE_MINUS_DST_ALPHA BlendFactor = C.SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA // 1-dstA, 1-dstA, 1-dstA, 1-dstA
)

type BlendMode

type BlendMode uint32

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

const (
	BLENDMODE_NONE    BlendMode = C.SDL_BLENDMODE_NONE  // no blending
	BLENDMODE_BLEND   BlendMode = C.SDL_BLENDMODE_BLEND // alpha blending
	BLENDMODE_ADD     BlendMode = C.SDL_BLENDMODE_ADD   // additive blending
	BLENDMODE_MOD     BlendMode = C.SDL_BLENDMODE_MOD   // color modulate
	BLENDMODE_MUL     BlendMode = C.SDL_BLENDMODE_MUL   // color multiply
	BLENDMODE_INVALID BlendMode = C.SDL_BLENDMODE_INVALID
)

func ComposeCustomBlendMode added in v0.4.0

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

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

dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor

and

dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor

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

type BlendOperation added in v0.4.0

type BlendOperation C.SDL_BlendOperation

BlendOperation is an enumeration of blend operations used when creating a custom blend mode with ComposeCustomBlendMode(). (https://wiki.libsdl.org/SDL_BlendOperation)

const (
	BLENDOPERATION_ADD          BlendOperation = C.SDL_BLENDOPERATION_ADD
	BLENDOPERATION_SUBTRACT     BlendOperation = C.SDL_BLENDOPERATION_SUBTRACT
	BLENDOPERATION_REV_SUBTRACT BlendOperation = C.SDL_BLENDOPERATION_REV_SUBTRACT
	BLENDOPERATION_MINIMUM      BlendOperation = C.SDL_BLENDOPERATION_MINIMUM
	BLENDOPERATION_MAXIMUM      BlendOperation = C.SDL_BLENDOPERATION_MAXIMUM
)

type Button

type Button uint32

Mouse buttons

const (
	ButtonLeft   Button = C.SDL_BUTTON_LEFT   // left mouse button
	ButtonMiddle Button = C.SDL_BUTTON_MIDDLE // middle mouse button
	ButtonRight  Button = C.SDL_BUTTON_RIGHT  // right mouse button
	ButtonX1     Button = C.SDL_BUTTON_X1     // x1 mouse button
	ButtonX2     Button = C.SDL_BUTTON_X2     // x2 mouse button
)

func (Button) Mask

func (b Button) Mask() ButtonMask

type ButtonMask

type ButtonMask uint32

Used as a mask when testing buttons in buttonstate.

const (
	ButtonLMask  ButtonMask = 1 << (ButtonLeft - 1)   // left mouse button mask
	ButtonMMask  ButtonMask = 1 << (ButtonMiddle - 1) // middle mouse button mask
	ButtonRMask  ButtonMask = 1 << (ButtonRight - 1)  // right mouse button mask
	ButtonX1Mask ButtonMask = 1 << (ButtonX1 - 1)     // x1 mouse button mask
	ButtonX2Mask ButtonMask = 1 << (ButtonX2 - 1)     // x2 mouse button mask
)

func GetGlobalMouseState added in v0.4.0

func GetGlobalMouseState() (x, y int32, state ButtonMask)

GetGlobalMouseState returns the current state of the mouse. (https://wiki.libsdl.org/SDL_GetGlobalMouseState)

func GetMouseState

func GetMouseState() (x, y int32, state ButtonMask)

GetMouseState returns the current state of the mouse. (https://wiki.libsdl.org/SDL_GetMouseState)

func GetRelativeMouseState

func GetRelativeMouseState() (x, y int32, state ButtonMask)

GetRelativeMouseState returns the relative state of the mouse. (https://wiki.libsdl.org/SDL_GetRelativeMouseState)

func (ButtonMask) Has

func (m ButtonMask) Has(b Button) bool

type ButtonState

type ButtonState uint8
const (
	RELEASED ButtonState = C.SDL_RELEASED
	PRESSED  ButtonState = C.SDL_PRESSED
)

type CEvent

type CEvent struct {
	Type EventType
	// contains filtered or unexported fields
}

CEvent is a union of all event structures used in SDL. (https://wiki.libsdl.org/SDL_Event)

type ClipboardEvent

type ClipboardEvent struct {
	Type      EventType // CLIPBOARDUPDATE
	Timestamp uint32    // timestamp of the event
}

ClipboardEvent contains clipboard event information. (https://wiki.libsdl.org/SDL_EventType)

func (ClipboardEvent) GetTimestamp added in v0.3.0

func (e ClipboardEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (ClipboardEvent) GetType added in v0.3.0

func (e ClipboardEvent) GetType() EventType

GetType returns the event type.

type CocoaInfo

type CocoaInfo struct {
	Window unsafe.Pointer // the Cocoa window
}

CocoaInfo contains Apple Mac OS X window information.

type Color

type Color color.NRGBA

Color represents a color. This implements image/color.Color interface. (https://wiki.libsdl.org/SDL_Color)

func (Color) Uint32

func (c Color) Uint32() uint32

Uint32 return uint32 representation of RGBA color. NOTE: Don't use this as color for SDL2's rendering operations. For that, please use `sdl.MapRGB()` or `sdl.MapRGBA()`.

type CommonEvent

type CommonEvent struct {
	Type      EventType // the event type
	Timestamp uint32    // timestamp of the event
}

CommonEvent contains common event data. (https://wiki.libsdl.org/SDL_Event)

func (CommonEvent) GetTimestamp added in v0.3.0

func (e CommonEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (CommonEvent) GetType added in v0.3.0

func (e CommonEvent) GetType() EventType

GetType returns the event type.

type Cond

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

Cond is the SDL condition variable structure.

func CreateCond

func CreateCond() *Cond

CreateCond (https://wiki.libsdl.org/SDL_CreateCond)

func (*Cond) Broadcast added in v0.3.0

func (cond *Cond) Broadcast() error

Broadcast restarts all threads that are waiting on the condition variable. (https://wiki.libsdl.org/SDL_CondBroadcast)

func (*Cond) Destroy added in v0.3.0

func (cond *Cond) Destroy()

Destroy creates a condition variable. (https://wiki.libsdl.org/SDL_DestroyCond)

func (*Cond) Signal added in v0.3.0

func (cond *Cond) Signal() error

Signal restarts one of the threads that are waiting on the condition variable. (https://wiki.libsdl.org/SDL_CondSignal)

func (*Cond) Wait added in v0.3.0

func (cond *Cond) Wait(mutex *Mutex) error

Wait waits until a condition variable is signaled. (https://wiki.libsdl.org/SDL_CondWait)

func (*Cond) WaitTimeout added in v0.3.0

func (cond *Cond) WaitTimeout(mutex *Mutex, ms uint32) error

WaitTimeout waits until a condition variable is signaled or a specified amount of time has passed. (https://wiki.libsdl.org/SDL_CondWaitTimeout)

type ControllerAxisEvent

type ControllerAxisEvent struct {
	Type      EventType          // CONTROLLERAXISMOTION
	Timestamp uint32             // the timestamp of the event
	Which     JoystickID         // the joystick instance id
	Axis      GameControllerAxis // the controller axis (https://wiki.libsdl.org/SDL_GameControllerAxis)
	Value     int16              // the axis value (range: -32768 to 32767)
}

ControllerAxisEvent contains game controller axis motion event information. (https://wiki.libsdl.org/SDL_ControllerAxisEvent)

func (ControllerAxisEvent) GetTimestamp added in v0.3.0

func (e ControllerAxisEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (ControllerAxisEvent) GetType added in v0.3.0

func (e ControllerAxisEvent) GetType() EventType

GetType returns the event type.

type ControllerButtonEvent

type ControllerButtonEvent struct {
	Type      EventType            // CONTROLLERBUTTONDOWN, CONTROLLERBUTTONUP
	Timestamp uint32               // the timestamp of the event
	Which     JoystickID           // the joystick instance id
	Button    GameControllerButton // the controller button (https://wiki.libsdl.org/SDL_GameControllerButton)
	State     ButtonState          // PRESSED, RELEASED
}

ControllerButtonEvent contains game controller button event information. (https://wiki.libsdl.org/SDL_ControllerButtonEvent)

func (ControllerButtonEvent) GetTimestamp added in v0.3.0

func (e ControllerButtonEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (ControllerButtonEvent) GetType added in v0.3.0

func (e ControllerButtonEvent) GetType() EventType

GetType returns the event type.

type ControllerDeviceEvent

type ControllerDeviceEvent struct {
	Type      EventType  // CONTROLLERDEVICEADDED, CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED
	Timestamp uint32     // the timestamp of the event
	Which     JoystickID // the joystick device index for the CONTROLLERDEVICEADDED event or instance id for the CONTROLLERDEVICEREMOVED or CONTROLLERDEVICEREMAPPED event
}

ControllerDeviceEvent contains controller device event information. (https://wiki.libsdl.org/SDL_ControllerDeviceEvent)

func (ControllerDeviceEvent) GetTimestamp added in v0.3.0

func (e ControllerDeviceEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (ControllerDeviceEvent) GetType added in v0.3.0

func (e ControllerDeviceEvent) GetType() EventType

GetType returns the event type.

type ControllerSensorEvent

type ControllerSensorEvent struct {
	Type        EventType  // SDL_CONTROLLERSENSORUPDATE
	Timestamp   uint32     // In milliseconds, populated using SDL_GetTicks()
	Which       JoystickID // The joystick instance id
	Sensor      int32      // The type of the sensor, one of the values of SensorType
	Data        [3]float32 // Up to 3 values from the sensor - additional values can be queried using SDL_SensorGetData()
	TimestampUs uint64     // The timestamp of the sensor reading in microseconds, if the hardware provides this information.
}

ControllerSensorEvent contains data from sensors such as accelerometer and gyroscope (TODO: https://wiki.libsdl.org/SDL_ControllerSensorEvent)

func (ControllerSensorEvent) GetTimestamp

func (e ControllerSensorEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (ControllerSensorEvent) GetType

func (e ControllerSensorEvent) GetType() EventType

GetType returns the event type.

type Cursor

type Cursor C.SDL_Cursor

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

func CreateColorCursor

func CreateColorCursor(surface *Surface, hotX, hotY int32) *Cursor

CreateColorCursor creates a color cursor. (https://wiki.libsdl.org/SDL_CreateColorCursor)

func CreateCursor

func CreateCursor(data, mask *uint8, w, h, hotX, hotY int32) *Cursor

CreateCursor creates a cursor using the specified bitmap data and mask (in MSB format). (https://wiki.libsdl.org/SDL_CreateCursor)

func CreateSystemCursor

func CreateSystemCursor(id SystemCursor) *Cursor

CreateSystemCursor creates a system cursor. (https://wiki.libsdl.org/SDL_CreateSystemCursor)

func GetCursor

func GetCursor() *Cursor

GetCursor returns the active cursor. (https://wiki.libsdl.org/SDL_GetCursor)

func GetDefaultCursor

func GetDefaultCursor() *Cursor

GetDefaultCursor returns the default cursor. (https://wiki.libsdl.org/SDL_GetDefaultCursor)

type DFBInfo

type DFBInfo struct {
	Dfb     unsafe.Pointer // the DirectFB main interface
	Window  unsafe.Pointer // the DirectFB window handle
	Surface unsafe.Pointer // the DirectFB client surface
}

DFBInfo contains DirectFB window information.

type DisplayEvent added in v0.4.0

type DisplayEvent struct {
	Type      EventType // the event type
	Timestamp uint32    // timestamp of the event
	Display   uint32    // the associated display index
	Event     uint8     // TODO: (https://wiki.libsdl.org/SDL_DisplayEventID)
	Data1     int32     // event dependent data
}

DisplayEvent contains common event data. (https://wiki.libsdl.org/SDL_Event)

func (DisplayEvent) GetTimestamp added in v0.4.0

func (e DisplayEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (DisplayEvent) GetType added in v0.4.0

func (e DisplayEvent) GetType() EventType

GetType returns the event type.

type DisplayMode

type DisplayMode struct {
	Format      uint32         // one of the PixelFormatEnum values (https://wiki.libsdl.org/SDL_PixelFormatEnum)
	W           int32          // width, in screen coordinates
	H           int32          // height, in screen coordinates
	RefreshRate int32          // refresh rate (in Hz), or 0 for unspecified
	DriverData  unsafe.Pointer // driver-specific data, initialize to 0
}

DisplayMode contains the description of a display mode. (https://wiki.libsdl.org/SDL_DisplayMode)

func GetClosestDisplayMode

func GetClosestDisplayMode(displayIndex int, mode *DisplayMode, closest *DisplayMode) (*DisplayMode, error)

GetClosestDisplayMode returns the closest match to the requested display mode. (https://wiki.libsdl.org/SDL_GetClosestDisplayMode)

func GetCurrentDisplayMode

func GetCurrentDisplayMode(displayIndex int) (mode DisplayMode, err error)

GetCurrentDisplayMode returns information about the current display mode. (https://wiki.libsdl.org/SDL_GetCurrentDisplayMode)

func GetDesktopDisplayMode

func GetDesktopDisplayMode(displayIndex int) (mode DisplayMode, err error)

GetDesktopDisplayMode returns information about the desktop display mode. (https://wiki.libsdl.org/SDL_GetDesktopDisplayMode)

func GetDisplayMode

func GetDisplayMode(displayIndex int, modeIndex int) (mode DisplayMode, err error)

GetDisplayMode returns information about a specific display mode. (https://wiki.libsdl.org/SDL_GetDisplayMode)

type DisplayOrientation

type DisplayOrientation C.SDL_DisplayOrientation
const (
	ORIENTATION_UNKNOWN           DisplayOrientation = C.SDL_ORIENTATION_UNKNOWN           // The display orientation can't be determined
	ORIENTATION_LANDSCAPE         DisplayOrientation = C.SDL_ORIENTATION_LANDSCAPE         // The display is in landscape mode, with the right side up, relative to portrait mode
	ORIENTATION_LANDSCAPE_FLIPPED DisplayOrientation = C.SDL_ORIENTATION_LANDSCAPE_FLIPPED // The display is in landscape mode, with the left side up, relative to portrait mode
	ORIENTATION_PORTRAIT          DisplayOrientation = C.SDL_ORIENTATION_PORTRAIT          // The display is in portrait mode
	ORIENTATION_PORTRAIT_FLIPPED  DisplayOrientation = C.SDL_ORIENTATION_PORTRAIT_FLIPPED  // The display is in portrait mode, upside down
)

func GetDisplayOrientation

func GetDisplayOrientation(displayIndex int) DisplayOrientation

GetDisplayOrientation returns the orientation of a display ((https://wiki.libsdl.org/SDLL_GetDisplayOrientation)

type DollarGestureEvent

type DollarGestureEvent struct {
	Type       EventType // DOLLARGESTURE, DOLLARRECORD
	Timestamp  uint32    // timestamp of the event
	TouchID    TouchID   // the touch device id
	GestureID  GestureID // the unique id of the closest gesture to the performed stroke
	NumFingers uint32    // the number of fingers used to draw the stroke
	Error      float32   // the difference between the gesture template and the actual performed gesture (lower error is a better match)
	X          float32   // the normalized center of gesture
	Y          float32   // the normalized center of gesture
}

DollarGestureEvent contains complex gesture event information. (https://wiki.libsdl.org/SDL_DollarGestureEvent)

func (DollarGestureEvent) GetTimestamp added in v0.3.0

func (e DollarGestureEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (DollarGestureEvent) GetType added in v0.3.0

func (e DollarGestureEvent) GetType() EventType

GetType returns the event type.

type DropEvent

type DropEvent struct {
	Type      EventType // DROPFILE, DROPTEXT, DROPBEGIN, DROPCOMPLETE
	Timestamp uint32    // timestamp of the event
	File      string    // the file name
	WindowID  uint32    // the window that was dropped on, if any
}

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

func (DropEvent) GetTimestamp added in v0.3.0

func (e DropEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (DropEvent) GetType added in v0.3.0

func (e DropEvent) GetType() EventType

GetType returns the event type.

type ErrorCode

type ErrorCode uint32

ErrorCode is an error code used in SDL error messages.

const (
	ENOMEM      ErrorCode = C.SDL_ENOMEM      // out of memory
	EFREAD      ErrorCode = C.SDL_EFREAD      // error reading from datastream
	EFWRITE     ErrorCode = C.SDL_EFWRITE     // error writing to datastream
	EFSEEK      ErrorCode = C.SDL_EFSEEK      // error seeking in datastream
	UNSUPPORTED ErrorCode = C.SDL_UNSUPPORTED // that operation is not supported
	LASTERROR   ErrorCode = C.SDL_LASTERROR   // the highest numbered predefined error
)

SDL error codes with their corresponding predefined strings.

type Event

type Event interface {
	GetType() EventType   // GetType returns the event type
	GetTimestamp() uint32 // GetTimestamp returns the timestamp of the event
}

Event is a union of all event structures used in SDL. (https://wiki.libsdl.org/SDL_Event)

func PollEvent

func PollEvent() Event

PollEvent polls for currently pending events. (https://wiki.libsdl.org/SDL_PollEvent)

func WaitEvent

func WaitEvent() Event

WaitEvent waits indefinitely for the next available event. (https://wiki.libsdl.org/SDL_WaitEvent)

func WaitEventTimeout

func WaitEventTimeout(timeout int) Event

WaitEventTimeout waits until the specified timeout (in milliseconds) for the next available event. (https://wiki.libsdl.org/SDL_WaitEventTimeout)

type EventAction

type EventAction C.SDL_eventaction

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

const (
	ADDEVENT  EventAction = C.SDL_ADDEVENT  // up to numevents events will be added to the back of the event queue
	PEEKEVENT EventAction = C.SDL_PEEKEVENT // up to numevents 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
	GETEVENT  EventAction = C.SDL_GETEVENT  // up to numevents 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
)

type EventFilter

type EventFilter interface {
	FilterEvent(e Event, userdata interface{}) bool
}

EventFilter is the function to call when an event happens. (https://wiki.libsdl.org/SDL_SetEventFilter)

func GetEventFilter

func GetEventFilter() EventFilter

GetEventFilter queries the current event filter. (https://wiki.libsdl.org/SDL_GetEventFilter)

type EventStateConstant

type EventStateConstant int

Toggles for different event state functions. (https://wiki.libsdl.org/SDL_EventState)

type EventType

type EventType uint32

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

const (
	FIRSTEVENT EventType = C.SDL_FIRSTEVENT // do not remove (unused)

	// Application events
	QUIT EventType = C.SDL_QUIT // user-requested quit

	// Android, iOS and WinRT events
	APP_TERMINATING         EventType = C.SDL_APP_TERMINATING         // OS is terminating the application
	APP_LOWMEMORY           EventType = C.SDL_APP_LOWMEMORY           // OS is low on memory; free some
	APP_WILLENTERBACKGROUND EventType = C.SDL_APP_WILLENTERBACKGROUND // application is entering background
	APP_DIDENTERBACKGROUND  EventType = C.SDL_APP_DIDENTERBACKGROUND  //application entered background
	APP_WILLENTERFOREGROUND EventType = C.SDL_APP_WILLENTERFOREGROUND // application is entering foreground
	APP_DIDENTERFOREGROUND  EventType = C.SDL_APP_DIDENTERFOREGROUND  // application entered foreground

	// Display events
	DISPLAYEVENT EventType = C.SDL_DISPLAYEVENT // Display state change

	// Window events
	WINDOWEVENT EventType = C.SDL_WINDOWEVENT // window state change
	SYSWMEVENT  EventType = C.SDL_SYSWMEVENT  // system specific event

	// Keyboard events
	KEYDOWN         EventType = C.SDL_KEYDOWN         // key pressed
	KEYUP           EventType = C.SDL_KEYUP           // key released
	TEXTEDITING     EventType = C.SDL_TEXTEDITING     // keyboard text editing (composition)
	TEXTINPUT       EventType = C.SDL_TEXTINPUT       // keyboard text input
	TEXTEDITING_EXT EventType = C.SDL_TEXTEDITING_EXT // keyboard text editing (composition)
	KEYMAPCHANGED   EventType = C.SDL_KEYMAPCHANGED   // keymap changed due to a system event such as an input language or keyboard layout change (>= SDL 2.0.4)

	// Mouse events
	MOUSEMOTION     EventType = C.SDL_MOUSEMOTION     // mouse moved
	MOUSEBUTTONDOWN EventType = C.SDL_MOUSEBUTTONDOWN // mouse button pressed
	MOUSEBUTTONUP   EventType = C.SDL_MOUSEBUTTONUP   // mouse button released
	MOUSEWHEEL      EventType = C.SDL_MOUSEWHEEL      // mouse wheel motion

	// Joystick events
	JOYAXISMOTION     EventType = C.SDL_JOYAXISMOTION     // joystick axis motion
	JOYBALLMOTION     EventType = C.SDL_JOYBALLMOTION     // joystick trackball motion
	JOYHATMOTION      EventType = C.SDL_JOYHATMOTION      // joystick hat position change
	JOYBUTTONDOWN     EventType = C.SDL_JOYBUTTONDOWN     // joystick button pressed
	JOYBUTTONUP       EventType = C.SDL_JOYBUTTONUP       // joystick button released
	JOYDEVICEADDED    EventType = C.SDL_JOYDEVICEADDED    // joystick connected
	JOYDEVICEREMOVED  EventType = C.SDL_JOYDEVICEREMOVED  // joystick disconnected
	JOYBATTERYUPDATED EventType = C.SDL_JOYBATTERYUPDATED // joystick battery level change

	// Game controller events
	CONTROLLERAXISMOTION     EventType = C.SDL_CONTROLLERAXISMOTION     // controller axis motion
	CONTROLLERBUTTONDOWN     EventType = C.SDL_CONTROLLERBUTTONDOWN     // controller button pressed
	CONTROLLERBUTTONUP       EventType = C.SDL_CONTROLLERBUTTONUP       // controller button released
	CONTROLLERDEVICEADDED    EventType = C.SDL_CONTROLLERDEVICEADDED    // controller connected
	CONTROLLERDEVICEREMOVED  EventType = C.SDL_CONTROLLERDEVICEREMOVED  // controller disconnected
	CONTROLLERDEVICEREMAPPED EventType = C.SDL_CONTROLLERDEVICEREMAPPED // controller mapping updated
	CONTROLLERTOUCHPADDOWN   EventType = C.SDL_CONTROLLERTOUCHPADDOWN   // Game controller touchpad was touched
	CONTROLLERTOUCHPADMOTION EventType = C.SDL_CONTROLLERTOUCHPADMOTION // Game controller touchpad finger was moved
	CONTROLLERTOUCHPADUP     EventType = C.SDL_CONTROLLERTOUCHPADUP     // Game controller touchpad finger was lifted
	CONTROLLERSENSORUPDATE   EventType = C.SDL_CONTROLLERSENSORUPDATE   // Game controller sensor was updated

	// Touch events
	FINGERDOWN   EventType = C.SDL_FINGERDOWN   // user has touched input device
	FINGERUP     EventType = C.SDL_FINGERUP     // user stopped touching input device
	FINGERMOTION EventType = C.SDL_FINGERMOTION // user is dragging finger on input device

	// Gesture events
	DOLLARGESTURE EventType = C.SDL_DOLLARGESTURE
	DOLLARRECORD  EventType = C.SDL_DOLLARRECORD
	MULTIGESTURE  EventType = C.SDL_MULTIGESTURE

	// Clipboard events
	CLIPBOARDUPDATE EventType = C.SDL_CLIPBOARDUPDATE // the clipboard changed

	// Drag and drop events
	DROPFILE     EventType = C.SDL_DROPFILE     // the system requests a file open
	DROPTEXT     EventType = C.SDL_DROPTEXT     // text/plain drag-and-drop event
	DROPBEGIN    EventType = C.SDL_DROPBEGIN    // a new set of drops is beginning (NULL filename)
	DROPCOMPLETE EventType = C.SDL_DROPCOMPLETE // current set of drops is now complete (NULL filename)

	// Audio hotplug events
	AUDIODEVICEADDED   EventType = C.SDL_AUDIODEVICEADDED   // a new audio device is available (>= SDL 2.0.4)
	AUDIODEVICEREMOVED EventType = C.SDL_AUDIODEVICEREMOVED // an audio device has been removed (>= SDL 2.0.4)

	// Sensor events
	SENSORUPDATE EventType = C.SDL_SENSORUPDATE // a sensor was updated

	// Render events
	RENDER_TARGETS_RESET EventType = C.SDL_RENDER_TARGETS_RESET // the render targets have been reset and their contents need to be updated (>= SDL 2.0.2)
	RENDER_DEVICE_RESET  EventType = C.SDL_RENDER_DEVICE_RESET  // the device has been reset and all textures need to be recreated (>= SDL 2.0.4)

	// These are for your use, and should be allocated with RegisterEvents()
	USEREVENT EventType = C.SDL_USEREVENT // a user-specified event
	LASTEVENT EventType = C.SDL_LASTEVENT // (only for bounding internal arrays)
)

type EventWatchHandle

type EventWatchHandle uintptr

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

func AddEventWatch

func AddEventWatch(filter EventFilter, userdata interface{}) EventWatchHandle

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

func AddEventWatchFunc

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

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

type FPoint added in v0.4.0

type FPoint struct {
	X float32 // the x coordinate of the point
	Y float32 // the y coordinate of the point
}

FPoint defines a two dimensional point. (https://wiki.libsdl.org/SDL_FPoint)

func (*FPoint) InRect added in v0.4.0

func (p *FPoint) InRect(r *FRect) bool

InRect reports whether the point resides inside a rectangle. (https://wiki.libsdl.org/SDL_PointInRect)

type FRect added in v0.4.0

type FRect struct {
	X float32 // the x location of the rectangle's upper left corner
	Y float32 // the y location of the rectangle's upper left corner
	W float32 // the width of the rectangle
	H float32 // the height of the rectangle
}

FRect contains the definition of a rectangle, with the origin at the upper left. (https://wiki.libsdl.org/SDL_FRect)

func EncloseFPoints added in v0.4.24

func EncloseFPoints(points []FPoint, clip *FRect) (result FRect, enclosed bool)

EncloseFPoints calculates a minimal rectangle that encloses a set of points with float precision. (https://wiki.libsdl.org/SDL_EncloseFPoints)

func (*FRect) Empty added in v0.4.0

func (a *FRect) Empty() bool

Empty reports whether a rectangle has no area. (https://wiki.libsdl.org/SDL_RectEmpty)

func (*FRect) Equals added in v0.4.0

func (a *FRect) Equals(b *FRect) bool

Equals reports whether two rectangles are equal. (https://wiki.libsdl.org/SDL_RectEquals)

func (*FRect) EqualsEpsilon added in v0.4.24

func (a *FRect) EqualsEpsilon(b *FRect, epsilon float32) bool

EqualsEpsilon returns true if the two rectangles are equal, within some given epsilon. (https://wiki.libsdl.org/SDL_FRectEqualsEpsilon)

func (*FRect) HasIntersection added in v0.4.0

func (a *FRect) HasIntersection(b *FRect) bool

HasIntersection reports whether two rectangles intersect. (https://wiki.libsdl.org/SDL_HasIntersection)

func (*FRect) Intersect added in v0.4.0

func (a *FRect) Intersect(b *FRect) (FRect, bool)

Intersect calculates the intersection of two rectangles. (https://wiki.libsdl.org/SDL_IntersectRect)

func (*FRect) IntersectLine added in v0.4.24

func (a *FRect) IntersectLine(X1, Y1, X2, Y2 *float32) bool

IntersectLine calculates the intersection of a rectangle and a line segment. (https://wiki.libsdl.org/SDL_IntersectFRectAndLine)

func (*FRect) Union added in v0.4.0

func (a *FRect) Union(b *FRect) FRect

Union calculates the union of two rectangles. (https://wiki.libsdl.org/SDL_UnionRect)

type Finger

type Finger struct {
	ID       FingerID // the finger id
	X        float32  // the x-axis location of the touch event, normalized (0...1)
	Y        float32  // the y-axis location of the touch event, normalized (0...1)
	Pressure float32  // the quantity of pressure applied, normalized (0...1)
}

Finger contains touch information.

func GetTouchFinger

func GetTouchFinger(t TouchID, index int) *Finger

GetTouchFinger returns the finger object for specified touch device ID and finger index. (https://wiki.libsdl.org/SDL_GetTouchFinger)

type FingerID

type FingerID C.SDL_FingerID

FingerID is a finger id.

type FlashOperation added in v0.4.11

type FlashOperation C.SDL_FlashOperation
const (
	FLASH_CANCEL        FlashOperation = C.SDL_FLASH_CANCEL        // Cancel any window flash state
	FLASH_BRIEFLY       FlashOperation = C.SDL_FLASH_BRIEFLY       // Flash the window briefly to get attention
	FLASH_UNTIL_FOCUSED FlashOperation = C.SDL_FLASH_UNTIL_FOCUSED // Flash the window until it gets focus
)

Window flash operation

type GLContext

type GLContext C.SDL_GLContext

GLContext is an opaque handle to an OpenGL context.

type GLattr

type GLattr C.SDL_GLattr

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

const (
	GL_RED_SIZE                   GLattr = C.SDL_GL_RED_SIZE                   // the minimum number of bits for the red channel of the color buffer; defaults to 3
	GL_GREEN_SIZE                 GLattr = C.SDL_GL_GREEN_SIZE                 // the minimum number of bits for the green channel of the color buffer; defaults to 3
	GL_BLUE_SIZE                  GLattr = C.SDL_GL_BLUE_SIZE                  // the minimum number of bits for the blue channel of the color buffer; defaults to 2
	GL_ALPHA_SIZE                 GLattr = C.SDL_GL_ALPHA_SIZE                 // the minimum number of bits for the alpha channel of the color buffer; defaults to 0
	GL_BUFFER_SIZE                GLattr = C.SDL_GL_BUFFER_SIZE                // the minimum number of bits for frame buffer size; defaults to 0
	GL_DOUBLEBUFFER               GLattr = C.SDL_GL_DOUBLEBUFFER               // whether the output is single or double buffered; defaults to double buffering on
	GL_DEPTH_SIZE                 GLattr = C.SDL_GL_DEPTH_SIZE                 // the minimum number of bits in the depth buffer; defaults to 16
	GL_STENCIL_SIZE               GLattr = C.SDL_GL_STENCIL_SIZE               // the minimum number of bits in the stencil buffer; defaults to 0
	GL_ACCUM_RED_SIZE             GLattr = C.SDL_GL_ACCUM_RED_SIZE             // the minimum number of bits for the red channel of the accumulation buffer; defaults to 0
	GL_ACCUM_GREEN_SIZE           GLattr = C.SDL_GL_ACCUM_GREEN_SIZE           // the minimum number of bits for the green channel of the accumulation buffer; defaults to 0
	GL_ACCUM_BLUE_SIZE            GLattr = C.SDL_GL_ACCUM_BLUE_SIZE            // the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0
	GL_ACCUM_ALPHA_SIZE           GLattr = C.SDL_GL_ALPHA_SIZE                 // the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0
	GL_STEREO                     GLattr = C.SDL_GL_STEREO                     // whether the output is stereo 3D; defaults to off
	GL_MULTISAMPLEBUFFERS         GLattr = C.SDL_GL_MULTISAMPLEBUFFERS         // the number of buffers used for multisample anti-aliasing; defaults to 0; see Remarks for details
	GL_MULTISAMPLESAMPLES         GLattr = C.SDL_GL_MULTISAMPLESAMPLES         // the number of samples used around the current pixel used for multisample anti-aliasing; defaults to 0; see Remarks for details
	GL_ACCELERATED_VISUAL         GLattr = C.SDL_GL_ACCELERATED_VISUAL         // set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either
	GL_RETAINED_BACKING           GLattr = C.SDL_GL_RETAINED_BACKING           // not used (deprecated)
	GL_CONTEXT_MAJOR_VERSION      GLattr = C.SDL_GL_CONTEXT_MAJOR_VERSION      // OpenGL context major version
	GL_CONTEXT_MINOR_VERSION      GLattr = C.SDL_GL_CONTEXT_MINOR_VERSION      // OpenGL context minor version
	GL_CONTEXT_EGL                GLattr = C.SDL_GL_CONTEXT_EGL                // not used (deprecated)
	GL_CONTEXT_FLAGS              GLattr = C.SDL_GL_CONTEXT_FLAGS              // some combination of 0 or more of elements of the GLcontextFlag enumeration; defaults to 0 (https://wiki.libsdl.org/SDL_GLcontextFlag)
	GL_CONTEXT_PROFILE_MASK       GLattr = C.SDL_GL_CONTEXT_PROFILE_MASK       // type of GL context (Core, Compatibility, ES); default value depends on platform (https://wiki.libsdl.org/SDL_GLprofile)
	GL_SHARE_WITH_CURRENT_CONTEXT GLattr = C.SDL_GL_SHARE_WITH_CURRENT_CONTEXT // OpenGL context sharing; defaults to 0
	GL_FRAMEBUFFER_SRGB_CAPABLE   GLattr = C.SDL_GL_FRAMEBUFFER_SRGB_CAPABLE   // requests sRGB capable visual; defaults to 0 (>= SDL 2.0.1)
	GL_CONTEXT_RELEASE_BEHAVIOR   GLattr = C.SDL_GL_CONTEXT_RELEASE_BEHAVIOR   // sets context the release behavior; defaults to 1 (>= SDL 2.0.4)
	GL_CONTEXT_RESET_NOTIFICATION GLattr = C.SDL_GL_CONTEXT_RESET_NOTIFICATION // (>= SDL 2.0.6)
	GL_CONTEXT_NO_ERROR           GLattr = C.SDL_GL_CONTEXT_NO_ERROR           // (>= SDL 2.0.6)
	GL_FLOATBUFFERS               GLattr = C.SDL_GL_FLOATBUFFERS               // (>= SDL 2.24.0)
)

type GUID added in v0.4.26

type GUID C.SDL_GUID

func GUIDFromString added in v0.4.26

func GUIDFromString(ascii string) (guid GUID)

GUIDFromString converts a GUID string into a GUID structure.

func (GUID) ToString added in v0.4.26

func (guid GUID) ToString() (ascii string)

ToString returns an ASCII string representation for a given GUID.

type GameController

type GameController C.SDL_GameController

GameController used to identify an SDL game controller.

func GameControllerFromInstanceID added in v0.3.0

func GameControllerFromInstanceID(joyid JoystickID) *GameController

GameControllerFromInstanceID returns the GameController associated with an instance id. (https://wiki.libsdl.org/SDL_GameControllerFromInstanceID)

func GameControllerFromPlayerIndex

func GameControllerFromPlayerIndex(playerIndex int) *GameController

GameControllerFromPlayerIndex returns associated with a player index. (https://wiki.libsdl.org/SDL_GameControllerFromPlayerIndex)

func GameControllerOpen

func GameControllerOpen(index int) *GameController

GameControllerOpen opens a gamecontroller for use. (https://wiki.libsdl.org/SDL_GameControllerOpen)

func (*GameController) Attached added in v0.3.0

func (ctrl *GameController) Attached() bool

Attached reports whether a controller has been opened and is currently connected. (https://wiki.libsdl.org/SDL_GameControllerGetAttached)

func (*GameController) Axis added in v0.3.0

func (ctrl *GameController) Axis(axis GameControllerAxis) int16

Axis returns the current state of an axis control on a game controller. (https://wiki.libsdl.org/SDL_GameControllerGetAxis)

func (*GameController) BindForAxis added in v0.3.0

BindForAxis returns the SDL joystick layer binding for a controller button mapping. (https://wiki.libsdl.org/SDL_GameControllerGetBindForAxis)

func (*GameController) BindForButton added in v0.3.0

BindForButton returns the SDL joystick layer binding for this controller button mapping. (https://wiki.libsdl.org/SDL_GameControllerGetBindForButton)

func (*GameController) Button added in v0.3.0

func (ctrl *GameController) Button(btn GameControllerButton) byte

Button returns the current state of a button on a game controller. (https://wiki.libsdl.org/SDL_GameControllerGetButton)

func (*GameController) Close

func (ctrl *GameController) Close()

Close closes a game controller previously opened with GameControllerOpen(). (https://wiki.libsdl.org/SDL_GameControllerClose)

func (*GameController) FirmwareVersion

func (ctrl *GameController) FirmwareVersion() uint16

FirmwareVersion returns the firmware version of an opened controller, if available. (https://wiki.libsdl.org/SDL_GameControllerGetFirmwareVersion)

func (*GameController) GetAppleSFSymbolsNameForButton added in v0.4.11

func (ctrl *GameController) GetAppleSFSymbolsNameForButton(button GameControllerButton) (sfSymbolsName string)

GetAppleSFSymbolsNameForButton returns the sfSymbolsName for a given button on a game controller on Apple platforms. (https://wiki.libsdl.org/SDL_GameControllerGetAppleSFSymbolsNameForButton)

func (*GameController) GetSensorData

func (ctrl *GameController) GetSensorData(typ SensorType, data []float32) (err error)

GameControllerGetSensorData gets the current state of a game controller sensor.

The number of values and interpretation of the data is sensor dependent. (https://wiki.libsdl.org/SDL_GameControllerGetSensorData)

func (*GameController) GetSensorDataRate

func (ctrl *GameController) GetSensorDataRate(typ SensorType) (rate float32)

GetSensorDataRate gets the data rate (number of events per second) of a game controller sensor. (https://wiki.libsdl.org/SDL_GameControllerGetSensorDataRate)

func (*GameController) GetSensorDataWithTimestamp

func (ctrl *GameController) GetSensorDataWithTimestamp(typ SensorType, timestamp *uint64, data []float32) (err error)

GameeControllerGetSensorDataWithTimestamp gets current state of a game controller sensor with the timestamp of the last update.

The number of values and interpretation of the data is sensor dependent. (https://wiki.libsdl.org/SDL_GameControllerGetSensorDataWithTimestamp)

func (*GameController) HasAxis

func (ctrl *GameController) HasAxis(axis GameControllerAxis) bool

HasAxis returns whether a game controller has a given axis. (https://wiki.libsdl.org/SDL_GameControllerHasAxis)

func (*GameController) HasButton

func (ctrl *GameController) HasButton(btn GameControllerButton) bool

HasButton returns whether a game controller has a given button. (https://wiki.libsdl.org/SDL_GameControllerHasButton)

func (*GameController) HasLED

func (ctrl *GameController) HasLED() bool

HasLED returns whether a controller has an LED. (https://wiki.libsdl.org/SDL_GameControllerHasLED)

func (*GameController) HasRumble added in v0.4.11

func (ctrl *GameController) HasRumble() bool

HasRumble queries whether a game controller has rumble support. (https://wiki.libsdl.org/SDL_GameControllerHasRumble)

func (*GameController) HasRumbleTriggers added in v0.4.11

func (ctrl *GameController) HasRumbleTriggers() bool

HasRumbleTriggers queries whether a game controller has rumble support on triggers. (https://wiki.libsdl.org/SDL_GameControllerHasRumbleTriggers)

func (*GameController) HasSensor

func (ctrl *GameController) HasSensor(typ SensorType) bool

HasSensor returns whether a game controller has a particular sensor. (https://wiki.libsdl.org/SDL_GameControllerHasSensor)

func (*GameController) IsSensorEnabled

func (ctrl *GameController) IsSensorEnabled(typ SensorType) bool

IsSensorEnabled queries whether sensor data reporting is enabled for a game controller. (https://wiki.libsdl.org/SDL_GameControllerIsSensorEnabled)

func (*GameController) Joystick added in v0.3.0

func (ctrl *GameController) Joystick() *Joystick

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

func (*GameController) Mapping added in v0.3.0

func (ctrl *GameController) Mapping() string

Mapping returns the current mapping of a Game Controller. (https://wiki.libsdl.org/SDL_GameControllerMapping)

func (*GameController) Name

func (ctrl *GameController) Name() string

Name returns the implementation dependent name for an opened game controller. (https://wiki.libsdl.org/SDL_GameControllerName)

func (*GameController) NumTouchpadFingers

func (ctrl *GameController) NumTouchpadFingers(touchpad int) int

NumTouchpadFingers returns the number of supported simultaneous fingers on a touchpad on a game controller. (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpadFingers)

func (*GameController) NumTouchpads

func (ctrl *GameController) NumTouchpads() int

NumTouchpads returns the number of touchpads on a game controller. (https://wiki.libsdl.org/SDL_GameControllerGetNumTouchpads)

func (*GameController) Path

func (ctrl *GameController) Path() string

Path returns the implementation dependent path of an opened game controller. (https://wiki.libsdl.org/SDL_GameControllerPath)

func (*GameController) PlayerIndex added in v0.4.0

func (ctrl *GameController) PlayerIndex() int

PlayerIndex the player index of an opened game controller, or -1 if it's not available. (https://wiki.libsdl.org/SDL_GameControllerGetPlayerIndex)

func (*GameController) Product added in v0.3.0

func (ctrl *GameController) Product() int

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

func (*GameController) ProductVersion added in v0.3.0

func (ctrl *GameController) ProductVersion() int

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

func (*GameController) Rumble added in v0.4.0

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

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

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

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

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

func (*GameController) RumbleTriggers

func (ctrl *GameController) RumbleTriggers(leftRumble, rightRumble uint16, durationMS uint32) error

RumbleTriggers starts a rumble effect in the game controller's triggers. (https://wiki.libsdl.org/SDL_GameControllerRumbleTriggers)

func (*GameController) SDL_GameControllerGetAppleSFSymbolsNameForAxis added in v0.4.11

func (ctrl *GameController) SDL_GameControllerGetAppleSFSymbolsNameForAxis(axis GameControllerAxis) (sfSymbolsName string)

GetAppleSFSymbolsNameForAxis returns the sfSymbolsName for a given axis on a game controller on Apple platforms. (https://wiki.libsdl.org/SDL_GameControllerGetAppleSFSymbolsNameForAxis)

func (*GameController) SendEffect added in v0.4.11

func (ctrl *GameController) SendEffect(data []byte) (err error)

SendEffect sends a controller specific effect packet. (https://wiki.libsdl.org/SDL_GameControllerSendEffect)

func (*GameController) SensorData

func (ctrl *GameController) SensorData(typ SensorType, numValues int) (data []float32, err error)

SensorData returns the current state of a game controller sensor. (https://wiki.libsdl.org/SDL_GameControllerGetSensorData)

func (*GameController) Serial

func (ctrl *GameController) Serial() string

Serial returns the serial number of an opened controller, if available. (https://wiki.libsdl.org/SDL_GameControllerGetSerial)

func (*GameController) SetLED

func (ctrl *GameController) SetLED(red, green, blue uint8) error

SetLED updates a controller's LED color. (https://wiki.libsdl.org/SDL_GameControllerSetLED)

func (*GameController) SetPlayerIndex

func (ctrl *GameController) SetPlayerIndex(playerIndex int)

SetPlayerIndex sets the player index of an opened game controller. (https://wiki.libsdl.org/SDL_GameControllerSetPlayerIndex)

func (*GameController) SetSensorEnabled

func (ctrl *GameController) SetSensorEnabled(typ SensorType, enabled bool) error

SetSensorEnabled sets whether data reporting for a game controller sensor is enabled. (https://wiki.libsdl.org/SDL_GameControllerSetSensorEnabled)

func (*GameController) TouchpadFinger

func (ctrl *GameController) TouchpadFinger(touchpad, finger int) (state uint8, x, y, pressure float32)

TouchpadFinger returns the current state of a finger on a touchpad on a game controller. (https://wiki.libsdl.org/SDL_GameControllerGetTouchpadFinger)

func (*GameController) Type

func (ctrl *GameController) Type() GameControllerType

Type returns the type of this currently opened controller TODO: (https://wiki.libsdl.org/SDL_GameControllerType)

func (*GameController) Vendor added in v0.3.0

func (ctrl *GameController) Vendor() int

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

type GameControllerAxis

type GameControllerAxis C.SDL_GameControllerAxis

An enumeration of axes available from a controller. GameControllerAxis is an axis on a game controller. (https://wiki.libsdl.org/SDL_GameControllerAxis)

func GameControllerGetAxisFromString

func GameControllerGetAxisFromString(pchString string) GameControllerAxis

GameControllerGetAxisFromString converts a string into an enum representation for a GameControllerAxis. (https://wiki.libsdl.org/SDL_GameControllerGetAxisFromString)

type GameControllerBindType

type GameControllerBindType C.SDL_GameControllerBindType

Types of game controller inputs. GameControllerBindType is a type of game controller input.

type GameControllerButton

type GameControllerButton C.SDL_GameControllerButton

An enumeration of buttons available from a controller. GameControllerButton is a button on a game controller. (https://wiki.libsdl.org/SDL_GameControllerButton)

func GameControllerGetButtonFromString

func GameControllerGetButtonFromString(pchString string) GameControllerButton

GameControllerGetButtonFromString turns a string into a button mapping. (https://wiki.libsdl.org/SDL_GameControllerGetButtonFromString)

type GameControllerButtonBind

type GameControllerButtonBind C.SDL_GameControllerButtonBind

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

func (*GameControllerButtonBind) Axis

func (bind *GameControllerButtonBind) Axis() int

Axis returns axis mapped for this SDL joystick layer binding.

func (*GameControllerButtonBind) Button

func (bind *GameControllerButtonBind) Button() int

Button returns button mapped for this SDL joystick layer binding.

func (*GameControllerButtonBind) Hat

func (bind *GameControllerButtonBind) Hat() int

Hat returns hat mapped for this SDL joystick layer binding.

func (*GameControllerButtonBind) HatMask

func (bind *GameControllerButtonBind) HatMask() int

HatMask returns hat mask for this SDL joystick layer binding.

func (*GameControllerButtonBind) Type

func (bind *GameControllerButtonBind) Type() int

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

type GameControllerType

type GameControllerType C.SDL_GameControllerType

The gamecontroller structure used to identify an SDL game controller

func GameControllerTypeForIndex

func GameControllerTypeForIndex(index int) GameControllerType

GameControllerTypeForIndex the type of a game controller. (https://wiki.libsdl.org/SDL_GameControllerTypeForIndex)

type GestureID

type GestureID C.SDL_GestureID

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

type HIDDevice added in v0.4.11

type HIDDevice C.SDL_hid_device

func HIDOpen added in v0.4.11

func HIDOpen(vendorID, productID uint16, _serialNumber *C.wchar_t) (device *HIDDevice)

HIDOpen opens a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number. (https://wiki.libsdl.org/SDL_hid_open)

func HIDOpenPath added in v0.4.11

func HIDOpenPath(path string, exclusive bool) (device *HIDDevice)

HIDOpenPath opens a HID device by its path name. (https://wiki.libsdl.org/SDL_hid_open_path)

func (*HIDDevice) Close added in v0.4.11

func (device *HIDDevice) Close()

Close closes a HID device. (https://wiki.libsdl.org/SDL_hid_close)

func (*HIDDevice) GetFeatureReport added in v0.4.11

func (device *HIDDevice) GetFeatureReport(data []byte) (n int, err error)

GetFeatureReport gets a feature report from a HID device. (https://wiki.libsdl.org/SDL_hid_get_feature_report)

func (*HIDDevice) GetIndexedString added in v0.4.11

func (device *HIDDevice) GetIndexedString(index int, _str *C.wchar_t, _maxlen C.size_t) (err error)

GetIndexedString gets a string from a HID device, based on its string index. (https://wiki.libsdl.org/SDL_hid_get_indexed_string)

func (*HIDDevice) GetManufacturerString added in v0.4.11

func (device *HIDDevice) GetManufacturerString(_str *C.wchar_t, _maxlen C.size_t) (err error)

GetManufacturerString gets The Manufacturer String from a HID device. (https://wiki.libsdl.org/SDL_hid_get_manufacturer_string)

func (*HIDDevice) GetProductString added in v0.4.11

func (device *HIDDevice) GetProductString(_str *C.wchar_t, _maxlen C.size_t) (err error)

GetProductString gets The Product String from a HID device. (https://wiki.libsdl.org/SDL_hid_get_product_string)

func (*HIDDevice) GetSerialNumberString added in v0.4.11

func (device *HIDDevice) GetSerialNumberString(_str *C.wchar_t, _maxlen C.size_t) (err error)

GetSerialNumberString gets The SerialNumber String from a HID device. (https://wiki.libsdl.org/SDL_hid_get_serial_number_string)

func (*HIDDevice) HIDBLEScan added in v0.4.11

func (device *HIDDevice) HIDBLEScan(active bool)

HIDBLEScan starts or stops a BLE scan on iOS and tvOS to pair Steam Controllers. (https://wiki.libsdl.org/SDL_hid_ble_scan)

func (*HIDDevice) Read added in v0.4.11

func (device *HIDDevice) Read(data []byte) (n int, err error)

Read an Input report from a HID device. (https://wiki.libsdl.org/SDL_hid_read)

func (*HIDDevice) ReadTimeout added in v0.4.11

func (device *HIDDevice) ReadTimeout(data []byte, milliseconds int) (n int, err error)

ReadTimeout reads an Input report from a HID device with timeout. (https://wiki.libsdl.org/SDL_hid_read_timeout)

func (*HIDDevice) SendFeatureReport added in v0.4.11

func (device *HIDDevice) SendFeatureReport(data []byte) (n int, err error)

SendFeatureReport sends a Feature report to the device. (https://wiki.libsdl.org/SDL_hid_send_feature_report)

func (*HIDDevice) SetNonBlocking added in v0.4.11

func (device *HIDDevice) SetNonBlocking(nonblock bool) (err error)

SetNonBlocking sets the device handle to be non-blocking. (https://wiki.libsdl.org/SDL_hid_set_nonblocking)

func (*HIDDevice) Write added in v0.4.11

func (device *HIDDevice) Write(data []byte) (n int, err error)

Write writes an Output report to a HID device. (https://wiki.libsdl.org/SDL_hid_write)

type HIDDeviceInfo added in v0.4.11

type HIDDeviceInfo struct {
	VendorID           uint16
	ProductID          uint16
	SerialNumber       *C.wchar_t
	ReleaseNumber      uint16
	ManufacturerString *C.wchar_t
	ProductString      *C.wchar_t
	UsagePage          uint16
	Usage              uint16
	InterfaceNumber    int32
	InterfaceClass     int32
	InterfaceSubclass  int32
	InterfaceProtocol  int32
	// contains filtered or unexported fields
}

func HIDEnumerate added in v0.4.11

func HIDEnumerate(vendorID, productID uint16) (info *HIDDeviceInfo)

HIDEnumerate enumerates the HID devices. (https://wiki.libsdl.org/SDL_hid_enumerate)

func (*HIDDeviceInfo) Path added in v0.4.11

func (info *HIDDeviceInfo) Path() string

type Haptic

type Haptic C.SDL_Haptic

Haptic identifies an SDL haptic. (https://wiki.libsdl.org/CategoryForceFeedback)

func HapticOpen

func HapticOpen(index int) (*Haptic, error)

HapticOpen opens a haptic device for use. (https://wiki.libsdl.org/SDL_HapticOpen)

func HapticOpenFromJoystick

func HapticOpenFromJoystick(joy *Joystick) (*Haptic, error)

HapticOpenFromJoystick opens a haptic device for use from a joystick device. (https://wiki.libsdl.org/SDL_HapticOpenFromJoystick)

func HapticOpenFromMouse

func HapticOpenFromMouse() (*Haptic, error)

HapticOpenFromMouse open a haptic device from the current mouse. (https://wiki.libsdl.org/SDL_HapticOpenFromMouse)

func (*Haptic) Close

func (h *Haptic) Close()

Close closes a haptic device previously opened with HapticOpen(). (https://wiki.libsdl.org/SDL_HapticClose)

func (*Haptic) DestroyEffect

func (h *Haptic) DestroyEffect(effect int)

DestroyEffect destroys a haptic effect on the device. (https://wiki.libsdl.org/SDL_HapticDestroyEffect)

func (*Haptic) EffectSupported

func (h *Haptic) EffectSupported(he HapticEffect) (bool, error)

EffectSupported reports whether an effect is supported by a haptic device. Pass pointer to a Haptic struct (Constant|Periodic|Condition|Ramp|LeftRight|Custom) instead of HapticEffect union. (https://wiki.libsdl.org/SDL_HapticEffectSupported)

func (*Haptic) GetEffectStatus

func (h *Haptic) GetEffectStatus(effect int) (int, error)

GetEffectStatus returns the status of the current effect on the specified haptic device. (https://wiki.libsdl.org/SDL_HapticGetEffectStatus)

func (*Haptic) NewEffect

func (h *Haptic) NewEffect(he HapticEffect) (int, error)

NewEffect creates a new haptic effect on a specified device. Pass pointer to a Haptic struct (Constant|Periodic|Condition|Ramp|LeftRight|Custom) instead of HapticEffect union. (https://wiki.libsdl.org/SDL_HapticNewEffect)

func (*Haptic) NumAxes

func (h *Haptic) NumAxes() (int, error)

NumAxes returns the number of haptic axes the device has. (https://wiki.libsdl.org/SDL_HapticNumAxes)

func (*Haptic) NumEffects

func (h *Haptic) NumEffects() (int, error)

NumEffects returns the number of effects a haptic device can store. (https://wiki.libsdl.org/SDL_HapticNumEffects)

func (*Haptic) NumEffectsPlaying

func (h *Haptic) NumEffectsPlaying() (int, error)

NumEffectsPlaying returns the number of effects a haptic device can play at the same time. (https://wiki.libsdl.org/SDL_HapticNumEffectsPlaying)

func (*Haptic) Pause

func (h *Haptic) Pause() error

Pause pauses a haptic device. (https://wiki.libsdl.org/SDL_HapticPause)

func (*Haptic) Query

func (h *Haptic) Query() (uint32, error)

Query returns haptic device's supported features in bitwise manner. (https://wiki.libsdl.org/SDL_HapticQuery)

func (*Haptic) RumbleInit

func (h *Haptic) RumbleInit() error

RumbleInit initializes the haptic device for simple rumble playback. (https://wiki.libsdl.org/SDL_HapticRumbleInit)

func (*Haptic) RumblePlay

func (h *Haptic) RumblePlay(strength float32, length uint32) error

RumblePlay runs a simple rumble effect on a haptic device. (https://wiki.libsdl.org/SDL_HapticRumblePlay)

func (*Haptic) RumbleStop

func (h *Haptic) RumbleStop() error

RumbleStop stops the simple rumble on a haptic device. (https://wiki.libsdl.org/SDL_HapticRumbleStop)

func (*Haptic) RumbleSupported

func (h *Haptic) RumbleSupported() (bool, error)

RumbleSupported reports whether rumble is supported on a haptic device. (https://wiki.libsdl.org/SDL_HapticRumbleSupported)

func (*Haptic) RunEffect

func (h *Haptic) RunEffect(effect int, iterations uint32) error

RunEffect runs the haptic effect on its associated haptic device. (https://wiki.libsdl.org/SDL_HapticRunEffect)

func (*Haptic) SetAutocenter

func (h *Haptic) SetAutocenter(autocenter int) error

SetAutocenter sets the global autocenter of the device. (https://wiki.libsdl.org/SDL_HapticSetAutocenter)

func (*Haptic) SetGain

func (h *Haptic) SetGain(gain int) error

SetGain sets the global gain of the specified haptic device. (https://wiki.libsdl.org/SDL_HapticSetGain)

func (*Haptic) StopAll

func (h *Haptic) StopAll() error

StopAll stops all the currently playing effects on a haptic device. (https://wiki.libsdl.org/SDL_HapticStopAll)

func (*Haptic) StopEffect

func (h *Haptic) StopEffect(effect int) error

StopEffect stops the haptic effect on its associated haptic device. (https://wiki.libsdl.org/SDL_HapticStopEffect)

func (*Haptic) Unpause

func (h *Haptic) Unpause() error

Unpause unpauses a haptic device. (https://wiki.libsdl.org/SDL_HapticUnpause)

func (*Haptic) UpdateEffect

func (h *Haptic) UpdateEffect(effect int, data HapticEffect) error

UpdateEffect updates the properties of an effect. Pass pointer to a Haptic struct (Constant|Periodic|Condition|Ramp|LeftRight|Custom) instead of HapticEffect union. (https://wiki.libsdl.org/SDL_HapticUpdateEffect)

type HapticCondition

type HapticCondition struct {
	Type       uint16          // HAPTIC_SPRING, HAPTIC_DAMPER, HAPTIC_INERTIA, HAPTIC_FRICTION
	Direction  HapticDirection // direction of the effect - not used at the moment
	Length     uint32          // duration of the effect
	Delay      uint16          // delay before starting the effect
	Button     uint16          // button that triggers the effect
	Interval   uint16          // how soon it can be triggered again after button
	RightSat   [3]uint16       // level when joystick is to the positive side; max 0xFFFF
	LeftSat    [3]uint16       // level when joystick is to the negative side; max 0xFFFF
	RightCoeff [3]int16        // how fast to increase the force towards the positive side
	LeftCoeff  [3]int16        // how fast to increase the force towards the negative side
	Deadband   [3]uint16       // size of the dead zone; max 0xFFFF: whole axis-range when 0-centered
	Center     [3]int16        // position of the dead zone
}

HapticCondition contains a template for a condition effect. (https://wiki.libsdl.org/SDL_HapticCondition)

type HapticConstant

type HapticConstant struct {
	Type         uint16          // HAPTIC_CONSTANT
	Direction    HapticDirection // direction of the effect
	Length       uint32          // duration of the effect
	Delay        uint16          // delay before starting the effect
	Button       uint16          // button that triggers the effect
	Interval     uint16          // how soon it can be triggered again after button
	Level        int16           // strength of the constant effect
	AttackLength uint16          // duration of the attack
	AttackLevel  uint16          // level at the start of the attack
	FadeLength   uint16          // duration of the fade
	FadeLevel    uint16          // level at the end of the fade
}

HapticConstant contains a template for a constant effect. (https://wiki.libsdl.org/SDL_HapticConstant)

type HapticCustom

type HapticCustom struct {
	Type         uint16          // SDL_HAPTIC_CUSTOM
	Direction    HapticDirection // direction of the effect
	Length       uint32          // duration of the effect
	Delay        uint16          // delay before starting the effect
	Button       uint16          // button that triggers the effect
	Interval     uint16          // how soon it can be triggered again after button
	Channels     uint8           // axes to use, minimum of 1
	Period       uint16          // sample periods
	Samples      uint16          // amount of samples
	Data         *uint16         // should contain channels*samples items
	AttackLength uint16          // duration of the attack
	AttackLevel  uint16          // level at the start of the attack
	FadeLength   uint16          // duration of the fade
	FadeLevel    uint16          // level at the end of the fade
}

HapticCustom contains a template for a custom effect. (https://wiki.libsdl.org/SDL_HapticCustom)

type HapticDirection

type HapticDirection struct {
	Type byte     // the type of encoding
	Dir  [3]int32 // the encoded direction
}

HapticDirection contains a haptic direction. (https://wiki.libsdl.org/SDL_HapticDirection)

type HapticEffect

type HapticEffect interface {
	// contains filtered or unexported methods
}

HapticEffect union that contains the generic template for any haptic effect. (https://wiki.libsdl.org/SDL_HapticEffect)

type HapticLeftRight

type HapticLeftRight struct {
	Type           uint16 // HAPTIC_LEFTRIGHT
	Length         uint32 // duration of the effect
	LargeMagnitude uint16 // control of the large controller motor
	SmallMagnitude uint16 // control of the small controller motor
}

HapticLeftRight contains a template for a left/right effect. (https://wiki.libsdl.org/SDL_HapticLeftRight)

type HapticPeriodic

type HapticPeriodic struct {
	Type         uint16          // HAPTIC_SINE, HAPTIC_LEFTRIGHT, HAPTIC_TRIANGLE, HAPTIC_SAWTOOTHUP, HAPTIC_SAWTOOTHDOWN
	Direction    HapticDirection // direction of the effect
	Length       uint32          // duration of the effect
	Delay        uint16          // delay before starting the effect
	Button       uint16          // button that triggers the effect
	Interval     uint16          // how soon it can be triggered again after button
	Period       uint16          // period of the wave
	Magnitude    int16           // peak value; if negative, equivalent to 180 degrees extra phase shift
	Offset       int16           // mean value of the wave
	Phase        uint16          // positive phase shift given by hundredth of a degree
	AttackLength uint16          // duration of the attack
	AttackLevel  uint16          // level at the start of the attack
	FadeLength   uint16          // duration of the fade
	FadeLevel    uint16          // level at the end of the fade
}

HapticPeriodic contains a template for a periodic effect. (https://wiki.libsdl.org/SDL_HapticPeriodic)

type HapticRamp

type HapticRamp struct {
	Type         uint16          // HAPTIC_RAMP
	Direction    HapticDirection // direction of the effect
	Length       uint32          // duration of the effect
	Delay        uint16          // delay before starting the effect
	Button       uint16          // button that triggers the effect
	Interval     uint16          // how soon it can be triggered again after button
	Start        int16           // beginning strength level
	End          int16           // ending strength level
	AttackLength uint16          // duration of the attack
	AttackLevel  uint16          // level at the start of the attack
	FadeLength   uint16          // duration of the fade
	FadeLevel    uint16          // level at the end of the fade
}

HapticRamp contains a template for a ramp effect. (https://wiki.libsdl.org/SDL_HapticRamp)

type HintCallback added in v0.2.0

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

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

type HintCallbackAndData added in v0.2.0

type HintCallbackAndData struct {
	// contains filtered or unexported fields
}

HintCallbackAndData contains a callback function and userdata.

type HintPriority

type HintPriority C.SDL_HintPriority

An enumeration of hint priorities. HintPriority is a hint priority used in SetHintWithPriority(). (https://wiki.libsdl.org/SDL_HintPriority)

const (
	HINT_DEFAULT  HintPriority = C.SDL_HINT_DEFAULT  // low priority, used for default values
	HINT_NORMAL   HintPriority = C.SDL_HINT_NORMAL   // medium priority
	HINT_OVERRIDE HintPriority = C.SDL_HINT_OVERRIDE // high priority
)

type JoyAxisEvent

type JoyAxisEvent struct {
	Type      EventType  // JOYAXISMOTION
	Timestamp uint32     // timestamp of the event
	Which     JoystickID // the instance id of the joystick that reported the event
	Axis      uint8      // the index of the axis that changed
	Value     int16      // the current position of the axis (range: -32768 to 32767)
}

JoyAxisEvent contains joystick axis motion event information. (https://wiki.libsdl.org/SDL_JoyAxisEvent)

func (JoyAxisEvent) GetTimestamp added in v0.3.0

func (e JoyAxisEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (JoyAxisEvent) GetType added in v0.3.0

func (e JoyAxisEvent) GetType() EventType

GetType returns the event type.

type JoyBallEvent

type JoyBallEvent struct {
	Type      EventType  // JOYBALLMOTION
	Timestamp uint32     // timestamp of the event
	Which     JoystickID // the instance id of the joystick that reported the event
	Ball      uint8      // the index of the trackball that changed
	XRel      int16      // the relative motion in the X direction
	YRel      int16      // the relative motion in the Y direction
}

JoyBallEvent contains joystick trackball motion event information. (https://wiki.libsdl.org/SDL_JoyBallEvent)

func (JoyBallEvent) GetTimestamp added in v0.3.0

func (e JoyBallEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (JoyBallEvent) GetType added in v0.3.0

func (e JoyBallEvent) GetType() EventType

GetType returns the event type.

type JoyBatteryEvent

type JoyBatteryEvent struct {
	Type      EventType          // JOYBATTERYUPDATED
	Timestamp uint32             // timestamp of the event
	Which     JoystickID         // the instance id of the joystick that reported the event
	Level     JoystickPowerLevel // the joystick battery level
}

JoyBatteryEvent contains joystick button event information. (https://wiki.libsdl.org/SDL_JoyBatteryEvent)

func (JoyBatteryEvent) GetTimestamp

func (e JoyBatteryEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (JoyBatteryEvent) GetType

func (e JoyBatteryEvent) GetType() EventType

GetType returns the event type.

type JoyButtonEvent

type JoyButtonEvent struct {
	Type      EventType   // JOYBUTTONDOWN, JOYBUTTONUP
	Timestamp uint32      // timestamp of the event
	Which     JoystickID  // the instance id of the joystick that reported the event
	Button    uint8       // the index of the button that changed
	State     ButtonState // PRESSED, RELEASED
}

JoyButtonEvent contains joystick button event information. (https://wiki.libsdl.org/SDL_JoyButtonEvent)

func (JoyButtonEvent) GetTimestamp added in v0.3.0

func (e JoyButtonEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (JoyButtonEvent) GetType added in v0.3.0

func (e JoyButtonEvent) GetType() EventType

GetType returns the event type.

type JoyDeviceAddedEvent added in v0.3.0

type JoyDeviceAddedEvent struct {
	Type      EventType  // JOYDEVICEADDED
	Timestamp uint32     // the timestamp of the event
	Which     JoystickID // the joystick device index
}

JoyDeviceAddedEvent contains joystick device event information. (https://wiki.libsdl.org/SDL_JoyDeviceEvent)

func (JoyDeviceAddedEvent) GetTimestamp added in v0.3.0

func (e JoyDeviceAddedEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (JoyDeviceAddedEvent) GetType added in v0.3.0

func (e JoyDeviceAddedEvent) GetType() EventType

GetType returns the event type.

type JoyDeviceRemovedEvent added in v0.3.0

type JoyDeviceRemovedEvent struct {
	Type      EventType  // JOYDEVICEREMOVED
	Timestamp uint32     // the timestamp of the event
	Which     JoystickID // the instance id
}

JoyDeviceRemovedEvent contains joystick device event information. (https://wiki.libsdl.org/SDL_JoyDeviceEvent)

func (JoyDeviceRemovedEvent) GetTimestamp added in v0.3.0

func (e JoyDeviceRemovedEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (JoyDeviceRemovedEvent) GetType added in v0.3.0

func (e JoyDeviceRemovedEvent) GetType() EventType

GetType returns the event type.

type JoyHatEvent

type JoyHatEvent struct {
	Type      EventType   // JOYHATMOTION
	Timestamp uint32      // timestamp of the event
	Which     JoystickID  // the instance id of the joystick that reported the event
	Hat       uint8       // the index of the hat that changed
	Value     JoystickHat // HAT_LEFTUP, HAT_UP, HAT_RIGHTUP, HAT_LEFT, HAT_CENTERED, HAT_RIGHT, HAT_LEFTDOWN, HAT_DOWN, HAT_RIGHTDOWN
}

JoyHatEvent contains joystick hat position change event information. (https://wiki.libsdl.org/SDL_JoyHatEvent)

func (JoyHatEvent) GetTimestamp added in v0.3.0

func (e JoyHatEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (JoyHatEvent) GetType added in v0.3.0

func (e JoyHatEvent) GetType() EventType

GetType returns the event type.

type Joystick

type Joystick C.SDL_Joystick

Joystick is an SDL joystick.

func JoystickFromInstanceID added in v0.3.0

func JoystickFromInstanceID(joyid JoystickID) *Joystick

JoystickFromInstanceID returns the Joystick associated with an instance id. (https://wiki.libsdl.org/SDL_JoystickFromInstanceID)

func JoystickFromPlayerIndex

func JoystickFromPlayerIndex(playerIndex int) *Joystick

JoystickFromPlayerIndex returns the Joystick associated with a player index. (https://wiki.libsdl.org/SDL_JoystickFromPlayerIndex)

func JoystickOpen

func JoystickOpen(index int) *Joystick

JoystickOpen opens a joystick for use. (https://wiki.libsdl.org/SDL_JoystickOpen)

func (*Joystick) Attached added in v0.3.0

func (joy *Joystick) Attached() bool

Attached returns the status of a specified joystick. (https://wiki.libsdl.org/SDL_JoystickGetAttached)

func (*Joystick) Axis added in v0.3.0

func (joy *Joystick) Axis(axis int) int16

Axis returns the current state of an axis control on a joystick. (https://wiki.libsdl.org/SDL_JoystickGetAxis)

func (*Joystick) AxisInitialState added in v0.3.0

func (joy *Joystick) AxisInitialState(axis int) (state int16, ok bool)

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

func (*Joystick) Ball added in v0.3.0

func (joy *Joystick) Ball(ball int, dx, dy *int32) int

Ball returns the ball axis change since the last poll. (https://wiki.libsdl.org/SDL_JoystickGetBall)

func (*Joystick) Button added in v0.3.0

func (joy *Joystick) Button(button int) byte

Button the current state of a button on a joystick. (https://wiki.libsdl.org/SDL_JoystickGetButton)

func (*Joystick) Close

func (joy *Joystick) Close()

Close closes a joystick previously opened with JoystickOpen(). (https://wiki.libsdl.org/SDL_JoystickClose)

func (*Joystick) CurrentPowerLevel added in v0.3.0

func (joy *Joystick) CurrentPowerLevel() JoystickPowerLevel

CurrentPowerLevel returns the battery level of a joystick as JoystickPowerLevel. (https://wiki.libsdl.org/SDL_JoystickCurrentPowerLevel)

func (*Joystick) FirmwareVersion

func (joy *Joystick) FirmwareVersion() uint16

FirmwareVersion returns the firmware version of an opened joystick, if available. (https://wiki.libsdl.org/SDL_JoystickGetFirmwareVersion)

func (*Joystick) GUID added in v0.3.0

func (joy *Joystick) GUID() JoystickGUID

GUID returns the implementation-dependent GUID for the joystick. (https://wiki.libsdl.org/SDL_JoystickGetGUID)

func (*Joystick) HasLED

func (joy *Joystick) HasLED() bool

HasLED returns whether a joystick has an LED. (https://wiki.libsdl.org/SDL_JoystickHasLED)

func (*Joystick) HasRumble added in v0.4.11

func (ctrl *Joystick) HasRumble() bool

HasRumble queries whether a game controller has rumble support. (https://wiki.libsdl.org/SDL_JoystickHasRumble)

func (*Joystick) HasRumbleTriggers added in v0.4.11

func (ctrl *Joystick) HasRumbleTriggers() bool

HasRumbleTriggers queries whether a game controller has rumble support on triggers. (https://wiki.libsdl.org/SDL_JoystickHasRumbleTriggers)

func (*Joystick) Hat added in v0.3.0

func (joy *Joystick) Hat(hat JoystickHat) byte

Hat returns the current state of a POV hat on a joystick. (https://wiki.libsdl.org/SDL_JoystickGetHat)

func (*Joystick) InstanceID

func (joy *Joystick) InstanceID() JoystickID

InstanceID returns the instance ID of an opened joystick. (https://wiki.libsdl.org/SDL_JoystickInstanceID)

func (*Joystick) Name

func (joy *Joystick) Name() string

Name returns the implementation dependent name of a joystick. (https://wiki.libsdl.org/SDL_JoystickName)

func (*Joystick) NumAxes

func (joy *Joystick) NumAxes() int

NumAxes returns the number of general axis controls on a joystick. (https://wiki.libsdl.org/SDL_JoystickNumAxes)

func (*Joystick) NumBalls

func (joy *Joystick) NumBalls() int

NumBalls returns the number of trackballs on a joystick. (https://wiki.libsdl.org/SDL_JoystickNumBalls)

func (*Joystick) NumButtons

func (joy *Joystick) NumButtons() int

NumButtons returns the number of buttons on a joystick. (https://wiki.libsdl.org/SDL_JoystickNumButtons)

func (*Joystick) NumHats

func (joy *Joystick) NumHats() int

NumHats returns the number of POV hats on a joystick. (https://wiki.libsdl.org/SDL_JoystickNumHats)

func (*Joystick) Path

func (joy *Joystick) Path() string

Path returns the implementation dependent path of a joystick. (https://wiki.libsdl.org/SDL_JoystickPath)

func (*Joystick) PlayerIndex added in v0.4.0

func (joy *Joystick) PlayerIndex() int

PlayerIndex returns the player index of an opened joystick, or -1 if it's not available. (https://wiki.libsdl.org/SDL_JoystickGetPlayerIndex)

func (*Joystick) Product added in v0.3.0

func (joy *Joystick) Product() int

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

func (*Joystick) ProductVersion added in v0.3.0

func (joy *Joystick) ProductVersion() int

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

func (*Joystick) Rumble added in v0.4.0

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

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

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

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

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

func (*Joystick) RumbleTriggers

func (joy *Joystick) RumbleTriggers(leftRumble, rightRumble uint16, durationMS uint32) error

RumbleTriggers starts a rumble effect in the joystick's triggers. (https://wiki.libsdl.org/SDL_JoystickRumbleTriggers)

func (*Joystick) Serial

func (joy *Joystick) Serial() string

Serial returns the serial number of an opened joystick, if available. (https://wiki.libsdl.org/SDL_JoystickGetSerial)

func (*Joystick) SetLED

func (joy *Joystick) SetLED(red, green, blue uint8) error

SetLED updates a joystick's LED color. (https://wiki.libsdl.org/SDL_JoystickSetLED)

func (*Joystick) SetPlayerIndex

func (joy *Joystick) SetPlayerIndex(playerIndex int)

SetPlayerIndex returns set the player index of an opened joystick. (https://wiki.libsdl.org/SDL_JoystickSetPlayerIndex)

func (*Joystick) SetVirtualAxis

func (joy *Joystick) SetVirtualAxis(axis int, value int16) error

SetVirtualAxis sets axis value on an opened, virtual-joystick's controls. Please note that values set here will not be applied until the next call to SDL_JoystickUpdate, which can either be called directly, or can be called indirectly through various other SDL APIS, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.. (https://wiki.libsdl.org/SDL_JoystickSetVirtualAxis)

func (*Joystick) SetVirtualButton

func (joy *Joystick) SetVirtualButton(button int, value uint8) error

SetVirtualButton sets button value on an opened, virtual-joystick's controls. Please note that values set here will not be applied until the next call to SDL_JoystickUpdate, which can either be called directly, or can be called indirectly through various other SDL APIS, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.. (https://wiki.libsdl.org/SDL_JoystickSetVirtualButton)

func (*Joystick) SetVirtualHat

func (joy *Joystick) SetVirtualHat(hat int, value uint8) error

SetVirtualHat sets hat value on an opened, virtual-joystick's controls. Please note that values set here will not be applied until the next call to SDL_JoystickUpdate, which can either be called directly, or can be called indirectly through various other SDL APIS, including, but not limited to the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout, SDL_WaitEvent.. (https://wiki.libsdl.org/SDL_JoystickSetVirtualHat)

func (*Joystick) Type added in v0.3.0

func (joy *Joystick) Type() JoystickType

Type returns the the type of an opened joystick.

func (*Joystick) Vendor added in v0.3.0

func (joy *Joystick) Vendor() int

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

type JoystickGUID

type JoystickGUID C.SDL_JoystickGUID

JoystickGUID is a stable unique id for a joystick device.

func JoystickGetDeviceGUID

func JoystickGetDeviceGUID(index int) JoystickGUID

JoystickGetDeviceGUID returns the implementation dependent GUID for the joystick at a given device index. (https://wiki.libsdl.org/SDL_JoystickGetDeviceGUID)

func JoystickGetGUIDFromString

func JoystickGetGUIDFromString(pchGUID string) JoystickGUID

JoystickGetGUIDFromString converts a GUID string into a JoystickGUID structure. (https://wiki.libsdl.org/SDL_JoystickGetGUIDFromString)

func (JoystickGUID) GetInfo

func (guid JoystickGUID) GetInfo() (vendor, product, version, crc16 uint16)

GetInfo returns the device information encoded in a JoystickGUID structure. (https://wiki.libsdl.org/SDL_GetJoystickGUIDInfo)

type JoystickHat

type JoystickHat int

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

type JoystickID

type JoystickID C.SDL_JoystickID

JoystickID is joystick's instance id.

func JoystickGetDeviceInstanceID added in v0.3.0

func JoystickGetDeviceInstanceID(index int) JoystickID

JoystickGetDeviceInstanceID returns the instance ID of a joystick.

type JoystickPowerLevel added in v0.3.0

type JoystickPowerLevel C.SDL_JoystickPowerLevel

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

type JoystickType added in v0.3.0

type JoystickType C.SDL_JoystickType

Types of a joystick.

const (
	JOYSTICK_TYPE_UNKNOWN        JoystickType = C.SDL_JOYSTICK_TYPE_UNKNOWN
	JOYSTICK_TYPE_GAMECONTROLLER JoystickType = C.SDL_JOYSTICK_TYPE_GAMECONTROLLER
	JOYSTICK_TYPE_WHEEL          JoystickType = C.SDL_JOYSTICK_TYPE_WHEEL
	JOYSTICK_TYPE_ARCADE_STICK   JoystickType = C.SDL_JOYSTICK_TYPE_ARCADE_STICK
	JOYSTICK_TYPE_FLIGHT_STICK   JoystickType = C.SDL_JOYSTICK_TYPE_FLIGHT_STICK
	JOYSTICK_TYPE_DANCE_PAD      JoystickType = C.SDL_JOYSTICK_TYPE_DANCE_PAD
	JOYSTICK_TYPE_GUITAR         JoystickType = C.SDL_JOYSTICK_TYPE_GUITAR
	JOYSTICK_TYPE_DRUM_KIT       JoystickType = C.SDL_JOYSTICK_TYPE_DRUM_KIT
	JOYSTICK_TYPE_ARCADE_PAD     JoystickType = C.SDL_JOYSTICK_TYPE_ARCADE_PAD
	JOYSTICK_TYPE_THROTTLE       JoystickType = C.SDL_JOYSTICK_TYPE_THROTTLE
)

func JoystickGetDeviceType added in v0.3.0

func JoystickGetDeviceType(index int) JoystickType

JoystickGetDeviceType returns the type of a joystick.

type KeyboardEvent added in v0.3.0

type KeyboardEvent struct {
	Type      EventType   // KEYDOWN, KEYUP
	Timestamp uint32      // timestamp of the event
	WindowID  uint32      // the window with keyboard focus, if any
	State     ButtonState // PRESSED, RELEASED
	Repeat    uint8       // non-zero if this is a key repeat
	Keysym    Keysym      // Keysym representing the key that was pressed or released
}

KeyboardEvent contains keyboard key down event information. (https://wiki.libsdl.org/SDL_KeyboardEvent)

func (KeyboardEvent) GetTimestamp added in v0.3.0

func (e KeyboardEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (KeyboardEvent) GetType added in v0.3.0

func (e KeyboardEvent) GetType() EventType

GetType returns the event type.

type Keycode

type Keycode C.SDL_Keycode

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

const (
	K_UNKNOWN Keycode = C.SDLK_UNKNOWN // "" (no name, empty string)

	K_RETURN     Keycode = C.SDLK_RETURN     // "Return" (the Enter key (main keyboard))
	K_ESCAPE     Keycode = C.SDLK_ESCAPE     // "Escape" (the Esc key)
	K_BACKSPACE  Keycode = C.SDLK_BACKSPACE  // "Backspace"
	K_TAB        Keycode = C.SDLK_TAB        // "Tab" (the Tab key)
	K_SPACE      Keycode = C.SDLK_SPACE      // "Space" (the Space Bar key(s))
	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          // "0"
	K_1          Keycode = C.SDLK_1          // "1"
	K_2          Keycode = C.SDLK_2          // "2"
	K_3          Keycode = C.SDLK_3          // "3"
	K_4          Keycode = C.SDLK_4          // "4"
	K_5          Keycode = C.SDLK_5          // "5"
	K_6          Keycode = C.SDLK_6          // "6"
	K_7          Keycode = C.SDLK_7          // "7"
	K_8          Keycode = C.SDLK_8          // "8"
	K_9          Keycode = C.SDLK_9          // "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         // "@"
	/*
	   Skip uppercase letters
	*/
	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            // "A"
	K_b            Keycode = C.SDLK_b            // "B"
	K_c            Keycode = C.SDLK_c            // "C"
	K_d            Keycode = C.SDLK_d            // "D"
	K_e            Keycode = C.SDLK_e            // "E"
	K_f            Keycode = C.SDLK_f            // "F"
	K_g            Keycode = C.SDLK_g            // "G"
	K_h            Keycode = C.SDLK_h            // "H"
	K_i            Keycode = C.SDLK_i            // "I"
	K_j            Keycode = C.SDLK_j            // "J"
	K_k            Keycode = C.SDLK_k            // "K"
	K_l            Keycode = C.SDLK_l            // "L"
	K_m            Keycode = C.SDLK_m            // "M"
	K_n            Keycode = C.SDLK_n            // "N"
	K_o            Keycode = C.SDLK_o            // "O"
	K_p            Keycode = C.SDLK_p            // "P"
	K_q            Keycode = C.SDLK_q            // "Q"
	K_r            Keycode = C.SDLK_r            // "R"
	K_s            Keycode = C.SDLK_s            // "S"
	K_t            Keycode = C.SDLK_t            // "T"
	K_u            Keycode = C.SDLK_u            // "U"
	K_v            Keycode = C.SDLK_v            // "V"
	K_w            Keycode = C.SDLK_w            // "W"
	K_x            Keycode = C.SDLK_x            // "X"
	K_y            Keycode = C.SDLK_y            // "Y"
	K_z            Keycode = C.SDLK_z            // "Z"

	K_CAPSLOCK Keycode = C.SDLK_CAPSLOCK // "CapsLock"

	K_F1  Keycode = C.SDLK_F1  // "F1"
	K_F2  Keycode = C.SDLK_F2  // "F2"
	K_F3  Keycode = C.SDLK_F3  // "F3"
	K_F4  Keycode = C.SDLK_F4  // "F4"
	K_F5  Keycode = C.SDLK_F5  // "F5"
	K_F6  Keycode = C.SDLK_F6  // "F6"
	K_F7  Keycode = C.SDLK_F7  // "F7"
	K_F8  Keycode = C.SDLK_F8  // "F8"
	K_F9  Keycode = C.SDLK_F9  // "F9"
	K_F10 Keycode = C.SDLK_F10 // "F10"
	K_F11 Keycode = C.SDLK_F11 // "F11"
	K_F12 Keycode = C.SDLK_F12 // "F12"

	K_PRINTSCREEN Keycode = C.SDLK_PRINTSCREEN // "PrintScreen"
	K_SCROLLLOCK  Keycode = C.SDLK_SCROLLLOCK  // "ScrollLock"
	K_PAUSE       Keycode = C.SDLK_PAUSE       // "Pause" (the Pause / Break key)
	K_INSERT      Keycode = C.SDLK_INSERT      // "Insert" (insert on PC, help on some Mac keyboards (but does send code 73, not 117))
	K_HOME        Keycode = C.SDLK_HOME        // "Home"
	K_PAGEUP      Keycode = C.SDLK_PAGEUP      // "PageUp"
	K_DELETE      Keycode = C.SDLK_DELETE      // "Delete"
	K_END         Keycode = C.SDLK_END         // "End"
	K_PAGEDOWN    Keycode = C.SDLK_PAGEDOWN    // "PageDown"
	K_RIGHT       Keycode = C.SDLK_RIGHT       // "Right" (the Right arrow key (navigation keypad))
	K_LEFT        Keycode = C.SDLK_LEFT        // "Left" (the Left arrow key (navigation keypad))
	K_DOWN        Keycode = C.SDLK_DOWN        // "Down" (the Down arrow key (navigation keypad))
	K_UP          Keycode = C.SDLK_UP          // "Up" (the Up arrow key (navigation keypad))

	K_NUMLOCKCLEAR Keycode = C.SDLK_NUMLOCKCLEAR // "Numlock" (the Num Lock key (PC) / the Clear key (Mac))
	K_KP_DIVIDE    Keycode = C.SDLK_KP_DIVIDE    // "Keypad /" (the / key (numeric keypad))
	K_KP_MULTIPLY  Keycode = C.SDLK_KP_MULTIPLY  // "Keypad *" (the * key (numeric keypad))
	K_KP_MINUS     Keycode = C.SDLK_KP_MINUS     // "Keypad -" (the - key (numeric keypad))
	K_KP_PLUS      Keycode = C.SDLK_KP_PLUS      // "Keypad +" (the + key (numeric keypad))
	K_KP_ENTER     Keycode = C.SDLK_KP_ENTER     // "Keypad Enter" (the Enter key (numeric keypad))
	K_KP_1         Keycode = C.SDLK_KP_1         // "Keypad 1" (the 1 key (numeric keypad))
	K_KP_2         Keycode = C.SDLK_KP_2         // "Keypad 2" (the 2 key (numeric keypad))
	K_KP_3         Keycode = C.SDLK_KP_3         // "Keypad 3" (the 3 key (numeric keypad))
	K_KP_4         Keycode = C.SDLK_KP_4         // "Keypad 4" (the 4 key (numeric keypad))
	K_KP_5         Keycode = C.SDLK_KP_5         // "Keypad 5" (the 5 key (numeric keypad))
	K_KP_6         Keycode = C.SDLK_KP_6         // "Keypad 6" (the 6 key (numeric keypad))
	K_KP_7         Keycode = C.SDLK_KP_7         // "Keypad 7" (the 7 key (numeric keypad))
	K_KP_8         Keycode = C.SDLK_KP_8         // "Keypad 8" (the 8 key (numeric keypad))
	K_KP_9         Keycode = C.SDLK_KP_9         // "Keypad 9" (the 9 key (numeric keypad))
	K_KP_0         Keycode = C.SDLK_KP_0         // "Keypad 0" (the 0 key (numeric keypad))
	K_KP_PERIOD    Keycode = C.SDLK_KP_PERIOD    // "Keypad ." (the . key (numeric keypad))

	K_APPLICATION    Keycode = C.SDLK_APPLICATION    // "Application" (the Application / Compose / Context Menu (Windows) key)
	K_POWER          Keycode = C.SDLK_POWER          // "Power" (The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key.)
	K_KP_EQUALS      Keycode = C.SDLK_KP_EQUALS      // "Keypad =" (the = key (numeric keypad))
	K_F13            Keycode = C.SDLK_F13            // "F13"
	K_F14            Keycode = C.SDLK_F14            // "F14"
	K_F15            Keycode = C.SDLK_F15            // "F15"
	K_F16            Keycode = C.SDLK_F16            // "F16"
	K_F17            Keycode = C.SDLK_F17            // "F17"
	K_F18            Keycode = C.SDLK_F18            // "F18"
	K_F19            Keycode = C.SDLK_F19            // "F19"
	K_F20            Keycode = C.SDLK_F20            // "F20"
	K_F21            Keycode = C.SDLK_F21            // "F21"
	K_F22            Keycode = C.SDLK_F22            // "F22"
	K_F23            Keycode = C.SDLK_F23            // "F23"
	K_F24            Keycode = C.SDLK_F24            // "F24"
	K_EXECUTE        Keycode = C.SDLK_EXECUTE        // "Execute"
	K_HELP           Keycode = C.SDLK_HELP           // "Help"
	K_MENU           Keycode = C.SDLK_MENU           // "Menu"
	K_SELECT         Keycode = C.SDLK_SELECT         // "Select"
	K_STOP           Keycode = C.SDLK_STOP           // "Stop"
	K_AGAIN          Keycode = C.SDLK_AGAIN          // "Again" (the Again key (Redo))
	K_UNDO           Keycode = C.SDLK_UNDO           // "Undo"
	K_CUT            Keycode = C.SDLK_CUT            // "Cut"
	K_COPY           Keycode = C.SDLK_COPY           // "Copy"
	K_PASTE          Keycode = C.SDLK_PASTE          // "Paste"
	K_FIND           Keycode = C.SDLK_FIND           // "Find"
	K_MUTE           Keycode = C.SDLK_MUTE           // "Mute"
	K_VOLUMEUP       Keycode = C.SDLK_VOLUMEUP       // "VolumeUp"
	K_VOLUMEDOWN     Keycode = C.SDLK_VOLUMEDOWN     // "VolumeDown"
	K_KP_COMMA       Keycode = C.SDLK_KP_COMMA       // "Keypad ," (the Comma key (numeric keypad))
	K_KP_EQUALSAS400 Keycode = C.SDLK_KP_EQUALSAS400 // "Keypad = (AS400)" (the Equals AS400 key (numeric keypad))

	K_ALTERASE   Keycode = C.SDLK_ALTERASE   // "AltErase" (Erase-Eaze)
	K_SYSREQ     Keycode = C.SDLK_SYSREQ     // "SysReq" (the SysReq key)
	K_CANCEL     Keycode = C.SDLK_CANCEL     // "Cancel"
	K_CLEAR      Keycode = C.SDLK_CLEAR      // "Clear"
	K_PRIOR      Keycode = C.SDLK_PRIOR      // "Prior"
	K_RETURN2    Keycode = C.SDLK_RETURN2    // "Return"
	K_SEPARATOR  Keycode = C.SDLK_SEPARATOR  // "Separator"
	K_OUT        Keycode = C.SDLK_OUT        // "Out"
	K_OPER       Keycode = C.SDLK_OPER       // "Oper"
	K_CLEARAGAIN Keycode = C.SDLK_CLEARAGAIN // "Clear / Again"
	K_CRSEL      Keycode = C.SDLK_CRSEL      // "CrSel"
	K_EXSEL      Keycode = C.SDLK_EXSEL      // "ExSel"

	K_KP_00              Keycode = C.SDLK_KP_00              // "Keypad 00" (the 00 key (numeric keypad))
	K_KP_000             Keycode = C.SDLK_KP_000             // "Keypad 000" (the 000 key (numeric keypad))
	K_THOUSANDSSEPARATOR Keycode = C.SDLK_THOUSANDSSEPARATOR // "ThousandsSeparator" (the Thousands Separator key)
	K_DECIMALSEPARATOR   Keycode = C.SDLK_DECIMALSEPARATOR   // "DecimalSeparator" (the Decimal Separator key)
	K_CURRENCYUNIT       Keycode = C.SDLK_CURRENCYUNIT       // "CurrencyUnit" (the Currency Unit key)
	K_CURRENCYSUBUNIT    Keycode = C.SDLK_CURRENCYSUBUNIT    // "CurrencySubUnit" (the Currency Subunit key)
	K_KP_LEFTPAREN       Keycode = C.SDLK_KP_LEFTPAREN       // "Keypad (" (the Left Parenthesis key (numeric keypad))
	K_KP_RIGHTPAREN      Keycode = C.SDLK_KP_RIGHTPAREN      // "Keypad )" (the Right Parenthesis key (numeric keypad))
	K_KP_LEFTBRACE       Keycode = C.SDLK_KP_LEFTBRACE       // "Keypad {" (the Left Brace key (numeric keypad))
	K_KP_RIGHTBRACE      Keycode = C.SDLK_KP_RIGHTBRACE      // "Keypad }" (the Right Brace key (numeric keypad))
	K_KP_TAB             Keycode = C.SDLK_KP_TAB             // "Keypad Tab" (the Tab key (numeric keypad))
	K_KP_BACKSPACE       Keycode = C.SDLK_KP_BACKSPACE       // "Keypad Backspace" (the Backspace key (numeric keypad))
	K_KP_A               Keycode = C.SDLK_KP_A               // "Keypad A" (the A key (numeric keypad))
	K_KP_B               Keycode = C.SDLK_KP_B               // "Keypad B" (the B key (numeric keypad))
	K_KP_C               Keycode = C.SDLK_KP_C               // "Keypad C" (the C key (numeric keypad))
	K_KP_D               Keycode = C.SDLK_KP_D               // "Keypad D" (the D key (numeric keypad))
	K_KP_E               Keycode = C.SDLK_KP_E               // "Keypad E" (the E key (numeric keypad))
	K_KP_F               Keycode = C.SDLK_KP_F               // "Keypad F" (the F key (numeric keypad))
	K_KP_XOR             Keycode = C.SDLK_KP_XOR             // "Keypad XOR" (the XOR key (numeric keypad))
	K_KP_POWER           Keycode = C.SDLK_KP_POWER           // "Keypad ^" (the Power key (numeric keypad))
	K_KP_PERCENT         Keycode = C.SDLK_KP_PERCENT         // "Keypad %" (the Percent key (numeric keypad))
	K_KP_LESS            Keycode = C.SDLK_KP_LESS            // "Keypad <" (the Less key (numeric keypad))
	K_KP_GREATER         Keycode = C.SDLK_KP_GREATER         // "Keypad >" (the Greater key (numeric keypad))
	K_KP_AMPERSAND       Keycode = C.SDLK_KP_AMPERSAND       // "Keypad &" (the & key (numeric keypad))
	K_KP_DBLAMPERSAND    Keycode = C.SDLK_KP_DBLAMPERSAND    // "Keypad &&" (the && key (numeric keypad))
	K_KP_VERTICALBAR     Keycode = C.SDLK_KP_VERTICALBAR     // "Keypad |" (the | key (numeric keypad))
	K_KP_DBLVERTICALBAR  Keycode = C.SDLK_KP_DBLVERTICALBAR  // "Keypad ||" (the || key (numeric keypad))
	K_KP_COLON           Keycode = C.SDLK_KP_COLON           // "Keypad :" (the : key (numeric keypad))
	K_KP_HASH            Keycode = C.SDLK_KP_HASH            // "Keypad #" (the # key (numeric keypad))
	K_KP_SPACE           Keycode = C.SDLK_KP_SPACE           // "Keypad Space" (the Space key (numeric keypad))
	K_KP_AT              Keycode = C.SDLK_KP_AT              // "Keypad @" (the @ key (numeric keypad))
	K_KP_EXCLAM          Keycode = C.SDLK_KP_EXCLAM          // "Keypad !" (the ! key (numeric keypad))
	K_KP_MEMSTORE        Keycode = C.SDLK_KP_MEMSTORE        // "Keypad MemStore" (the Mem Store key (numeric keypad))
	K_KP_MEMRECALL       Keycode = C.SDLK_KP_MEMRECALL       // "Keypad MemRecall" (the Mem Recall key (numeric keypad))
	K_KP_MEMCLEAR        Keycode = C.SDLK_KP_MEMCLEAR        // "Keypad MemClear" (the Mem Clear key (numeric keypad))
	K_KP_MEMADD          Keycode = C.SDLK_KP_MEMADD          // "Keypad MemAdd" (the Mem Add key (numeric keypad))
	K_KP_MEMSUBTRACT     Keycode = C.SDLK_KP_MEMSUBTRACT     // "Keypad MemSubtract" (the Mem Subtract key (numeric keypad))
	K_KP_MEMMULTIPLY     Keycode = C.SDLK_KP_MEMMULTIPLY     // "Keypad MemMultiply" (the Mem Multiply key (numeric keypad))
	K_KP_MEMDIVIDE       Keycode = C.SDLK_KP_MEMDIVIDE       // "Keypad MemDivide" (the Mem Divide key (numeric keypad))
	K_KP_PLUSMINUS       Keycode = C.SDLK_KP_PLUSMINUS       // "Keypad +/-" (the +/- key (numeric keypad))
	K_KP_CLEAR           Keycode = C.SDLK_KP_CLEAR           // "Keypad Clear" (the Clear key (numeric keypad))
	K_KP_CLEARENTRY      Keycode = C.SDLK_KP_CLEARENTRY      // "Keypad ClearEntry" (the Clear Entry key (numeric keypad))
	K_KP_BINARY          Keycode = C.SDLK_KP_BINARY          // "Keypad Binary" (the Binary key (numeric keypad))
	K_KP_OCTAL           Keycode = C.SDLK_KP_OCTAL           // "Keypad Octal" (the Octal key (numeric keypad))
	K_KP_DECIMAL         Keycode = C.SDLK_KP_DECIMAL         // "Keypad Decimal" (the Decimal key (numeric keypad))
	K_KP_HEXADECIMAL     Keycode = C.SDLK_KP_HEXADECIMAL     // "Keypad Hexadecimal" (the Hexadecimal key (numeric keypad))

	K_LCTRL  Keycode = C.SDLK_LCTRL  // "Left Ctrl"
	K_LSHIFT Keycode = C.SDLK_LSHIFT // "Left Shift"
	K_LALT   Keycode = C.SDLK_LALT   // "Left Alt" (alt, option)
	K_LGUI   Keycode = C.SDLK_LGUI   // "Left GUI" (windows, command (apple), meta)
	K_RCTRL  Keycode = C.SDLK_RCTRL  // "Right Ctrl"
	K_RSHIFT Keycode = C.SDLK_RSHIFT // "Right Shift"
	K_RALT   Keycode = C.SDLK_RALT   // "Right Alt" (alt, option)
	K_RGUI   Keycode = C.SDLK_RGUI   // "Right GUI" (windows, command (apple), meta)

	K_MODE Keycode = C.SDLK_MODE // "ModeSwitch" (I'm not sure if this is really not covered by any of the above, but since there's a special KMOD_MODE for it I'm adding it here)

	K_AUDIONEXT    Keycode = C.SDLK_AUDIONEXT    // "AudioNext" (the Next Track media key)
	K_AUDIOPREV    Keycode = C.SDLK_AUDIOPREV    // "AudioPrev" (the Previous Track media key)
	K_AUDIOSTOP    Keycode = C.SDLK_AUDIOSTOP    // "AudioStop" (the Stop media key)
	K_AUDIOPLAY    Keycode = C.SDLK_AUDIOPLAY    // "AudioPlay" (the Play media key)
	K_AUDIOMUTE    Keycode = C.SDLK_AUDIOMUTE    // "AudioMute" (the Mute volume key)
	K_MEDIASELECT  Keycode = C.SDLK_MEDIASELECT  // "MediaSelect" (the Media Select key)
	K_WWW          Keycode = C.SDLK_WWW          // "WWW" (the WWW/World Wide Web key)
	K_MAIL         Keycode = C.SDLK_MAIL         // "Mail" (the Mail/eMail key)
	K_CALCULATOR   Keycode = C.SDLK_CALCULATOR   // "Calculator" (the Calculator key)
	K_COMPUTER     Keycode = C.SDLK_COMPUTER     // "Computer" (the My Computer key)
	K_AC_SEARCH    Keycode = C.SDLK_AC_SEARCH    // "AC Search" (the Search key (application control keypad))
	K_AC_HOME      Keycode = C.SDLK_AC_HOME      // "AC Home" (the Home key (application control keypad))
	K_AC_BACK      Keycode = C.SDLK_AC_BACK      // "AC Back" (the Back key (application control keypad))
	K_AC_FORWARD   Keycode = C.SDLK_AC_FORWARD   // "AC Forward" (the Forward key (application control keypad))
	K_AC_STOP      Keycode = C.SDLK_AC_STOP      // "AC Stop" (the Stop key (application control keypad))
	K_AC_REFRESH   Keycode = C.SDLK_AC_REFRESH   // "AC Refresh" (the Refresh key (application control keypad))
	K_AC_BOOKMARKS Keycode = C.SDLK_AC_BOOKMARKS // "AC Bookmarks" (the Bookmarks key (application control keypad))

	K_BRIGHTNESSDOWN Keycode = C.SDLK_BRIGHTNESSDOWN // "BrightnessDown" (the Brightness Down key)
	K_BRIGHTNESSUP   Keycode = C.SDLK_BRIGHTNESSUP   // "BrightnessUp" (the Brightness Up key)
	K_DISPLAYSWITCH  Keycode = C.SDLK_DISPLAYSWITCH  // "DisplaySwitch" (display mirroring/dual display switch, video mode switch)
	K_KBDILLUMTOGGLE Keycode = C.SDLK_KBDILLUMTOGGLE // "KBDIllumToggle" (the Keyboard Illumination Toggle key)
	K_KBDILLUMDOWN   Keycode = C.SDLK_KBDILLUMDOWN   // "KBDIllumDown" (the Keyboard Illumination Down key)
	K_KBDILLUMUP     Keycode = C.SDLK_KBDILLUMUP     // "KBDIllumUp" (the Keyboard Illumination Up key)
	K_EJECT          Keycode = C.SDLK_EJECT          // "Eject" (the Eject key)
	K_SLEEP          Keycode = C.SDLK_SLEEP          // "Sleep" (the Sleep key)
)

func GetKeyFromName

func GetKeyFromName(name string) Keycode

GetKeyFromName returns a key code from a human-readable name. (https://wiki.libsdl.org/SDL_GetKeyFromName)

func GetKeyFromScancode

func GetKeyFromScancode(code Scancode) Keycode

GetKeyFromScancode returns the key code corresponding to the given scancode according to the current keyboard layout. (https://wiki.libsdl.org/SDL_GetKeyFromScancode)

type Keymod

type Keymod C.SDL_Keymod

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

const (
	KMOD_NONE     Keymod = C.KMOD_NONE     // 0 (no modifier is applicable)
	KMOD_LSHIFT   Keymod = C.KMOD_LSHIFT   // the left Shift key is down
	KMOD_RSHIFT   Keymod = C.KMOD_RSHIFT   // the right Shift key is down
	KMOD_LCTRL    Keymod = C.KMOD_LCTRL    // the left Ctrl (Control) key is down
	KMOD_RCTRL    Keymod = C.KMOD_RCTRL    // the right Ctrl (Control) key is down
	KMOD_LALT     Keymod = C.KMOD_LALT     // the left Alt key is down
	KMOD_RALT     Keymod = C.KMOD_RALT     // the right Alt key is down
	KMOD_LGUI     Keymod = C.KMOD_LGUI     // the left GUI key (often the Windows key) is down
	KMOD_RGUI     Keymod = C.KMOD_RGUI     // the right GUI key (often the Windows key) is down
	KMOD_NUM      Keymod = C.KMOD_NUM      // the Num Lock key (may be located on an extended keypad) is down
	KMOD_CAPS     Keymod = C.KMOD_CAPS     // the Caps Lock key is down
	KMOD_MODE     Keymod = C.KMOD_MODE     // the AltGr key is down
	KMOD_CTRL     Keymod = C.KMOD_CTRL     // (KMOD_LCTRL|KMOD_RCTRL)
	KMOD_SHIFT    Keymod = C.KMOD_SHIFT    // (KMOD_LSHIFT|KMOD_RSHIFT)
	KMOD_ALT      Keymod = C.KMOD_ALT      // (KMOD_LALT|KMOD_RALT)
	KMOD_GUI      Keymod = C.KMOD_GUI      // (KMOD_LGUI|KMOD_RGUI)
	KMOD_RESERVED Keymod = C.KMOD_RESERVED // reserved for future use
)

func GetModState added in v0.2.0

func GetModState() Keymod

GetModState returns the current key modifier state for the keyboard. (https://wiki.libsdl.org/SDL_GetModState)

type Keysym

type Keysym struct {
	Scancode Scancode // SDL physical key code
	Sym      Keycode  // SDL virtual key code
	Mod      Keymod   // current key modifiers
	// contains filtered or unexported fields
}

Keysym contains key information used in key events. (https://wiki.libsdl.org/SDL_Keysym)

type Locale

type Locale struct {
	Language string // A language name, like "en" for English.
	Country  string // A country, like "US" for America. Can be empty.
}

func GetPreferredLocales

func GetPreferredLocales() (locale Locale, err error)

type LogCategory

type LogCategory C.SDL_LogCategory

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

const (
	LOG_CATEGORY_APPLICATION LogCategory = C.SDL_LOG_CATEGORY_APPLICATION // application log
	LOG_CATEGORY_ERROR       LogCategory = C.SDL_LOG_CATEGORY_ERROR       // error log
	LOG_CATEGORY_ASSERT      LogCategory = C.SDL_LOG_CATEGORY_ASSERT      // assert log
	LOG_CATEGORY_SYSTEM      LogCategory = C.SDL_LOG_CATEGORY_SYSTEM      // system log
	LOG_CATEGORY_AUDIO       LogCategory = C.SDL_LOG_CATEGORY_AUDIO       // audio log
	LOG_CATEGORY_VIDEO       LogCategory = C.SDL_LOG_CATEGORY_VIDEO       // video log
	LOG_CATEGORY_RENDER      LogCategory = C.SDL_LOG_CATEGORY_RENDER      // render log
	LOG_CATEGORY_INPUT       LogCategory = C.SDL_LOG_CATEGORY_INPUT       // input log
	LOG_CATEGORY_TEST        LogCategory = C.SDL_LOG_CATEGORY_TEST        // test log
	LOG_CATEGORY_RESERVED1   LogCategory = C.SDL_LOG_CATEGORY_RESERVED1   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED2   LogCategory = C.SDL_LOG_CATEGORY_RESERVED2   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED3   LogCategory = C.SDL_LOG_CATEGORY_RESERVED3   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED4   LogCategory = C.SDL_LOG_CATEGORY_RESERVED4   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED5   LogCategory = C.SDL_LOG_CATEGORY_RESERVED5   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED6   LogCategory = C.SDL_LOG_CATEGORY_RESERVED6   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED7   LogCategory = C.SDL_LOG_CATEGORY_RESERVED7   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED8   LogCategory = C.SDL_LOG_CATEGORY_RESERVED8   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED9   LogCategory = C.SDL_LOG_CATEGORY_RESERVED9   // reserved for future SDL library use
	LOG_CATEGORY_RESERVED10  LogCategory = C.SDL_LOG_CATEGORY_RESERVED10  // reserved for future SDL library use
	LOG_CATEGORY_CUSTOM      LogCategory = C.SDL_LOG_CATEGORY_CUSTOM      // reserved for application use
)

type LogOutputFunction

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

LogOutputFunction is the function to call instead of the default

func LogGetOutputFunction

func LogGetOutputFunction() (LogOutputFunction, interface{})

LogGetOutputFunction returns the current log output function. (https://wiki.libsdl.org/SDL_LogGetOutputFunction)

type LogPriority

type LogPriority C.SDL_LogPriority

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

const (
	LOG_PRIORITY_VERBOSE  LogPriority = C.SDL_LOG_PRIORITY_VERBOSE  // verbose
	LOG_PRIORITY_DEBUG    LogPriority = C.SDL_LOG_PRIORITY_DEBUG    // debug
	LOG_PRIORITY_INFO     LogPriority = C.SDL_LOG_PRIORITY_INFO     // info
	LOG_PRIORITY_WARN     LogPriority = C.SDL_LOG_PRIORITY_WARN     // warn
	LOG_PRIORITY_ERROR    LogPriority = C.SDL_LOG_PRIORITY_ERROR    // error
	LOG_PRIORITY_CRITICAL LogPriority = C.SDL_LOG_PRIORITY_CRITICAL // critical
	NUM_LOG_PRIORITIES    LogPriority = C.SDL_NUM_LOG_PRIORITIES    // (internal use)
)

func LogGetPriority

func LogGetPriority(category LogCategory) LogPriority

LogGetPriority returns the priority of a particular log category. (https://wiki.libsdl.org/SDL_LogGetPriority)

type MessageBoxButtonData

type MessageBoxButtonData struct {
	Flags    MessageBoxButtonDataFlags // MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT
	ButtonID int32                     // user defined button id (value returned via ShowMessageBox())
	Text     string                    // the UTF-8 button text
}

MessageBoxButtonData contains individual button data for a message box. (https://wiki.libsdl.org/SDL_MessageBoxButtonData)

type MessageBoxButtonDataFlags

type MessageBoxButtonDataFlags uint32

Flags for MessageBoxButtonData. (https://wiki.libsdl.org/SDL_MessageBoxButtonFlags)

const (
	MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT MessageBoxButtonDataFlags = C.SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT // marks the default button when return is hit
	MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT MessageBoxButtonDataFlags = C.SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT // marks the default button when escape is hit
)

type MessageBoxColor

type MessageBoxColor struct {
	R uint8 // the red component in the range 0-255
	G uint8 // the green component in the range 0-255
	B uint8 // the blue component in the range 0-255
}

MessageBoxColor contains RGB value used in an MessageBoxColorScheme. (https://wiki.libsdl.org/SDL_MessageBoxColor)

type MessageBoxColorScheme

type MessageBoxColorScheme struct {
	Colors [5]MessageBoxColor // background, text, button border, button background, button selected
}

MessageBoxColorScheme contains a set of colors to use for message box dialogs. (https://wiki.libsdl.org/SDL_MessageBoxColorScheme)

type MessageBoxData

type MessageBoxData struct {
	Flags       MessageBoxFlags // MESSAGEBOX_ERROR, MESSAGEBOX_WARNING, MESSAGEBOX_INFORMATION
	Window      *Window         // parent window or nil
	Title       string
	Message     string
	Buttons     []MessageBoxButtonData
	ColorScheme *MessageBoxColorScheme // nil to use system settings
}

MessageBoxData contains title, text, window and other data for a message box. (https://wiki.libsdl.org/SDL_MessageBoxData)

type MessageBoxFlags

type MessageBoxFlags uint32

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

const (
	MESSAGEBOX_ERROR       MessageBoxFlags = C.SDL_MESSAGEBOX_ERROR       // error dialog
	MESSAGEBOX_WARNING     MessageBoxFlags = C.SDL_MESSAGEBOX_WARNING     // warning dialog
	MESSAGEBOX_INFORMATION MessageBoxFlags = C.SDL_MESSAGEBOX_INFORMATION // informational dialog
)

type MetalView

type MetalView C.SDL_MetalView

A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).

func Metal_CreateView

func Metal_CreateView(window *Window) MetalView

Metal_CreateView creates a CAMetalLayer-backed NSView/UIView and attach it to the specified window. (https://wiki.libsdl.org/SDL_Metal_CreateView)

type MouseButtonEvent

type MouseButtonEvent struct {
	Type      EventType   // MOUSEBUTTONDOWN, MOUSEBUTTONUP
	Timestamp uint32      // timestamp of the event
	WindowID  uint32      // the window with mouse focus, if any
	Which     uint32      // the mouse instance id, or TOUCH_MOUSEID
	Button    Button      // BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT, BUTTON_X1, BUTTON_X2
	State     ButtonState // PRESSED, RELEASED
	Clicks    uint8       // 1 for single-click, 2 for double-click, etc. (>= SDL 2.0.2)
	X         int32       // X coordinate, relative to window
	Y         int32       // Y coordinate, relative to window
}

MouseButtonEvent contains mouse button event information. (https://wiki.libsdl.org/SDL_MouseButtonEvent)

func (MouseButtonEvent) GetTimestamp added in v0.3.0

func (e MouseButtonEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (MouseButtonEvent) GetType added in v0.3.0

func (e MouseButtonEvent) GetType() EventType

GetType returns the event type.

type MouseMotionEvent

type MouseMotionEvent struct {
	Type      EventType  // MOUSEMOTION
	Timestamp uint32     // timestamp of the event
	WindowID  uint32     // the window with mouse focus, if any
	Which     uint32     // the mouse instance id, or TOUCH_MOUSEID
	State     ButtonMask // masks for BUTTON_LEFT, BUTTON_MIDDLE, BUTTON_RIGHT, BUTTON_X1, BUTTON_X2
	X         int32      // X coordinate, relative to window
	Y         int32      // Y coordinate, relative to window
	XRel      int32      // relative motion in the X direction
	YRel      int32      // relative motion in the Y direction
}

MouseMotionEvent contains mouse motion event information. (https://wiki.libsdl.org/SDL_MouseMotionEvent)

func (MouseMotionEvent) GetTimestamp added in v0.3.0

func (e MouseMotionEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (MouseMotionEvent) GetType added in v0.3.0

func (e MouseMotionEvent) GetType() EventType

GetType returns the event type.

type MouseWheelEvent

type MouseWheelEvent struct {
	Type      EventType // MOUSEWHEEL
	Timestamp uint32    // timestamp of the event
	WindowID  uint32    // the window with mouse focus, if any
	Which     uint32    // the mouse instance id, or TOUCH_MOUSEID
	X         int32     // the amount scrolled horizontally, positive to the right and negative to the left
	Y         int32     // the amount scrolled vertically, positive away from the user and negative toward the user
	Direction uint32    // MOUSEWHEEL_NORMAL, MOUSEWHEEL_FLIPPED (>= SDL 2.0.4)
	PreciseX  float32   // The amount scrolled horizontally, positive to the right and negative to the left, with float precision (added in 2.0.18)
	PreciseY  float32   // The amount scrolled vertically, positive away from the user and negative toward the user, with float precision (added in 2.0.18)
	MouseX    int32     // X coordinate, relative to window (added in 2.26.0)
	MouseY    int32     // Y coordinate, relative to window (added in 2.26.0)
}

MouseWheelEvent contains mouse wheel event information. (https://wiki.libsdl.org/SDL_MouseWheelEvent)

func (MouseWheelEvent) GetTimestamp added in v0.3.0

func (e MouseWheelEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (MouseWheelEvent) GetType added in v0.3.0

func (e MouseWheelEvent) GetType() EventType

GetType returns the event type.

type MultiGestureEvent

type MultiGestureEvent struct {
	Type       EventType // MULTIGESTURE
	Timestamp  uint32    // timestamp of the event
	TouchID    TouchID   // the touch device id
	DTheta     float32   // the amount that the fingers rotated during this motion
	DDist      float32   // the amount that the fingers pinched during this motion
	X          float32   // the normalized center of gesture
	Y          float32   // the normalized center of gesture
	NumFingers uint16    // the number of fingers used in the gesture
}

MultiGestureEvent contains multiple finger gesture event information. (https://wiki.libsdl.org/SDL_MultiGestureEvent)

func (MultiGestureEvent) GetTimestamp added in v0.3.0

func (e MultiGestureEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (MultiGestureEvent) GetType added in v0.3.0

func (e MultiGestureEvent) GetType() EventType

GetType returns the event type.

type Mutex

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

Mutex is the SDL mutex structure.

func CreateMutex

func CreateMutex() (*Mutex, error)

CreateMutex creates a new mutex. (https://wiki.libsdl.org/SDL_CreateMutex)

func (*Mutex) Destroy added in v0.3.0

func (mutex *Mutex) Destroy()

Destroy destroys a mutex created with CreateMutex(). (https://wiki.libsdl.org/SDL_DestroyMutex)

func (*Mutex) Lock added in v0.3.0

func (mutex *Mutex) Lock() error

Lock locks a mutex created with CreateMutex(). (https://wiki.libsdl.org/SDL_LockMutex)

func (*Mutex) TryLock added in v0.3.0

func (mutex *Mutex) TryLock() error

TryLock tries to lock a mutex without blocking. (https://wiki.libsdl.org/SDL_TryLockMutex)

func (*Mutex) Unlock added in v0.3.0

func (mutex *Mutex) Unlock() error

Unlock unlocks a mutex created with CreateMutex(). (https://wiki.libsdl.org/SDL_UnlockMutex)

type OSEvent

type OSEvent struct {
	Type      EventType // the event type
	Timestamp uint32    // timestamp of the event
}

OSEvent contains OS specific event information.

func (OSEvent) GetTimestamp added in v0.3.0

func (e OSEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (OSEvent) GetType added in v0.3.0

func (e OSEvent) GetType() EventType

GetType returns the event type.

type Palette

type Palette struct {
	Ncolors int32  // the number of colors in the palette
	Colors  *Color // an array of Color structures representing the palette (https://wiki.libsdl.org/SDL_Color)
	// contains filtered or unexported fields
}

Palette contains palette information. (https://wiki.libsdl.org/SDL_Palette)

func AllocPalette

func AllocPalette(ncolors int) (*Palette, error)

AllocPalette creates a palette structure with the specified number of color entries. (https://wiki.libsdl.org/SDL_AllocPalette)

func (*Palette) Free

func (palette *Palette) Free()

Free frees the palette created with AllocPalette(). (https://wiki.libsdl.org/SDL_FreePalette)

func (*Palette) SetColors

func (palette *Palette) SetColors(colors []Color) error

SetColors sets a range of colors in the palette. (https://wiki.libsdl.org/SDL_SetPaletteColors)

type PixelFormat

type PixelFormat struct {
	Format        PixelFormatConstant // one of the PIXELFORMAT values (https://wiki.libsdl.org/SDL_PixelFormatEnum)
	Palette       *Palette            // palette structure associated with this pixel format, or nil if the format doesn't have a palette (https://wiki.libsdl.org/SDL_Palette)
	BitsPerPixel  uint8               // the number of significant bits in a pixel value, eg: 8, 15, 16, 24, 32
	BytesPerPixel uint8               // the number of bytes required to hold a pixel value, eg: 1, 2, 3, 4

	Rmask uint32 // a mask representing the location of the red component of the pixel
	Gmask uint32 // a mask representing the location of the green component of the pixel
	Bmask uint32 // a mask representing the location of the blue component of the pixel
	Amask uint32 // a mask representing the location of the alpha component of the pixel or 0 if the pixel format doesn't have any alpha information
	// contains filtered or unexported fields
}

PixelFormat contains pixel format information. (https://wiki.libsdl.org/SDL_PixelFormat)

func AllocFormat

func AllocFormat(format PixelFormatConstant) (*PixelFormat, error)

AllocFormat creates a PixelFormat structure corresponding to a pixel format. (https://wiki.libsdl.org/SDL_AllocFormat)

func (*PixelFormat) Free

func (format *PixelFormat) Free()

Free frees the PixelFormat structure allocated by AllocFormat(). (https://wiki.libsdl.org/SDL_FreeFormat)

func (*PixelFormat) SetPalette

func (format *PixelFormat) SetPalette(palette *Palette) error

SetPalette sets the palette for the pixel format structure. (https://wiki.libsdl.org/SDL_SetPixelFormatPalette)

type PixelFormatConstant

type PixelFormatConstant uint32
const (
	PIXELFORMAT_UNKNOWN     PixelFormatConstant = C.SDL_PIXELFORMAT_UNKNOWN
	PIXELFORMAT_INDEX1LSB   PixelFormatConstant = C.SDL_PIXELFORMAT_INDEX1LSB
	PIXELFORMAT_INDEX1MSB   PixelFormatConstant = C.SDL_PIXELFORMAT_INDEX1MSB
	PIXELFORMAT_INDEX4LSB   PixelFormatConstant = C.SDL_PIXELFORMAT_INDEX4LSB
	PIXELFORMAT_INDEX4MSB   PixelFormatConstant = C.SDL_PIXELFORMAT_INDEX4MSB
	PIXELFORMAT_INDEX8      PixelFormatConstant = C.SDL_PIXELFORMAT_INDEX8
	PIXELFORMAT_RGB332      PixelFormatConstant = C.SDL_PIXELFORMAT_RGB332
	PIXELFORMAT_RGB444      PixelFormatConstant = C.SDL_PIXELFORMAT_RGB444
	PIXELFORMAT_RGB555      PixelFormatConstant = C.SDL_PIXELFORMAT_RGB555
	PIXELFORMAT_BGR555      PixelFormatConstant = C.SDL_PIXELFORMAT_BGR555
	PIXELFORMAT_ARGB4444    PixelFormatConstant = C.SDL_PIXELFORMAT_ARGB4444
	PIXELFORMAT_RGBA4444    PixelFormatConstant = C.SDL_PIXELFORMAT_RGBA4444
	PIXELFORMAT_ABGR4444    PixelFormatConstant = C.SDL_PIXELFORMAT_ABGR4444
	PIXELFORMAT_BGRA4444    PixelFormatConstant = C.SDL_PIXELFORMAT_BGRA4444
	PIXELFORMAT_XRGB4444    PixelFormatConstant = C.SDL_PIXELFORMAT_XRGB4444
	PIXELFORMAT_XBGR4444    PixelFormatConstant = C.SDL_PIXELFORMAT_XBGR4444
	PIXELFORMAT_ARGB1555    PixelFormatConstant = C.SDL_PIXELFORMAT_ARGB1555
	PIXELFORMAT_XRGB1555    PixelFormatConstant = C.SDL_PIXELFORMAT_XRGB1555
	PIXELFORMAT_XBGR1555    PixelFormatConstant = C.SDL_PIXELFORMAT_XBGR1555
	PIXELFORMAT_RGBA5551    PixelFormatConstant = C.SDL_PIXELFORMAT_RGBA5551
	PIXELFORMAT_ABGR1555    PixelFormatConstant = C.SDL_PIXELFORMAT_ABGR1555
	PIXELFORMAT_BGRA5551    PixelFormatConstant = C.SDL_PIXELFORMAT_BGRA5551
	PIXELFORMAT_RGB565      PixelFormatConstant = C.SDL_PIXELFORMAT_RGB565
	PIXELFORMAT_BGR565      PixelFormatConstant = C.SDL_PIXELFORMAT_BGR565
	PIXELFORMAT_RGB24       PixelFormatConstant = C.SDL_PIXELFORMAT_RGB24
	PIXELFORMAT_BGR24       PixelFormatConstant = C.SDL_PIXELFORMAT_BGR24
	PIXELFORMAT_XRGB8888    PixelFormatConstant = C.SDL_PIXELFORMAT_XRGB8888
	PIXELFORMAT_XBGR8888    PixelFormatConstant = C.SDL_PIXELFORMAT_XBGR8888
	PIXELFORMAT_RGB888      PixelFormatConstant = C.SDL_PIXELFORMAT_RGB888
	PIXELFORMAT_RGBX8888    PixelFormatConstant = C.SDL_PIXELFORMAT_RGBX8888
	PIXELFORMAT_BGR888      PixelFormatConstant = C.SDL_PIXELFORMAT_BGR888
	PIXELFORMAT_BGRX8888    PixelFormatConstant = C.SDL_PIXELFORMAT_BGRX8888
	PIXELFORMAT_ARGB8888    PixelFormatConstant = C.SDL_PIXELFORMAT_ARGB8888
	PIXELFORMAT_RGBA8888    PixelFormatConstant = C.SDL_PIXELFORMAT_RGBA8888
	PIXELFORMAT_ABGR8888    PixelFormatConstant = C.SDL_PIXELFORMAT_ABGR8888
	PIXELFORMAT_BGRA8888    PixelFormatConstant = C.SDL_PIXELFORMAT_BGRA8888
	PIXELFORMAT_ARGB2101010 PixelFormatConstant = C.SDL_PIXELFORMAT_ARGB2101010
	PIXELFORMAT_YV12        PixelFormatConstant = C.SDL_PIXELFORMAT_YV12
	PIXELFORMAT_IYUV        PixelFormatConstant = C.SDL_PIXELFORMAT_IYUV
	PIXELFORMAT_YUY2        PixelFormatConstant = C.SDL_PIXELFORMAT_YUY2
	PIXELFORMAT_UYVY        PixelFormatConstant = C.SDL_PIXELFORMAT_UYVY
	PIXELFORMAT_YVYU        PixelFormatConstant = C.SDL_PIXELFORMAT_YVYU
)

Pixel format values.

Pixel format variables.

func (PixelFormatConstant) String

func (i PixelFormatConstant) String() string

type Point

type Point struct {
	X int32 // the x coordinate of the point
	Y int32 // the y coordinate of the point
}

Point defines a two dimensional point. (https://wiki.libsdl.org/SDL_Point)

func (*Point) InRect

func (p *Point) InRect(r *Rect) bool

InRect reports whether the point resides inside a rectangle. (https://wiki.libsdl.org/SDL_PointInRect)

type PowerState

type PowerState C.SDL_PowerState

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

const (
	POWERSTATE_UNKNOWN    PowerState = C.SDL_POWERSTATE_UNKNOWN    // cannot determine power status
	POWERSTATE_ON_BATTERY PowerState = C.SDL_POWERSTATE_ON_BATTERY // not plugged in, running on the battery
	POWERSTATE_NO_BATTERY PowerState = C.SDL_POWERSTATE_NO_BATTERY // plugged in, no battery available
	POWERSTATE_CHARGING   PowerState = C.SDL_POWERSTATE_CHARGING   // plugged in, charging battery
	POWERSTATE_CHARGED    PowerState = C.SDL_POWERSTATE_CHARGED    // plugged in, battery charged
)

func GetPowerInfo

func GetPowerInfo() (PowerState, int, int)

GetPowerInfo returns the current power supply details. (https://wiki.libsdl.org/SDL_GetPowerInfo)

type QuitEvent

type QuitEvent struct {
	Type      EventType // QUIT
	Timestamp uint32    // timestamp of the event
}

QuitEvent contains the "quit requested" event. (https://wiki.libsdl.org/SDL_QuitEvent)

func (QuitEvent) GetTimestamp added in v0.3.0

func (e QuitEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (QuitEvent) GetType added in v0.3.0

func (e QuitEvent) GetType() EventType

GetType returns the event type.

type RGB332 added in v0.4.0

type RGB332 struct {
	R, G, B byte
}

func (RGB332) RGBA added in v0.4.0

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

type RGB444 added in v0.4.0

type RGB444 struct {
	R, G, B byte
}

func (RGB444) RGBA added in v0.4.0

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

type RGB555 added in v0.4.0

type RGB555 struct {
	R, G, B byte
}

func (RGB555) RGBA added in v0.4.0

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

type RGB565 added in v0.4.0

type RGB565 struct {
	R, G, B byte
}

func (RGB565) RGBA added in v0.4.0

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

type RGB888 added in v0.4.36

type RGB888 struct {
	R, G, B byte
}

func (RGB888) RGBA added in v0.4.36

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

type RGBA4444 added in v0.4.0

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

func (RGBA4444) RGBA added in v0.4.0

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

type RGBA5551 added in v0.4.0

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

func (RGBA5551) RGBA added in v0.4.0

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

type RGBA8888 added in v0.4.0

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

func (RGBA8888) RGBA added in v0.4.0

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

type RWSeek

type RWSeek int

RWops seek from (https://wiki.libsdl.org/SDL_RWops#seek_function)

const (
	RW_SEEK_SET RWSeek = C.RW_SEEK_SET // seek from the beginning of data
	RW_SEEK_CUR RWSeek = C.RW_SEEK_CUR // seek relative to current read point
	RW_SEEK_END RWSeek = C.RW_SEEK_END // seek relative to the end of data
)

type RWStreamType

type RWStreamType int

RWops types (https://wiki.libsdl.org/SDL_RWops#stream_type)

const (
	RWOPS_UNKNOWN   RWStreamType = C.SDL_RWOPS_UNKNOWN   // unknown stream type
	RWOPS_WINFILE   RWStreamType = C.SDL_RWOPS_WINFILE   // win32 file
	RWOPS_STDFILE   RWStreamType = C.SDL_RWOPS_STDFILE   // stdio file
	RWOPS_JNIFILE   RWStreamType = C.SDL_RWOPS_JNIFILE   // android asset
	RWOPS_MEMORY    RWStreamType = C.SDL_RWOPS_MEMORY    // memory stream
	RWOPS_MEMORY_RO RWStreamType = C.SDL_RWOPS_MEMORY_RO // read-only memory stream
)

type RWops

type RWops C.SDL_RWops

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

func AllocRW

func AllocRW() *RWops

AllocRW allocates an empty, unpopulated RWops structure. (https://wiki.libsdl.org/SDL_AllocRW)

func RWFromFile

func RWFromFile(file, mode string) *RWops

RWFromFile creates a new RWops structure for reading from and/or writing to a named file. (https://wiki.libsdl.org/SDL_RWFromFile)

func RWFromMem

func RWFromMem(mem []byte) (*RWops, error)

RWFromMem prepares a read-write memory buffer for use with RWops. (https://wiki.libsdl.org/SDL_RWFromMem)

func (*RWops) Close added in v0.4.0

func (rwops *RWops) Close() error

Close closes and frees the allocated RWops structure. (https://wiki.libsdl.org/SDL_RWclose)

func (*RWops) Free added in v0.4.0

func (rwops *RWops) Free() error

Free frees the RWops structure allocated by AllocRW(). (https://wiki.libsdl.org/SDL_FreeRW)

func (*RWops) LoadFileRW added in v0.4.0

func (src *RWops) LoadFileRW(freesrc bool) (data []byte, size int)

LoadFile_RW loads all the data from an SDL data stream. (https://wiki.libsdl.org/SDL_LoadFile_RW)

func (*RWops) Read added in v0.4.0

func (rwops *RWops) Read(buf []byte) (n int, err error)

Read reads from a data source. (https://wiki.libsdl.org/SDL_RWread)

func (*RWops) Read2 added in v0.4.0

func (rwops *RWops) Read2(buf []byte, size, maxnum uint) (n int, err error)

Read2 reads from a data source (native). (https://wiki.libsdl.org/SDL_RWread)

func (*RWops) ReadBE16

func (rwops *RWops) ReadBE16() uint16

ReadBE16 read 16 bits of big-endian data from the RWops and returns in native format. (https://wiki.libsdl.org/SDL_ReadBE16)

func (*RWops) ReadBE32

func (rwops *RWops) ReadBE32() uint32

ReadBE32 reads 32 bits of big-endian data from the RWops and returns in native format. (https://wiki.libsdl.org/SDL_ReadBE32)

func (*RWops) ReadBE64

func (rwops *RWops) ReadBE64() uint64

ReadBE64 reads 64 bits of big-endian data from the RWops and returns in native format. (https://wiki.libsdl.org/SDL_ReadBE64)

func (*RWops) ReadLE16

func (rwops *RWops) ReadLE16() uint16

ReadLE16 reads 16 bits of little-endian data from the RWops and returns in native format. (https://wiki.libsdl.org/SDL_ReadLE16)

func (*RWops) ReadLE32

func (rwops *RWops) ReadLE32() uint32

ReadLE32 reads 32 bits of little-endian data from the RWops and returns in native format. (https://wiki.libsdl.org/SDL_ReadLE32)

func (*RWops) ReadLE64

func (rwops *RWops) ReadLE64() uint64

ReadLE64 reads 64 bits of little-endian data from the RWops and returns in native format. (https://wiki.libsdl.org/SDL_ReadLE64)

func (*RWops) ReadU8

func (rwops *RWops) ReadU8() uint8

ReadU8 reads a byte from the RWops. (https://wiki.libsdl.org/SDL_ReadU8)

func (*RWops) Seek added in v0.4.0

func (rwops *RWops) Seek(offset int64, whence RWSeek) (int64, error)

Seek seeks within the RWops data stream. (https://wiki.libsdl.org/SDL_RWseek)

func (*RWops) Size added in v0.4.0

func (rwops *RWops) Size() (int64, error)

Size returns the size of the data stream in the RWops. (https://wiki.libsdl.org/SDL_RWsize)

func (*RWops) Tell added in v0.4.0

func (rwops *RWops) Tell() (int64, error)

Tell returns the current read/write offset in the RWops data stream. (https://wiki.libsdl.org/SDL_RWtell)

func (*RWops) Write added in v0.4.0

func (rwops *RWops) Write(buf []byte) (n int, err error)

Write writes to the RWops data stream. (https://wiki.libsdl.org/SDL_RWwrite)

func (*RWops) Write2 added in v0.4.0

func (rwops *RWops) Write2(buf []byte, size, num uint) (n int, err error)

Write2 writes to the RWops data stream (native). (https://wiki.libsdl.org/SDL_RWwrite)

func (*RWops) WriteBE16

func (rwops *RWops) WriteBE16(value uint16) uint

WriteBE16 writes 16 bits in native format to the RWops as big-endian data. (https://wiki.libsdl.org/SDL_WriteBE16)

func (*RWops) WriteBE32

func (rwops *RWops) WriteBE32(value uint32) uint

WriteBE32 writes 32 bits in native format to the RWops as big-endian data. (https://wiki.libsdl.org/SDL_WriteBE32)

func (*RWops) WriteBE64

func (rwops *RWops) WriteBE64(value uint64) uint

WriteBE64 writes 64 bits in native format to the RWops as big-endian data. (https://wiki.libsdl.org/SDL_WriteBE64)

func (*RWops) WriteLE16

func (rwops *RWops) WriteLE16(value uint16) uint

WriteLE16 writes 16 bits in native format to the RWops as little-endian data. (https://wiki.libsdl.org/SDL_WriteLE16)

func (*RWops) WriteLE32

func (rwops *RWops) WriteLE32(value uint32) uint

WriteLE32 writes 32 bits in native format to the RWops as little-endian data. (https://wiki.libsdl.org/SDL_WriteLE32)

func (*RWops) WriteLE64

func (rwops *RWops) WriteLE64(value uint64) uint

WriteLE64 writes 64 bits in native format to the RWops as little-endian data. (https://wiki.libsdl.org/SDL_WriteLE64)

func (*RWops) WriteU8

func (rwops *RWops) WriteU8(value uint8) uint

WriteU8 writes a byte to the RWops. (https://wiki.libsdl.org/SDL_WriteU8)

type Rect

type Rect struct {
	X int32 // the x location of the rectangle's upper left corner
	Y int32 // the y location of the rectangle's upper left corner
	W int32 // the width of the rectangle
	H int32 // the height of the rectangle
}

Rect contains the definition of a rectangle, with the origin at the upper left. (https://wiki.libsdl.org/SDL_Rect)

func EnclosePoints

func EnclosePoints(points []Point, clip *Rect) (Rect, bool)

EnclosePoints calculates a minimal rectangle that encloses a set of points. (https://wiki.libsdl.org/SDL_EnclosePoints)

func GetDisplayBounds

func GetDisplayBounds(displayIndex int) (rect Rect, err error)

GetDisplayBounds returns the desktop area represented by a display, with the primary display located at 0,0. (https://wiki.libsdl.org/SDL_GetDisplayBounds)

func GetDisplayUsableBounds added in v0.3.0

func GetDisplayUsableBounds(displayIndex int) (rect Rect, err error)

GetDisplayUsableBounds returns the usable desktop area represented by a display, with the primary display located at 0,0. (https://wiki.libsdl.org/SDL_GetDisplayUsableBounds)

func (*Rect) Empty

func (a *Rect) Empty() bool

Empty reports whether a rectangle has no area. (https://wiki.libsdl.org/SDL_RectEmpty)

func (*Rect) Equals

func (a *Rect) Equals(b *Rect) bool

Equals reports whether two rectangles are equal. (https://wiki.libsdl.org/SDL_RectEquals)

func (*Rect) HasIntersection

func (a *Rect) HasIntersection(b *Rect) bool

HasIntersection reports whether two rectangles intersect. (https://wiki.libsdl.org/SDL_HasIntersection)

func (*Rect) Intersect

func (a *Rect) Intersect(b *Rect) (Rect, bool)

Intersect calculates the intersection of two rectangles. (https://wiki.libsdl.org/SDL_IntersectRect)

func (*Rect) IntersectLine

func (a *Rect) IntersectLine(X1, Y1, X2, Y2 *int32) bool

IntersectLine calculates the intersection of a rectangle and a line segment. (https://wiki.libsdl.org/SDL_IntersectRectAndLine)

func (*Rect) Union

func (a *Rect) Union(b *Rect) Rect

Union calculates the union of two rectangles. (https://wiki.libsdl.org/SDL_UnionRect)

type RenderEvent

type RenderEvent struct {
	Type      EventType // the event type
	Timestamp uint32    // timestamp of the event
}

RenderEvent contains render event information. (https://wiki.libsdl.org/SDL_EventType)

func (RenderEvent) GetTimestamp added in v0.3.0

func (e RenderEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (RenderEvent) GetType added in v0.3.0

func (e RenderEvent) GetType() EventType

GetType returns the event type.

type Renderer

type Renderer C.SDL_Renderer

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

func CreateRenderer

func CreateRenderer(window *Window, index int, flags RendererFlags) (*Renderer, error)

CreateRenderer returns a new 2D rendering context for a window. (https://wiki.libsdl.org/SDL_CreateRenderer)

func CreateSoftwareRenderer

func CreateSoftwareRenderer(surface *Surface) (*Renderer, error)

CreateSoftwareRenderer returns a new 2D software rendering context for a surface. (https://wiki.libsdl.org/SDL_CreateSoftwareRenderer)

func (*Renderer) Clear

func (renderer *Renderer) Clear() error

Clear clears the current rendering target with the drawing color. (https://wiki.libsdl.org/SDL_RenderClear)

func (*Renderer) Copy

func (renderer *Renderer) Copy(texture *Texture, src, dst *Rect) error

Copy copies a portion of the texture to the current rendering target. (https://wiki.libsdl.org/SDL_RenderCopy)

func (*Renderer) CopyEx

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

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

func (*Renderer) CopyExF added in v0.4.0

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

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

func (*Renderer) CopyF added in v0.4.0

func (renderer *Renderer) CopyF(texture *Texture, src *Rect, dst *FRect) error

CopyF copies a portion of the texture to the current rendering target. (https://wiki.libsdl.org/SDL_RenderCopyF)

func (*Renderer) CreateTexture

func (renderer *Renderer) CreateTexture(format PixelFormatConstant, access TextureAccess, w, h int32) (*Texture, error)

CreateTexture returns a new texture for a rendering context. (https://wiki.libsdl.org/SDL_CreateTexture)

func (*Renderer) CreateTextureFromSurface

func (renderer *Renderer) CreateTextureFromSurface(surface *Surface) (*Texture, error)

CreateTextureFromSurface returns a new texture from an existing surface. (https://wiki.libsdl.org/SDL_CreateTextureFromSurface)

func (*Renderer) Destroy

func (renderer *Renderer) Destroy() error

Destroy destroys the rendering context for a window and free associated textures. (https://wiki.libsdl.org/SDL_DestroyRenderer)

func (*Renderer) DrawLine

func (renderer *Renderer) DrawLine(x1, y1, x2, y2 int32) error

DrawLine draws a line on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawLine)

func (*Renderer) DrawLineF added in v0.4.0

func (renderer *Renderer) DrawLineF(x1, y1, x2, y2 float32) error

DrawLineF draws a line on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawLineF)

func (*Renderer) DrawLines

func (renderer *Renderer) DrawLines(points []Point) error

DrawLines draws a series of connected lines on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawLines)

func (*Renderer) DrawLinesF added in v0.4.0

func (renderer *Renderer) DrawLinesF(points []FPoint) error

DrawLinesF draws a series of connected lines on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawLinesF)

func (*Renderer) DrawPoint

func (renderer *Renderer) DrawPoint(x, y int32) error

DrawPoint draws a point on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawPoint)

func (*Renderer) DrawPointF added in v0.4.0

func (renderer *Renderer) DrawPointF(x, y float32) error

DrawPointF draws a point on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawPointF)

func (*Renderer) DrawPoints

func (renderer *Renderer) DrawPoints(points []Point) error

DrawPoints draws multiple points on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawPoints)

func (*Renderer) DrawPointsF added in v0.4.0

func (renderer *Renderer) DrawPointsF(points []FPoint) error

DrawPointsF draws multiple points on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawPointsF)

func (*Renderer) DrawRect

func (renderer *Renderer) DrawRect(rect *Rect) error

DrawRect draws a rectangle on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawRect)

func (*Renderer) DrawRectF added in v0.4.0

func (renderer *Renderer) DrawRectF(rect *FRect) error

DrawRectF draws a rectangle on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawRectF)

func (*Renderer) DrawRects

func (renderer *Renderer) DrawRects(rects []Rect) error

DrawRects draws some number of rectangles on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawRects)

func (*Renderer) DrawRectsF added in v0.4.0

func (renderer *Renderer) DrawRectsF(rects []FRect) error

DrawRectsF draws some number of rectangles on the current rendering target. (https://wiki.libsdl.org/SDL_RenderDrawRectsF)

func (*Renderer) FillRect

func (renderer *Renderer) FillRect(rect *Rect) error

FillRect fills a rectangle on the current rendering target with the drawing color. (https://wiki.libsdl.org/SDL_RenderFillRect)

func (*Renderer) FillRectF added in v0.4.0

func (renderer *Renderer) FillRectF(rect *FRect) error

FillRectF fills a rectangle on the current rendering target with the drawing color. (https://wiki.libsdl.org/SDL_RenderFillRectF)

func (*Renderer) FillRects

func (renderer *Renderer) FillRects(rects []Rect) error

FillRects fills some number of rectangles on the current rendering target with the drawing color. (https://wiki.libsdl.org/SDL_RenderFillRects)

func (*Renderer) FillRectsF added in v0.4.0

func (renderer *Renderer) FillRectsF(rects []FRect) error

FillRectsF fills some number of rectangles on the current rendering target with the drawing color. (https://wiki.libsdl.org/SDL_RenderFillRectsF)

func (*Renderer) Flush added in v0.4.0

func (renderer *Renderer) Flush() error

Flush forces the rendering context to flush any pending commands to the underlying rendering API. (https://wiki.libsdl.org/SDL_RenderFlush)

func (*Renderer) GetClipRect

func (renderer *Renderer) GetClipRect() (rect Rect)

GetClipRect returns the clip rectangle for the current target. (https://wiki.libsdl.org/SDL_RenderGetClipRect)

func (*Renderer) GetDrawBlendMode

func (renderer *Renderer) GetDrawBlendMode(bm *BlendMode) error

GetDrawBlendMode returns the blend mode used for drawing operations. (https://wiki.libsdl.org/SDL_GetRenderDrawBlendMode)

func (*Renderer) GetDrawColor

func (renderer *Renderer) GetDrawColor() (r, g, b, a uint8, err error)

GetDrawColor returns the color used for drawing operations (Rect, Line and Clear). (https://wiki.libsdl.org/SDL_GetRenderDrawColor)

func (*Renderer) GetInfo added in v0.2.0

func (renderer *Renderer) GetInfo() (RendererInfo, error)

GetInfo returns information about a rendering context. (https://wiki.libsdl.org/SDL_GetRendererInfo)

func (*Renderer) GetIntegerScale added in v0.4.0

func (renderer *Renderer) GetIntegerScale() (bool, error)

GetIntegerScale reports whether integer scales are forced for resolution-independent rendering.

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

func (*Renderer) GetLogicalSize added in v0.2.0

func (renderer *Renderer) GetLogicalSize() (w, h int32)

GetLogicalSize returns device independent resolution for rendering. (https://wiki.libsdl.org/SDL_RenderGetLogicalSize)

func (*Renderer) GetMetalCommandEncoder added in v0.4.0

func (renderer *Renderer) GetMetalCommandEncoder() (encoder unsafe.Pointer, err error)

GetMetalCommandEncoder gets the Metal command encoder for the current frame (https://wiki.libsdl.org/SDL_RenderGetMetalCommandEncoder)

func (*Renderer) GetMetalLayer added in v0.4.0

func (renderer *Renderer) GetMetalLayer() (layer unsafe.Pointer, err error)

GetMetalLayer gets the CAMetalLayer associated with the given Metal renderer (https://wiki.libsdl.org/SDL_RenderGetMetalLayer)

func (*Renderer) GetOutputSize added in v0.2.0

func (renderer *Renderer) GetOutputSize() (w, h int32, err error)

GetOutputSize returns the output size in pixels of a rendering context. (https://wiki.libsdl.org/SDL_GetRendererOutputSize)

func (*Renderer) GetRenderTarget

func (renderer *Renderer) GetRenderTarget() *Texture

GetRenderTarget returns the current render target. (https://wiki.libsdl.org/SDL_GetRenderTarget)

func (*Renderer) GetScale

func (renderer *Renderer) GetScale() (scaleX, scaleY float32)

GetScale returns the drawing scale for the current target. (https://wiki.libsdl.org/SDL_RenderGetScale)

func (*Renderer) GetViewport

func (renderer *Renderer) GetViewport() (rect Rect)

GetViewport returns the drawing area for the current target. (https://wiki.libsdl.org/SDL_RenderGetViewport)

func (*Renderer) GetWindow added in v0.4.24

func (renderer *Renderer) GetWindow() (window *Window, err error)

GetWindow gets the window associated with a renderer. (https://wiki.libsdl.org/SDL_RenderGetWindow)

func (*Renderer) IsClipEnabled added in v0.4.30

func (renderer *Renderer) IsClipEnabled() bool

IsClipEnabled returns whether clipping is enabled on the given renderer. (https://wiki.libsdl.org/SDL_RenderIsClipEnabled)

func (*Renderer) Present

func (renderer *Renderer) Present()

Present updates the screen with any rendering performed since the previous call. (https://wiki.libsdl.org/SDL_RenderPresent)

func (*Renderer) ReadPixels

func (renderer *Renderer) ReadPixels(rect *Rect, format PixelFormatConstant, pixels unsafe.Pointer, pitch int) error

ReadPixels reads pixels from the current rendering target. (https://wiki.libsdl.org/SDL_RenderReadPixels)

func (*Renderer) RenderGeometry added in v0.4.11

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

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

func (*Renderer) RenderGeometryRaw added in v0.4.11

func (renderer *Renderer) RenderGeometryRaw(texture *Texture, xy *float32, xy_stride int, color *Color, color_stride int, uv *float32, uv_stride int, num_vertices int,
	indices unsafe.Pointer, num_indices int, size_indices int,

) (err error)

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

func (*Renderer) RenderLogicalToWindow added in v0.4.11

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

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

func (*Renderer) RenderSetVSync added in v0.4.11

func (renderer *Renderer) RenderSetVSync(vsync bool) (err error)

RenderSetVSync toggles VSync of the given renderer. (https://wiki.libsdl.org/SDL_RenderSetVSync)

func (*Renderer) RenderTargetSupported

func (renderer *Renderer) RenderTargetSupported() bool

RenderTargetSupported reports whether a window supports the use of render targets. (https://wiki.libsdl.org/SDL_RenderTargetSupported)

func (*Renderer) RenderWindowToLogical added in v0.4.11

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

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

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

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

func (*Renderer) SetClipRect

func (renderer *Renderer) SetClipRect(rect *Rect) error

SetClipRect sets the clip rectangle for rendering on the specified target. (https://wiki.libsdl.org/SDL_RenderSetClipRect)

func (*Renderer) SetDrawBlendMode

func (renderer *Renderer) SetDrawBlendMode(bm BlendMode) error

SetDrawBlendMode sets the blend mode used for drawing operations (Fill and Line). (https://wiki.libsdl.org/SDL_SetRenderDrawBlendMode)

func (*Renderer) SetDrawColor

func (renderer *Renderer) SetDrawColor(r, g, b, a uint8) error

SetDrawColor sets the color used for drawing operations (Rect, Line and Clear). (https://wiki.libsdl.org/SDL_SetRenderDrawColor)

func (*Renderer) SetDrawColorArray

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

SetDrawColorArray is a custom variant of SetDrawColor.

func (*Renderer) SetIntegerScale added in v0.4.0

func (renderer *Renderer) SetIntegerScale(v bool) error

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

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

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

func (*Renderer) SetLogicalSize

func (renderer *Renderer) SetLogicalSize(w, h int32) error

SetLogicalSize sets a device independent resolution for rendering. (https://wiki.libsdl.org/SDL_RenderSetLogicalSize)

func (*Renderer) SetRenderTarget

func (renderer *Renderer) SetRenderTarget(texture *Texture) error

SetRenderTarget sets a texture as the current rendering target. (https://wiki.libsdl.org/SDL_SetRenderTarget)

func (*Renderer) SetScale

func (renderer *Renderer) SetScale(scaleX, scaleY float32) error

SetScale sets the drawing scale for rendering on the current target. (https://wiki.libsdl.org/SDL_RenderSetScale)

func (*Renderer) SetViewport

func (renderer *Renderer) SetViewport(rect *Rect) error

SetViewport sets the drawing area for rendering on the current target. (https://wiki.libsdl.org/SDL_RenderSetViewport)

type RendererFlags

type RendererFlags uint32

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

const (
	RENDERER_SOFTWARE      RendererFlags = C.SDL_RENDERER_SOFTWARE      // the renderer is a software fallback
	RENDERER_ACCELERATED   RendererFlags = C.SDL_RENDERER_ACCELERATED   // the renderer uses hardware acceleration
	RENDERER_PRESENTVSYNC  RendererFlags = C.SDL_RENDERER_PRESENTVSYNC  // present is synchronized with the refresh rate
	RENDERER_TARGETTEXTURE RendererFlags = C.SDL_RENDERER_TARGETTEXTURE // the renderer supports rendering to texture
)

type RendererFlip

type RendererFlip C.SDL_RendererFlip

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

const (
	FLIP_NONE       RendererFlip = C.SDL_FLIP_NONE       // do not flip
	FLIP_HORIZONTAL RendererFlip = C.SDL_FLIP_HORIZONTAL // flip horizontally
	FLIP_VERTICAL   RendererFlip = C.SDL_FLIP_VERTICAL   // flip vertically
)

type RendererInfo

type RendererInfo struct {
	Name string // the name of the renderer
	RendererInfoData
}

RendererInfo contains information on the capabilities of a render driver or the current render context. (https://wiki.libsdl.org/SDL_RendererInfo)

type RendererInfoData

type RendererInfoData struct {
	Flags             uint32    // a mask of supported renderer flags
	NumTextureFormats uint32    // the number of available texture formats
	TextureFormats    [16]int32 // the available texture formats
	MaxTextureWidth   int32     // the maximum texture width
	MaxTextureHeight  int32     // the maximum texture height
}

RendererInfoData contains information on the capabilities of a render driver or the current render context. (https://wiki.libsdl.org/SDL_RendererInfo)

type ScaleMode added in v0.4.11

type ScaleMode uint32
const (
	ScaleModeNearest ScaleMode = C.SDL_ScaleModeNearest // nearest pixel sampling
	ScaleModeLinear  ScaleMode = C.SDL_ScaleModeLinear  // linear filtering
	ScaleModeBest    ScaleMode = C.SDL_ScaleModeBest    // anisotropic filtering
)

The scaling mode for a texture.

type Scancode

type Scancode uint32

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

const (
	SCANCODE_UNKNOWN Scancode = C.SDL_SCANCODE_UNKNOWN // "" (no name, empty string)

	SCANCODE_A Scancode = C.SDL_SCANCODE_A // "A"
	SCANCODE_B Scancode = C.SDL_SCANCODE_B // "B"
	SCANCODE_C Scancode = C.SDL_SCANCODE_C // "C"
	SCANCODE_D Scancode = C.SDL_SCANCODE_D // "D"
	SCANCODE_E Scancode = C.SDL_SCANCODE_E // "E"
	SCANCODE_F Scancode = C.SDL_SCANCODE_F // "F"
	SCANCODE_G Scancode = C.SDL_SCANCODE_G // "G"
	SCANCODE_H Scancode = C.SDL_SCANCODE_H // "H"
	SCANCODE_I Scancode = C.SDL_SCANCODE_I // "I"
	SCANCODE_J Scancode = C.SDL_SCANCODE_J // "J"
	SCANCODE_K Scancode = C.SDL_SCANCODE_K // "K"
	SCANCODE_L Scancode = C.SDL_SCANCODE_L // "L"
	SCANCODE_M Scancode = C.SDL_SCANCODE_M // "M"
	SCANCODE_N Scancode = C.SDL_SCANCODE_N // "N"
	SCANCODE_O Scancode = C.SDL_SCANCODE_O // "O"
	SCANCODE_P Scancode = C.SDL_SCANCODE_P // "P"
	SCANCODE_Q Scancode = C.SDL_SCANCODE_Q // "Q"
	SCANCODE_R Scancode = C.SDL_SCANCODE_R // "R"
	SCANCODE_S Scancode = C.SDL_SCANCODE_S // "S"
	SCANCODE_T Scancode = C.SDL_SCANCODE_T // "T"
	SCANCODE_U Scancode = C.SDL_SCANCODE_U // "U"
	SCANCODE_V Scancode = C.SDL_SCANCODE_V // "V"
	SCANCODE_W Scancode = C.SDL_SCANCODE_W // "W"
	SCANCODE_X Scancode = C.SDL_SCANCODE_X // "X"
	SCANCODE_Y Scancode = C.SDL_SCANCODE_Y // "Y"
	SCANCODE_Z Scancode = C.SDL_SCANCODE_Z // "Z"

	SCANCODE_1 Scancode = C.SDL_SCANCODE_1 // "1"
	SCANCODE_2 Scancode = C.SDL_SCANCODE_2 // "2"
	SCANCODE_3 Scancode = C.SDL_SCANCODE_3 // "3"
	SCANCODE_4 Scancode = C.SDL_SCANCODE_4 // "4"
	SCANCODE_5 Scancode = C.SDL_SCANCODE_5 // "5"
	SCANCODE_6 Scancode = C.SDL_SCANCODE_6 // "6"
	SCANCODE_7 Scancode = C.SDL_SCANCODE_7 // "7"
	SCANCODE_8 Scancode = C.SDL_SCANCODE_8 // "8"
	SCANCODE_9 Scancode = C.SDL_SCANCODE_9 // "9"
	SCANCODE_0 Scancode = C.SDL_SCANCODE_0 // "0"

	SCANCODE_RETURN    Scancode = C.SDL_SCANCODE_RETURN    // "Return"
	SCANCODE_ESCAPE    Scancode = C.SDL_SCANCODE_ESCAPE    // "Escape" (the Esc key)
	SCANCODE_BACKSPACE Scancode = C.SDL_SCANCODE_BACKSPACE // "Backspace"
	SCANCODE_TAB       Scancode = C.SDL_SCANCODE_TAB       // "Tab" (the Tab key)
	SCANCODE_SPACE     Scancode = C.SDL_SCANCODE_SPACE     // "Space" (the Space Bar key(s))

	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    // "#" (ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I've seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate SDL_SCANCODE_BACKSLASH instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards.)
	SCANCODE_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     // "CapsLock"
	SCANCODE_F1           Scancode = C.SDL_SCANCODE_F1           // "F1"
	SCANCODE_F2           Scancode = C.SDL_SCANCODE_F2           // "F2"
	SCANCODE_F3           Scancode = C.SDL_SCANCODE_F3           // "F3"
	SCANCODE_F4           Scancode = C.SDL_SCANCODE_F4           // "F4"
	SCANCODE_F5           Scancode = C.SDL_SCANCODE_F5           // "F5"
	SCANCODE_F6           Scancode = C.SDL_SCANCODE_F6           // "F6"
	SCANCODE_F7           Scancode = C.SDL_SCANCODE_F7           // "F7"
	SCANCODE_F8           Scancode = C.SDL_SCANCODE_F8           // "F8"
	SCANCODE_F9           Scancode = C.SDL_SCANCODE_F9           // "F9"
	SCANCODE_F10          Scancode = C.SDL_SCANCODE_F10          // "F10"
	SCANCODE_F11          Scancode = C.SDL_SCANCODE_F11          // "F11"
	SCANCODE_F12          Scancode = C.SDL_SCANCODE_F12          // "F12"
	SCANCODE_PRINTSCREEN  Scancode = C.SDL_SCANCODE_PRINTSCREEN  // "PrintScreen"
	SCANCODE_SCROLLLOCK   Scancode = C.SDL_SCANCODE_SCROLLLOCK   // "ScrollLock"
	SCANCODE_PAUSE        Scancode = C.SDL_SCANCODE_PAUSE        // "Pause" (the Pause / Break key)
	SCANCODE_INSERT       Scancode = C.SDL_SCANCODE_INSERT       // "Insert" (insert on PC, help on some Mac keyboards (but does send code 73, not 117))
	SCANCODE_HOME         Scancode = C.SDL_SCANCODE_HOME         // "Home"
	SCANCODE_PAGEUP       Scancode = C.SDL_SCANCODE_PAGEUP       // "PageUp"
	SCANCODE_DELETE       Scancode = C.SDL_SCANCODE_DELETE       // "Delete"
	SCANCODE_END          Scancode = C.SDL_SCANCODE_END          // "End"
	SCANCODE_PAGEDOWN     Scancode = C.SDL_SCANCODE_PAGEDOWN     // "PageDown"
	SCANCODE_RIGHT        Scancode = C.SDL_SCANCODE_RIGHT        // "Right" (the Right arrow key (navigation keypad))
	SCANCODE_LEFT         Scancode = C.SDL_SCANCODE_LEFT         // "Left" (the Left arrow key (navigation keypad))
	SCANCODE_DOWN         Scancode = C.SDL_SCANCODE_DOWN         // "Down" (the Down arrow key (navigation keypad))
	SCANCODE_UP           Scancode = C.SDL_SCANCODE_UP           // "Up" (the Up arrow key (navigation keypad))

	SCANCODE_NUMLOCKCLEAR Scancode = C.SDL_SCANCODE_NUMLOCKCLEAR // "Numlock" (the Num Lock key (PC) / the Clear key (Mac))
	SCANCODE_KP_DIVIDE    Scancode = C.SDL_SCANCODE_KP_DIVIDE    // "Keypad /" (the / key (numeric keypad))
	SCANCODE_KP_MULTIPLY  Scancode = C.SDL_SCANCODE_KP_MULTIPLY  // "Keypad *" (the * key (numeric keypad))
	SCANCODE_KP_MINUS     Scancode = C.SDL_SCANCODE_KP_MINUS     // "Keypad -" (the - key (numeric keypad))
	SCANCODE_KP_PLUS      Scancode = C.SDL_SCANCODE_KP_PLUS      // "Keypad +" (the + key (numeric keypad))
	SCANCODE_KP_ENTER     Scancode = C.SDL_SCANCODE_KP_ENTER     // "Keypad Enter" (the Enter key (numeric keypad))
	SCANCODE_KP_1         Scancode = C.SDL_SCANCODE_KP_1         // "Keypad 1" (the 1 key (numeric keypad))
	SCANCODE_KP_2         Scancode = C.SDL_SCANCODE_KP_2         // "Keypad 2" (the 2 key (numeric keypad))
	SCANCODE_KP_3         Scancode = C.SDL_SCANCODE_KP_3         // "Keypad 3" (the 3 key (numeric keypad))
	SCANCODE_KP_4         Scancode = C.SDL_SCANCODE_KP_4         // "Keypad 4" (the 4 key (numeric keypad))
	SCANCODE_KP_5         Scancode = C.SDL_SCANCODE_KP_5         // "Keypad 5" (the 5 key (numeric keypad))
	SCANCODE_KP_6         Scancode = C.SDL_SCANCODE_KP_6         // "Keypad 6" (the 6 key (numeric keypad))
	SCANCODE_KP_7         Scancode = C.SDL_SCANCODE_KP_7         // "Keypad 7" (the 7 key (numeric keypad))
	SCANCODE_KP_8         Scancode = C.SDL_SCANCODE_KP_8         // "Keypad 8" (the 8 key (numeric keypad))
	SCANCODE_KP_9         Scancode = C.SDL_SCANCODE_KP_9         // "Keypad 9" (the 9 key (numeric keypad))
	SCANCODE_KP_0         Scancode = C.SDL_SCANCODE_KP_0         // "Keypad 0" (the 0 key (numeric keypad))
	SCANCODE_KP_PERIOD    Scancode = C.SDL_SCANCODE_KP_PERIOD    // "Keypad ." (the . key (numeric keypad))

	SCANCODE_NONUSBACKSLASH Scancode = C.SDL_SCANCODE_NONUSBACKSLASH // "" (no name, empty string; This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout.)
	SCANCODE_APPLICATION    Scancode = C.SDL_SCANCODE_APPLICATION    // "Application" (the Application / Compose / Context Menu (Windows) key)
	SCANCODE_POWER          Scancode = C.SDL_SCANCODE_POWER          // "Power" (The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key.)
	SCANCODE_KP_EQUALS      Scancode = C.SDL_SCANCODE_KP_EQUALS      // "Keypad =" (the = key (numeric keypad))
	SCANCODE_F13            Scancode = C.SDL_SCANCODE_F13            // "F13"
	SCANCODE_F14            Scancode = C.SDL_SCANCODE_F14            // "F14"
	SCANCODE_F15            Scancode = C.SDL_SCANCODE_F15            // "F15"
	SCANCODE_F16            Scancode = C.SDL_SCANCODE_F16            // "F16"
	SCANCODE_F17            Scancode = C.SDL_SCANCODE_F17            // "F17"
	SCANCODE_F18            Scancode = C.SDL_SCANCODE_F18            // "F18"
	SCANCODE_F19            Scancode = C.SDL_SCANCODE_F19            // "F19"
	SCANCODE_F20            Scancode = C.SDL_SCANCODE_F20            // "F20"
	SCANCODE_F21            Scancode = C.SDL_SCANCODE_F21            // "F21"
	SCANCODE_F22            Scancode = C.SDL_SCANCODE_F22            // "F22"
	SCANCODE_F23            Scancode = C.SDL_SCANCODE_F23            // "F23"
	SCANCODE_F24            Scancode = C.SDL_SCANCODE_F24            // "F24"
	SCANCODE_EXECUTE        Scancode = C.SDL_SCANCODE_EXECUTE        // "Execute"
	SCANCODE_HELP           Scancode = C.SDL_SCANCODE_HELP           // "Help"
	SCANCODE_MENU           Scancode = C.SDL_SCANCODE_MENU           // "Menu"
	SCANCODE_SELECT         Scancode = C.SDL_SCANCODE_SELECT         // "Select"
	SCANCODE_STOP           Scancode = C.SDL_SCANCODE_STOP           // "Stop"
	SCANCODE_AGAIN          Scancode = C.SDL_SCANCODE_AGAIN          // "Again" (the Again key (Redo))
	SCANCODE_UNDO           Scancode = C.SDL_SCANCODE_UNDO           // "Undo"
	SCANCODE_CUT            Scancode = C.SDL_SCANCODE_CUT            // "Cut"
	SCANCODE_COPY           Scancode = C.SDL_SCANCODE_COPY           // "Copy"
	SCANCODE_PASTE          Scancode = C.SDL_SCANCODE_PASTE          // "Paste"
	SCANCODE_FIND           Scancode = C.SDL_SCANCODE_FIND           // "Find"
	SCANCODE_MUTE           Scancode = C.SDL_SCANCODE_MUTE           // "Mute"
	SCANCODE_VOLUMEUP       Scancode = C.SDL_SCANCODE_VOLUMEUP       // "VolumeUp"
	SCANCODE_VOLUMEDOWN     Scancode = C.SDL_SCANCODE_VOLUMEDOWN     // "VolumeDown"
	SCANCODE_KP_COMMA       Scancode = C.SDL_SCANCODE_KP_COMMA       // "Keypad ," (the Comma key (numeric keypad))
	SCANCODE_KP_EQUALSAS400 Scancode = C.SDL_SCANCODE_KP_EQUALSAS400 // "Keypad = (AS400)" (the Equals AS400 key (numeric keypad))

	SCANCODE_INTERNATIONAL1 Scancode = C.SDL_SCANCODE_INTERNATIONAL1 // "" (no name, empty string; used on Asian keyboards, see footnotes in USB doc)
	SCANCODE_INTERNATIONAL2 Scancode = C.SDL_SCANCODE_INTERNATIONAL2 // "" (no name, empty string)
	SCANCODE_INTERNATIONAL3 Scancode = C.SDL_SCANCODE_INTERNATIONAL3 // "" (no name, empty string; Yen)
	SCANCODE_INTERNATIONAL4 Scancode = C.SDL_SCANCODE_INTERNATIONAL4 // "" (no name, empty string)
	SCANCODE_INTERNATIONAL5 Scancode = C.SDL_SCANCODE_INTERNATIONAL5 // "" (no name, empty string)
	SCANCODE_INTERNATIONAL6 Scancode = C.SDL_SCANCODE_INTERNATIONAL6 // "" (no name, empty string)
	SCANCODE_INTERNATIONAL7 Scancode = C.SDL_SCANCODE_INTERNATIONAL7 // "" (no name, empty string)
	SCANCODE_INTERNATIONAL8 Scancode = C.SDL_SCANCODE_INTERNATIONAL8 // "" (no name, empty string)
	SCANCODE_INTERNATIONAL9 Scancode = C.SDL_SCANCODE_INTERNATIONAL9 // "" (no name, empty string)
	SCANCODE_LANG1          Scancode = C.SDL_SCANCODE_LANG1          // "" (no name, empty string; Hangul/English toggle)
	SCANCODE_LANG2          Scancode = C.SDL_SCANCODE_LANG2          // "" (no name, empty string; Hanja conversion)
	SCANCODE_LANG3          Scancode = C.SDL_SCANCODE_LANG3          // "" (no name, empty string; Katakana)
	SCANCODE_LANG4          Scancode = C.SDL_SCANCODE_LANG4          // "" (no name, empty string; Hiragana)
	SCANCODE_LANG5          Scancode = C.SDL_SCANCODE_LANG5          // "" (no name, empty string; Zenkaku/Hankaku)
	SCANCODE_LANG6          Scancode = C.SDL_SCANCODE_LANG6          // "" (no name, empty string; reserved)
	SCANCODE_LANG7          Scancode = C.SDL_SCANCODE_LANG7          // "" (no name, empty string; reserved)
	SCANCODE_LANG8          Scancode = C.SDL_SCANCODE_LANG8          // "" (no name, empty string; reserved)
	SCANCODE_LANG9          Scancode = C.SDL_SCANCODE_LANG9          // "" (no name, empty string; reserved)

	SCANCODE_ALTERASE   Scancode = C.SDL_SCANCODE_ALTERASE   // "AltErase" (Erase-Eaze)
	SCANCODE_SYSREQ     Scancode = C.SDL_SCANCODE_SYSREQ     // "SysReq" (the SysReq key)
	SCANCODE_CANCEL     Scancode = C.SDL_SCANCODE_CANCEL     // "Cancel"
	SCANCODE_CLEAR      Scancode = C.SDL_SCANCODE_CLEAR      // "Clear"
	SCANCODE_PRIOR      Scancode = C.SDL_SCANCODE_PRIOR      // "Prior"
	SCANCODE_RETURN2    Scancode = C.SDL_SCANCODE_RETURN2    // "Return"
	SCANCODE_SEPARATOR  Scancode = C.SDL_SCANCODE_SEPARATOR  // "Separator"
	SCANCODE_OUT        Scancode = C.SDL_SCANCODE_OUT        // "Out"
	SCANCODE_OPER       Scancode = C.SDL_SCANCODE_OPER       // "Oper"
	SCANCODE_CLEARAGAIN Scancode = C.SDL_SCANCODE_CLEARAGAIN // "Clear / Again"
	SCANCODE_CRSEL      Scancode = C.SDL_SCANCODE_CRSEL      // "CrSel"
	SCANCODE_EXSEL      Scancode = C.SDL_SCANCODE_EXSEL      // "ExSel"

	SCANCODE_KP_00              Scancode = C.SDL_SCANCODE_KP_00              // "Keypad 00" (the 00 key (numeric keypad))
	SCANCODE_KP_000             Scancode = C.SDL_SCANCODE_KP_000             // "Keypad 000" (the 000 key (numeric keypad))
	SCANCODE_THOUSANDSSEPARATOR Scancode = C.SDL_SCANCODE_THOUSANDSSEPARATOR // "ThousandsSeparator" (the Thousands Separator key)
	SCANCODE_DECIMALSEPARATOR   Scancode = C.SDL_SCANCODE_DECIMALSEPARATOR   // "DecimalSeparator" (the Decimal Separator key)
	SCANCODE_CURRENCYUNIT       Scancode = C.SDL_SCANCODE_CURRENCYUNIT       // "CurrencyUnit" (the Currency Unit key)
	SCANCODE_CURRENCYSUBUNIT    Scancode = C.SDL_SCANCODE_CURRENCYSUBUNIT    // "CurrencySubUnit" (the Currency Subunit key)
	SCANCODE_KP_LEFTPAREN       Scancode = C.SDL_SCANCODE_KP_LEFTPAREN       // "Keypad (" (the Left Parenthesis key (numeric keypad))
	SCANCODE_KP_RIGHTPAREN      Scancode = C.SDL_SCANCODE_KP_RIGHTPAREN      // "Keypad )" (the Right Parenthesis key (numeric keypad))
	SCANCODE_KP_LEFTBRACE       Scancode = C.SDL_SCANCODE_KP_LEFTBRACE       // "Keypad {" (the Left Brace key (numeric keypad))
	SCANCODE_KP_RIGHTBRACE      Scancode = C.SDL_SCANCODE_KP_RIGHTBRACE      // "Keypad }" (the Right Brace key (numeric keypad))
	SCANCODE_KP_TAB             Scancode = C.SDL_SCANCODE_KP_TAB             // "Keypad Tab" (the Tab key (numeric keypad))
	SCANCODE_KP_BACKSPACE       Scancode = C.SDL_SCANCODE_KP_BACKSPACE       // "Keypad Backspace" (the Backspace key (numeric keypad))
	SCANCODE_KP_A               Scancode = C.SDL_SCANCODE_KP_A               // "Keypad A" (the A key (numeric keypad))
	SCANCODE_KP_B               Scancode = C.SDL_SCANCODE_KP_B               // "Keypad B" (the B key (numeric keypad))
	SCANCODE_KP_C               Scancode = C.SDL_SCANCODE_KP_C               // "Keypad C" (the C key (numeric keypad))
	SCANCODE_KP_D               Scancode = C.SDL_SCANCODE_KP_D               // "Keypad D" (the D key (numeric keypad))
	SCANCODE_KP_E               Scancode = C.SDL_SCANCODE_KP_E               // "Keypad E" (the E key (numeric keypad))
	SCANCODE_KP_F               Scancode = C.SDL_SCANCODE_KP_F               // "Keypad F" (the F key (numeric keypad))
	SCANCODE_KP_XOR             Scancode = C.SDL_SCANCODE_KP_XOR             // "Keypad XOR" (the XOR key (numeric keypad))
	SCANCODE_KP_POWER           Scancode = C.SDL_SCANCODE_KP_POWER           // "Keypad ^" (the Power key (numeric keypad))
	SCANCODE_KP_PERCENT         Scancode = C.SDL_SCANCODE_KP_PERCENT         // "Keypad %" (the Percent key (numeric keypad))
	SCANCODE_KP_LESS            Scancode = C.SDL_SCANCODE_KP_LESS            // "Keypad <" (the Less key (numeric keypad))
	SCANCODE_KP_GREATER         Scancode = C.SDL_SCANCODE_KP_GREATER         // "Keypad >" (the Greater key (numeric keypad))
	SCANCODE_KP_AMPERSAND       Scancode = C.SDL_SCANCODE_KP_AMPERSAND       // "Keypad &" (the & key (numeric keypad))
	SCANCODE_KP_DBLAMPERSAND    Scancode = C.SDL_SCANCODE_KP_DBLAMPERSAND    // "Keypad &&" (the && key (numeric keypad))
	SCANCODE_KP_VERTICALBAR     Scancode = C.SDL_SCANCODE_KP_VERTICALBAR     // "Keypad |" (the | key (numeric keypad))
	SCANCODE_KP_DBLVERTICALBAR  Scancode = C.SDL_SCANCODE_KP_DBLVERTICALBAR  // "Keypad ||" (the || key (numeric keypad))
	SCANCODE_KP_COLON           Scancode = C.SDL_SCANCODE_KP_COLON           // "Keypad :" (the : key (numeric keypad))
	SCANCODE_KP_HASH            Scancode = C.SDL_SCANCODE_KP_HASH            // "Keypad #" (the # key (numeric keypad))
	SCANCODE_KP_SPACE           Scancode = C.SDL_SCANCODE_KP_SPACE           // "Keypad Space" (the Space key (numeric keypad))
	SCANCODE_KP_AT              Scancode = C.SDL_SCANCODE_KP_AT              // "Keypad @" (the @ key (numeric keypad))
	SCANCODE_KP_EXCLAM          Scancode = C.SDL_SCANCODE_KP_EXCLAM          // "Keypad !" (the ! key (numeric keypad))
	SCANCODE_KP_MEMSTORE        Scancode = C.SDL_SCANCODE_KP_MEMSTORE        // "Keypad MemStore" (the Mem Store key (numeric keypad))
	SCANCODE_KP_MEMRECALL       Scancode = C.SDL_SCANCODE_KP_MEMRECALL       // "Keypad MemRecall" (the Mem Recall key (numeric keypad))
	SCANCODE_KP_MEMCLEAR        Scancode = C.SDL_SCANCODE_KP_MEMCLEAR        // "Keypad MemClear" (the Mem Clear key (numeric keypad))
	SCANCODE_KP_MEMADD          Scancode = C.SDL_SCANCODE_KP_MEMADD          // "Keypad MemAdd" (the Mem Add key (numeric keypad))
	SCANCODE_KP_MEMSUBTRACT     Scancode = C.SDL_SCANCODE_KP_MEMSUBTRACT     // "Keypad MemSubtract" (the Mem Subtract key (numeric keypad))
	SCANCODE_KP_MEMMULTIPLY     Scancode = C.SDL_SCANCODE_KP_MEMMULTIPLY     // "Keypad MemMultiply" (the Mem Multiply key (numeric keypad))
	SCANCODE_KP_MEMDIVIDE       Scancode = C.SDL_SCANCODE_KP_MEMDIVIDE       // "Keypad MemDivide" (the Mem Divide key (numeric keypad))
	SCANCODE_KP_PLUSMINUS       Scancode = C.SDL_SCANCODE_KP_PLUSMINUS       // "Keypad +/-" (the +/- key (numeric keypad))
	SCANCODE_KP_CLEAR           Scancode = C.SDL_SCANCODE_KP_CLEAR           // "Keypad Clear" (the Clear key (numeric keypad))
	SCANCODE_KP_CLEARENTRY      Scancode = C.SDL_SCANCODE_KP_CLEARENTRY      // "Keypad ClearEntry" (the Clear Entry key (numeric keypad))
	SCANCODE_KP_BINARY          Scancode = C.SDL_SCANCODE_KP_BINARY          // "Keypad Binary" (the Binary key (numeric keypad))
	SCANCODE_KP_OCTAL           Scancode = C.SDL_SCANCODE_KP_OCTAL           // "Keypad Octal" (the Octal key (numeric keypad))
	SCANCODE_KP_DECIMAL         Scancode = C.SDL_SCANCODE_KP_DECIMAL         // "Keypad Decimal" (the Decimal key (numeric keypad))
	SCANCODE_KP_HEXADECIMAL     Scancode = C.SDL_SCANCODE_KP_HEXADECIMAL     // "Keypad Hexadecimal" (the Hexadecimal key (numeric keypad))

	SCANCODE_LCTRL          Scancode = C.SDL_SCANCODE_LCTRL          // "Left Ctrl"
	SCANCODE_LSHIFT         Scancode = C.SDL_SCANCODE_LSHIFT         // "Left Shift"
	SCANCODE_LALT           Scancode = C.SDL_SCANCODE_LALT           // "Left Alt" (alt, option)
	SCANCODE_LGUI           Scancode = C.SDL_SCANCODE_LGUI           // "Left GUI" (windows, command (apple), meta)
	SCANCODE_RCTRL          Scancode = C.SDL_SCANCODE_RCTRL          // "Right Ctrl"
	SCANCODE_RSHIFT         Scancode = C.SDL_SCANCODE_RSHIFT         // "Right Shift"
	SCANCODE_RALT           Scancode = C.SDL_SCANCODE_RALT           // "Right Alt" (alt gr, option)
	SCANCODE_RGUI           Scancode = C.SDL_SCANCODE_RGUI           // "Right GUI" (windows, command (apple), meta)
	SCANCODE_MODE           Scancode = C.SDL_SCANCODE_MODE           // "ModeSwitch" (I'm not sure if this is really not covered by any of the above, but since there's a special KMOD_MODE for it I'm adding it here)
	SCANCODE_AUDIONEXT      Scancode = C.SDL_SCANCODE_AUDIONEXT      // "AudioNext" (the Next Track media key)
	SCANCODE_AUDIOPREV      Scancode = C.SDL_SCANCODE_AUDIOPREV      // "AudioPrev" (the Previous Track media key)
	SCANCODE_AUDIOSTOP      Scancode = C.SDL_SCANCODE_AUDIOSTOP      // "AudioStop" (the Stop media key)
	SCANCODE_AUDIOPLAY      Scancode = C.SDL_SCANCODE_AUDIOPLAY      // "AudioPlay" (the Play media key)
	SCANCODE_AUDIOMUTE      Scancode = C.SDL_SCANCODE_AUDIOMUTE      // "AudioMute" (the Mute volume key)
	SCANCODE_MEDIASELECT    Scancode = C.SDL_SCANCODE_MEDIASELECT    // "MediaSelect" (the Media Select key)
	SCANCODE_WWW            Scancode = C.SDL_SCANCODE_WWW            // "WWW" (the WWW/World Wide Web key)
	SCANCODE_MAIL           Scancode = C.SDL_SCANCODE_MAIL           // "Mail" (the Mail/eMail key)
	SCANCODE_CALCULATOR     Scancode = C.SDL_SCANCODE_CALCULATOR     // "Calculator" (the Calculator key)
	SCANCODE_COMPUTER       Scancode = C.SDL_SCANCODE_COMPUTER       // "Computer" (the My Computer key)
	SCANCODE_AC_SEARCH      Scancode = C.SDL_SCANCODE_AC_SEARCH      // "AC Search" (the Search key (application control keypad))
	SCANCODE_AC_HOME        Scancode = C.SDL_SCANCODE_AC_HOME        // "AC Home" (the Home key (application control keypad))
	SCANCODE_AC_BACK        Scancode = C.SDL_SCANCODE_AC_BACK        // "AC Back" (the Back key (application control keypad))
	SCANCODE_AC_FORWARD     Scancode = C.SDL_SCANCODE_AC_FORWARD     // "AC Forward" (the Forward key (application control keypad))
	SCANCODE_AC_STOP        Scancode = C.SDL_SCANCODE_AC_STOP        // "AC Stop" (the Stop key (application control keypad))
	SCANCODE_AC_REFRESH     Scancode = C.SDL_SCANCODE_AC_REFRESH     // "AC Refresh" (the Refresh key (application control keypad))
	SCANCODE_AC_BOOKMARKS   Scancode = C.SDL_SCANCODE_AC_BOOKMARKS   // "AC Bookmarks" (the Bookmarks key (application control keypad))
	SCANCODE_BRIGHTNESSDOWN Scancode = C.SDL_SCANCODE_BRIGHTNESSDOWN // "BrightnessDown" (the Brightness Down key)
	SCANCODE_BRIGHTNESSUP   Scancode = C.SDL_SCANCODE_BRIGHTNESSUP   // "BrightnessUp" (the Brightness Up key)
	SCANCODE_DISPLAYSWITCH  Scancode = C.SDL_SCANCODE_DISPLAYSWITCH  // "DisplaySwitch" (display mirroring/dual display switch, video mode switch)
	SCANCODE_KBDILLUMTOGGLE Scancode = C.SDL_SCANCODE_KBDILLUMTOGGLE // "KBDIllumToggle" (the Keyboard Illumination Toggle key)
	SCANCODE_KBDILLUMDOWN   Scancode = C.SDL_SCANCODE_KBDILLUMDOWN   // "KBDIllumDown" (the Keyboard Illumination Down key)
	SCANCODE_KBDILLUMUP     Scancode = C.SDL_SCANCODE_KBDILLUMUP     // "KBDIllumUp" (the Keyboard Illumination Up key)
	SCANCODE_EJECT          Scancode = C.SDL_SCANCODE_EJECT          // "Eject" (the Eject key)
	SCANCODE_SLEEP          Scancode = C.SDL_SCANCODE_SLEEP          // "Sleep" (the Sleep key)
	SCANCODE_APP1           Scancode = C.SDL_SCANCODE_APP1
	SCANCODE_APP2           Scancode = C.SDL_SCANCODE_APP2
	NUM_SCANCODES           Scancode = C.SDL_NUM_SCANCODES
)

func GetScancodeFromKey

func GetScancodeFromKey(code Keycode) Scancode

GetScancodeFromKey returns the scancode corresponding to the given key code according to the current keyboard layout. (https://wiki.libsdl.org/SDL_GetScancodeFromKey)

func GetScancodeFromName

func GetScancodeFromName(name string) Scancode

GetScancodeFromName returns a scancode from a human-readable name. (https://wiki.libsdl.org/SDL_GetScancodeFromName)

type Sem

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

Sem is the SDL semaphore structure.

func CreateSemaphore

func CreateSemaphore(initialValue uint32) (*Sem, error)

CreateSemaphore creates a semaphore. (https://wiki.libsdl.org/SDL_CreateSemaphore)

func (*Sem) Destroy added in v0.3.0

func (sem *Sem) Destroy()

Destroy destroys a semaphore. (https://wiki.libsdl.org/SDL_DestroySemaphore)

func (*Sem) Post added in v0.3.0

func (sem *Sem) Post() error

Post atomically increments a semaphore's value and wake waiting threads. (https://wiki.libsdl.org/SDL_SemPost)

func (*Sem) TryWait added in v0.3.0

func (sem *Sem) TryWait() error

TryWait sees if a semaphore has a positive value and decrement it if it does. (https://wiki.libsdl.org/SDL_SemTryWait)

func (*Sem) Value added in v0.3.0

func (sem *Sem) Value() uint32

Value returns the current value of a semaphore. (https://wiki.libsdl.org/SDL_SemValue)

func (*Sem) Wait added in v0.3.0

func (sem *Sem) Wait() error

Wait waits until a semaphore has a positive value and then decrements it. (https://wiki.libsdl.org/SDL_SemWait)

func (*Sem) WaitTimeout added in v0.3.0

func (sem *Sem) WaitTimeout(ms uint32) error

WaitTimeout waits until a semaphore has a positive value and then decrements it. (https://wiki.libsdl.org/SDL_SemWaitTimeout)

type Sensor added in v0.4.0

type Sensor C.SDL_Sensor

func SensorFromInstanceID added in v0.4.0

func SensorFromInstanceID(id SensorID) (sensor *Sensor)

SensorFromInstanceID returns the Sensor associated with an instance id. (https://wiki.libsdl.org/SDL_SensorFromInstanceID)

func SensorOpen added in v0.4.0

func SensorOpen(deviceIndex int) (sensor *Sensor)

SensorOpen opens a sensor for use.

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

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

func (*Sensor) Close added in v0.4.0

func (sensor *Sensor) Close()

Close closes a sensor previously opened with SensorOpen() (https://wiki.libsdl.org/SDL_SensorClose)

func (*Sensor) GetData added in v0.4.0

func (sensor *Sensor) GetData(data []float32) (err error)

GetData gets the current state of an opened sensor.

The number of values and interpretation of the data is sensor dependent. (https://wiki.libsdl.org/SDL_SensorGetData)

func (*Sensor) GetDataWithTimestamp

func (sensor *Sensor) GetDataWithTimestamp(timestamp *uint64, data []float32) (err error)

GetDataWithTimestamp gets the current state of an opened sensor with the timestamp of the last update.

The number of values and interpretation of the data is sensor dependent. (https://wiki.libsdl.org/SDL_SensorGetDataWithTimestamp)

func (*Sensor) GetInstanceID added in v0.4.0

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

GetInstanceID gets the instance ID of a sensor.

This can be called before any sensors are opened.

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

func (*Sensor) GetName added in v0.4.0

func (sensor *Sensor) GetName() (name string)

GetName gets the implementation dependent name of a sensor.

Returns the sensor name, or empty string if the sensor is nil. (https://wiki.libsdl.org/SDL_SensorGetName)

func (*Sensor) GetNonPortableType added in v0.4.0

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

GetNonPortableType gets the platform dependent type of a sensor.

This can be called before any sensors are opened.

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

func (*Sensor) GetType added in v0.4.0

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

GetType gets the type of a sensor.

This can be called before any sensors are opened.

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

type SensorEvent added in v0.4.0

type SensorEvent struct {
	Type        EventType  // SDL_SENSORUPDATE
	Timestamp   uint32     // In milliseconds, populated using SDL_GetTicks()
	Which       int32      // The instance ID of the sensor
	Data        [6]float32 // Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData()
	TimestampUs uint64     // The timestamp of the sensor reading in microseconds, if the hardware provides this information.
}

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

func (SensorEvent) GetTimestamp added in v0.4.0

func (e SensorEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (SensorEvent) GetType added in v0.4.0

func (e SensorEvent) GetType() EventType

GetType returns the event type.

type SensorID added in v0.4.0

type SensorID int32

func SensorGetDeviceInstanceID added in v0.4.0

func SensorGetDeviceInstanceID(deviceIndex int) (id SensorID)

SensorGetDeviceInstanceID gets the instance ID of a sensor.

This can be called before any sensors are opened.

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

type SensorType added in v0.4.0

type SensorType int
const (
	SENSOR_INVALID SensorType = C.SDL_SENSOR_INVALID // Returned for an invalid sensor
	SENSOR_UNKNOWN SensorType = C.SDL_SENSOR_UNKNOWN // Unknown sensor type
	SENSOR_ACCEL   SensorType = C.SDL_SENSOR_ACCEL   // Accelerometer
	SENSOR_GYRO    SensorType = C.SDL_SENSOR_GYRO    // Gyroscope
)

The different sensors defined by SDL

Additional sensors may be available, using platform dependent semantics.

Here are the additional Android sensors: https://developer.android.com/reference/android/hardware/SensorEvent.html#values

func SensorGetDeviceType added in v0.4.0

func SensorGetDeviceType(deviceIndex int) (typ SensorType)
SensorGetDeviceType gets the type of a sensor.

This can be called before any sensors are opened.

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

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

type ShapeModeBinarizeAlpha added in v0.4.31

type ShapeModeBinarizeAlpha struct {
	Cutoff uint8
}

func (ShapeModeBinarizeAlpha) Mode added in v0.4.31

type ShapeModeColorKey added in v0.4.31

type ShapeModeColorKey struct {
	Color Color
}

func (ShapeModeColorKey) Mode added in v0.4.31

type ShapeModeDefault added in v0.4.31

type ShapeModeDefault struct{}

func (ShapeModeDefault) Mode added in v0.4.31

type ShapeModeReverseBinarizeAlpha added in v0.4.31

type ShapeModeReverseBinarizeAlpha struct {
	Cutoff uint8
}

func (ShapeModeReverseBinarizeAlpha) Mode added in v0.4.31

type SharedObject

type SharedObject uintptr

SharedObject is a pointer to the object handle.

func LoadObject

func LoadObject(sofile string) SharedObject

LoadObject dynamically loads a shared object and returns a pointer to the object handle. (https://wiki.libsdl.org/SDL_LoadObject)

func (SharedObject) LoadFunction

func (handle SharedObject) LoadFunction(name string) unsafe.Pointer

LoadFunction returns a pointer to the named function from the shared object. (https://wiki.libsdl.org/SDL_LoadFunction)

func (SharedObject) Unload

func (handle SharedObject) Unload()

Unload unloads a shared object from memory. (https://wiki.libsdl.org/SDL_UnloadObject)

type Surface

type Surface struct {
	Format *PixelFormat // the format of the pixels stored in the surface (read-only) (https://wiki.libsdl.org/SDL_PixelFormat)
	W      int32        // the width in pixels (read-only)
	H      int32        // the height in pixels (read-only)
	Pitch  int32        // the length of a row of pixels in bytes (read-only)

	UserData unsafe.Pointer // an arbitrary pointer you can set

	ClipRect Rect // a Rect structure used to clip blits to the surface which can be set by SetClipRect() (read-only)

	RefCount int32 // reference count that can be incremented by the application
	// contains filtered or unexported fields
}

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

func CreateRGBSurface

func CreateRGBSurface(flags uint32, width, height, depth int32, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error)

CreateRGBSurface allocates a new RGB surface. (https://wiki.libsdl.org/SDL_CreateRGBSurface)

func CreateRGBSurfaceFrom

func CreateRGBSurfaceFrom(pixels unsafe.Pointer, width, height int32, depth, pitch int, Rmask, Gmask, Bmask, Amask uint32) (*Surface, error)

CreateRGBSurfaceFrom allocate a new RGB surface with existing pixel data. (https://wiki.libsdl.org/SDL_CreateRGBSurfaceFrom)

func CreateRGBSurfaceWithFormat added in v0.3.0

func CreateRGBSurfaceWithFormat(flags uint32, width, height, depth int32, format uint32) (*Surface, error)

CreateRGBSurfaceWithFormat allocates an RGB surface. (https://wiki.libsdl.org/SDL_CreateRGBSurfaceWithFormat)

func CreateRGBSurfaceWithFormatFrom added in v0.3.0

func CreateRGBSurfaceWithFormatFrom(pixels unsafe.Pointer, width, height, depth, pitch int32, format uint32) (*Surface, error)

CreateRGBSurfaceWithFormatFrom allocates an RGB surface from provided pixel data. (https://wiki.libsdl.org/SDL_CreateRGBSurfaceWithFormatFrom)

func LoadBMP

func LoadBMP(file string) (*Surface, error)

LoadBMP loads a surface from a BMP file. (https://wiki.libsdl.org/SDL_LoadBMP)

func LoadBMPRW added in v0.3.0

func LoadBMPRW(src *RWops, freeSrc bool) (*Surface, error)

LoadBMPRW loads a BMP image from a seekable SDL data stream (memory or file). (https://wiki.libsdl.org/SDL_LoadBMP_RW)

func (*Surface) At added in v0.4.0

func (surface *Surface) At(x, y int) color.Color

At returns the pixel color at (x, y)

func (*Surface) Blit

func (surface *Surface) Blit(srcRect *Rect, dst *Surface, dstRect *Rect) error

Blit performs a fast surface copy to a destination surface. (https://wiki.libsdl.org/SDL_BlitSurface)

func (*Surface) BlitScaled

func (surface *Surface) BlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error

BlitScaled performs a scaled surface copy to a destination surface. (https://wiki.libsdl.org/SDL_BlitScaled)

func (*Surface) Bounds added in v0.4.0

func (surface *Surface) Bounds() image.Rectangle

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

func (*Surface) BytesPerPixel

func (surface *Surface) BytesPerPixel() int

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

func (*Surface) ColorModel added in v0.4.0

func (surface *Surface) ColorModel() color.Model

ColorModel returns the color model used by this Surface.

func (*Surface) Convert

func (surface *Surface) Convert(fmt *PixelFormat, flags uint32) (*Surface, error)

Convert copies the existing surface into a new one that is optimized for blitting to a surface of a specified pixel format. (https://wiki.libsdl.org/SDL_ConvertSurface)

func (*Surface) ConvertFormat

func (surface *Surface) ConvertFormat(pixelFormat uint32, flags uint32) (*Surface, error)

ConvertFormat copies the existing surface to a new surface of the specified format. (https://wiki.libsdl.org/SDL_ConvertSurfaceFormat)

func (*Surface) Data

func (surface *Surface) Data() unsafe.Pointer

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

func (*Surface) Duplicate added in v0.4.0

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

Duplicate creates a new surface identical to the existing surface

func (*Surface) FillRect

func (surface *Surface) FillRect(rect *Rect, color uint32) error

FillRect performs a fast fill of a rectangle with a specific color. (https://wiki.libsdl.org/SDL_FillRect)

func (*Surface) FillRects

func (surface *Surface) FillRects(rects []Rect, color uint32) error

FillRects performs a fast fill of a set of rectangles with a specific color. (https://wiki.libsdl.org/SDL_FillRects)

func (*Surface) Free

func (surface *Surface) Free()

Free frees the RGB surface. (https://wiki.libsdl.org/SDL_FreeSurface)

func (*Surface) GetAlphaMod

func (surface *Surface) GetAlphaMod() (alpha uint8, err error)

GetAlphaMod returns the additional alpha value used in blit operations. (https://wiki.libsdl.org/SDL_GetSurfaceAlphaMod)

func (*Surface) GetBlendMode

func (surface *Surface) GetBlendMode() (bm BlendMode, err error)

GetBlendMode returns the blend mode used for blit operations. (https://wiki.libsdl.org/SDL_GetSurfaceBlendMode)

func (*Surface) GetClipRect

func (surface *Surface) GetClipRect(rect *Rect)

GetClipRect returns the clipping rectangle for a surface. (https://wiki.libsdl.org/SDL_GetClipRect)

func (*Surface) GetColorKey

func (surface *Surface) GetColorKey() (key uint32, err error)

GetColorKey returns the color key (transparent pixel) for the surface. (https://wiki.libsdl.org/SDL_GetColorKey)

func (*Surface) GetColorMod

func (surface *Surface) GetColorMod() (r, g, b uint8, err error)

GetColorMod returns the additional color value multiplied into blit operations. (https://wiki.libsdl.org/SDL_GetSurfaceColorMod)

func (*Surface) HasColorKey added in v0.4.0

func (surface *Surface) HasColorKey() bool

HasColorKey returns the color key (transparent pixel) for the surface. (https://wiki.libsdl.org/SDL_HasColorKey)

func (*Surface) HasRLE

func (surface *Surface) HasRLE() bool

HasRLE returns whether the surface is RLE enabled. (https://wiki.libsdl.org/SDL_HasSurfaceRLE)

func (*Surface) Lock

func (surface *Surface) Lock() error

Lock sets up the surface for directly accessing the pixels. (https://wiki.libsdl.org/SDL_LockSurface)

func (*Surface) LowerBlit

func (surface *Surface) LowerBlit(srcRect *Rect, dst *Surface, dstRect *Rect) error

LowerBlit performs low-level surface blitting only. (https://wiki.libsdl.org/SDL_LowerBlit)

func (*Surface) LowerBlitScaled

func (surface *Surface) LowerBlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error

LowerBlitScaled performs low-level surface scaled blitting only. (https://wiki.libsdl.org/SDL_LowerBlitScaled)

func (*Surface) MustLock

func (surface *Surface) MustLock() bool

MustLock reports whether the surface must be locked for access. (https://wiki.libsdl.org/SDL_MUSTLOCK)

func (*Surface) PixelNum

func (surface *Surface) PixelNum() int

PixelNum returns the number of pixels stored in the surface.

func (*Surface) Pixels

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

Pixels returns the actual pixel data of the surface.

func (*Surface) SaveBMP

func (surface *Surface) SaveBMP(file string) error

SaveBMP saves the surface to a BMP file. (https://wiki.libsdl.org/SDL_SaveBMP)

func (*Surface) SaveBMPRW added in v0.3.0

func (surface *Surface) SaveBMPRW(dst *RWops, freeDst bool) error

SaveBMPRW save the surface to a seekable SDL data stream (memory or file) in BMP format. (https://wiki.libsdl.org/SDL_SaveBMP_RW)

func (*Surface) Set added in v0.4.0

func (surface *Surface) Set(x, y int, c color.Color)

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

func (*Surface) SetAlphaMod

func (surface *Surface) SetAlphaMod(alpha uint8) error

SetAlphaMod sets an additional alpha value used in blit operations. (https://wiki.libsdl.org/SDL_SetSurfaceAlphaMod)

func (*Surface) SetBlendMode

func (surface *Surface) SetBlendMode(bm BlendMode) error

SetBlendMode sets the blend mode used for blit operations. (https://wiki.libsdl.org/SDL_SetSurfaceBlendMode)

func (*Surface) SetClipRect

func (surface *Surface) SetClipRect(rect *Rect) bool

SetClipRect sets the clipping rectangle for the surface (https://wiki.libsdl.org/SDL_SetClipRect)

func (*Surface) SetColorKey

func (surface *Surface) SetColorKey(flag bool, key uint32) error

SetColorKey sets the color key (transparent pixel) in the surface. (https://wiki.libsdl.org/SDL_SetColorKey)

func (*Surface) SetColorMod

func (surface *Surface) SetColorMod(r, g, b uint8) error

SetColorMod sets an additional color value multiplied into blit operations. (https://wiki.libsdl.org/SDL_SetSurfaceColorMod)

func (*Surface) SetPalette

func (surface *Surface) SetPalette(palette *Palette) error

SetPalette sets the palette used by the surface. (https://wiki.libsdl.org/SDL_SetSurfacePalette)

func (*Surface) SetRLE

func (surface *Surface) SetRLE(flag bool) error

SetRLE sets the RLE acceleration hint for the surface. (https://wiki.libsdl.org/SDL_SetSurfaceRLE)

func (*Surface) SoftStretch

func (surface *Surface) SoftStretch(srcRect *Rect, dst *Surface, dstRect *Rect) error

SoftStretch has been replaced by BlitScaled(). (https://wiki.libsdl.org/SDL_SoftStretch)

func (*Surface) SoftStretchLinear added in v0.4.11

func (surface *Surface) SoftStretchLinear(srcRect *Rect, dst *Surface, dstRect *Rect) (err error)

SoftStretchLinear performs bilinear scaling between two surfaces of the same format, 32BPP. (https://wiki.libsdl.org/SDL_SoftStretchLinear)

func (*Surface) Unlock

func (surface *Surface) Unlock()

Unlock releases the surface after directly accessing the pixels. (https://wiki.libsdl.org/SDL_UnlockSurface)

func (*Surface) UpperBlit

func (surface *Surface) UpperBlit(srcRect *Rect, dst *Surface, dstRect *Rect) error

UpperBlit has been replaced by Blit(). (https://wiki.libsdl.org/SDL_UpperBlit)

func (*Surface) UpperBlitScaled

func (surface *Surface) UpperBlitScaled(srcRect *Rect, dst *Surface, dstRect *Rect) error

UpperBlitScaled has been replaced by BlitScaled(). (https://wiki.libsdl.org/SDL_UpperBlitScaled)

type SysWMEvent

type SysWMEvent struct {
	Type      EventType // SYSWMEVENT
	Timestamp uint32    // timestamp of the event
	Msg       *SysWMmsg // driver dependent data, defined in SDL_syswm.h
}

SysWMEvent contains a video driver dependent system event. (https://wiki.libsdl.org/SDL_SysWMEvent)

func (SysWMEvent) GetTimestamp added in v0.3.0

func (e SysWMEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (SysWMEvent) GetType added in v0.3.0

func (e SysWMEvent) GetType() EventType

GetType returns the event type.

type SysWMInfo

type SysWMInfo struct {
	Version   Version   // a Version structure that contains the current SDL version
	Subsystem SysWmType // the windowing system type
	// contains filtered or unexported fields
}

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

func (*SysWMInfo) GetCocoaInfo

func (info *SysWMInfo) GetCocoaInfo() *CocoaInfo

GetCocoaInfo returns Apple Mac OS X window information.

func (*SysWMInfo) GetDFBInfo

func (info *SysWMInfo) GetDFBInfo() *DFBInfo

GetDFBInfo returns DirectFB window information.

func (*SysWMInfo) GetUIKitInfo

func (info *SysWMInfo) GetUIKitInfo() *UIKitInfo

GetUIKitInfo returns Apple iOS window information.

func (*SysWMInfo) GetWindowsInfo

func (info *SysWMInfo) GetWindowsInfo() *WindowsInfo

GetWindowsInfo returns Microsoft Windows window information.

func (*SysWMInfo) GetX11Info

func (info *SysWMInfo) GetX11Info() *X11Info

GetX11Info returns X Window System window information.

type SysWMmsg added in v0.4.0

type SysWMmsg struct {
	Version   Version   // a Version structure that contains the current SDL version
	Subsystem SysWmType // the windowing system type
	// contains filtered or unexported fields
}

SysWMmsg contains system-dependent window manager messages. (https://wiki.libsdl.org/SDL_SysWMmsg)

type SysWmType

type SysWmType C.SDL_SYSWM_TYPE

Various supported windowing subsystems. (https://wiki.libsdl.org/SDL_SYSWM_TYPE)

const (
	SYSWM_UNKNOWN  SysWmType = C.SDL_SYSWM_UNKNOWN
	SYSWM_WINDOWS  SysWmType = C.SDL_SYSWM_WINDOWS  // Microsoft Windows
	SYSWM_X11      SysWmType = C.SDL_SYSWM_X11      // X Window System
	SYSWM_DIRECTFB SysWmType = C.SDL_SYSWM_DIRECTFB // DirectFB
	SYSWM_COCOA    SysWmType = C.SDL_SYSWM_COCOA    // Apple Mac OS X
	SYSWM_UIKIT    SysWmType = C.SDL_SYSWM_UIKIT    // Apple iOS
	SYSWM_WAYLAND  SysWmType = C.SDL_SYSWM_WAYLAND  // Wayland (>= SDL 2.0.2)
	SYSWM_MIR      SysWmType = C.SDL_SYSWM_MIR      // Mir (>= SDL 2.0.2)
	SYSWM_WINRT    SysWmType = C.SDL_SYSWM_WINRT    // WinRT (>= SDL 2.0.3)
	SYSWM_ANDROID  SysWmType = C.SDL_SYSWM_ANDROID  // Android (>= SDL 2.0.4)
	SYSWM_VIVANTE  SysWmType = C.SDL_SYSWM_VIVANTE  // Vivante (>= SDL 2.0.5)
)

type SystemCursor

type SystemCursor C.SDL_SystemCursor

Cursor types for CreateSystemCursor() (https://wiki.libsdl.org/SDL_SystemCursor)

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
	NUM_SYSTEM_CURSORS      SystemCursor = C.SDL_NUM_SYSTEM_CURSORS      // (only for bounding internal arrays)
)

type TextEditingEvent

type TextEditingEvent struct {
	Type      EventType // TEXTEDITING
	Timestamp uint32    // timestamp of the event
	WindowID  uint32    // the window with keyboard focus, if any
	Text      string    // the null-terminated editing text in UTF-8 encoding
	Start     int32     // the location to begin editing from
	Length    int32     // the number of characters to edit from the start point
}

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

func (TextEditingEvent) GetText added in v0.4.0

func (e TextEditingEvent) GetText() string

GetText returns the text as string

func (TextEditingEvent) GetTimestamp added in v0.3.0

func (e TextEditingEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (TextEditingEvent) GetType added in v0.3.0

func (e TextEditingEvent) GetType() EventType

GetType returns the event type.

type TextInputEvent

type TextInputEvent struct {
	Type      EventType // TEXTINPUT
	Timestamp uint32    // timestamp of the event
	WindowID  uint32    // the window with keyboard focus, if any
	Text      string    // the null-terminated input text in UTF-8 encoding
}

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

func (TextInputEvent) GetText added in v0.4.0

func (e TextInputEvent) GetText() string

GetText returns the text as string

func (TextInputEvent) GetTimestamp added in v0.3.0

func (e TextInputEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (TextInputEvent) GetType added in v0.3.0

func (e TextInputEvent) GetType() EventType

GetType returns the event type.

type Texture

type Texture C.SDL_Texture

Texture contains an efficient, driver-specific representation of pixel data. (https://wiki.libsdl.org/SDL_Texture)

func (*Texture) Destroy

func (texture *Texture) Destroy() error

Destroy destroys the specified texture. (https://wiki.libsdl.org/SDL_DestroyTexture)

func (*Texture) GLBind added in v0.3.0

func (texture *Texture) GLBind(texw, texh *float32) error

GLBind binds an OpenGL/ES/ES2 texture to the current context for use with OpenGL instructions when rendering OpenGL primitives directly. (https://wiki.libsdl.org/SDL_GL_BindTexture)

func (*Texture) GLUnbind added in v0.3.0

func (texture *Texture) GLUnbind() error

GLUnbind unbinds an OpenGL/ES/ES2 texture from the current context. (https://wiki.libsdl.org/SDL_GL_UnbindTexture)

func (*Texture) GetAlphaMod

func (texture *Texture) GetAlphaMod() (alpha uint8, err error)

GetAlphaMod returns the additional alpha value multiplied into render copy operations. (https://wiki.libsdl.org/SDL_GetTextureAlphaMod)

func (*Texture) GetBlendMode

func (texture *Texture) GetBlendMode() (bm BlendMode, err error)

GetBlendMode returns the blend mode used for texture copy operations. (https://wiki.libsdl.org/SDL_GetTextureBlendMode)

func (*Texture) GetScaleMode

func (texture *Texture) GetScaleMode() (sm ScaleMode, err error)

GetScaleMode returns the scale mode used for texture scale operations. (https://wiki.libsdl.org/SDL_GetTextureScaleMode)

func (*Texture) GetTextureUserData added in v0.4.11

func (texture *Texture) GetTextureUserData() (userdata unsafe.Pointer)

GetTextureUserData gets the user-specified pointer associated with a texture. (https://wiki.libsdl.org/SDL_GetTextureUserData)

func (*Texture) Lock

func (texture *Texture) Lock(rect *Rect) ([]byte, int, error)

Lock locks a portion of the texture for write-only pixel access. (https://wiki.libsdl.org/SDL_LockTexture)

func (*Texture) LockToSurface

func (texture *Texture) LockToSurface(rect *Rect) (surface *Surface, err error)

LockToSurface locks a portion of the texture for write-only pixel access. Expose it as a SDL surface. (https://wiki.libsdl.org/SDL_LockTextureToSurface)

func (*Texture) Query

func (texture *Texture) Query() (format uint32, access int, width int32, height int32, err error)

Query returns the attributes of a texture. (https://wiki.libsdl.org/SDL_QueryTexture)

func (*Texture) SetAlphaMod

func (texture *Texture) SetAlphaMod(alpha uint8) error

SetAlphaMod sets an additional alpha value multiplied into render copy operations. (https://wiki.libsdl.org/SDL_SetTextureAlphaMod)

func (*Texture) SetBlendMode

func (texture *Texture) SetBlendMode(bm BlendMode) error

SetBlendMode sets the blend mode for a texture, used by Renderer.Copy(). (https://wiki.libsdl.org/SDL_SetTextureBlendMode)

func (*Texture) SetColorMod

func (texture *Texture) SetColorMod(r uint8, g uint8, b uint8) error

SetColorMod sets an additional color value multiplied into render copy operations. (https://wiki.libsdl.org/SDL_SetTextureColorMod)

func (*Texture) SetScaleMode

func (texture *Texture) SetScaleMode(sm ScaleMode) error

SetScaleMode Set the scale mode used for texture scale operations. (https://wiki.libsdl.org/SDL_SetTextureScaleMode)

func (*Texture) SetTextureUserData added in v0.4.11

func (texture *Texture) SetTextureUserData(userdata unsafe.Pointer) (err error)

SetTextureUserData associates a user-specified pointer with a texture. (https://wiki.libsdl.org/SDL_SetTextureUserData)

func (*Texture) Unlock

func (texture *Texture) Unlock()

Unlock unlocks a texture, uploading the changes to video memory, if needed. (https://wiki.libsdl.org/SDL_UnlockTexture)

func (*Texture) Update

func (texture *Texture) Update(rect *Rect, pixels unsafe.Pointer, pitch int) error

Update updates the given texture rectangle with new pixel data. (https://wiki.libsdl.org/SDL_UpdateTexture)

func (*Texture) UpdateNV added in v0.4.11

func (texture *Texture) UpdateNV(rect *Rect, yPlane []byte, yPitch int, uvPlane []byte, uvPitch int) error

UpdateNV updates a rectangle within a planar NV12 or NV21 texture with new pixels. (https://wiki.libsdl.org/SDL_UpdateNVTexture)

func (*Texture) UpdateRGBA added in v0.4.0

func (texture *Texture) UpdateRGBA(rect *Rect, pixels []uint32, pitch int) error

UpdateRGBA updates the given texture rectangle with new uint32 pixel data. (https://wiki.libsdl.org/SDL_UpdateTexture)

func (*Texture) UpdateYUV added in v0.2.0

func (texture *Texture) UpdateYUV(rect *Rect, yPlane []byte, yPitch int, uPlane []byte, uPitch int, vPlane []byte, vPitch int) error

UpdateYUV updates a rectangle within a planar YV12 or IYUV texture with new pixel data. (https://wiki.libsdl.org/SDL_UpdateYUVTexture)

type TextureAccess

type TextureAccess int

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

const (
	TEXTUREACCESS_STATIC    TextureAccess = C.SDL_TEXTUREACCESS_STATIC    // changes rarely, not lockable
	TEXTUREACCESS_STREAMING TextureAccess = C.SDL_TEXTUREACCESS_STREAMING // changes frequently, lockable
	TEXTUREACCESS_TARGET    TextureAccess = C.SDL_TEXTUREACCESS_TARGET    // can be used as a render target
)

type TextureModulate

type TextureModulate C.SDL_TextureModulate

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

const (
	TEXTUREMODULATE_NONE  TextureModulate = C.SDL_TEXTUREMODULATE_NONE  // no modulation
	TEXTUREMODULATE_COLOR TextureModulate = C.SDL_TEXTUREMODULATE_COLOR // srcC = srcC * color
	TEXTUREMODULATE_ALPHA TextureModulate = C.SDL_TEXTUREMODULATE_ALPHA // srcA = srcA * alpha
)

type ThreadID

type ThreadID uint64

ThreadID is the thread identifier for a thread.

type TouchDeviceType added in v0.4.0

type TouchDeviceType C.SDL_TouchDeviceType

TouchDeviceType is a touch device type.

const (
	TOUCH_DEVICE_INVALID           TouchDeviceType = C.SDL_TOUCH_DEVICE_INVALID
	TOUCH_DEVICE_DIRECT            TouchDeviceType = C.SDL_TOUCH_DEVICE_DIRECT            // touch screen with window-relative coordinates
	TOUCH_DEVICE_INDIRECT_ABSOLUTE TouchDeviceType = C.SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE // trackpad with absolute device coordinates
	TOUCH_DEVICE_INDIRECT_RELATIVE TouchDeviceType = C.SDL_TOUCH_DEVICE_INDIRECT_RELATIVE // trackpad with screen cursor-relative coordinates
)

func GetTouchDeviceType added in v0.4.0

func GetTouchDeviceType(id TouchID) TouchDeviceType

GetTouchDeviceType returns the type of the given touch device. (https://wiki.libsdl.org/SDL_GetTouchDeviceType)

type TouchFingerEvent

type TouchFingerEvent struct {
	Type      EventType // FINGERMOTION, FINGERDOWN, FINGERUP
	Timestamp uint32    // timestamp of the event
	TouchID   TouchID   // the touch device id
	FingerID  FingerID  // the finger id
	X         float32   // the x-axis location of the touch event, normalized (0...1)
	Y         float32   // the y-axis location of the touch event, normalized (0...1)
	DX        float32   // the distance moved in the x-axis, normalized (-1...1)
	DY        float32   // the distance moved in the y-axis, normalized (-1...1)
	Pressure  float32   // the quantity of pressure applied, normalized (0...1)
	WindowID  uint32    // the window underneath the finger, if any
}

TouchFingerEvent contains finger touch event information. (https://wiki.libsdl.org/SDL_TouchFingerEvent)

func (TouchFingerEvent) GetTimestamp added in v0.3.0

func (e TouchFingerEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (TouchFingerEvent) GetType added in v0.3.0

func (e TouchFingerEvent) GetType() EventType

GetType returns the event type.

type TouchID

type TouchID C.SDL_TouchID

TouchID is the ID of a touch device.

func GetTouchDevice

func GetTouchDevice(index int) TouchID

GetTouchDevice returns the touch ID with the given index. (https://wiki.libsdl.org/SDL_GetTouchDevice)

type UIKitInfo

type UIKitInfo struct {
	Window unsafe.Pointer // the UIKit window
}

UIKitInfo contains Apple iOS window information.

type UserEvent

type UserEvent struct {
	Type      EventType      // value obtained from RegisterEvents()
	Timestamp uint32         // timestamp of the event
	WindowID  uint32         // the associated window, if any
	Code      int32          // user defined event code
	Data1     unsafe.Pointer // user defined data pointer
	Data2     unsafe.Pointer // user defined data pointer
}

UserEvent contains an application-defined event type. (https://wiki.libsdl.org/SDL_UserEvent)

func (UserEvent) GetTimestamp added in v0.3.0

func (e UserEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (UserEvent) GetType added in v0.3.0

func (e UserEvent) GetType() EventType

GetType returns the event type.

type Version

type Version struct {
	Major uint8 // major version
	Minor uint8 // minor version
	Patch uint8 // update version (patchlevel)
}

Version contains information about the version of SDL in use. (https://wiki.libsdl.org/SDL_version)

type Vertex added in v0.4.11

type Vertex struct {
	Position FPoint // Vertex position, in SDL_Renderer coordinates
	Color    Color  // Vertex color
	TexCoord FPoint // Normalized texture coordinates, if needed
}

Vertex structure

type Window

type Window C.SDL_Window

Window is a type used to identify a window.

func CreateShapedWindow added in v0.4.31

func CreateShapedWindow(title string, x, y, w, h uint32, flags uint32) (*Window, error)

CreateShapedWindow creates a window that can be shaped with the specified position, dimensions, and flags (https://wiki.libsdl.org/SDL_CreateShapedWindow)

func CreateWindow

func CreateWindow(title string, x, y, w, h int32, flags WindowFlags) (*Window, error)

CreateWindow creates a window with the specified position, dimensions, and flags. (https://wiki.libsdl.org/SDL_CreateWindow)

func CreateWindowFrom

func CreateWindowFrom(data unsafe.Pointer) (*Window, error)

CreateWindowFrom creates an SDL window from an existing native window. (https://wiki.libsdl.org/SDL_CreateWindowFrom)

func GetKeyboardFocus

func GetKeyboardFocus() *Window

GetKeyboardFocus returns the window which currently has keyboard focus. (https://wiki.libsdl.org/SDL_GetKeyboardFocus)

func GetMouseFocus

func GetMouseFocus() *Window

GetMouseFocus returns the window which currently has mouse focus. (https://wiki.libsdl.org/SDL_GetMouseFocus)

func GetWindowFromID

func GetWindowFromID(id uint32) (*Window, error)

GetWindowFromID returns a window from a stored ID. (https://wiki.libsdl.org/SDL_GetWindowFromID)

func (*Window) Destroy

func (window *Window) Destroy() error

Destroy destroys the window. (https://wiki.libsdl.org/SDL_DestroyWindow)

func (*Window) DestroySurface

func (window *Window) DestroySurface() error

DestroySurface destroys the surface associated with the window.. (https://wiki.libsdl.org/SDL_DestroyWindowSurface)

func (*Window) Flash added in v0.4.11

func (window *Window) Flash(operation FlashOperation) (err error)

Flash requests the window to demand attention from the user. (https://wiki.libsdl.org/SDL_FlashWindow)

func (*Window) GLCreateContext added in v0.3.0

func (window *Window) GLCreateContext() (GLContext, error)

GLCreateContext creates an OpenGL context for use with an OpenGL window, and make it current. (https://wiki.libsdl.org/SDL_GL_CreateContext)

func (*Window) GLGetDrawableSize added in v0.3.0

func (window *Window) GLGetDrawableSize() (w, h int32)

GLGetDrawableSize returns the size of a window's underlying drawable in pixels (for use with glViewport). (https://wiki.libsdl.org/SDL_GL_GetDrawableSize)

func (*Window) GLMakeCurrent added in v0.3.0

func (window *Window) GLMakeCurrent(glcontext GLContext) error

GLMakeCurrent sets up an OpenGL context for rendering into an OpenGL window. (https://wiki.libsdl.org/SDL_GL_MakeCurrent)

func (*Window) GLSwap added in v0.3.0

func (window *Window) GLSwap()

GLSwap updates a window with OpenGL rendering. (https://wiki.libsdl.org/SDL_GL_SwapWindow)

func (*Window) GetBrightness

func (window *Window) GetBrightness() float32

GetBrightness returns the brightness (gamma multiplier) for the display that owns the given window. (https://wiki.libsdl.org/SDL_GetWindowBrightness)

func (*Window) GetData

func (window *Window) GetData(name string) unsafe.Pointer

GetData returns the data pointer associated with the window. (https://wiki.libsdl.org/SDL_GetWindowData)

func (*Window) GetDisplayIndex

func (window *Window) GetDisplayIndex() (int, error)

GetDisplayIndex returns the index of the display associated with the window. (https://wiki.libsdl.org/SDL_GetWindowDisplayIndex)

func (*Window) GetDisplayMode

func (window *Window) GetDisplayMode() (mode DisplayMode, err error)

GetDisplayMode fills in information about the display mode to use when the window is visible at fullscreen. (https://wiki.libsdl.org/SDL_GetWindowDisplayMode)

func (*Window) GetFlags

func (window *Window) GetFlags() WindowFlags

GetFlags returns the window flags. (https://wiki.libsdl.org/SDL_GetWindowFlags)

func (*Window) GetGammaRamp

func (window *Window) GetGammaRamp() (red, green, blue *[256]uint16, err error)

GetGammaRamp returns the gamma ramp for the display that owns a given window. (https://wiki.libsdl.org/SDL_GetWindowGammaRamp)

func (*Window) GetGrab

func (window *Window) GetGrab() bool

GetGrab returns the window's input grab mode. (https://wiki.libsdl.org/SDL_GetWindowGrab)

func (*Window) GetICCProfile added in v0.4.11

func (window *Window) GetICCProfile() (iccProfile unsafe.Pointer, size uintptr, err error)

GetICCProfile gets the raw ICC profile data for the screen the window is currently on.

Data returned should be freed with SDL_free.

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

func (*Window) GetID

func (window *Window) GetID() (uint32, error)

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

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

func (*Window) GetMaximumSize

func (window *Window) GetMaximumSize() (w, h int32)

GetMaximumSize returns the maximum size of the window's client area. (https://wiki.libsdl.org/SDL_GetWindowMaximumSize)

func (*Window) GetMinimumSize

func (window *Window) GetMinimumSize() (w, h int32)

GetMinimumSize returns the minimum size of the window's client area. (https://wiki.libsdl.org/SDL_GetWindowMinimumSize)

func (*Window) GetMouseRect added in v0.4.11

func (window *Window) GetMouseRect() (rect Rect)

GetMouseRect gets the mouse confinement rectangle of a window. (https://wiki.libsdl.org/SDL_GetWindowMouseRect)

func (*Window) GetPixelFormat

func (window *Window) GetPixelFormat() (PixelFormatConstant, error)

GetPixelFormat returns the pixel format associated with the window. (https://wiki.libsdl.org/SDL_GetWindowPixelFormat)

func (*Window) GetPosition

func (window *Window) GetPosition() (x, y int32)

GetPosition returns the position of the window. (https://wiki.libsdl.org/SDL_GetWindowPosition)

func (*Window) GetRenderer

func (window *Window) GetRenderer() (*Renderer, error)

GetRenderer returns the renderer associated with a window. (https://wiki.libsdl.org/SDL_GetRenderer)

func (*Window) GetShapeMode added in v0.4.31

func (window *Window) GetShapeMode() (WindowShapeMode, int32)

GetShapeMode gets the shape parameters of a shaped window (https://wiki.libsdl.org/SDL_GetShapedWindowMode)

func (*Window) GetSize

func (window *Window) GetSize() (w, h int32)

GetSize returns the size of the window's client area. (https://wiki.libsdl.org/SDL_GetWindowSize)

func (*Window) GetSizeInPixels

func (window *Window) GetSizeInPixels() (w, h int32)

GetSizeInPixels returns the size of a window in pixels. (https://wiki.libsdl.org/SDL_GetWindowSizeInPixels)

func (*Window) GetSurface

func (window *Window) GetSurface() (*Surface, error)

GetSurface returns the SDL surface associated with the window. (https://wiki.libsdl.org/SDL_GetWindowSurface)

func (*Window) GetTitle

func (window *Window) GetTitle() string

GetTitle returns the title of the window. (https://wiki.libsdl.org/SDL_GetWindowTitle)

func (*Window) GetWMInfo

func (window *Window) GetWMInfo() (*SysWMInfo, error)

GetWMInfo returns driver specific information about a window. (https://wiki.libsdl.org/SDL_GetWindowWMInfo)

func (*Window) GetWindowOpacity added in v0.3.0

func (window *Window) GetWindowOpacity() (opacity float32, err error)

GetWindowOpacity returns the opacity of the window. (https://wiki.libsdl.org/SDL_GetWindowOpacity)

func (*Window) HasSurface

func (window *Window) HasSurface() bool

HasSurface returns whether the window has a surface associated with it. (https://wiki.libsdl.org/SDL_HasWindowSurface)

func (*Window) Hide

func (window *Window) Hide()

Hide hides the window. (https://wiki.libsdl.org/SDL_HideWindow)

func (*Window) IsShaped added in v0.4.31

func (window *Window) IsShaped() bool

IsShapedWindow returns whether the given window is a shaped window. (https://wiki.libsdl.org/SDL_IsShapedWindow)

func (*Window) Maximize

func (window *Window) Maximize()

Maximize makes the window as large as possible. (https://wiki.libsdl.org/SDL_MaximizeWindow)

func (*Window) Minimize

func (window *Window) Minimize()

Minimize minimizes the window to an iconic representation. (https://wiki.libsdl.org/SDL_MinimizeWindow)

func (*Window) Raise

func (window *Window) Raise()

Raise raises the window above other windows and set the input focus. (https://wiki.libsdl.org/SDL_RaiseWindow)

func (*Window) Restore

func (window *Window) Restore()

Restore restores the size and position of a minimized or maximized window. (https://wiki.libsdl.org/SDL_RestoreWindow)

func (*Window) SetAlwaysOnTop added in v0.4.11

func (window *Window) SetAlwaysOnTop(onTop bool)

SetAlwaysOnTop sets the window to always be above the others. (https://wiki.libsdl.org/SDL_SetWindowAlwaysOnTop)

func (*Window) SetBordered

func (window *Window) SetBordered(bordered bool)

SetBordered sets the border state of the window. (https://wiki.libsdl.org/SDL_SetWindowBordered)

func (*Window) SetBrightness

func (window *Window) SetBrightness(brightness float32) error

SetBrightness sets the brightness (gamma multiplier) for the display that owns the given window. (https://wiki.libsdl.org/SDL_SetWindowBrightness)

func (*Window) SetData

func (window *Window) SetData(name string, userdata unsafe.Pointer) unsafe.Pointer

SetData associates an arbitrary named pointer with the window. (https://wiki.libsdl.org/SDL_SetWindowData)

func (*Window) SetDisplayMode

func (window *Window) SetDisplayMode(mode *DisplayMode) error

SetDisplayMode sets the display mode to use when the window is visible at fullscreen. (https://wiki.libsdl.org/SDL_SetWindowDisplayMode)

func (*Window) SetFullscreen

func (window *Window) SetFullscreen(flags uint32) error

SetFullscreen sets the window's fullscreen state. (https://wiki.libsdl.org/SDL_SetWindowFullscreen)

func (*Window) SetGammaRamp

func (window *Window) SetGammaRamp(red, green, blue *[256]uint16) error

SetGammaRamp sets the gamma ramp for the display that owns the given window. (https://wiki.libsdl.org/SDL_SetWindowGammaRamp)

func (*Window) SetGrab

func (window *Window) SetGrab(grabbed bool)

SetGrab sets the window's input grab mode. (https://wiki.libsdl.org/SDL_SetWindowGrab)

func (*Window) SetIcon

func (window *Window) SetIcon(icon *Surface)

SetIcon sets the icon for the window. (https://wiki.libsdl.org/SDL_SetWindowIcon)

func (*Window) SetKeyboardGrab added in v0.4.11

func (window *Window) SetKeyboardGrab(grabbed bool)

SetKeyboardGrab sets a window's keyboard grab mode. (https://wiki.libsdl.org/SDL_GetWindowKeyboardGrab)

func (*Window) SetMaximumSize

func (window *Window) SetMaximumSize(maxW, maxH int32)

SetMaximumSize sets the maximum size of the window's client area. (https://wiki.libsdl.org/SDL_SetWindowMaximumSize)

func (*Window) SetMinimumSize

func (window *Window) SetMinimumSize(minW, minH int32)

SetMinimumSize sets the minimum size of the window's client area. (https://wiki.libsdl.org/SDL_SetWindowMinimumSize)

func (*Window) SetMouseRect added in v0.4.11

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

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

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

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

func (*Window) SetPosition

func (window *Window) SetPosition(x, y int32)

SetPosition sets the position of the window. (https://wiki.libsdl.org/SDL_SetWindowPosition)

func (*Window) SetResizable added in v0.2.0

func (window *Window) SetResizable(resizable bool)

SetResizable sets the user-resizable state of the window. (https://wiki.libsdl.org/SDL_SetWindowResizable)

func (*Window) SetShape added in v0.4.31

func (window *Window) SetShape(shape *Surface, shape_mode WindowShapeMode) int32

SetShape sets the shape and parameters of a shaped window (https://wiki.libsdl.org/SDL_SetWindowShape)

func (*Window) SetSize

func (window *Window) SetSize(w, h int32)

SetSize sets the size of the window's client area. (https://wiki.libsdl.org/SDL_SetWindowSize)

func (*Window) SetTitle

func (window *Window) SetTitle(title string)

SetTitle sets the title of the window. (https://wiki.libsdl.org/SDL_SetWindowTitle)

func (*Window) SetWindowOpacity added in v0.3.0

func (window *Window) SetWindowOpacity(opacity float32) error

SetWindowOpacity sets the opacity of the window. (https://wiki.libsdl.org/SDL_SetWindowOpacity)

func (*Window) Show

func (window *Window) Show()

Show shows the window. (https://wiki.libsdl.org/SDL_ShowWindow)

func (*Window) UpdateSurface

func (window *Window) UpdateSurface() error

UpdateSurface copies the window surface to the screen. (https://wiki.libsdl.org/SDL_UpdateWindowSurface)

func (*Window) UpdateSurfaceRects

func (window *Window) UpdateSurfaceRects(rects []Rect) error

UpdateSurfaceRects copies areas of the window surface to the screen. (https://wiki.libsdl.org/SDL_UpdateWindowSurfaceRects)

func (*Window) VulkanCreateSurface added in v0.4.0

func (window *Window) VulkanCreateSurface(instance interface{}) (surface unsafe.Pointer, err error)

VulkanCreateSurface creates a Vulkan rendering surface for a window. (https://wiki.libsdl.org/SDL_Vulkan_CreateSurface)

func (*Window) VulkanGetDrawableSize added in v0.4.0

func (window *Window) VulkanGetDrawableSize() (w, h int32)

VulkanGetDrawableSize gets the size of a window's underlying drawable in pixels (for use with setting viewport, scissor & etc). (https://wiki.libsdl.org/SDL_Vulkan_GetDrawableSize)

func (*Window) VulkanGetInstanceExtensions added in v0.4.0

func (window *Window) VulkanGetInstanceExtensions() []string

VulkanGetInstanceExtensions gets the names of the Vulkan instance extensions needed to create a surface with VulkanCreateSurface(). (https://wiki.libsdl.org/SDL_Vulkan_GetInstanceExtensions)

func (*Window) WarpMouseInWindow

func (window *Window) WarpMouseInWindow(x, y int32)

WarpMouseInWindow moves the mouse to the given position within the window. (https://wiki.libsdl.org/SDL_WarpMouseInWindow)

type WindowEvent

type WindowEvent struct {
	Type      EventType     // WINDOWEVENT
	Timestamp uint32        // timestamp of the event
	WindowID  uint32        // the associated window
	Event     WindowEventID // (https://wiki.libsdl.org/SDL_WindowEventID)
	Data1     int32         // event dependent data
	Data2     int32         // event dependent data
}

WindowEvent contains window state change event data. (https://wiki.libsdl.org/SDL_WindowEvent)

func (WindowEvent) GetTimestamp added in v0.3.0

func (e WindowEvent) GetTimestamp() uint32

GetTimestamp returns the timestamp of the event.

func (WindowEvent) GetType added in v0.3.0

func (e WindowEvent) GetType() EventType

GetType returns the event type.

type WindowEventID

type WindowEventID uint32

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

const (
	WINDOWEVENT_NONE            WindowEventID = C.SDL_WINDOWEVENT_NONE            // (never used)
	WINDOWEVENT_SHOWN           WindowEventID = C.SDL_WINDOWEVENT_SHOWN           // window has been shown
	WINDOWEVENT_HIDDEN          WindowEventID = C.SDL_WINDOWEVENT_HIDDEN          // window has been hidden
	WINDOWEVENT_EXPOSED         WindowEventID = C.SDL_WINDOWEVENT_EXPOSED         // window has been exposed and should be redrawn
	WINDOWEVENT_MOVED           WindowEventID = C.SDL_WINDOWEVENT_MOVED           // window has been moved to data1, data2
	WINDOWEVENT_RESIZED         WindowEventID = C.SDL_WINDOWEVENT_RESIZED         // window has been resized to data1xdata2; this event is always preceded by WINDOWEVENT_SIZE_CHANGED
	WINDOWEVENT_SIZE_CHANGED    WindowEventID = C.SDL_WINDOWEVENT_SIZE_CHANGED    // window size has changed, either as a result of an API call or through the system or user changing the window size; this event is followed by WINDOWEVENT_RESIZED if the size was changed by an external event, i.e. the user or the window manager
	WINDOWEVENT_MINIMIZED       WindowEventID = C.SDL_WINDOWEVENT_MINIMIZED       // window has been minimized
	WINDOWEVENT_MAXIMIZED       WindowEventID = C.SDL_WINDOWEVENT_MAXIMIZED       // window has been maximized
	WINDOWEVENT_RESTORED        WindowEventID = C.SDL_WINDOWEVENT_RESTORED        // window has been restored to normal size and position
	WINDOWEVENT_ENTER           WindowEventID = C.SDL_WINDOWEVENT_ENTER           // window has gained mouse focus
	WINDOWEVENT_LEAVE           WindowEventID = C.SDL_WINDOWEVENT_LEAVE           // window has lost mouse focus
	WINDOWEVENT_FOCUS_GAINED    WindowEventID = C.SDL_WINDOWEVENT_FOCUS_GAINED    // window has gained keyboard focus
	WINDOWEVENT_FOCUS_LOST      WindowEventID = C.SDL_WINDOWEVENT_FOCUS_LOST      // window has lost keyboard focus
	WINDOWEVENT_CLOSE           WindowEventID = C.SDL_WINDOWEVENT_CLOSE           // the window manager requests that the window be closed
	WINDOWEVENT_TAKE_FOCUS      WindowEventID = C.SDL_WINDOWEVENT_TAKE_FOCUS      // window is being offered a focus (should SDL_SetWindowInputFocus() on itself or a subwindow, or ignore) (>= SDL 2.0.5)
	WINDOWEVENT_HIT_TEST        WindowEventID = C.SDL_WINDOWEVENT_HIT_TEST        // window had a hit test that wasn't SDL_HITTEST_NORMAL (>= SDL 2.0.5)
	WINDOWEVENT_ICCPROF_CHANGED WindowEventID = C.SDL_WINDOWEVENT_ICCPROF_CHANGED // the ICC profile of the window's display has changed
	WINDOWEVENT_DISPLAY_CHANGED WindowEventID = C.SDL_WINDOWEVENT_DISPLAY_CHANGED // window has been moved to display data1
)

type WindowFlags

type WindowFlags uint32

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

const (
	WINDOW_FULLSCREEN         WindowFlags = C.SDL_WINDOW_FULLSCREEN         // fullscreen window
	WINDOW_OPENGL             WindowFlags = C.SDL_WINDOW_OPENGL             // window usable with OpenGL context
	WINDOW_SHOWN              WindowFlags = C.SDL_WINDOW_SHOWN              // window is visible
	WINDOW_HIDDEN             WindowFlags = C.SDL_WINDOW_HIDDEN             // window is not visible
	WINDOW_BORDERLESS         WindowFlags = C.SDL_WINDOW_BORDERLESS         // no window decoration
	WINDOW_RESIZABLE          WindowFlags = C.SDL_WINDOW_RESIZABLE          // window can be resized
	WINDOW_MINIMIZED          WindowFlags = C.SDL_WINDOW_MINIMIZED          // window is minimized
	WINDOW_MAXIMIZED          WindowFlags = C.SDL_WINDOW_MAXIMIZED          // window is maximized
	WINDOW_INPUT_GRABBED      WindowFlags = C.SDL_WINDOW_INPUT_GRABBED      // window has grabbed input focus
	WINDOW_INPUT_FOCUS        WindowFlags = C.SDL_WINDOW_INPUT_FOCUS        // window has input focus
	WINDOW_MOUSE_FOCUS        WindowFlags = C.SDL_WINDOW_MOUSE_FOCUS        // window has mouse focus
	WINDOW_FULLSCREEN_DESKTOP WindowFlags = C.SDL_WINDOW_FULLSCREEN_DESKTOP // fullscreen window at the current desktop resolution
	WINDOW_FOREIGN            WindowFlags = C.SDL_WINDOW_FOREIGN            // window not created by SDL
	WINDOW_ALLOW_HIGHDPI      WindowFlags = C.SDL_WINDOW_ALLOW_HIGHDPI      // window should be created in high-DPI mode if supported (>= SDL 2.0.1)
	WINDOW_MOUSE_CAPTURE      WindowFlags = C.SDL_WINDOW_MOUSE_CAPTURE      // window has mouse captured (unrelated to INPUT_GRABBED, >= SDL 2.0.4)
	WINDOW_ALWAYS_ON_TOP      WindowFlags = C.SDL_WINDOW_ALWAYS_ON_TOP      // window should always be above others (X11 only, >= SDL 2.0.5)
	WINDOW_SKIP_TASKBAR       WindowFlags = C.SDL_WINDOW_SKIP_TASKBAR       // window should not be added to the taskbar (X11 only, >= SDL 2.0.5)
	WINDOW_UTILITY            WindowFlags = C.SDL_WINDOW_UTILITY            // window should be treated as a utility window (X11 only, >= SDL 2.0.5)
	WINDOW_TOOLTIP            WindowFlags = C.SDL_WINDOW_TOOLTIP            // window should be treated as a tooltip (X11 only, >= SDL 2.0.5)
	WINDOW_POPUP_MENU         WindowFlags = C.SDL_WINDOW_POPUP_MENU         // window should be treated as a popup menu (X11 only, >= SDL 2.0.5)
	WINDOW_VULKAN             WindowFlags = C.SDL_WINDOW_VULKAN             // window usable for Vulkan surface (>= SDL 2.0.6)
	WINDOW_METAL              WindowFlags = C.SDL_WINDOW_METAL              // window usable for Metal view (>= SDL 2.0.14)
)

type WindowShapeMode added in v0.4.31

type WindowShapeMode interface {
	Mode() WindowShapeModeKind
	// contains filtered or unexported methods
}

type WindowShapeModeKind added in v0.4.31

type WindowShapeModeKind C.WindowShapeMode
const (
	ShapeModeDefaultKind              WindowShapeModeKind = C.ShapeModeDefault              // the default mode, a binarized alpha cutoff of 1
	ShapeModeBinarizeAlphaKind        WindowShapeModeKind = C.ShapeModeBinarizeAlpha        // a binarized alpha cutoff with a given integer value
	ShapeModeReverseBinarizeAlphaKind WindowShapeModeKind = C.ShapeModeReverseBinarizeAlpha // a binarized alpha cutoff with a given integer value, but with the opposite comparison
	ShapeModeColorKeyKind             WindowShapeModeKind = C.ShapeModeColorKey             // a color key is applied
)

type WindowsInfo

type WindowsInfo struct {
	Window        unsafe.Pointer // the window handle
	DeviceContext unsafe.Pointer // the device context handle
	Instance      unsafe.Pointer // the instance handle
}

WindowsInfo contains Microsoft Windows window information.

type X11Info

type X11Info struct {
	Display unsafe.Pointer // the X11 display
	Window  uint           // the X11 window
}

X11Info contains X Window System window information.

type YUV_CONVERSION_MODE added in v0.4.0

type YUV_CONVERSION_MODE C.SDL_YUV_CONVERSION_MODE
const (
	YUV_CONVERSION_JPEG      YUV_CONVERSION_MODE = C.SDL_YUV_CONVERSION_JPEG      // Full range JPEG
	YUV_CONVERSION_BT601     YUV_CONVERSION_MODE = C.SDL_YUV_CONVERSION_BT601     // BT.601 (the default)
	YUV_CONVERSION_BT709     YUV_CONVERSION_MODE = C.SDL_YUV_CONVERSION_BT709     // BT.709
	YUV_CONVERSION_AUTOMATIC YUV_CONVERSION_MODE = C.SDL_YUV_CONVERSION_AUTOMATIC // BT.601 for SD content, BT.709 for HD content
)

YUV Conversion Modes

func GetYUVConversionMode added in v0.4.0

func GetYUVConversionMode() YUV_CONVERSION_MODE

GetYUVConversionMode gets the YUV conversion mode (https://wiki.libsdl.org/SDL_GetYUVConversionMode)

func GetYUVConversionModeForResolution added in v0.4.0

func GetYUVConversionModeForResolution(width, height int) YUV_CONVERSION_MODE

GetYUVConversionModeForResolution gets the YUV conversion mode (https://wiki.libsdl.org/SDL_GetYUVConversionModeForResolution)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL