summaryrefslogtreecommitdiff
path: root/rgfw.c3l/rgfw.c3
diff options
context:
space:
mode:
authorandromeda <andromeda@bsd.my.domain>2026-10-24 00:48:05 -0400
committerandromeda <andromeda@bsd.my.domain>2026-10-24 00:48:05 -0400
commiteb0f2cc6373393303c5a4cd83792dd79103b85de (patch)
tree3f4b746ec73ce745f0c65a5666da7293bd7bd907 /rgfw.c3l/rgfw.c3
parent2e0b6ffcd7c3ddc09daca64993bdc62fc428a175 (diff)
revitalise
Diffstat (limited to 'rgfw.c3l/rgfw.c3')
-rw-r--r--rgfw.c3l/rgfw.c3760
1 files changed, 422 insertions, 338 deletions
diff --git a/rgfw.c3l/rgfw.c3 b/rgfw.c3l/rgfw.c3
index 66bcd69..4ed2a7b 100644
--- a/rgfw.c3l/rgfw.c3
+++ b/rgfw.c3l/rgfw.c3
@@ -1,18 +1,33 @@
/**
-* Copyright (C) 2026 andromeda
-*
-* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * Copyright (C) 2026 andromeda <andromeda@galaxious.de>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
**/
module rgfw;
-alias Info = void;
-alias Window = void;
-alias Window_src = void;
+bitstruct InitFlags : char
+{
+ bool opengl : 0;
+ bool egl : 1;
+ bool vulkan : 2;
+ bool x11 : 3;
+}
+
+typedef Info = void;
+typedef Window = void;
+typedef Window_src = void;
constdef Format : char
{
@@ -36,8 +51,8 @@ struct ColorLayout
alias ConvertImageDataFunc = fn void(char*, char*, ColorLayout*, ColorLayout*, usz);
-alias NativeImage = void;
-alias Surface = void;
+typedef NativeImage = void;
+typedef Surface = void;
struct GammaRamp
{
@@ -51,25 +66,25 @@ struct MonitorMode
{
int w;
int h;
- float refreshRate;
+ float refresh_rate;
char red;
char blue;
char green;
void* src;
}
-alias MonitorNode = void;
+typedef MonitorNode = void;
struct Monitor
{
int x;
int y;
- CChar* name;
- float scaleX;
- float scaleY;
- float pixelRatio;
- float physW;
- float physH;
+ CChar[128] name;
+ float scale_x;
+ float scale_y;
+ float pixel_ratio;
+ float phys_w;
+ float phys_h;
MonitorMode mode;
void* userPtr;
MonitorNode* node;
@@ -83,9 +98,9 @@ constdef ModeRequest : char
ALL = SCALE | REFRESH | RGB,
}
-alias Mouse = void;
+typedef Mouse = void;
-constdef Key
+constdef Key : char
{
KEY_NULL = 0,
KEY_ESCAPE = 27,
@@ -194,7 +209,7 @@ constdef Key
KEY_PADMINUS,
KEY_PADEQUAL,
KEY_PADEQUALS = KEY_PADEQUAL,
- KEY_KEY_PAD1,
+ KEY_PAD1,
KEY_PAD2,
KEY_PAD3,
KEY_PAD4,
@@ -211,7 +226,7 @@ constdef Key
KEY_PAUSE,
KEY_WORLD1,
KEY_WORLD2,
- KEY_LAST = 256,
+ KEY_LAST = 255,
}
constdef MouseButton : char
@@ -227,23 +242,23 @@ constdef MouseButton : char
FINAL,
}
-constdef Keymod : char
+bitstruct Keymod : char
{
- CAPSLOCK = 1 << 0,
- NUMLOCK = 1 << 1,
- CONTROL = 1 << 2,
- ALT = 1 << 3,
- SHIFT = 1 << 4,
- SUPER = 1 << 5,
- SCROLLLOCK = 1 << 6,
+ bool caps_lock : 0;
+ bool num_lock : 1;
+ bool control : 2;
+ bool alt : 3;
+ bool shift : 4;
+ bool super : 5;
+ bool scroll_lock : 6;
}
constdef DndActionType : char
{
- ACTION_NONE = 0,
- ACTION_ENTER,
- ACTION_MOVE,
- ACTION_EXIT,
+ NONE = 0,
+ ENTER,
+ MOVE,
+ EXIT,
}
constdef DataTransferType : char
@@ -256,6 +271,13 @@ constdef DataTransferType : char
UNKNOWN,
}
+struct DataTransfer
+{
+ ZString data;
+ usz length;
+ DataTransferType type;
+}
+
struct DataDropNode
{
ZString data;
@@ -273,7 +295,7 @@ constdef EventType : char
MOUSE_BUTTON_PRESSED,
MOUSE_BUTTON_RELEASED,
MOUSE_SCROLL,
- MOUSE_POS_CHANGED,
+ MOUSE_MOTION,
MOUSE_RAW_MOTION,
MOUSE_ENTER,
MOUSE_LEAVE,
@@ -294,46 +316,56 @@ constdef EventType : char
EVENT_COUNT,
}
-constdef EventFlag : uint
+bitstruct EventFlag : uint @overlap
{
- KEY_PRESSED = 1 << (char)EventType.KEY_PRESSED,
- KEY_RELEASED = 1 << (char)EventType.KEY_RELEASED,
- KEY_CHAR = 1 << (char)EventType.KEY_CHAR,
- MOUSE_BUTTON_PRESSED = 1 << (char)EventType.MOUSE_BUTTON_PRESSED,
- MOUSE_BUTTON_RELEASED = 1 << (char)EventType.MOUSE_BUTTON_RELEASED,
- MOUSE_SCROLL = 1 << (char)EventType.MOUSE_SCROLL,
- MOUSE_POS_CHANGED = 1 << (char)EventType.MOUSE_POS_CHANGED,
- MOUSE_RAW_MOTION = 1 << (char)EventType.MOUSE_RAW_MOTION,
- MOUSE_ENTER = 1 << (char)EventType.MOUSE_ENTER,
- MOUSE_LEAVE = 1 << (char)EventType.MOUSE_LEAVE,
- WINDOW_MOVED = 1 << (char)EventType.WINDOW_MOVED,
- WINDOW_RESIZED = 1 << (char)EventType.WINDOW_RESIZED,
- WINDOW_FOCUS_IN = 1 << (char)EventType.WINDOW_FOCUS_IN,
- WINDOW_FOCUS_OUT = 1 << (char)EventType.WINDOW_FOCUS_OUT,
- WINDOW_REFRESH = 1 << (char)EventType.WINDOW_REFRESH,
- WINDOW_CLOSE = 1 << (char)EventType.WINDOW_CLOSE,
- WINDOW_MAXIMIZED = 1 << (char)EventType.WINDOW_MAXIMIZED,
- WINDOW_MINIMIZED = 1 << (char)EventType.WINDOW_MINIMIZED,
- WINDOW_RESTORED = 1 << (char)EventType.WINDOW_RESTORED,
- DATA_DROP = 1 << (char)EventType.DATA_DROP,
- DATA_DRAG = 1 << (char)EventType.DATA_DRAG,
- SCALE_UPDATED = 1 << (char)EventType.SCALE_UPDATED,
- MONITOR_CONNECTED = 1 << (char)EventType.MONITOR_CONNECTED,
- MONITOR_DISCONNECTED = 1 << (char)EventType.MONITOR_DISCONNECTED,
-
- KEY_EVENTS = KEY_PRESSED | KEY_RELEASED | KEY_CHAR,
- MOUSE_EVENTS = MOUSE_BUTTON_PRESSED | MOUSE_BUTTON_RELEASED | MOUSE_SCROLL | MOUSE_POS_CHANGED | MOUSE_RAW_MOTION
- | MOUSE_ENTER
- | MOUSE_LEAVE,
- WINDOW_EVENTS = WINDOW_MOVED | WINDOW_RESIZED | WINDOW_REFRESH | WINDOW_MAXIMIZED | WINDOW_MINIMIZED | WINDOW_RESTORED
- | SCALE_UPDATED,
- WINDOW_FOCUS_EVENTS = WINDOW_FOCUS_IN | WINDOW_FOCUS_OUT,
- DATA_DRAG_DROP_EVENTS = DATA_DRAG | DATA_DROP,
- MONITOR_EVENTS = MONITOR_CONNECTED | MONITOR_DISCONNECTED,
- ALL_EVENTS = KEY_EVENTS | MOUSE_EVENTS | WINDOW_EVENTS | WINDOW_FOCUS_EVENTS | DATA_DRAG_DROP_EVENTS
- | MONITOR_EVENTS,
+ bool key_pressed : (char)EventType.KEY_PRESSED;
+ bool key_released : (char)EventType.KEY_RELEASED;
+ bool key_char : (char)EventType.KEY_CHAR;
+ bool mouse_scroll : (char)EventType.MOUSE_SCROLL;
+ bool mouse_button_pressed : (char)EventType.MOUSE_BUTTON_PRESSED;
+ bool mouse_button_released : (char)EventType.MOUSE_BUTTON_RELEASED;
+ bool mouse_motion : (char)EventType.MOUSE_MOTION;
+ bool mouse_raw_motion : (char)EventType.MOUSE_RAW_MOTION;
+ bool mouse_enter : (char)EventType.MOUSE_ENTER;
+ bool mouse_leave : (char)EventType.MOUSE_LEAVE;
+ bool window_moved : (char)EventType.WINDOW_MOVED;
+ bool window_resized : (char)EventType.WINDOW_RESIZED;
+ bool window_focus_in : (char)EventType.WINDOW_FOCUS_IN;
+ bool window_focus_out : (char)EventType.WINDOW_FOCUS_OUT;
+ bool window_refresh : (char)EventType.WINDOW_REFRESH;
+ bool window_maximized : (char)EventType.WINDOW_MAXIMIZED;
+ bool window_minimized : (char)EventType.WINDOW_MINIMIZED;
+ bool window_restored : (char)EventType.WINDOW_RESTORED;
+ bool scale_updated : (char)EventType.SCALE_UPDATED;
+ bool window_close : (char)EventType.WINDOW_CLOSE;
+ bool data_drop : (char)EventType.DATA_DROP;
+ bool data_drag : (char)EventType.DATA_DRAG;
+ bool monitor_connected : (char)EventType.MONITOR_CONNECTED;
+ bool monitor_disconnected : (char)EventType.MONITOR_DISCONNECTED;
+ bool key_events : (char)EventType.KEY_PRESSED | (char)EventType.KEY_RELEASED | (char)EventType.KEY_CHAR;
+ bool mouse_events : (char)EventType.MOUSE_BUTTON_PRESSED | (char)EventType.MOUSE_BUTTON_RELEASED | (char)EventType.MOUSE_MOTION
+ | (char)EventType.MOUSE_ENTER
+ | (char)EventType.MOUSE_LEAVE
+ | (char)EventType.MOUSE_SCROLL
+ | (char)EventType.MOUSE_RAW_MOTION;
+ bool window_events : (char)EventType.WINDOW_MOVED | (char)EventType.WINDOW_RESIZED | (char)EventType.WINDOW_REFRESH
+ | (char)EventType.WINDOW_MAXIMIZED
+ | (char)EventType.WINDOW_RESTORED
+ | (char)EventType.SCALE_UPDATED;
+ bool window_focus_events : (char)EventType.WINDOW_FOCUS_IN | (char)EventType.WINDOW_FOCUS_OUT;
+ bool data_drag_drop_events : (char)EventType.DATA_DROP | (char)EventType.DATA_DRAG;
+ bool monitor_events : (char)EventType.MONITOR_CONNECTED | (char)EventType.MONITOR_DISCONNECTED;
}
+const EventFlag ALL_EVENTS = {
+ .key_events,
+ .mouse_events,
+ .window_events,
+ .window_focus_events,
+ .data_drag_drop_events,
+ .monitor_events
+};
+
struct CommonEvent
{
EventType type;
@@ -342,31 +374,27 @@ struct CommonEvent
struct WindowFocusEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
bool state;
}
struct MouseButtonEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
MouseButton value;
bool state;
}
struct MouseDeltaEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
float x;
float y;
}
struct MousePosEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
int x;
int y;
bool inWindow;
@@ -374,8 +402,7 @@ struct MousePosEvent
struct KeyEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
Key value;
bool repeat;
Keymod mod;
@@ -384,22 +411,19 @@ struct KeyEvent
struct KeyCharEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
Char32 value;
}
struct DataDropEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
DataDropNode* value;
}
struct DataDragEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
int x;
int y;
DndActionType action;
@@ -408,24 +432,21 @@ struct DataDragEvent
struct ScaleUpdatedEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
float x;
float y;
}
struct MonitorEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
Monitor* monitor;
bool state;
}
struct WindowUpdateEvent
{
- EventType type;
- Window* win;
+ inline CommonEvent meta;
int x;
int y;
int w;
@@ -462,38 +483,44 @@ struct Callbacks
GenericFunc* arr;
}
-constdef WindowFlags : uint
+constdef FullscreenMode : char
+{
+ NONE,
+ BORDERLESS,
+ EXCLUSIVE,
+}
+
+bitstruct WindowFlags : uint @overlap
{
- NO_BORDER = 1 << 0,
- NO_RESIZE = 1 << 1,
- ALLOW_DND = 1 << 2,
- HIDE_MOUSE = 1 << 3,
- FULLSCREEN = 1 << 4,
- TRANSLUCENT = 1 << 5,
- TRANSPARENT = TRANSLUCENT,
- CENTER = 1 << 6,
- RAW_MOUSE = 1 << 7,
- SCALE_TO_MONITOR = 1 << 8,
- HIDE = 1 << 9,
- MAXIMIZE = 1 << 10,
- CENTER_CURSOR = 1 << 11,
- FLOATING = 1 << 12,
- FOCUS_ON_SHOW = 1 << 13,
- MINIMIZE = 1 << 14,
- FOCUS = 1 << 15,
- CAPTURE_MOUSE = 1 << 16,
- OPENGL = 1 << 17,
- EGL = 1 << 18,
- NO_DEINIT_ON_CLOSE = 1 << 19,
- WINDOWED_FULLSCREEN = NO_BORDER | MAXIMIZE,
- CAPTURE_RAW_MOUSE = CAPTURE_MOUSE | RAW_MOUSE,
+ bool no_border : 0;
+ bool no_resize : 1;
+ bool allow_DND : 2;
+ bool hide_mouse : 3;
+ bool fullscreen_exclusive : 4;
+ bool translucent : 5;
+ bool transparent : 5;
+ bool center : 6;
+ bool raw_mouse : 7;
+ bool scale_to_monitor : 8;
+ bool hide : 9;
+ bool maximize : 10;
+ bool center_cursor : 11;
+ bool floating : 12;
+ bool focus_on_show : 13;
+ bool minimize : 14;
+ bool focus : 15;
+ bool capture_mouse : 16;
+ bool openGL : 17;
+ bool egl : 18;
+ bool fullscreen_borderless : 19;
+ bool capture_raw_mouse : 7 | 16;
}
-constdef Icon : char
+bitstruct Icon : char @overlap
{
- TASKBAR = 1 << 0,
- WINDOW = 1 << 1,
- BOTH = TASKBAR | WINDOW,
+ bool taskbar : 0;
+ bool window : 1;
+ bool both : 0 | 1;
}
constdef MouseIcon : char
@@ -552,8 +579,10 @@ constdef ErrorCode : char
ERR_FAILED_FUNC_LOAD,
ERR_BUFFER,
ERR_METAL,
+ ERR_OBJC_RUNTIME,
ERR_PLATFORM,
ERR_EVENT_QUEUE,
+ ERR_NO_INIT,
INFO_WINDOW,
INFO_BUFFER,
INFO_GLOBAL,
@@ -570,31 +599,32 @@ struct DebugInfo
}
alias DebugFunc = fn void(DebugInfo*);
-alias Proc @if($feature(OPENGL)) = fn void();
-alias GlContext @if($feature(OPENGL)) = void;
-alias EglContext @if($feature(EGL)) = void;
+alias Proc = fn void();
+typedef GlContext @feat(OPENGL) = void;
+typedef EglContext @feat(OPENGL) = void;
-constdef GlReleaseBehavior : int @if($feature(OPENGL))
+constdef GlReleaseBehavior : int @feat(OPENGL)
{
FLUSH = 0,
NONE,
}
-constdef GlProfile : int @if($feature(OPENGL))
+constdef GlProfile : int @feat(OPENGL)
{
CORE = 0,
FORWARD_COMPATIBILITY,
COMPATIBILITY,
ES,
+ WEB,
}
-constdef GlRenderer : int @if($feature(OPENGL))
+constdef GlRenderer : int @feat(OPENGL)
{
ACCELERATED = 0,
SOFTWARE,
}
-struct GlHints @if($feature(OPENGL))
+struct GlHints @feat(OPENGL)
{
int stencil;
int samples;
@@ -625,213 +655,267 @@ struct GlHints @if($feature(OPENGL))
extern fn void* alloc(usz) @cname("RGFW_alloc");
extern fn void free(void*) @cname("RGFW_free");
-extern fn usz sizeofWindow() @cname("RGFW_sizeofWindow");
-extern fn usz sizeofWindowSrc() @cname("RGFW_sizeofWindowSrc");
-extern fn void useWayland(bool) @cname("RGFW_useWayland");
-extern fn bool usingWayland() @cname("RGFW_usingWayland");
-extern fn void* getLayer_OSX() @cname("RGFW_getLayer_OSX");
-extern fn void* getDisplay_X11() @cname("RGFW_getDisplay_X11");
-extern fn void* getDisplay_Wayland() @cname("RGFW_getDisplay_Wayland"); // TODO return isn't void*
-extern fn void setClassName(ZString) @cname("RGFW_setClassName");
-extern fn void setXInstName(ZString) @cname("RGFW_setXInstName");
-extern fn void moveToMacOSResourceDir() @cname("RGFW_modeToMacOSResourceDir");
-extern fn void copyImageData(char*, int, int, Format, char*, Format, ConvertImageDataFunc) @cname("RGFW_copyImageData");
-extern fn usz sizeofNativeImage() @cname("RGFW_sizeofNativeImage");
-extern fn usz sizeofSurface() @cname("RGFW_sizeofSurface");
-extern fn Format nativeFormat() @cname("RGFW_nativeFormat");
-extern fn Surface* createSurface(char*, int, int, Format) @cname("RGFW_createSurface");
-extern fn bool createSurfacePtr(char*, int, int, Format, Surface*) @cname("RGFW_createSurfacePtr");
-extern fn NativeImage* surface_getNativeImage(Surface*) @cname("RGFW_surface_getNativeImage");
-extern fn void surface_free(Surface*) @cname("RGFW_surface_free");
-extern fn void surface_freePtr(Surface*) @cname("RGFW_surface_freePtr");
-extern fn Mouse* createMouse(char*, int, int, Format) @cname("RGFW_createMouse");
-extern fn Mouse* createMouseStandard(MouseIcon) @cname("RGFW_createMouseStandard");
-extern fn void freeMouse(Mouse*) @cname("RGFW_freeMouse");
-extern fn MonitorMode* monitor_getModes(Monitor*, usz*) @cname("RGFW_monitor_getModes");
-extern fn void freeModes(MonitorMode*) @cname("RGFW_freeModes");
-extern fn usz monitor_getModesPtr(Monitor*, MonitorMode**) @cname("RGFW_monitor_getModesPtr");
-extern fn bool monitor_findClosestMode(Monitor*, MonitorMode*, MonitorMode*) @cname("RGFW_monitor_findClosestMode");
-extern fn GammaRamp* monitor_getGammaRamp(Monitor*) @cname("RGFW_monitor_getGammaRamp");
-extern fn void freeGammaRamp(GammaRamp*) @cname("RGFW_freeGammaRamp");
-extern fn usz monitor_getGammaRampPtr(Monitor*, GammaRamp*) @cname("RGFW_monitor_getGammaRampPtr");
-extern fn bool monitor_setGammaRamp(Monitor*, GammaRamp*) @cname("RGFW_monitor_setGammaRamp");
-extern fn bool monitor_setGamma(Monitor*, float) @cname("RGFW_monitor_setGamma");
-extern fn bool monitor_setGammaPtr(Monitor*, float, ushort*, usz) @cname("RGFW_monitor_setGammaPtr");
-extern fn bool monitor_getWorkarea(Monitor*, int*, int*, int*, int*) @cname("RGFW_monitor_getWorkarea");
-extern fn bool monitor_getPosition(Monitor*, int*, int*) @cname("RGFW_monitor_getPosition");
-extern fn ZString monitor_getName(Monitor*) @cname("RGFW_monitor_getName");
-extern fn bool monitor_getScale(Monitor*, float*, float*) @cname("RGFW_monitor_getScale");
-extern fn bool monitor_getPhysicalSize(Monitor*, float*, float*) @cname("RGFW_monitor_getPhysicalSize");
-extern fn void monitor_setUserPtr(Monitor*, void*) @cname("RGFW_monitor_setUserPtr");
-extern fn void* monitor_getUserPtr(Monitor*) @cname("RGFW_monitor_getUserPtr");
-extern fn bool monitor_getMode(Monitor*, MonitorMode*) @cname("RGFW_monitor_getMode");
-extern fn void pollMonitors() @cname("RGFW_pollMonitors");
-extern fn Monitor** getMonitors(usz*) @cname("RGFW_getMonitors");
-extern fn Monitor* getPrimaryMonitor() @cname("RGFW_getPrimaryMonitor");
-extern fn bool monitor_requestMode(Monitor*, MonitorMode*, ModeRequest) @cname("RGFW_monitor_requestMode");
-extern fn bool monitor_setMode(Monitor*, MonitorMode*) @cname("RGFW_monitor_setMode");
-extern fn bool monitorModeCompare(MonitorMode*, MonitorMode*, ModeRequest) @cname("RGFW_monitorModeCompare");
-extern fn bool monitor_scaleToWindow(Monitor*, Window*) @cname("RGFW_monitor_scaleToWindow");
-extern fn void setRawMouseMode(bool) @cname("RGFW_setRawMouseMode");
-extern fn void setBuildDND(bool) @cname("RGFW_setbuildDND");
-extern fn void waitForEvent(int) @cname("RGFW_waitForEvent");
-extern fn void setQueueEvents(bool) @cname("RGFW_setQueueEvents");
-extern fn GenericFunc* setEventCallback(EventType, GenericFunc) @cname("RGFW_setEventCallback");
-extern fn void setDualEventCallback(EventType, GenericFunc, GenericFunc*, GenericFunc*) @cname("RGFW_setDualEventCallback");
-extern fn void setAllEventCallbacks(GenericFunc, Callbacks*) @cname("RGFW_setAllEventCallbacks");
-extern fn void pollEvents() @cname("RGFW_pollEvents");
-extern fn void stopCheckEvents() @cname("RGFW_stopCheckEvents");
-extern fn bool checkEvent(Event*) @cname("RGFW_checkEvent");
-extern fn bool checkQueuedEvent(Event*) @cname("RGFW_checkQueuedEvent");
-extern fn bool isKeyPressed(Key) @cname("RGFW_isKeyPressed");
-extern fn bool isKeyReleased(Key) @cname("RGFW_isKeyReleased");
-extern fn bool isKeyDown(Key) @cname("RGFW_isKeyDown");
-extern fn bool isMousePressed(MouseButton) @cname("RGFW_isMousePressed");
-extern fn bool isMouseReleased(MouseButton) @cname("RGFW_isMouseReleased");
-extern fn bool isMouseDown(MouseButton) @cname("RGFW_isMouseDown");
-extern fn void getMouseScroll(float*, float*) @cname("RGFW_getMouseScroll");
-extern fn void getMouseVector(float*, float*) @cname("RGFW_getMouseVector");
-extern fn Window* createWindow(ZString, int, int, int, int, WindowFlags) @cname("RGFW_createWindow");
-extern fn Window* createWindowPtr(ZString, int, int, int, int, WindowFlags, Window*) @cname("RGFW_createWindowPtr");
-extern fn Surface* window_createSurface(Window*, char*, int, int, Format) @cname("RGFW_window_createSurface");
-extern fn Surface* window_createSurfacePtr(Window*, char*, int, int, Format, Surface*) @cname("RGFW_window_createSurfacePtr");
-extern fn void surface_setConvertFunc(Surface*, ConvertImageDataFunc) @cname("RGFW_surface_setConvertFunc");
-extern fn void window_blitSurface(Window*, Surface*) @cname("RGFW_window_blitSurface");
-extern fn bool window_getPosition(Window*, int*, int*) @cname("RGFW_window_getPosition");
-extern fn bool window_getSize(Window*, int*, int*) @cname("RGFW_window_getSize");
-extern fn bool window_getSizeInPixels(Window*, int*, int*) @cname("RGFW_window_getSizeInPixels");
-extern fn uint window_getFlags(Window*) @cname("RGFW_window_getFlags");
-extern fn Key window_getExitKey(Window*) @cname("RGFW_window_getExitKey");
-extern fn void window_setExitKey(Window*, Key) @cname("RGFW_window_setExitKey");
-extern fn void window_setEnabledEvents(Window*, EventFlag) @cname("RGFW_window_setEnabledEvents");
-extern fn EventFlag window_getEnabledEvents(Window*) @cname("RGFW_window_getEnabledEvents");
-extern fn void window_setDisabledEvents(Window*, EventFlag) @cname("RGFW_window_setDisabledEvents");
-extern fn void window_setEventState(Window*, EventFlag, bool) @cname("RGFW_window_setEventState");
-extern fn void* window_getUserPtr(Window*) @cname("RGFW_window_getUserPtr");
-extern fn void window_setUserPtr(Window*, void*) @cname("RGFW_window_setUserPtr");
-extern fn Window_src* window_getSrc(Window*) @cname("RGFW_window_getSrc");
-extern fn void window_setLayer_OSX(Window*, void*) @cname("RGFW_window_setLayer_OSX");
-extern fn void* window_getView_OSX(Window*) @cname("RGFW_window_getView_OSX");
-extern fn void* window_getWindow_OSX(Window*) @cname("RGFW_window_getWindow_OSX");
-extern fn void* window_getHWND(Window*) @cname("RGFW_window_getHWND");
-extern fn void* window_getHDC(Window*) @cname("RGFW_window_getHDC");
-extern fn ulong window_getWindow_X11(Window*) @cname("RGFW_window_getWindow_X11");
-extern fn void* window_getWindow_Wayland(Window*) @cname("RGFW_window_getWindow_Wayland"); // TODO return isn't *void
-extern fn void window_setFlags(Window*, WindowFlags) @cname("RGFW_window_setFlags");
-extern fn bool window_checkEvent(Window*, Event*) @cname("RGFW_window_checkEvent");
-extern fn bool window_checkQueuedEvent(Window*, Event*) @cname("RGFW_window_checkQueuedEvent");
-extern fn bool window_isKeyPressed(Window*, Key) @cname("RGFW_window_isKeyPressed");
-extern fn bool window_isKeyDown(Window*, Key) @cname("RGFW_window_isKeyDown");
-extern fn bool window_isKeyReleased(Window*, Key) @cname("RGFW_window_isKeyReleased");
-extern fn bool window_isMousePressed(Window*, MouseButton) @cname("RGFW_window_isMousePressed");
-extern fn bool window_isMouseDown(Window*, MouseButton) @cname("RGFW_window_isMouseDown");
-extern fn bool window_isMouseReleased(Window*, MouseButton) @cname("RGFW_window_isMouseReleased");
-extern fn bool window_didMouseLeave(Window*) @cname("RGFW_window_didMouseLeave");
-extern fn bool window_didMouseEnter(Window*) @cname("RGFW_window_didMouseEnter");
-extern fn bool window_isMouseInside(Window*) @cname("RGFW_window_isMouseInside");
-extern fn bool window_isDataDragging(Window*) @cname("RGFW_window_isDataDragging");
-extern fn bool window_getDataDrag(Window*, int*, int*) @cname("RGFW_window_getDataDrag");
-extern fn bool window_didDataDrop(Window*) @cname("RGFW_window_didDataDrop");
-extern fn DataDropNode* window_getDataDrop(Window*) @cname("RGFW_window_getDataDrop");
-extern fn void window_close(Window*) @cname("RGFW_window_close");
-extern fn void window_closePtr(Window*) @cname("RGFW_window_closePtr");
-extern fn bool window_fetchSize(Window*, int*, int*) @cname("RGFW_window_fetchSize");
-extern fn void window_move(Window*, int, int) @cname("RGFW_window_move");
-extern fn void window_moveToMonitor(Window*, Monitor*) @cname("RGFW_window_moveToMonitor");
-extern fn void window_resize(Window*, int, int) @cname("RGFW_window_resize");
-extern fn void window_setAspectRatio(Window*, int, int) @cname("RGFW_window_setAspectRation");
-extern fn void window_setMinSize(Window*, int, int) @cname("RGFW_window_setMinSize");
-extern fn void window_setMaxSize(Window*, int, int) @cname("RGFW_window_setMaxSize");
-extern fn void window_focus(Window*) @cname("RGFW_window_focus");
-extern fn bool window_isInFocus(Window*) @cname("RGFW_window_isInFocus");
-extern fn void window_raise(Window*) @cname("RGFW_window_raise");
-extern fn void window_maximize(Window*) @cname("RGFW_window_maximize");
-extern fn void window_setFullscreen(Window*, bool) @cname("RGFW_window_setFullscreen");
-extern fn void window_center(Window*) @cname("RGFW_window_center");
-extern fn void window_minimize(Window*) @cname("RGFW_window_minimize");
-extern fn void window_restore(Window*) @cname("RGFW_window_restore");
-extern fn void window_setFloating(Window*, bool) @cname("RGFW_window_setFloating");
-extern fn void window_setOpacity(Window*, char) @cname("RGFW_window_setOpacity");
-extern fn void window_setBorder(Window*, bool) @cname("RGFW_window_setBorder");
-extern fn bool window_borderless(Window*) @cname("RGFW_window_borderless");
-extern fn void window_setDND(Window*, bool) @cname("RGFW_window_setDND");
-extern fn bool window_allowsDND(Window*) @cname("RGFW_window_allowsDND");
-extern fn void window_setMousePassthrough(Window*, bool) @cname("RGFW_window_setMousePassthrough");
-extern fn void window_setName(Window*, ZString) @cname("RGFW_window_setName");
-extern fn bool window_setIcon(Window*, char*, int, int, Format) @cname("RGFW_window_seticon");
-extern fn bool window_setIconEx(Window*, char*, int, int, Format, Icon) @cname("RGFW_window_setIconEx");
-extern fn bool window_setMouse(Window*, Mouse*) @cname("RGFW_window_setMouse");
-extern fn bool window_setMouseStandard(Window*, MouseIcon) @cname("RGFW_window_setMouseStandard");
-extern fn bool window_setMouseDefault(Window*) @cname("RGFW_window_setMouseDefault");
-extern fn void window_setRawMouseMode(Window*, bool) @cname("RGFW_window_setRawMousemode");
-extern fn void window_captureMouse(Window*, bool) @cname("RGFW_window_captureMouse");
-extern fn void window_captureRawMouse(Window*, bool) @cname("RGFW_window_captureRawMouse");
-extern fn bool window_isRawMouseMode(Window*) @cname("RGFW_window_isRawMouseMode");
-extern fn bool window_isCaptured(Window*) @cname("RGFW_window_isCaptured");
-extern fn void window_hide(Window*) @cname("RGFW_window_hide");
-extern fn void window_show(Window*) @cname("RGFW_window_show");
-extern fn void window_flash(Window*, FlashRequest) @cname("RGFW_window_flash");
-extern fn void window_setShouldClose(Window*, bool) @cname("RGFW_window_setShouldClose");
-extern fn bool window_getGlobalMouse(int*, int*) @cname("RGFW_window_getGlobalMouse");
-extern fn bool window_getMouse(Window*, int*, int*) @cname("RGFW_window_getMouse");
-extern fn void window_showMouse(Window*, bool) @cname("RGFW_window_showMouse");
-extern fn bool window_isMouseHidden(Window*) @cname("RGFW_window_isMouseHidden");
-extern fn void window_moveMouse(Window*, int, int) @cname("RGFW_window_moveMouse");
-extern fn bool window_shouldClose(Window*) @cname("RGFW_window_shouldClose");
-extern fn bool window_isFullscreen(Window*) @cname("RGFW_window_isFullscreen");
-extern fn bool window_isHidden(Window*) @cname("RGFW_window_isHidden");
-extern fn bool window_isMinimized(Window*) @cname("RGFW_window_isMinimized");
-extern fn bool window_isMaximized(Window*) @cname("RGFW_window_isMaximized");
-extern fn bool window_isFloating(Window*) @cname("RGFW_window_isFloating");
-extern fn void window_scaleToMonitor(Window*) @cname("RGFW_window_scaleToMonitor");
-extern fn Monitor* window_getMonitor(Window*) @cname("RGFW_window_getMonitor");
-extern fn ZString readClipboard(usz*) @cname("RGFW_readClipboard");
-extern fn sz readClipboardPtr(CChar*, usz) @cname("RGFW_readClipboardPtr");
-extern fn void writeClipboard(ZString, uint) @cname("RGFW_writeClipboard");
-extern fn DebugFunc setDebugCallback(DebugFunc) @cname("RGFW_setDebugCallback");
-extern fn void debugCallback(DebugType, ErrorCode, ZString) @cname("RGFW_debugCallback");
+extern fn usz sizeof_info() @cname("RGFW_sizeofInfo");
+extern fn int init(ZString, InitFlags) @cname("RGFW_init");
+extern fn void deinit() @cname("RGFW_deinit");
+extern fn int init_ptr(ZString, InitFlags, Info*) @cname("RGFW_init_ptr");
+extern fn void deinit_ptr(Info*) @cname("RGFW_deinit_ptr");
+extern fn void set_info(Info*) @cname("RGFW_setInfo");
+extern fn Info* get_info() @cname("RGFW_getInfo");
+extern fn usz sizeof_window() @cname("RGFW_sizeofWindow");
+extern fn usz sizeof_window_src() @cname("RGFW_sizeofWindowSrc");
+extern fn bool using_wayland() @cname("RGFW_usingWayland");
+extern fn void* get_layer_OSX() @cname("RGFW_getLayer_OSX");
+extern fn void* get_display_X11() @cname("RGFW_getDisplay_X11");
+extern fn void* get_display_wayland() @cname("RGFW_getDisplay_Wayland");
+extern fn void move_to_macos_resource_dir() @cname("RGFW_moveToMacOSResourceDir");
+extern fn void copy_image_data(char*, int, int, Format, char*, Format, ConvertImageDataFunc) @cname("RGFW_copyImageData");
+extern fn usz sizeof_native_image() @cname("RGFW_sizeofNativeImage");
+extern fn usz sizeof_surface() @cname("RGFW_sizeofSurface");
+extern fn Format native_format() @cname("RGFW_nativeFormat");
+extern fn Surface* create_surface(char*, int, int, Format) @cname("RGFW_createSurface");
+extern fn bool create_surface_ptr(char*, int, int, Format, Surface*) @cname("RGFW_createSurfacePtr");
+extern fn NativeImage* Surface.get_native_image(&self) @cname("RGFW_surface_getNativeImage");
+extern fn void Surface.free(&self) @cname("RGFW_surface_free");
+extern fn void Surface.free_ptr(&self) @cname("RGFW_surface_freePtr");
+extern fn Mouse* create_mouse(char*, int, int, Format) @cname("RGFW_createMouse");
+extern fn Mouse* create_mouse_standard(MouseIcon) @cname("RGFW_createMouseStandard");
+extern fn void Mouse.free(Mouse*) @cname("RGFW_freeMouse");
+extern fn MonitorMode* Monitor.get_modes(&self, usz*) @cname("RGFW_monitor_getModes");
+extern fn void free_modes(MonitorMode*) @cname("RGFW_freeModes");
+extern fn usz Monitor.get_modes_ptr(&self, MonitorMode**) @cname("RGFW_monitor_getModesPtr");
+extern fn bool Monitor.find_closest_mode(&self, MonitorMode*, MonitorMode*) @cname("RGFW_monitor_findClosestMode");
+extern fn GammaRamp* Monitor.get_gamma_ramp(&self) @cname("RGFW_monitor_getGammaRamp");
+extern fn void GammaRamp.free(&self) @cname("RGFW_freeGammaRamp");
+extern fn usz Monitor.get_gamma_ramp_ptr(&self, GammaRamp*) @cname("RGFW_monitor_getGammaRampPtr");
+extern fn bool Monitor.set_gamma_ramp(&self, GammaRamp*) @cname("RGFW_monitor_setGammaRamp");
+extern fn bool Monitor.set_gamma(&self, float) @cname("RGFW_monitor_setGamma");
+extern fn bool Monitor.set_gamma_ptr(&self, float, ushort*, usz) @cname("RGFW_monitor_setGammaPtr");
+extern fn bool Monitor.get_workarea(&self, int*, int*, int*, int*) @cname("RGFW_monitor_getWorkarea");
+extern fn bool Monitor.get_position(&self, int*, int*) @cname("RGFW_monitor_getPosition");
+extern fn ZString Monitor.get_name(&self) @cname("RGFW_monitor_getName");
+extern fn bool Monitor.get_scale(&self, float*, float*) @cname("RGFW_monitor_getScale");
+extern fn bool Monitor.get_physical_size(&self, float*, float*) @cname("RGFW_monitor_getPhysicalSize");
+extern fn void Monitor.set_user_ptr(&self, void*) @cname("RGFW_monitor_setUserPtr");
+extern fn void* Monitor.get_user_ptr(&self) @cname("RGFW_monitor_getUserPtr");
+extern fn bool Monitor.get_mode(&self, MonitorMode*) @cname("RGFW_monitor_getMode");
+extern fn void poll_monitors() @cname("RGFW_pollMonitors");
+extern fn void free_monitors() @cname("RGFW_freeMonitors");
+extern fn Monitor** get_monitors(usz*) @cname("RGFW_getMonitors");
+extern fn bool get_monitors_ptr(usz, Monitor**, usz*) @cname("RGFW_getMonitorsPtr");
+extern fn Monitor* get_primary_monitor() @cname("RGFW_getPrimaryMonitor");
+extern fn bool Monitor.request_mode(&self, MonitorMode*, ModeRequest) @cname("RGFW_monitor_requestMode");
+extern fn bool Monitor.set_mode(&self, MonitorMode*) @cname("RGFW_monitor_setMode");
+extern fn bool monitor_mode_compare(MonitorMode*, MonitorMode*, ModeRequest) @cname("RGFW_monitorModeCompare");
+extern fn bool Monitor.scale_to_window(&self, Window*) @cname("RGFW_monitor_scaleToWindow");
+extern fn void set_raw_mouse_mode(bool) @cname("RGFW_setRawMouseMode");
+extern fn void set_build_DND(bool) @cname("RGFW_setbuildDND");
+extern fn void wait_for_event(int) @cname("RGFW_waitForEvent");
+extern fn void set_queue_events(bool) @cname("RGFW_setQueueEvents");
+extern fn GenericFunc* set_event_callback(EventType, GenericFunc) @cname("RGFW_setEventCallback");
+extern fn void set_dual_event_callback(EventType, GenericFunc, GenericFunc*, GenericFunc*) @cname("RGFW_setDualEventCallback");
+extern fn void set_all_event_callbacks(GenericFunc, Callbacks*) @cname("RGFW_setAllEventCallbacks");
+extern fn void poll_events() @cname("RGFW_pollEvents");
+extern fn void stop_check_events() @cname("RGFW_stopCheckEvents");
+extern fn bool check_event(Event*) @cname("RGFW_checkEvent");
+extern fn bool check_queued_event(Event*) @cname("RGFW_checkQueuedEvent");
+extern fn bool Key.is_pressed(self) @cname("RGFW_isKeyPressed");
+extern fn bool Key.is_released(self) @cname("RGFW_isKeyReleased");
+extern fn bool Key.is_down(self) @cname("RGFW_isKeyDown");
+extern fn bool MouseButton.is_pressed(self) @cname("RGFW_isMousePressed");
+extern fn bool MouseButton.is_released(self) @cname("RGFW_isMouseReleased");
+extern fn bool MouseButton.is_down(self) @cname("RGFW_isMouseDown");
+extern fn void get_mouse_scroll(float*, float*) @cname("RGFW_getMouseScroll");
+extern fn void get_mouse_vector(float*, float*) @cname("RGFW_getMouseVector");
+extern fn Window* create_window(ZString, int, int, int, int, WindowFlags) @cname("RGFW_createWindow");
+extern fn Window* create_window_ptr(ZString, int, int, int, int, WindowFlags, Window*) @cname("RGFW_createWindowPtr");
+extern fn Surface* Window.create_surface(&self, char*, int, int, Format) @cname("RGFW_window_createSurface");
+extern fn Surface* Window.create_surface_ptr(&self, char*, int, int, Format, Surface*) @cname("RGFW_window_createSurfacePtr");
+extern fn void Surface.set_convert_func(&self, ConvertImageDataFunc) @cname("RGFW_surface_setConvertFunc");
+extern fn void Window.blit_suface(&self, Surface*) @cname("RGFW_window_blitSurface");
+extern fn bool Window.get_position(&self, int*, int*) @cname("RGFW_window_getPosition");
+extern fn bool Window.get_size(&self, int*, int*) @cname("RGFW_window_getSize");
+extern fn bool Window.get_size_in_pixels(&self, int*, int*) @cname("RGFW_window_getSizeInPixels");
+extern fn uint Window.get_flags(&self) @cname("RGFW_window_getFlags");
+extern fn Key Window.get_exit_key(&self) @cname("RGFW_window_getExitKey");
+extern fn void Window.set_exit_key(&self, Key) @cname("RGFW_window_setExitKey");
+extern fn void Window.set_enabled_events(&self, EventFlag) @cname("RGFW_window_setEnabledEvents");
+extern fn EventFlag Window.get_enabled_events(&self) @cname("RGFW_window_getEnabledEvents");
+extern fn void Window.set_disabled_events(&self, EventFlag) @cname("RGFW_window_setDisabledEvents");
+extern fn void Window.set_event_state(&self, EventFlag, bool) @cname("RGFW_window_setEventState");
+extern fn void* Window.get_user_ptr(&self) @cname("RGFW_window_getUserPtr");
+extern fn void Window.set_user_ptr(&self, void*) @cname("RGFW_window_setUserPtr");
+extern fn Window_src* Window.get_src(&self) @cname("RGFW_window_getSrc");
+extern fn void Window.set_layer_OSX(&self, void*) @cname("RGFW_window_setLayer_OSX");
+extern fn void* Window.get_view_OSX(&self) @cname("RGFW_window_getView_OSX");
+extern fn void* Window.get_window_OSX(&self) @cname("RGFW_window_getWindow_OSX");
+extern fn void* Window.get_HWND(&self) @cname("RGFW_window_getHWND");
+extern fn void* Window.get_HDC(&self) @cname("RGFW_window_getHDC");
+extern fn ulong Window.get_window_X11(&self) @cname("RGFW_window_getWindow_X11");
+extern fn void* Window.get_window_wayland(&self) @cname("RGFW_window_getWindow_Wayland");
+extern fn void Window.set_flags(&self, WindowFlags) @cname("RGFW_window_setFlags");
+extern fn bool Window.check_event(&self, Event*) @cname("RGFW_window_checkEvent");
+extern fn bool Window.check_queued_event(&self, Event*) @cname("RGFW_window_checkQueuedEvent");
+extern fn bool Window.is_key_pressed(&self, Key) @cname("RGFW_window_isKeyPressed");
+extern fn bool Window.is_key_down(&self, Key) @cname("RGFW_window_isKeyDown");
+extern fn bool Window.is_key_released(&self, Key) @cname("RGFW_window_isKeyReleased");
+extern fn bool Window.is_mouse_pressed(&self, MouseButton) @cname("RGFW_window_isMousePressed");
+extern fn bool Window.is_mouse_down(&self, MouseButton) @cname("RGFW_window_isMouseDown");
+extern fn bool Window.is_mouse_released(&self, MouseButton) @cname("RGFW_window_isMouseReleased");
+extern fn bool Window.did_mouse_leave(&self) @cname("RGFW_window_didMouseLeave");
+extern fn bool Window.did_mouse_enter(&self) @cname("RGFW_window_didMouseEnter");
+extern fn bool Window.is_mouse_inside(&self) @cname("RGFW_window_isMouseInside");
+extern fn bool Window.is_data_dragging(&self) @cname("RGFW_window_isDataDragging");
+extern fn bool Window.get_data_drag(&self, int*, int*) @cname("RGFW_window_getDataDrag");
+extern fn bool Window.did_data_drop(&self) @cname("RGFW_window_didDataDrop");
+extern fn DataDropNode* Window.get_data_drop(&self) @cname("RGFW_window_getDataDrop");
+extern fn void Window.close(&self) @cname("RGFW_window_close");
+extern fn void Window.close_ptr(&self) @cname("RGFW_window_closePtr");
+extern fn bool Window.fetch_size(&self, int*, int*) @cname("RGFW_window_fetchSize");
+extern fn void Window.move(&self, int, int) @cname("RGFW_window_move");
+extern fn void Window.move_to_monitor(&self, Monitor*) @cname("RGFW_window_moveToMonitor");
+extern fn void Window.resize(&self, int, int) @cname("RGFW_window_resize");
+extern fn void Window.set_aspect_ratio(&self, int, int) @cname("RGFW_window_setAspectRatio");
+extern fn void Window.set_min_size(&self, int, int) @cname("RGFW_window_setMinSize");
+extern fn void Window.set_max_size(&self, int, int) @cname("RGFW_window_setMaxSize");
+extern fn void Window.focus(&self) @cname("RGFW_window_focus");
+extern fn bool Window.is_in_focus(&self) @cname("RGFW_window_isInFocus");
+extern fn void Window.raise(&self) @cname("RGFW_window_raise");
+extern fn void Window.maximize(&self) @cname("RGFW_window_maximize");
+extern fn void Window.set_fullscreen(&self, bool) @cname("RGFW_window_setFullscreen");
+extern fn void Window.center(&self) @cname("RGFW_window_center");
+extern fn void Window.minimize(&self) @cname("RGFW_window_minimize");
+extern fn void Window.restore(&self) @cname("RGFW_window_restore");
+extern fn void Window.set_floating(&self, bool) @cname("RGFW_window_setFloating");
+extern fn void Window.set_opacity(&self, char) @cname("RGFW_window_setOpacity");
+extern fn void Window.set_border(&self, bool) @cname("RGFW_window_setBorder");
+extern fn bool Window.borderless(&self) @cname("RGFW_window_borderless");
+extern fn void Window.set_DND(&self, bool) @cname("RGFW_window_setDND");
+extern fn bool Window.allows_DND(&self) @cname("RGFW_window_allowsDND");
+extern fn void Window.set_mouse_passthrough(&self, bool) @cname("RGFW_window_setMousePassthrough");
+extern fn void Window.set_name(&self, ZString) @cname("RGFW_window_setName");
+extern fn bool Window.set_icon(&self, char*, int, int, Format) @cname("RGFW_window_seticon");
+extern fn bool Window.set_icon_ex(&self, char*, int, int, Format, Icon) @cname("RGFW_window_setIconEx");
+extern fn bool Window.set_mouse(&self, Mouse*) @cname("RGFW_window_setMouse");
+extern fn bool Window.set_mouse_standard(&self, MouseIcon) @cname("RGFW_window_setMouseStandard");
+extern fn bool Window.set_mouse_default(&self) @cname("RGFW_window_setMouseDefault");
+extern fn void Window.set_raw_mouse_mode(&self, bool) @cname("RGFW_window_setRawMouseMode");
+extern fn void Window.capture_mouse(&self, bool) @cname("RGFW_window_captureMouse");
+extern fn void Window.capture_raw_mouse_mode(&self, bool) @cname("RGFW_window_captureRawMouse");
+extern fn bool Window.is_raw_mouse_mode(&self) @cname("RGFW_window_isRawMouseMode");
+extern fn bool Window.is_captured(&self) @cname("RGFW_window_isCaptured");
+extern fn void Window.hide(&self) @cname("RGFW_window_hide");
+extern fn void Window.show(&self) @cname("RGFW_window_show");
+extern fn void Window.flash(&self, FlashRequest) @cname("RGFW_window_flash");
+extern fn void Window.set_should_close(&self, bool) @cname("RGFW_window_setShouldClose");
+extern fn bool get_global_mouse(int*, int*) @cname("RGFW_getGlobalMouse");
+extern fn bool Window.get_mouse(&self, int*, int*) @cname("RGFW_window_getMouse");
+extern fn void Window.show_mouse(&self, bool) @cname("RGFW_window_showMouse");
+extern fn bool Window.is_mouse_hidden(&self) @cname("RGFW_window_isMouseHidden");
+extern fn void Window.move_mouse(&self, int, int) @cname("RGFW_window_moveMouse");
+extern fn bool Window.should_close(&self) @cname("RGFW_window_shouldClose");
+extern fn bool Window.is_fullscreen(&self) @cname("RGFW_window_isFullscreen");
+extern fn bool Window.is_fullscreen_exclusive(&self) @cname("RGFW_window_isFullscreenExclusive");
+extern fn bool Window.is_fullscreen_borderless(&self) @cname("RGFW_window_isFullscreenBorderless");
+extern fn bool Window.is_hidden(&self) @cname("RGFW_window_isHidden");
+extern fn bool Window.is_minimized(&self) @cname("RGFW_window_isMinimized");
+extern fn bool Window.is_maximized(&self) @cname("RGFW_window_isMaximized");
+extern fn bool Window.is_floating(&self) @cname("RGFW_window_isFloating");
+extern fn void Window.scale_to_monitor(&self) @cname("RGFW_window_scaleToMonitor");
+extern fn Monitor* Window.get_monitor(&self) @cname("RGFW_window_getMonitor");
+extern fn DataTransfer* read_clipboard(DataTransferType) @cname("RGFW_readClipboard");
+extern fn bool read_clipboard_ptr(DataTransferType, char*, usz, DataTransfer*) @cname("RGFW_readClipboardPtr");
+// TODO tell upstream the following function's docs are wrong
+extern fn DataTransfer* read_clipboard_string() @cname("RGFW_readClipboardString");
+extern fn bool read_clipboard_string_ptr(char*, usz, DataTransfer*) @cname("RGFW_readClipboardStringPtr");
+extern fn bool write_clipboard(DataTransfer*) @cname("RGFW_writeClipboard");
+extern fn DebugFunc set_debug_callback(DebugFunc) @cname("RGFW_setDebugCallback");
+extern fn void debug_callback(DebugType, ErrorCode, ZString) @cname("RGFW_debugCallback");
+extern fn void Window.set_root(&self) @cname("RGFW_setRootWindow");
+extern fn Window* get_root_window() @cname("RGFW_getRootWindow");
+extern fn void event_queue_push(Event*) @cname("RGFW_eventQueuePush");
+extern fn void event_queue_push_and_call(Event*) @cname("RGFW_eventQueuePushAndCall");
+extern fn void event_queue_flush() @cname("RGFW_eventQueueFlush");
+extern fn Event* event_queue_pop() @cname("RGFW_eventQueuePop");
+extern fn Event* Window.event_queue_pop(&self) @cname("RGFW_window_eventQueuePop");
+extern fn Key api_key_to_rgfw(uint) @cname("RGFW_apiKeyToRGFW");
+extern fn uint rgfw_to_api_key(Key) @cname("RGFW_rgfwToApiKey");
+extern fn Key physical_to_mapped_key(Key) @cname("RGFW_physicalToMappedKey");
+
+module rgfw::opengl @feat(OPENGL | EGL);
+extern fn void set_global_hints(GlHints*) @cname("RGFW_setGlobalHints_OpenGL");
+extern fn void reset_global_hints() @cname("RGFW_resetGlobalHints_OpenGL");
+extern fn GlHints* get_global_hints() @cname("RGFW_getGlobalHints_OpenGL");
+
+module rgfw::opengl @feat(OPENGL);
+extern fn GlContext* create_context(GlHints*) @cname("RGFW_createContext_OpenGL");
+extern fn bool create_context_ptr(GlContext*, GlHints*) @cname("RGFW_createContextPtr_OpenGL");
+extern fn void delete_context(GlContext*) @cname("RGFW_deleteContext_OpenGL");
+extern fn void delete_context_ptr(GlContext*) @cname("RGFW_deleteContextPtr_OpenGL");
+extern fn GlContext* copy_context(GlContext*) @cname("RGFW_copyContext_OpenGL");
+extern fn bool copy_context_ptr(GlContext*, GlContext*) @cname("RGFW_copyContextPtr_OpenGL");
+extern fn void* GlContext.get_source_context(&self) @cname("RGFW_glContext_getSourceContext");
+extern fn void* get_current_context() @cname("RGFW_getCurrentContext_OpenGL");
+extern fn void* get_current_surface() @cname("RGFW_getCurrentSurface_OpenGL");
+extern fn Window* get_current_window() @cname("RGFW_getCurrentWindow_OpenGL");
+extern fn Proc get_proc_address(ZString) @cname("RGFW_getProcAddress_OpenGL");
+extern fn bool extension_supported(ZString, usz) @cname("RGFW_extensionSupported_OpenGL");
+extern fn bool extension_supported_platform(ZString, usz) @cname("RGFW_extensionSupportedPlatform_OpenGL");
+
+// if EGL is defined, prefer those methods as they (should) fall back
+module rgfw::opengl @feat(OPENGL & !EGL);
+extern fn bool Window.set_context(&self, GlContext*) @cname("RGFW_window_setContext_OpenGL");
+extern fn GlContext* Window.get_context(&self) @cname("RGFW_window_getContext_OpenGL");
+extern fn void Window.make_current_window(&self) @cname("RGFW_window_makeCurrentWindow_OpenGL");
+extern fn void Window.make_current_context(&self) @cname("RGFW_window_makeCurrentContext_OpenGL");
+extern fn void Window.swap_buffers(&self) @cname("RGFW_window_swapBuffers_OpenGL");
+extern fn void Window.swap_interval(&self, int) @cname("RGFW_window_swapInterval_OpenGL");
+
+module rgfw::egl @feat(EGL);
+extern fn EglContext* create_context(GlHints*) @cname("RGFW_window_createContext_EGL");
+extern fn bool create_context_ptr(EglContext*, GlHints*) @cname("RGFW_window_createContextPtr_EGL");
+extern fn void delete_context(EglContext*) @cname("RGFW_window_deleteContext_EGL");
+extern fn void delete_context_ptr(EglContext*) @cname("RGFW_window_deleteContextPtr_EGL");
+extern fn EglContext* copy_context(EglContext*) @cname("RGFW_copyContext_EGL");
+extern fn bool copy_context_ptr(EglContext*, EglContext*) @cname("RGFW_copyContextPtr_EGL");
+extern fn bool Window.set_context(&self, EglContext*) @cname("RGFW_window_setContext_EGL");
+extern fn EglContext* Window.get_context(&self) @cname("RGFW_window_getContext_EGL");
+extern fn void* get_display() @cname("RGFW_getDisplay_EGL");
+extern fn void* EglContext.get_source_context(&self) @cname("RGFW_eglContext_getSourceContext");
+extern fn void* EglContext.get_surface(&self) @cname("RGFW_eglContext_getSurface");
+extern fn void* EglContext.wl_egl_window(&self) @cname("RGFW_eglContext_wlEGLWindow");
+extern fn void Window.swap_buffers(&self) @cname("RGFW_window_swapBuffers_EGL");
+extern fn void Window.make_current_window(&self) @cname("RGFW_window_makeCurrentWindow_EGL");
+extern fn void Window.make_current_context(&self) @cname("RGFW_window_makeCurrentContext_EGL");
+extern fn void* get_current_context() @cname("RGFW_getCurrentContext_EGL");
+extern fn void* get_current_surface() @cname("RGFW_getCurrentSurface_EGL");
+extern fn Window* get_current_window() @cname("RGFW_getCurrentWindow_EGL");
+extern fn void Window.swap_interval(&self, int) @cname("RGFW_window_swapInterval_EGL");
+extern fn Proc get_proc_address(ZString) @cname("RGFW_getProcAddress_EGL");
+extern fn bool extension_supported(ZString, usz) @cname("RGFW_extensionSupported_EGL");
+extern fn bool extension_supported_platform(ZString, usz) @cname("RGFW_extensionSupportedPlatform_EGL");
-module rgfw::opengl @if($feature(OPENGL));
-extern fn void setGlobalHints(GlHints*) @cname("RGFW_setGlobalHints_OpenGL");
-extern fn void resetGlobalHints() @cname("RGFW_resetGlobalHints_OpenGL");
-extern fn GlHints* getGlobalHints() @cname("RGFW_getGlobalHints_OpenGL");
-extern fn GlContext* window_createContext(Window*, GlHints*) @cname("RGFW_window_createContext_OpenGL");
-extern fn bool window_createContextPtr(Window*, GlContext*, GlHints*) @cname("RGFW_window_createContextPtr_OpenGL");
-extern fn GlContext* window_getContext(Window*) @cname("RGFW_window_getContext_OpenGL");
-extern fn void window_deleteContext(Window*, GlContext*) @cname("RGFW_window_deleteContext_OpenGL");
-extern fn void window_deleteContextPtr(Window*, GlContext*) @cname("RGFW_window_deleteContextPtr_OpenGL");
-extern fn void* glContext_getSourceContext(GlContext*) @cname("RGFW_glContext_getSourceContext");
-extern fn void window_makeCurrentWindow(Window*) @cname("RGFW_window_makeCurrentWindow_OpenGL");
-extern fn void window_makeCurrentContext(Window*) @cname("RGFW_window_makeCurrentContext_OpenGL");
-extern fn void window_swapBuffers(Window*) @cname("RGFW_window_swapBuffers_OpenGL");
-extern fn void* getCurrentContext() @cname("RGFW_getCurrentContext_OpenGL");
-extern fn Window* getCurrentWindow() @cname("RGFW_getCurrentWindow_OpenGL");
-extern fn void window_swapInterval(Window*, int) @cname("RGFW_window_swapInterval_OpenGL");
-extern fn Proc getProcAddress(ZString) @cname("RGFW_getProcAddress_OpenGL");
-extern fn bool extensionSupported(ZString, usz) @cname("RGFW_extensionSupported_OpenGL");
-extern fn bool extensionSupportedPlatform(ZString, usz) @cname("RGFW_extensionSupportedPlatform_OpenGL");
+module rgfw::vulkan @feat(VULKAN);
+alias VkResult = int;
+alias VkInstance = void*;
+alias VkSurfaceKHR = ulong;
+alias VkPhysicalDevice = void*;
+extern fn Proc VkInstance.get_proc_address(self, ZString) @cname("RGFW_getInstanceProcAddress_Vulkan");
+extern fn ZString[] get_required_instance_extensions(usz*) @cname("RGFW_getRequiredInstanceExtensions_Vulkan");
+extern fn VkResult create_surface(Window*, VkInstance, VkSurfaceKHR*) @cname("RGFW_window_createSurface_Vulkan");
+extern fn bool VkInstance.get_physical_device_presentation_support(
+ self,
+ VkPhysicalDevice,
+ uint
+) @cname("RGFW_getPhysicalDevicePresentationSupport_Vulkan");
-// RGFW_EGL
-module rgfw::egl @if($feature(EGL));
-extern fn EglContext* window_createContext(Window*, GlHints*) @cname("RGFW_window_createContext_EGL");
-extern fn bool window_createContextPtr(Window*, EglContext*, GlHints*) @cname("RGFW_window_createContextPtr_EGL");
-extern fn void window_deleteContext(Window*, EglContext*) @cname("RGFW_window_deleteContext_EGL");
-extern fn void window_deleteContextPtr(Window*, EglContext*) @cname("RGFW_window_deleteContextPtr_EGL");
-extern fn EglContext* window_getContext(Window*) @cname("RGFW_window_getContext_EGL");
-extern fn void* getDisplay() @cname("RGFW_getDisplay_EGL");
-extern fn void* eglContext_getSourceContext(EglContext*) @cname("RGFW_eglContext_getSourceContext");
-extern fn void* eglContext_getSurface(EglContext*) @cname("RGFW_eglContext_getSurface");
-extern fn void* eglContext_wlEglWindow(EglContext*) @cname("RGFW_eglContext_wlEGLWindow");
-extern fn void window_swapBuffers(Window*) @cname("RGFW_window_swapBuffers_EGL");
-extern fn void window_makeCurrentWindow(Window*) @cname("RGFW_window_makeCurrentWindow_EGL");
-extern fn void window_makeCurrentContext(Window*) @cname("RGFW_window_makeCurrentContext_EGL");
-extern fn void* getCurrentContext() @cname("RGFW_getCurrentContext_EGL");
-extern fn Window* getCurrentWindow() @cname("RGFW_getCurrentWindow_EGL");
-extern fn void window_swapInterval(Window*, int) @cname("RGFW_window_swapInterval_EGL");
-extern fn Proc* getProcAddress(ZString) @cname("RGFW_getProcAddress_EGL");
-extern fn bool extensionSupported(ZString, usz) @cname("RGFW_extensionSupported_EGL");
-extern fn bool extensionSupportedPlatform(ZString, usz) @cname("RGFW_extensionSupportedPlatform_EGL");
+module rgfw::directx @feat(DIRECTX);
+alias IDXGIFactory = void;
+alias IUnknown = void;
+alias UDXGISwapChain = void;
+extern fn int create_swap_chain(Window*, IDXGIFactory*, IUnknown*, UDXGISwapChain**) @cname("RGFW_window_createSwapChain_DirectX");
-// RGFW_VULKAN 2599..2626
-// RGFW_DIRECTX 2630..2649
-// RGFW_WEBGPU 2652..2661
+module rgfw::wgpu @feat(WGPU);
+alias WGPUSurface = void*;
+alias WGPUInstance = void*;
+extern fn WGPUSurface create_surface(Window*, WGPUInstance) @cname("RGFW_window_createSurface_WebGPU");