From 80fb72b7015f5469922d2a883ea732b470404d7f Mon Sep 17 00:00:00 2001 From: Randy Jordan Date: Mon, 11 May 2026 19:07:29 -0500 Subject: [PATCH] More roadmap, added flag to gui test --- README.md | 5 ++++- include/ci2_window.h | 3 ++- src/linux_ci2_window.c | 2 -- tests/{01_ci2.c => 99_gui.c} | 7 +++++++ 4 files changed, 13 insertions(+), 4 deletions(-) rename tests/{01_ci2.c => 99_gui.c} (95%) diff --git a/README.md b/README.md index 8ab315b..b1cca10 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,16 @@ the platform layer prefix. ## Todos - [x] Basic Window - [ ] Input Handling - - [ ] Add sys_fd for handle + - [x] Add sys_fd for handle - [ ] Class and Title sys_char* - [ ] Assertions & Testing - [ ] Exceptions & Errors - [ ] Memory Allocations +- [ ] Arena Allocations - [ ] Atoms +- [ ] String Views +- [ ] Serialization & Packing ## Usage diff --git a/include/ci2_window.h b/include/ci2_window.h index dd55a5c..52e11ce 100644 --- a/include/ci2_window.h +++ b/include/ci2_window.h @@ -23,8 +23,9 @@ SOFTWARE. #ifndef CI2_WINDOW_H #define CI2_WINDOW_H -#include "./base/ci2_base.h" +#include "./base/ci2_base.h" // ci2_platform detection +// Our ci2_specific handle that depends on platform detection. struct CI2_Window_Handle { ci2_fd fd; ci2_bool should_close; diff --git a/src/linux_ci2_window.c b/src/linux_ci2_window.c index 422434d..48af762 100644 --- a/src/linux_ci2_window.c +++ b/src/linux_ci2_window.c @@ -59,13 +59,11 @@ CI2_Window* ci2_create_window(const ci2_sys_char* title, int width, int height) CI2_Window* window = malloc(sizeof(CI2_Window)); - // CI2_Window_Handle* h = malloc(sizeof(CI2_Window_Handle)); if (!window) { XDestroyWindow(display, win); XCloseDisplay(display); return NULL; } - // window->handle = h; window->display = display; window->wm_delete_window = wm_delete_window; window->handle.should_close = ci2_false; diff --git a/tests/01_ci2.c b/tests/99_gui.c similarity index 95% rename from tests/01_ci2.c rename to tests/99_gui.c index a7a9b2f..43c016b 100644 --- a/tests/01_ci2.c +++ b/tests/99_gui.c @@ -21,6 +21,7 @@ * --------------------------------------------------------------------------*/ #define DEBUG +#define GUI_DEBUG_CLOSE #include "../include/ci2.h" #ifdef CI2_WINDOWS @@ -49,6 +50,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // Per-frame update/render would go here. // Example: simple sleep to avoid busy-looping; adjust to suit your app's timing. Sleep(1); + #ifdef GUI_DEBUG_CLOSE + break; + #endif } // 5) Destroy window and shutdown ci2. @@ -70,6 +74,9 @@ int main(int argc, ci2_sys_char *argv[]) while (ci2_poll_events(window)) { // Your rendering / game loop goes here + #ifdef GUI_DEBUG_CLOSE + break; + #endif } ci2_destroy_window(window);