const std = @import("std"); pub const c = @import("c.zig").c; pub const PixelFormat = enum(c_int) { pixelformatYv12 = 0x32315659, //Planar mode: Y + V + U (3 planes) pixelformatIyuv = 0x56555949, //Planar mode: Y + U + V (3 planes) pixelformatYuy2 = 0x32595559, //Packed mode: Y0+U0+Y1+V0 (1 plane) pixelformatUyvy = 0x59565955, //Packed mode: U0+Y0+V0+Y1 (1 plane) pixelformatYvyu = 0x55595659, //Packed mode: Y0+V0+Y1+U0 (1 plane) pixelformatNv12 = 0x3231564e, //Planar mode: Y + U/V interleaved (2 planes) pixelformatNv21 = 0x3132564e, //Planar mode: Y + V/U interleaved (2 planes) pixelformatP010 = 0x30313050, //Planar mode: Y + U/V interleaved (2 planes) pixelformatExternalOes = 0x2053454f, //Android video texture format pixelformatMjpg = 0x47504a4d, //Motion JPEG }; pub const Point = extern struct { x: c_int, y: c_int, }; pub const Surface = opaque {}; pub const PropertiesID = u32; pub const Rect = extern struct { x: c_int, y: c_int, w: c_int, h: c_int, }; pub const FunctionPointer = c.SDL_FunctionPointer; pub const DisplayID = u32; pub const WindowID = u32; pub const SystemTheme = enum(c_int) { systemThemeUnknown, //Unknown system theme systemThemeLight, //Light colored system theme systemThemeDark, //Dark colored system theme }; pub const DisplayModeData = opaque {}; pub const DisplayMode = extern struct { displayID: DisplayID, // the display this mode is associated with format: PixelFormat, // pixel format w: c_int, // width h: c_int, // height pixel_density: f32, // scale converting size to pixels (e.g. a 1920x1080 mode with 2.0 scale would have 3840x2160 pixels) refresh_rate: f32, // refresh rate (or 0.0f for unspecified) refresh_rate_numerator: c_int, // precise refresh rate numerator (or 0 for unspecified) refresh_rate_denominator: c_int, // precise refresh rate denominator internal: ?*DisplayModeData, // Private }; pub const DisplayOrientation = enum(c_int) { orientationUnknown, //The display orientation can't be determined orientationLandscape, //The display is in landscape mode, with the right side up, relative to portrait mode orientationLandscapeFlipped, //The display is in landscape mode, with the left side up, relative to portrait mode orientationPortrait, //The display is in portrait mode orientationPortraitFlipped, }; pub const Window = opaque { pub inline fn getDisplayForWindow(window: *Window) DisplayID { return c.SDL_GetDisplayForWindow(@ptrCast(window)); } pub inline fn getWindowPixelDensity(window: *Window) f32 { return c.SDL_GetWindowPixelDensity(@ptrCast(window)); } pub inline fn getWindowDisplayScale(window: *Window) f32 { return c.SDL_GetWindowDisplayScale(@ptrCast(window)); } pub inline fn setWindowFullscreenMode(window: *Window, mode: *const DisplayMode) bool { return @bitCast(c.SDL_SetWindowFullscreenMode(@ptrCast(window), @ptrCast(mode))); } pub inline fn getWindowFullscreenMode(window: *Window) *const DisplayMode { return @ptrCast(c.SDL_GetWindowFullscreenMode(@ptrCast(window))); } pub inline fn getWindowICCProfile(window: *Window, size: *usize) ?*anyopaque { return c.SDL_GetWindowICCProfile(@ptrCast(window), @ptrCast(size)); } pub inline fn getWindowPixelFormat(window: *Window) PixelFormat { return @bitCast(c.SDL_GetWindowPixelFormat(@ptrCast(window))); } pub inline fn createPopupWindow(window: *Window, offset_x: c_int, offset_y: c_int, w: c_int, h: c_int, flags: WindowFlags) ?*Window { return @ptrCast(c.SDL_CreatePopupWindow(@ptrCast(window), offset_x, offset_y, w, h, @bitCast(flags))); } pub inline fn getWindowID(window: *Window) WindowID { return c.SDL_GetWindowID(@ptrCast(window)); } pub inline fn getWindowParent(window: *Window) ?*Window { return @ptrCast(c.SDL_GetWindowParent(@ptrCast(window))); } pub inline fn getWindowProperties(window: *Window) PropertiesID { return c.SDL_GetWindowProperties(@ptrCast(window)); } pub inline fn getWindowFlags(window: *Window) WindowFlags { return @bitCast(c.SDL_GetWindowFlags(@ptrCast(window))); } pub inline fn setWindowTitle(window: *Window, title: [*c]const u8) bool { return @bitCast(c.SDL_SetWindowTitle(@ptrCast(window), title)); } pub inline fn getWindowTitle(window: *Window) [*c]const u8 { return c.SDL_GetWindowTitle(@ptrCast(window)); } pub inline fn setWindowIcon(window: *Window, icon: ?*Surface) bool { return @bitCast(c.SDL_SetWindowIcon(@ptrCast(window), @ptrCast(icon))); } pub inline fn setWindowPosition(window: *Window, x: c_int, y: c_int) bool { return @bitCast(c.SDL_SetWindowPosition(@ptrCast(window), x, y)); } pub inline fn getWindowPosition(window: *Window, x: *c_int, y: *c_int) bool { return @bitCast(c.SDL_GetWindowPosition(@ptrCast(window), @ptrCast(x), @ptrCast(y))); } pub inline fn setWindowSize(window: *Window, w: c_int, h: c_int) bool { return @bitCast(c.SDL_SetWindowSize(@ptrCast(window), w, h)); } pub inline fn getWindowSize(window: *Window, w: *c_int, h: *c_int) bool { return @bitCast(c.SDL_GetWindowSize(@ptrCast(window), @ptrCast(w), @ptrCast(h))); } pub inline fn getWindowSafeArea(window: *Window, rect: ?*Rect) bool { return @bitCast(c.SDL_GetWindowSafeArea(@ptrCast(window), @ptrCast(rect))); } pub inline fn setWindowAspectRatio(window: *Window, min_aspect: f32, max_aspect: f32) bool { return @bitCast(c.SDL_SetWindowAspectRatio(@ptrCast(window), min_aspect, max_aspect)); } pub inline fn getWindowAspectRatio(window: *Window, min_aspect: *f32, max_aspect: *f32) bool { return @bitCast(c.SDL_GetWindowAspectRatio(@ptrCast(window), @ptrCast(min_aspect), @ptrCast(max_aspect))); } pub inline fn getWindowBordersSize(window: *Window, top: *c_int, left: *c_int, bottom: *c_int, right: *c_int) bool { return @bitCast(c.SDL_GetWindowBordersSize(@ptrCast(window), @ptrCast(top), @ptrCast(left), @ptrCast(bottom), @ptrCast(right))); } pub inline fn getWindowSizeInPixels(window: *Window, w: *c_int, h: *c_int) bool { return @bitCast(c.SDL_GetWindowSizeInPixels(@ptrCast(window), @ptrCast(w), @ptrCast(h))); } pub inline fn setWindowMinimumSize(window: *Window, min_w: c_int, min_h: c_int) bool { return @bitCast(c.SDL_SetWindowMinimumSize(@ptrCast(window), min_w, min_h)); } pub inline fn getWindowMinimumSize(window: *Window, w: *c_int, h: *c_int) bool { return @bitCast(c.SDL_GetWindowMinimumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h))); } pub inline fn setWindowMaximumSize(window: *Window, max_w: c_int, max_h: c_int) bool { return @bitCast(c.SDL_SetWindowMaximumSize(@ptrCast(window), max_w, max_h)); } pub inline fn getWindowMaximumSize(window: *Window, w: *c_int, h: *c_int) bool { return @bitCast(c.SDL_GetWindowMaximumSize(@ptrCast(window), @ptrCast(w), @ptrCast(h))); } pub inline fn setWindowBordered(window: *Window, bordered: bool) bool { return @bitCast(c.SDL_SetWindowBordered(@ptrCast(window), @bitCast(bordered))); } pub inline fn setWindowResizable(window: *Window, resizable: bool) bool { return @bitCast(c.SDL_SetWindowResizable(@ptrCast(window), @bitCast(resizable))); } pub inline fn setWindowAlwaysOnTop(window: *Window, on_top: bool) bool { return @bitCast(c.SDL_SetWindowAlwaysOnTop(@ptrCast(window), @bitCast(on_top))); } pub inline fn setWindowFillDocument(window: *Window, fill: bool) bool { return @bitCast(c.SDL_SetWindowFillDocument(@ptrCast(window), @bitCast(fill))); } pub inline fn showWindow(window: *Window) bool { return @bitCast(c.SDL_ShowWindow(@ptrCast(window))); } pub inline fn hideWindow(window: *Window) bool { return @bitCast(c.SDL_HideWindow(@ptrCast(window))); } pub inline fn raiseWindow(window: *Window) bool { return @bitCast(c.SDL_RaiseWindow(@ptrCast(window))); } pub inline fn maximizeWindow(window: *Window) bool { return @bitCast(c.SDL_MaximizeWindow(@ptrCast(window))); } pub inline fn minimizeWindow(window: *Window) bool { return @bitCast(c.SDL_MinimizeWindow(@ptrCast(window))); } pub inline fn restoreWindow(window: *Window) bool { return @bitCast(c.SDL_RestoreWindow(@ptrCast(window))); } pub inline fn setWindowFullscreen(window: *Window, fullscreen: bool) bool { return @bitCast(c.SDL_SetWindowFullscreen(@ptrCast(window), @bitCast(fullscreen))); } pub inline fn syncWindow(window: *Window) bool { return @bitCast(c.SDL_SyncWindow(@ptrCast(window))); } pub inline fn windowHasSurface(window: *Window) bool { return @bitCast(c.SDL_WindowHasSurface(@ptrCast(window))); } pub inline fn getWindowSurface(window: *Window) ?*Surface { return @ptrCast(c.SDL_GetWindowSurface(@ptrCast(window))); } pub inline fn setWindowSurfaceVSync(window: *Window, vsync: c_int) bool { return @bitCast(c.SDL_SetWindowSurfaceVSync(@ptrCast(window), vsync)); } pub inline fn getWindowSurfaceVSync(window: *Window, vsync: *c_int) bool { return @bitCast(c.SDL_GetWindowSurfaceVSync(@ptrCast(window), @ptrCast(vsync))); } pub inline fn updateWindowSurface(window: *Window) bool { return @bitCast(c.SDL_UpdateWindowSurface(@ptrCast(window))); } pub inline fn updateWindowSurfaceRects(window: *Window, rects: *const Rect, numrects: c_int) bool { return @bitCast(c.SDL_UpdateWindowSurfaceRects(@ptrCast(window), @ptrCast(rects), numrects)); } pub inline fn destroyWindowSurface(window: *Window) bool { return @bitCast(c.SDL_DestroyWindowSurface(@ptrCast(window))); } pub inline fn setWindowKeyboardGrab(window: *Window, grabbed: bool) bool { return @bitCast(c.SDL_SetWindowKeyboardGrab(@ptrCast(window), @bitCast(grabbed))); } pub inline fn setWindowMouseGrab(window: *Window, grabbed: bool) bool { return @bitCast(c.SDL_SetWindowMouseGrab(@ptrCast(window), @bitCast(grabbed))); } pub inline fn getWindowKeyboardGrab(window: *Window) bool { return @bitCast(c.SDL_GetWindowKeyboardGrab(@ptrCast(window))); } pub inline fn getWindowMouseGrab(window: *Window) bool { return @bitCast(c.SDL_GetWindowMouseGrab(@ptrCast(window))); } pub inline fn setWindowMouseRect(window: *Window, rect: *const Rect) bool { return @bitCast(c.SDL_SetWindowMouseRect(@ptrCast(window), @ptrCast(rect))); } pub inline fn getWindowMouseRect(window: *Window) *const Rect { return @ptrCast(c.SDL_GetWindowMouseRect(@ptrCast(window))); } pub inline fn setWindowOpacity(window: *Window, opacity: f32) bool { return @bitCast(c.SDL_SetWindowOpacity(@ptrCast(window), opacity)); } pub inline fn getWindowOpacity(window: *Window) f32 { return c.SDL_GetWindowOpacity(@ptrCast(window)); } pub inline fn setWindowParent(window: *Window, parent: ?*Window) bool { return @bitCast(c.SDL_SetWindowParent(@ptrCast(window), @ptrCast(parent))); } pub inline fn setWindowModal(window: *Window, modal: bool) bool { return @bitCast(c.SDL_SetWindowModal(@ptrCast(window), @bitCast(modal))); } pub inline fn setWindowFocusable(window: *Window, focusable: bool) bool { return @bitCast(c.SDL_SetWindowFocusable(@ptrCast(window), @bitCast(focusable))); } pub inline fn showWindowSystemMenu(window: *Window, x: c_int, y: c_int) bool { return @bitCast(c.SDL_ShowWindowSystemMenu(@ptrCast(window), x, y)); } pub inline fn setWindowHitTest(window: *Window, callback: HitTest, callback_data: ?*anyopaque) bool { return @bitCast(c.SDL_SetWindowHitTest(@ptrCast(window), callback, callback_data)); } pub inline fn setWindowShape(window: *Window, shape: ?*Surface) bool { return @bitCast(c.SDL_SetWindowShape(@ptrCast(window), @ptrCast(shape))); } pub inline fn flashWindow(window: *Window, operation: FlashOperation) bool { return @bitCast(c.SDL_FlashWindow(@ptrCast(window), @intFromEnum(operation))); } pub inline fn setWindowProgressState(window: *Window, state: ProgressState) bool { return @bitCast(c.SDL_SetWindowProgressState(@ptrCast(window), state)); } pub inline fn getWindowProgressState(window: *Window) ProgressState { return c.SDL_GetWindowProgressState(@ptrCast(window)); } pub inline fn setWindowProgressValue(window: *Window, value: f32) bool { return @bitCast(c.SDL_SetWindowProgressValue(@ptrCast(window), value)); } pub inline fn getWindowProgressValue(window: *Window) f32 { return c.SDL_GetWindowProgressValue(@ptrCast(window)); } pub inline fn destroyWindow(window: *Window) void { return c.SDL_DestroyWindow(@ptrCast(window)); } pub inline fn gl_CreateContext(window: *Window) GLContext { return c.SDL_GL_CreateContext(@ptrCast(window)); } pub inline fn gl_MakeCurrent(window: *Window, context: GLContext) bool { return @bitCast(c.SDL_GL_MakeCurrent(@ptrCast(window), context)); } pub inline fn egl_GetWindowSurface(window: *Window) EGLSurface { return c.SDL_EGL_GetWindowSurface(@ptrCast(window)); } pub inline fn gl_SwapWindow(window: *Window) bool { return @bitCast(c.SDL_GL_SwapWindow(@ptrCast(window))); } }; pub const WindowFlags = packed struct(u64) { windowFullscreen: bool = false, // window is in fullscreen mode windowOpengl: bool = false, // window usable with OpenGL context windowOccluded: bool = false, // window is occluded windowHidden: bool = false, // window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; SDL_ShowWindow() is required for it to become visible windowBorderless: bool = false, // no window decoration windowResizable: bool = false, // window can be resized windowMinimized: bool = false, // window is minimized windowMaximized: bool = false, // window is maximized windowMouseGrabbed: bool = false, // window has grabbed mouse input windowInputFocus: bool = false, // window has input focus windowMouseFocus: bool = false, // window has mouse focus windowExternal: bool = false, // window not created by SDL windowModal: bool = false, // window is modal windowHighPixelDensity: bool = false, // window uses high pixel density back buffer if possible windowMouseCapture: bool = false, // window has mouse captured (unrelated to MOUSE_GRABBED) windowMouseRelativeMode: bool = false, // window has relative mode enabled windowAlwaysOnTop: bool = false, // window should always be above others windowUtility: bool = false, // window should be treated as a utility window, not showing in the task bar and window list windowTooltip: bool = false, // window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window windowPopupMenu: bool = false, // window should be treated as a popup menu, requires a parent window windowKeyboardGrabbed: bool = false, // window has grabbed keyboard input windowFillDocument: bool = false, // window is in fill-document mode (Emscripten only), since SDL 3.4.0 windowVulkan: bool = false, // window usable for Vulkan surface windowMetal: bool = false, // window usable for Metal view windowTransparent: bool = false, // window with transparent buffer windowNotFocusable: bool = false, // window should not be focusable pad0: u37 = 0, rsvd: bool = false, pub const None = WindowFlags{}; }; pub const FlashOperation = enum(c_int) { flashCancel, //Cancel any window flash state flashBriefly, //Flash the window briefly to get attention flashUntilFocused, //Flash the window until it gets focus }; pub const ProgressState = enum(c_int) { progressStateInvalid = -1, //An invalid progress state indicating an error; check SDL_GetError() progressStateNone, //No progress bar is shown progressStateIndeterminate, //The progress bar is shown in a indeterminate state progressStateNormal, //The progress bar is shown in a normal state progressStatePaused, //The progress bar is shown in a paused state progressStateError, //The progress bar is shown in a state indicating the application had an error }; pub const GLContext = *anyopaque; pub const EGLDisplay = ?*anyopaque; pub const EGLConfig = ?*anyopaque; pub const EGLSurface = ?*anyopaque; pub const EGLAttrib = isize; pub const EGLint = c_int; pub const EGLAttribArrayCallback = c.SDL_EGLAttribArrayCallback; pub const EGLIntArrayCallback = c.SDL_EGLIntArrayCallback; pub const GLAttr = enum(c_int) { glRedSize, //the minimum number of bits for the red channel of the color buffer; defaults to 8. glGreenSize, //the minimum number of bits for the green channel of the color buffer; defaults to 8. glBlueSize, //the minimum number of bits for the blue channel of the color buffer; defaults to 8. glAlphaSize, //the minimum number of bits for the alpha channel of the color buffer; defaults to 8. glBufferSize, //the minimum number of bits for frame buffer size; defaults to 0. glDoublebuffer, //whether the output is single or double buffered; defaults to double buffering on. glDepthSize, //the minimum number of bits in the depth buffer; defaults to 16. glStencilSize, //the minimum number of bits in the stencil buffer; defaults to 0. glAccumRedSize, //the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. glAccumGreenSize, //the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. glAccumBlueSize, //the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. glAccumAlphaSize, //the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. glStereo, //whether the output is stereo 3D; defaults to off. glMultisamplebuffers, //the number of buffers used for multisample anti-aliasing; defaults to 0. glMultisamplesamples, //the number of samples used around the current pixel used for multisample anti-aliasing. glAcceleratedVisual, //set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either. glRetainedBacking, //not used (deprecated). glContextMajorVersion, //OpenGL context major version. glContextMinorVersion, //OpenGL context minor version. glContextFlags, //some combination of 0 or more of elements of the SDL_GLContextFlag enumeration; defaults to 0. glContextProfileMask, //type of GL context (Core, Compatibility, ES). See SDL_GLProfile; default value depends on platform. glShareWithCurrentContext, //OpenGL context sharing; defaults to 0. glFramebufferSrgbCapable, //requests sRGB-capable visual if 1. Defaults to -1 ("don't care"). This is a request; GL drivers might not comply! glContextReleaseBehavior, //sets context the release behavior. See SDL_GLContextReleaseFlag; defaults to FLUSH. glContextResetNotification, //set context reset notification. See SDL_GLContextResetNotification; defaults to NO_NOTIFICATION. glContextNoError, glFloatbuffers, glEglPlatform, }; pub const GLProfile = u32; pub const GLContextFlag = u32; pub const GLContextReleaseFlag = u32; pub const GLContextResetNotification = u32; pub inline fn getNumVideoDrivers() c_int { return c.SDL_GetNumVideoDrivers(); } pub inline fn getVideoDriver(index: c_int) [*c]const u8 { return c.SDL_GetVideoDriver(index); } pub inline fn getCurrentVideoDriver() [*c]const u8 { return c.SDL_GetCurrentVideoDriver(); } pub inline fn getSystemTheme() SystemTheme { return c.SDL_GetSystemTheme(); } pub inline fn getDisplays(count: *c_int) ?*DisplayID { return @ptrCast(c.SDL_GetDisplays(@ptrCast(count))); } pub inline fn getPrimaryDisplay() DisplayID { return c.SDL_GetPrimaryDisplay(); } pub inline fn getDisplayProperties(displayID: DisplayID) PropertiesID { return c.SDL_GetDisplayProperties(displayID); } pub inline fn getDisplayName(displayID: DisplayID) [*c]const u8 { return c.SDL_GetDisplayName(displayID); } pub inline fn getDisplayBounds(displayID: DisplayID, rect: ?*Rect) bool { return @bitCast(c.SDL_GetDisplayBounds(displayID, @ptrCast(rect))); } pub inline fn getDisplayUsableBounds(displayID: DisplayID, rect: ?*Rect) bool { return @bitCast(c.SDL_GetDisplayUsableBounds(displayID, @ptrCast(rect))); } pub inline fn getNaturalDisplayOrientation(displayID: DisplayID) DisplayOrientation { return c.SDL_GetNaturalDisplayOrientation(displayID); } pub inline fn getCurrentDisplayOrientation(displayID: DisplayID) DisplayOrientation { return c.SDL_GetCurrentDisplayOrientation(displayID); } pub inline fn getDisplayContentScale(displayID: DisplayID) f32 { return c.SDL_GetDisplayContentScale(displayID); } pub inline fn getFullscreenDisplayModes(displayID: DisplayID, count: *c_int) [*c][*c]DisplayMode { return @intFromEnum(c.SDL_GetFullscreenDisplayModes(displayID, @ptrCast(count))); } pub inline fn getClosestFullscreenDisplayMode(displayID: DisplayID, w: c_int, h: c_int, refresh_rate: f32, include_high_density_modes: bool, closest: ?*DisplayMode) bool { return @bitCast(c.SDL_GetClosestFullscreenDisplayMode(displayID, w, h, refresh_rate, @bitCast(include_high_density_modes), @ptrCast(closest))); } pub inline fn getDesktopDisplayMode(displayID: DisplayID) *const DisplayMode { return @ptrCast(c.SDL_GetDesktopDisplayMode(displayID)); } pub inline fn getCurrentDisplayMode(displayID: DisplayID) *const DisplayMode { return @ptrCast(c.SDL_GetCurrentDisplayMode(displayID)); } pub inline fn getDisplayForPoint(point: *const Point) DisplayID { return c.SDL_GetDisplayForPoint(@ptrCast(point)); } pub inline fn getDisplayForRect(rect: *const Rect) DisplayID { return c.SDL_GetDisplayForRect(@ptrCast(rect)); } pub inline fn getWindows(count: *c_int) [*c][*c]Window { return c.SDL_GetWindows(@ptrCast(count)); } pub inline fn createWindow(title: [*c]const u8, w: c_int, h: c_int, flags: WindowFlags) ?*Window { return @ptrCast(c.SDL_CreateWindow(title, w, h, @bitCast(flags))); } pub inline fn createWindowWithProperties(props: PropertiesID) ?*Window { return @ptrCast(c.SDL_CreateWindowWithProperties(props)); } pub inline fn getWindowFromID(id: WindowID) ?*Window { return @ptrCast(c.SDL_GetWindowFromID(id)); } pub inline fn getGrabbedWindow() ?*Window { return @ptrCast(c.SDL_GetGrabbedWindow()); } pub const HitTestResult = enum(c_int) { hittestNormal, //Region is normal. No special properties. hittestDraggable, //Region can drag entire window. hittestResizeTopleft, //Region is the resizable top-left corner border. hittestResizeTop, //Region is the resizable top border. hittestResizeTopright, //Region is the resizable top-right corner border. hittestResizeRight, //Region is the resizable right border. hittestResizeBottomright, //Region is the resizable bottom-right corner border. hittestResizeBottom, //Region is the resizable bottom border. hittestResizeBottomleft, //Region is the resizable bottom-left corner border. hittestResizeLeft, //Region is the resizable left border. }; pub const HitTest = c.SDL_HitTest; pub inline fn screenSaverEnabled() bool { return @bitCast(c.SDL_ScreenSaverEnabled()); } pub inline fn enableScreenSaver() bool { return @bitCast(c.SDL_EnableScreenSaver()); } pub inline fn disableScreenSaver() bool { return @bitCast(c.SDL_DisableScreenSaver()); } pub inline fn gl_LoadLibrary(path: [*c]const u8) bool { return @bitCast(c.SDL_GL_LoadLibrary(path)); } pub inline fn gl_GetProcAddress(proc: [*c]const u8) FunctionPointer { return c.SDL_GL_GetProcAddress(proc); } pub inline fn egl_GetProcAddress(proc: [*c]const u8) FunctionPointer { return c.SDL_EGL_GetProcAddress(proc); } pub inline fn gl_UnloadLibrary() void { return c.SDL_GL_UnloadLibrary(); } pub inline fn gl_ExtensionSupported(extension: [*c]const u8) bool { return @bitCast(c.SDL_GL_ExtensionSupported(extension)); } pub inline fn gl_ResetAttributes() void { return c.SDL_GL_ResetAttributes(); } pub inline fn gl_SetAttribute(attr: GLAttr, value: c_int) bool { return @bitCast(c.SDL_GL_SetAttribute(attr, value)); } pub inline fn gl_GetAttribute(attr: GLAttr, value: *c_int) bool { return @bitCast(c.SDL_GL_GetAttribute(attr, @ptrCast(value))); } pub inline fn gl_GetCurrentWindow() ?*Window { return @ptrCast(c.SDL_GL_GetCurrentWindow()); } pub inline fn gl_GetCurrentContext() GLContext { return c.SDL_GL_GetCurrentContext(); } pub inline fn egl_GetCurrentDisplay() EGLDisplay { return c.SDL_EGL_GetCurrentDisplay(); } pub inline fn egl_GetCurrentConfig() EGLConfig { return c.SDL_EGL_GetCurrentConfig(); } pub inline fn egl_SetAttributeCallbacks(platformAttribCallback: EGLAttribArrayCallback, surfaceAttribCallback: EGLIntArrayCallback, contextAttribCallback: EGLIntArrayCallback, userdata: ?*anyopaque) void { return c.SDL_EGL_SetAttributeCallbacks(platformAttribCallback, surfaceAttribCallback, contextAttribCallback, userdata); } pub inline fn gl_SetSwapInterval(interval: c_int) bool { return @bitCast(c.SDL_GL_SetSwapInterval(interval)); } pub inline fn gl_GetSwapInterval(interval: *c_int) bool { return @bitCast(c.SDL_GL_GetSwapInterval(@ptrCast(interval))); } pub inline fn gl_DestroyContext(context: GLContext) bool { return @bitCast(c.SDL_GL_DestroyContext(context)); }