summaryrefslogtreecommitdiff
path: root/rgfw.c3
diff options
context:
space:
mode:
authorandromeda <andromeda@lenovo>2026-04-25 00:49:46 +0200
committerandromeda <andromeda@lenovo>2026-04-25 00:49:46 +0200
commit168abecfafadb57a0c677777a40083761bf8a922 (patch)
tree2437a104b6c7ba15702fcee10851cfe16b0505cb /rgfw.c3
parent643cf49f77e64f00589bc16147be0afc95fc08cf (diff)
add rsgl, modularize
Diffstat (limited to 'rgfw.c3')
-rw-r--r--rgfw.c383
1 files changed, 83 insertions, 0 deletions
diff --git a/rgfw.c3 b/rgfw.c3
new file mode 100644
index 0000000..3dd0692
--- /dev/null
+++ b/rgfw.c3
@@ -0,0 +1,83 @@
+module rgfw;
+
+alias Window = void;
+alias GlContext = void;
+alias EglContext = void;
+alias Proc = fn void ();
+
+enum GlReleaseBehavior: int
+{
+ GL_RELEASE_FLUSH,
+ GL_RELEASE_NONE,
+}
+
+enum GlProfile: int
+{
+ GL_CORE,
+ GL_FORWARD_COMPATIBILITY,
+ GL_COMPATIBILITY,
+ GL_ES,
+}
+
+enum GlRenderer: int
+{
+ GL_ACCELERATED,
+ GL_SOFTWARE,
+}
+
+constdef WindowFlags : uint
+{
+ WINDOW_NO_BORDER = 1 << 0,
+ WINDOW_NO_RESIZE = 1 << 1,
+ WINDOW_ALLOW_DND = 1 << 2,
+ WINDOW_HIDE_MOUSE = 1 << 3,
+ WINDOW_FULLSCREEN = 1 << 4,
+ WINDOW_TRANSLUCENT = 1 << 5,
+ WINDOW_TRANSPARENT = WINDOW_TRANSLUCENT,
+ WINDOW_CENTER = 1 << 6,
+ WINDOW_RAW_MOUSE = 1 << 7,
+ WINDOW_SCALE_TO_MONITOR = 1 << 8,
+ WINDOW_HIDE = 1 << 9,
+ WINDOW_MAXIMIZE = 1 << 10,
+ WINDOW_CENTER_CURSOR = 1 << 11,
+ WINDOW_FLOATING = 1 << 12,
+ WINDOW_FOCUS_ON_SHOW = 1 << 13,
+ WINDOW_MINIMIZE = 1 << 14,
+ WINDOW_FOCUS = 1 << 15,
+ WINDOW_CAPTURE_MOUSE = 1 << 16,
+ WINDOW_OPENGL = 1 << 17,
+ WINDOW_EGL = 1 << 18,
+ NO_DEINIT_ON_CLOSE = 1 << 19,
+ WINDOWED_FULLSCREEN = WINDOW_NO_BORDER | WINDOW_MAXIMIZE,
+ WINDOW_CAPTURE_RAW_MOUSE = WINDOW_CAPTURE_MOUSE | WINDOW_RAW_MOUSE,
+}
+
+struct GlHints
+{
+ int stencil;
+ int samples;
+ int stereo;
+ int auxBuffers;
+ int doubleBuffer;
+ int red; int green; int blue; int alpha;
+ int depth;
+ int accumRed; int accumGreen; int accumBlue; int accumAlpha;
+ bool sRGB;
+ bool robustness;
+ bool debug;
+ bool noError;
+ GlReleaseBehavior releaseBehavior;
+ GlProfile profile;
+ int major; int minor;
+ GlContext* share;
+ EglContext* shareEGL;
+ GlRenderer renderer;
+}
+
+extern fn Window* createWindow(ZString, int, int, int, int, WindowFlags) @cname("RGFW_createWindow");
+extern fn bool window_shouldClose(Window*) @cname("RGFW_window_shouldClose");
+extern fn bool window_close(Window*) @cname("RGFW_window_close");
+extern fn void pollEvents() @cname("RGFW_pollEvents");
+extern fn GlHints* getGlobalHints_OpenGL() @cname("RGFW_getGlobalHints_OpenGL");
+extern fn void setGlobalHints_OpenGL(GlHints*) @cname("RGFW_setGlobalHints_OpenGL");
+extern fn Proc getProcAddress_OpenGL(ZString) @cname("RGFW_getProcAddress_OpenGL");