sdl3.c3l/sdl3_video.c3i

358 lines
24 KiB
Plaintext

module sdl3::sdl;
typedef DisplayID = uint;
typedef WindowID = uint;
const ZString PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER @builtin = "SDL.video.wayland.wl_display";
enum SystemTheme : inline CInt {
SYSTEM_THEME_UNKNOWN,
SYSTEM_THEME_LIGHT,
SYSTEM_THEME_DARK
}
typedef DisplayModeData = void;
struct DisplayMode {
DisplayID displayID;
PixelFormat format;
int w;
int h;
float pixel_density;
float refresh_rate;
int refresh_rate_numerator;
int refresh_rate_denominator;
DisplayModeData *internal;
}
enum DisplayOrientation : inline CInt {
ORIENTATION_UNKNOWN,
ORIENTATION_LANDSCAPE,
ORIENTATION_LANDSCAPE_FLIPPED,
ORIENTATION_PORTRAIT,
ORIENTATION_PORTRAIT_FLIPPED
}
typedef Window = void;
typedef WindowFlags = ulong;
const WindowFlags WINDOW_FULLSCREEN @builtin = 0x0000000000000001;
const WindowFlags WINDOW_OPENGL @builtin = 0x0000000000000002;
const WindowFlags WINDOW_OCCLUDED @builtin = 0x0000000000000004;
const WindowFlags WINDOW_HIDDEN @builtin = 0x0000000000000008;
const WindowFlags WINDOW_BORDERLESS @builtin = 0x0000000000000010;
const WindowFlags WINDOW_RESIZABLE @builtin = 0x0000000000000020;
const WindowFlags WINDOW_MINIMIZED @builtin = 0x0000000000000040;
const WindowFlags WINDOW_MAXIMIZED @builtin = 0x0000000000000080;
const WindowFlags WINDOW_MOUSE_GRABBED @builtin = 0x0000000000000100;
const WindowFlags WINDOW_INPUT_FOCUS @builtin = 0x0000000000000200;
const WindowFlags WINDOW_MOUSE_FOCUS @builtin = 0x0000000000000400;
const WindowFlags WINDOW_EXTERNAL @builtin = 0x0000000000000800;
const WindowFlags WINDOW_MODAL @builtin = 0x0000000000001000;
const WindowFlags WINDOW_HIGH_PIXEL_DENSITY @builtin = 0x0000000000002000;
const WindowFlags WINDOW_MOUSE_CAPTURE @builtin = 0x0000000000004000;
const WindowFlags WINDOW_MOUSE_RELATIVE_MODE @builtin = 0x0000000000008000;
const WindowFlags WINDOW_ALWAYS_ON_TOP @builtin = 0x0000000000010000;
const WindowFlags WINDOW_UTILITY @builtin = 0x0000000000020000;
const WindowFlags WINDOW_TOOLTIP @builtin = 0x0000000000040000;
const WindowFlags WINDOW_POPUP_MENU @builtin = 0x0000000000080000;
const WindowFlags WINDOW_KEYBOARD_GRABBED @builtin = 0x0000000000100000;
const WindowFlags WINDOW_VULKAN @builtin = 0x0000000010000000;
const WindowFlags WINDOW_METAL @builtin = 0x0000000020000000;
const WindowFlags WINDOW_TRANSPARENT @builtin = 0x0000000040000000;
const WindowFlags WINDOW_NOT_FOCUSABLE @builtin = 0x0000000080000000;
const uint WINDOWPOS_UNDEFINED_MASK @builtin = 0x1FFF0000;
const uint WINDOWPOS_CENTERED_MASK @builtin = 0x2FFF0000;
macro uint @windowpos_undefined_display($x) => WINDOWPOS_UNDEFINED_MASK|$x;
macro bool @windowpos_isundefined($x) => ($x&0xFFFF0000) == WINDOWPOS_UNDEFINED_MASK;
macro uint @windowpos_centered_display($x) => WINDOWPOS_CENTERED_MASK|$x;
macro bool @windowpos_iscentered($x) => ($x&0xFFFF0000) == WINDOWPOS_CENTERED_MASK;
const uint WINDOWPOS_UNDEFINED @builtin = @windowpos_undefined_display(0);
const uint WINDOWPOS_CENTERED @builtin = @windowpos_centered_display(0);
enum FlashOperation : inline CInt {
FLASH_CANCEL,
FLASH_BRIEFLY,
FLASH_UNTIL_FOCUSED
}
typedef GLContext = void*;
typedef EGLDisplay = void*;
typedef EGLConfig = void*;
typedef EGLSurface = void*;
typedef EGLAttrib = ulong; // FIXME: this is not correct for all platforms
typedef EGLint = int;
//alias EGLAttribArrayCallback = fn SDL_EGLAttrib*(void* userdata);
//alias EGLIntArrayCallback = fn SDL_EGLint*(void* userdata, EGLDisplay display, EGLConfig config);
enum GLAttr : inline CInt {
GL_RED_SIZE,
GL_GREEN_SIZE,
GL_BLUE_SIZE,
GL_ALPHA_SIZE,
GL_BUFFER_SIZE,
GL_DOUBLEBUFFER,
GL_DEPTH_SIZE,
GL_STENCIL_SIZE,
GL_ACCUM_RED_SIZE,
GL_ACCUM_GREEN_SIZE,
GL_ACCUM_BLUE_SIZE,
GL_ACCUM_ALPHA_SIZE,
GL_STEREO,
GL_MULTISAMPLEBUFFERS,
GL_MULTISAMPLESAMPLES,
GL_ACCELERATED_VISUAL,
GL_RETAINED_BACKING,
GL_CONTEXT_MAJOR_VERSION,
GL_CONTEXT_MINOR_VERSION,
GL_CONTEXT_FLAGS,
GL_CONTEXT_PROFILE_MASK,
GL_SHARE_WITH_CURRENT_CONTEXT,
GL_FRAMEBUFFER_SRGB_CAPABLE,
GL_CONTEXT_RELEASE_BEHAVIOR,
GL_CONTEXT_RESET_NOTIFICATION,
GL_CONTEXT_NO_ERROR,
GL_FLOATBUFFERS,
GL_EGL_PLATFORM
}
typedef GLProfile = uint;
const GLProfile GL_CONTEXT_PROFILE_CORE @builtin = 0x0001;
const GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY @builtin = 0x0002;
const GLProfile GL_CONTEXT_PROFILE_ES @builtin = 0x0004;
typedef GLContextFlag = uint;
const GLContextFlag GL_CONTEXT_DEBUG_FLAG @builtin = 0x0001;
const GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG @builtin = 0x0002;
const GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG @builtin = 0x0004;
const GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG @builtin = 0x0008;
typedef GLContextReleaseFlag = uint;
const GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE @builtin = 0x0000;
const GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH @builtin = 0x0001;
typedef GLContextResetNotification = uint;
const GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION @builtin = 0x0000;
const GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT @builtin = 0x0001;
extern fn int get_num_video_drivers() @extern("SDL_GetNumVideoDrivers");
extern fn ZString get_video_driver(int index) @extern("SDL_GetVideoDriver");
extern fn ZString get_current_video_driver() @extern("SDL_GetCurrentVideoDriver");
extern fn SystemTheme get_system_theme() @extern("SDL_GetSystemTheme");
extern fn DisplayID * get_displays(int *count) @extern("SDL_GetDisplays");
extern fn DisplayID get_primary_display() @extern("SDL_GetPrimaryDisplay");
extern fn PropertiesID get_display_properties(DisplayID displayID) @extern("SDL_GetDisplayProperties");
const ZString PROP_DISPLAY_HDR_ENABLED_BOOLEAN @builtin = "SDL.display.HDR_enabled";
const ZString PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER @builtin = "SDL.display.KMSDRM.panel_orientation";
extern fn ZString get_display_name(DisplayID displayID) @extern("SDL_GetDisplayName");
extern fn bool get_display_bounds(DisplayID displayID, Rect* rect) @extern("SDL_GetDisplayBounds");
extern fn bool get_display_usable_bounds(DisplayID displayID, Rect* rect) @extern("SDL_GetDisplayUsableBounds");
extern fn DisplayOrientation get_natural_display_orientation(DisplayID displayID) @extern("SDL_GetNaturalDisplayOrientation");
extern fn DisplayOrientation get_current_display_orientation(DisplayID displayID) @extern("SDL_GetCurrentDisplayOrientation");
extern fn float get_display_content_scale(DisplayID displayID) @extern("SDL_GetDisplayContentScale");
extern fn DisplayMode** get_fullscreen_display_modes(DisplayID displayID, int *count) @extern("SDL_GetFullscreenDisplayModes");
extern fn bool get_closest_fullscreen_display_mode(DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, DisplayMode*closest) @extern("SDL_GetClosestFullscreenDisplayMode");
extern fn DisplayMode* get_desktop_display_mode(DisplayID displayID) @extern("SDL_GetDesktopDisplayMode");
extern fn DisplayMode* get_current_display_mode(DisplayID displayID) @extern("SDL_GetCurrentDisplayMode");
extern fn DisplayID get_display_for_point(Point *point) @extern("SDL_GetDisplayForPoint");
extern fn DisplayID get_display_for_rect(Rect *rect) @extern("SDL_GetDisplayForRect");
extern fn DisplayID get_display_for_window(Window *window) @extern("SDL_GetDisplayForWindow");
extern fn float get_window_pixel_density(Window *window) @extern("SDL_GetWindowPixelDensity");
extern fn float get_window_display_scale(Window *window) @extern("SDL_GetWindowDisplayScale");
extern fn bool set_window_fullscreen_mode(Window *window, DisplayMode* mode) @extern("SDL_SetWindowFullscreenMode");
extern fn DisplayMode* get_window_fullscreen_mode(Window *window) @extern("SDL_GetWindowFullscreenMode");
extern fn void* get_window_icc_profile(Window *window, isz* size) @extern("SDL_GetWindowICCProfile");
extern fn PixelFormat get_window_pixel_format(Window *window) @extern("SDL_GetWindowPixelFormat");
extern fn Window** get_windows(int *count) @extern("SDL_GetWindows");
extern fn Window* create_window(ZString title, int w, int h, WindowFlags flags) @extern("SDL_CreateWindow");
extern fn Window* create_popup_window(Window *parent, int offset_x, int offset_y, int w, int h, WindowFlags flags) @extern("SDL_CreatePopupWindow");
extern fn Window* create_window_with_properties(PropertiesID props) @extern("SDL_CreateWindowWithProperties");
const ZString PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN @builtin = "SDL.window.create.always_on_top";
const ZString PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN @builtin = "SDL.window.create.borderless";
const ZString PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN @builtin = "SDL.window.create.focusable";
const ZString PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN @builtin = "SDL.window.create.external_graphics_context";
const ZString PROP_WINDOW_CREATE_FLAGS_NUMBER @builtin = "SDL.window.create.flags";
const ZString PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN @builtin = "SDL.window.create.fullscreen";
const ZString PROP_WINDOW_CREATE_HEIGHT_NUMBER @builtin = "SDL.window.create.height";
const ZString PROP_WINDOW_CREATE_HIDDEN_BOOLEAN @builtin = "SDL.window.create.hidden";
const ZString PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN @builtin = "SDL.window.create.high_pixel_density";
const ZString PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN @builtin = "SDL.window.create.maximized";
const ZString PROP_WINDOW_CREATE_MENU_BOOLEAN @builtin = "SDL.window.create.menu";
const ZString PROP_WINDOW_CREATE_METAL_BOOLEAN @builtin = "SDL.window.create.metal";
const ZString PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN @builtin = "SDL.window.create.minimized";
const ZString PROP_WINDOW_CREATE_MODAL_BOOLEAN @builtin = "SDL.window.create.modal";
const ZString PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN @builtin = "SDL.window.create.mouse_grabbed";
const ZString PROP_WINDOW_CREATE_OPENGL_BOOLEAN @builtin = "SDL.window.create.opengl";
const ZString PROP_WINDOW_CREATE_PARENT_POINTER @builtin = "SDL.window.create.parent";
const ZString PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN @builtin = "SDL.window.create.resizable";
const ZString PROP_WINDOW_CREATE_TITLE_STRING @builtin = "SDL.window.create.title";
const ZString PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN @builtin = "SDL.window.create.transparent";
const ZString PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN @builtin = "SDL.window.create.tooltip";
const ZString PROP_WINDOW_CREATE_UTILITY_BOOLEAN @builtin = "SDL.window.create.utility";
const ZString PROP_WINDOW_CREATE_VULKAN_BOOLEAN @builtin = "SDL.window.create.vulkan";
const ZString PROP_WINDOW_CREATE_WIDTH_NUMBER @builtin = "SDL.window.create.width";
const ZString PROP_WINDOW_CREATE_X_NUMBER @builtin = "SDL.window.create.x";
const ZString PROP_WINDOW_CREATE_Y_NUMBER @builtin = "SDL.window.create.y";
const ZString PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER @builtin = "SDL.window.create.cocoa.window";
const ZString PROP_WINDOW_CREATE_COCOA_VIEW_POINTER @builtin = "SDL.window.create.cocoa.view";
const ZString PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN @builtin = "SDL.window.create.wayland.surface_role_custom";
const ZString PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN @builtin = "SDL.window.create.wayland.create_egl_window";
const ZString PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER @builtin = "SDL.window.create.wayland.wl_surface";
const ZString PROP_WINDOW_CREATE_WIN32_HWND_POINTER @builtin = "SDL.window.create.win32.hwnd";
const ZString PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER @builtin = "SDL.window.create.win32.pixel_format_hwnd";
const ZString PROP_WINDOW_CREATE_X11_WINDOW_NUMBER @builtin = "SDL.window.create.x11.window";
extern fn WindowID get_window_id(Window* window) @extern("SDL_GetWindowID");
extern fn Window* get_window_from_id(WindowID id) @extern("SDL_GetWindowFromID");
extern fn Window* get_window_parent(Window* window) @extern("SDL_GetWindowParent");
extern fn PropertiesID get_window_properties(Window* window) @extern("SDL_GetWindowProperties");
const ZString PROP_WINDOW_SHAPE_POINTER @builtin = "SDL.window.shape";
const ZString PROP_WINDOW_HDR_ENABLED_BOOLEAN @builtin = "SDL.window.HDR_enabled";
const ZString PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT @builtin = "SDL.window.SDR_white_level";
const ZString PROP_WINDOW_HDR_HEADROOM_FLOAT @builtin = "SDL.window.HDR_headroom";
const ZString PROP_WINDOW_ANDROID_WINDOW_POINTER @builtin = "SDL.window.android.window";
const ZString PROP_WINDOW_ANDROID_SURFACE_POINTER @builtin = "SDL.window.android.surface";
const ZString PROP_WINDOW_UIKIT_WINDOW_POINTER @builtin = "SDL.window.uikit.window";
const ZString PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER @builtin = "SDL.window.uikit.metal_view_tag";
const ZString PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER @builtin = "SDL.window.uikit.opengl.framebuffer";
const ZString PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER @builtin = "SDL.window.uikit.opengl.renderbuffer";
const ZString PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER @builtin = "SDL.window.uikit.opengl.resolve_framebuffer";
const ZString PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER @builtin = "SDL.window.kmsdrm.dev_index";
const ZString PROP_WINDOW_KMSDRM_DRM_FD_NUMBER @builtin = "SDL.window.kmsdrm.drm_fd";
const ZString PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER @builtin = "SDL.window.kmsdrm.gbm_dev";
const ZString PROP_WINDOW_COCOA_WINDOW_POINTER @builtin = "SDL.window.cocoa.window";
const ZString PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER @builtin = "SDL.window.cocoa.metal_view_tag";
const ZString PROP_WINDOW_OPENVR_OVERLAY_ID @builtin = "SDL.window.openvr.overlay_id";
const ZString PROP_WINDOW_VIVANTE_DISPLAY_POINTER @builtin = "SDL.window.vivante.display";
const ZString PROP_WINDOW_VIVANTE_WINDOW_POINTER @builtin = "SDL.window.vivante.window";
const ZString PROP_WINDOW_VIVANTE_SURFACE_POINTER @builtin = "SDL.window.vivante.surface";
const ZString PROP_WINDOW_WIN32_HWND_POINTER @builtin = "SDL.window.win32.hwnd";
const ZString PROP_WINDOW_WIN32_HDC_POINTER @builtin = "SDL.window.win32.hdc";
const ZString PROP_WINDOW_WIN32_INSTANCE_POINTER @builtin = "SDL.window.win32.instance";
const ZString PROP_WINDOW_WAYLAND_DISPLAY_POINTER @builtin = "SDL.window.wayland.display";
const ZString PROP_WINDOW_WAYLAND_SURFACE_POINTER @builtin = "SDL.window.wayland.surface";
const ZString PROP_WINDOW_WAYLAND_VIEWPORT_POINTER @builtin = "SDL.window.wayland.viewport";
const ZString PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER @builtin = "SDL.window.wayland.egl_window";
const ZString PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER @builtin = "SDL.window.wayland.xdg_surface";
const ZString PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER @builtin = "SDL.window.wayland.xdg_toplevel";
const ZString PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING @builtin = "SDL.window.wayland.xdg_toplevel_export_handle";
const ZString PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER @builtin = "SDL.window.wayland.xdg_popup";
const ZString PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER @builtin = "SDL.window.wayland.xdg_positioner";
const ZString PROP_WINDOW_X11_DISPLAY_POINTER @builtin = "SDL.window.x11.display";
const ZString PROP_WINDOW_X11_SCREEN_NUMBER @builtin = "SDL.window.x11.screen";
const ZString PROP_WINDOW_X11_WINDOW_NUMBER @builtin = "SDL.window.x11.window";
extern fn WindowFlags get_window_flags(Window* window) @extern("SDL_GetWindowFlags");
extern fn bool set_window_title(Window* window, ZString title) @extern("SDL_SetWindowTitle");
extern fn ZString get_window_title(Window* window) @extern("SDL_GetWindowTitle");
extern fn bool set_window_icon(Window* window, Surface *icon) @extern("SDL_SetWindowIcon");
extern fn bool set_window_position(Window* window, int x, int y) @extern("SDL_SetWindowPosition");
extern fn bool get_window_position(Window* window, int *x, int *y) @extern("SDL_GetWindowPosition");
extern fn bool set_window_size(Window* window, int w, int h) @extern("SDL_SetWindowSize");
extern fn bool get_window_size(Window* window, int *w, int *h) @extern("SDL_GetWindowSize");
extern fn bool get_window_safe_area(Window* window, Rect *rect) @extern("SDL_GetWindowSafeArea");
extern fn bool set_window_aspect_ratio(Window* window, float min_aspect, float max_aspect) @extern("SDL_SetWindowAspectRatio");
extern fn bool get_window_aspect_ratio(Window* window, float *min_aspect, float *max_aspect) @extern("SDL_GetWindowAspectRatio");
extern fn bool get_window_borders_size(Window* window, int *top, int *left, int *bottom, int *right) @extern("SDL_GetWindowBordersSize");
extern fn bool get_window_size_in_pixels(Window* window, int *w, int *h) @extern("SDL_GetWindowSizeInPixels");
extern fn bool set_window_minimum_size(Window* window, int min_w, int min_h) @extern("SDL_SetWindowMinimumSize");
extern fn bool get_window_minimum_size(Window* window, int *w, int *h) @extern("SDL_GetWindowMinimumSize");
extern fn bool set_window_maximum_size(Window* window, int max_w, int max_h) @extern("SDL_SetWindowMaximumSize");
extern fn bool get_window_maximum_size(Window* window, int *w, int *h) @extern("SDL_GetWindowMaximumSize");
extern fn bool set_window_bordered(Window* window, bool bordered) @extern("SDL_SetWindowBordered");
extern fn bool set_window_resizable(Window* window, bool resizable) @extern("SDL_SetWindowResizable");
extern fn bool set_window_always_on_top(Window* window, bool on_top) @extern("SDL_SetWindowAlwaysOnTop");
extern fn bool show_window(Window* window) @extern("SDL_ShowWindow");
extern fn bool hide_window(Window* window) @extern("SDL_HideWindow");
extern fn bool raise_window(Window* window) @extern("SDL_RaiseWindow");
extern fn bool maximize_window(Window* window) @extern("SDL_MaximizeWindow");
extern fn bool minimize_window(Window* window) @extern("SDL_MinimizeWindow");
extern fn bool restore_window(Window* window) @extern("SDL_RestoreWindow");
extern fn bool set_window_fullscreen(Window* window, bool fullscreen) @extern("SDL_SetWindowFullscreen");
extern fn bool sync_window(Window* window) @extern("SDL_SyncWindow");
extern fn bool window_has_surface(Window* window) @extern("SDL_WindowHasSurface");
extern fn Surface* get_window_surface(Window* window) @extern("SDL_GetWindowSurface");
extern fn bool set_window_surface_v_sync(Window* window, int vsync) @extern("SDL_SetWindowSurfaceVSync");
const int WINDOW_SURFACE_VSYNC_DISABLED @builtin = 0;
const int WINDOW_SURFACE_VSYNC_ADAPTIVE @builtin = -1;
extern fn bool get_window_surface_v_sync(Window* window, int *vsync) @extern("SDL_GetWindowSurfaceVSync");
extern fn bool update_window_surface(Window* window) @extern("SDL_UpdateWindowSurface");
extern fn bool update_window_surface_rects(Window* window, Rect* rects, int numrects) @extern("SDL_UpdateWindowSurfaceRects");
extern fn bool destroy_window_surface(Window* window) @extern("SDL_DestroyWindowSurface");
extern fn bool set_window_keyboard_grab(Window* window, bool grabbed) @extern("SDL_SetWindowKeyboardGrab");
extern fn bool set_window_mouse_grab(Window* window, bool grabbed) @extern("SDL_SetWindowMouseGrab");
extern fn bool get_window_keyboard_grab(Window* window) @extern("SDL_GetWindowKeyboardGrab");
extern fn bool get_window_mouse_grab(Window* window) @extern("SDL_GetWindowMouseGrab");
extern fn Window* get_grabbed_window() @extern("SDL_GetGrabbedWindow");
extern fn bool set_window_mouse_rect(Window* window, Rect* rect) @extern("SDL_SetWindowMouseRect");
extern fn Rect* get_window_mouse_rect(Window* window) @extern("SDL_GetWindowMouseRect");
extern fn bool set_window_opacity(Window* window, float opacity) @extern("SDL_SetWindowOpacity");
extern fn float get_window_opacity(Window* window) @extern("SDL_GetWindowOpacity");
extern fn bool set_window_parent(Window* window, Window* parent) @extern("SDL_SetWindowParent");
extern fn bool set_window_modal(Window* window, bool modal) @extern("SDL_SetWindowModal");
extern fn bool set_window_focusable(Window* window, bool focusable) @extern("SDL_SetWindowFocusable");
extern fn bool show_window_system_menu(Window* window, int x, int y) @extern("SDL_ShowWindowSystemMenu");
enum HitTestResult : inline CInt{
HITTEST_NORMAL,
HITTEST_DRAGGABLE,
HITTEST_RESIZE_TOPLEFT,
HITTEST_RESIZE_TOP,
HITTEST_RESIZE_TOPRIGHT,
HITTEST_RESIZE_RIGHT,
HITTEST_RESIZE_BOTTOMRIGHT,
HITTEST_RESIZE_BOTTOM,
HITTEST_RESIZE_BOTTOMLEFT,
HITTEST_RESIZE_LEFT
}
alias HitTest = fn HitTestResult(Window *win, Point *area, void *data);
extern fn bool set_window_hit_test(Window *window, HitTest callback, void *callback_data) @extern("SDL_SetWindowHitTest");
extern fn bool set_window_shape(Window *window, Surface *shape) @extern("SDL_SetWindowShape");
extern fn bool flash_window(Window *window, FlashOperation operation) @extern("SDL_FlashWindow");
extern fn void destroy_window(Window *window) @extern("SDL_DestroyWindow");
extern fn bool screen_saver_enabled() @extern("SDL_ScreenSaverEnabled");
extern fn bool enable_screen_saver() @extern("SDL_EnableScreenSaver");
extern fn bool disable_screen_saver() @extern("SDL_DisableScreenSaver");
extern fn bool gl_load_library(ZString path) @extern("SDL_GL_LoadLibrary");
extern fn FunctionPointer gl_get_proc_address(ZString proc) @extern("SDL_GL_GetProcAddress");
extern fn FunctionPointer egl_get_proc_address(ZString proc) @extern("SDL_EGL_GetProcAddress");
extern fn void gl_unload_library() @extern("SDL_GL_UnloadLibrary");
extern fn bool gl_extension_supported(ZString extension) @extern("SDL_GL_ExtensionSupported");
extern fn void gl_reset_attributes() @extern("SDL_GL_ResetAttributes");
extern fn bool gl_set_attribute(GLAttr attr, int value) @extern("SDL_GL_SetAttribute");
extern fn bool gl_get_attribute(GLAttr attr, int *value) @extern("SDL_GL_GetAttribute");
extern fn GLContext gl_create_context(Window* window) @extern("SDL_GL_CreateContext");
extern fn bool gl_make_current(Window* window, GLContext context) @extern("SDL_GL_MakeCurrent");
extern fn Window* gl_get_current_window() @extern("SDL_GL_GetCurrentWindow");
extern fn GLContext gl_get_current_context() @extern("SDL_GL_GetCurrentContext");
extern fn EGLDisplay egl_get_current_display() @extern("SDL_EGL_GetCurrentDisplay");
extern fn EGLConfig egl_get_current_config() @extern("SDL_EGL_GetCurrentConfig");
extern fn EGLSurface egl_get_window_surface(Window* window) @extern("SDL_EGL_GetWindowSurface");
//extern fn void EGL_SetAttributeCallbacks(EGLAttribArrayCallback platformAttribCallback, EGLIntArrayCallback surfaceAttribCallback, EGLIntArrayCallback contextAttribCallback, void *userdata) @extern("SDL_EGL_SetAttributeCallbacks");
extern fn bool gl_set_swap_interval(int interval) @extern("SDL_GL_SetSwapInterval");
extern fn bool gl_get_swap_interval(int *interval) @extern("SDL_GL_GetSwapInterval");
extern fn bool gl_swap_window(Window *window) @extern("SDL_GL_SwapWindow");
extern fn bool gl_destroy_context(GLContext context) @extern("SDL_GL_DestroyContext");