summaryrefslogtreecommitdiff
path: root/main.c3
diff options
context:
space:
mode:
authorandromeda <andromeda@lenovo>2026-04-24 22:07:01 +0200
committerandromeda <andromeda@lenovo>2026-04-24 22:07:01 +0200
commit643cf49f77e64f00589bc16147be0afc95fc08cf (patch)
treea0055c97ba4d024e3c27d2679ddc5c4447ed6b0e /main.c3
parent1b3c57972570f9e79c21a571b6cd1b3273ea3059 (diff)
rgfw
Diffstat (limited to 'main.c3')
-rw-r--r--main.c382
1 files changed, 39 insertions, 43 deletions
diff --git a/main.c3 b/main.c3
index f349205..f9763ef 100644
--- a/main.c3
+++ b/main.c3
@@ -1,57 +1,53 @@
module c3term;
import std::io;
-struct TPixel {
- char r; char g; char b; char a;
-}
-
-struct Tigr {
- CInt w; CInt h;
- CInt cx; CInt cy; CInt cw; CInt ch;
- TPixel* pix;
- void* handle;
- CInt blitMode;
-}
-
-struct TigrGlyph {
- CInt code; CInt x; CInt y; CInt w; CInt h;
-}
+alias RGFW_window = void;
-struct TigrFont {
- Tigr* bitmap;
- CInt numglyphs;
- TigrGlyph* glyphs;
+constdef RGFW_windowFlags : uint
+{
+ RGFW_WINDOW_NO_BORDER = 1 << 0,
+ RGFW_WINDOW_NO_RESIZE = 1 << 1,
+ RGFW_WINDOW_ALLOW_DND = 1 << 2,
+ RGFW_WINDOW_HIDE_MOUSE = 1 << 3,
+ RGFW_WINDOW_FULLSCREEN = 1 << 4,
+ RGFW_WINDOW_TRANSLUCENT = 1 << 5,
+ RGFW_WINDOW_TRANSPARENT = RGFW_WINDOW_TRANSLUCENT,
+ RGFW_WINDOW_CENTER = 1 << 6,
+ RGFW_WINDOW_RAW_MOUSE = 1 << 7,
+ RGFW_WINDOW_SCALE_TO_MONITOR = 1 << 8,
+ RGFW_WINDOW_HIDE = 1 << 9,
+ RGFW_WINDOW_MAXIMIZE = 1 << 10,
+ RGFW_WINDOW_CENTER_CURSOR = 1 << 11,
+ RGFW_WINDOW_FLOATING = 1 << 12,
+ RGFW_WINDOW_FOCUS_ON_SHOW = 1 << 13,
+ RGFW_WINDOW_MINIMIZE = 1 << 14,
+ RGFW_WINDOW_FOCUS = 1 << 15,
+ RGFW_WINDOW_CAPTURE_MOUSE = 1 << 16,
+ RGFW_WINDOW_OPENGL = 1 << 17,
+ RGFW_WINDOW_EGL = 1 << 18,
+ RGFW_NO_DEINIT_ON_CLOSE = 1 << 19,
+ RGFW_WINDOWED_FULLSCREEN = RGFW_WINDOW_NO_BORDER | RGFW_WINDOW_MAXIMIZE,
+ RGFW_WINDOW_CAPTURE_RAW_MOUSE = RGFW_WINDOW_CAPTURE_MOUSE | RGFW_WINDOW_RAW_MOUSE,
}
-extern fn Tigr* tigrWindow(CInt, CInt, ZString, CInt);
-extern fn CInt tigrClosed(Tigr*);
-extern fn void tigrUpdate(Tigr*);
-extern fn void tigrClear(Tigr*, TPixel);
-extern fn void tigrPrint(Tigr*, TigrFont*, CInt, CInt, TPixel, ZString);
-extern TigrFont* tfont;
+extern fn RGFW_window* rgfw_createWindow(ZString, int, int, int, int, RGFW_windowFlags) @cname("RGFW_createWindow");
+extern fn bool rgfw_window_shouldClose(RGFW_window*) @cname("RGFW_window_shouldClose");
+extern fn bool rgfw_window_close(RGFW_window*) @cname("RGFW_window_close");
+extern fn void rgfw_pollEvents() @cname("RGFW_pollEvents");
fn int main(String[] args)
{
- io::printn(*tfont);
io::printn("init");
- Tigr* screen = tigrWindow(320, 240, "title", 0);
- while (!tigrClosed(screen)) {
- TPixel p = {
- .r = 0x80,
- .g = 0x90,
- .b = 0xA0,
- .a = 0x00,
- };
- TPixel w = {
- .r = 0xFF,
- .g = 0xFF,
- .b = 0xFF,
- .a = 0xFF,
- };
- tigrClear(screen, p);
- tigrPrint(screen, tfont, 120, 110, w, "Hello, world.");
- tigrUpdate(screen);
+
+ RGFW_window* window = rgfw_createWindow("window title", 0, 0, 800, 400, RGFW_WINDOW_CENTER | RGFW_WINDOW_NO_RESIZE);
+
+ while (!rgfw_window_shouldClose(window))
+ {
+ rgfw_pollEvents();
}
+
+ rgfw_window_close(window);
+
io::printn("tschuess");
return(0);
}