commit 5e9b0d5

uint  ·  2026-05-04 13:06:07 +0000 UTC
parent 7fe31a5
add resource cleaning pu
1 files changed,  +15, -0
+15, -0
 1@@ -18,9 +18,23 @@ RGFW_window* win = NULL;
 2 RGFW_surface* surf = NULL;
 3 uint32_t* pixels = NULL;
 4 
 5+static void cleanup(void);
 6 static void init(void);
 7 static void run(void);
 8 
 9+/**
10+ * @brief release resources, close window (TODO)
11+ */
12+static void cleanup(void)
13+{
14+	if (surf)
15+		RGFW_surface_free(surf);
16+	if (pixels)
17+		free(pixels);
18+	if (win)
19+		RGFW_window_close(win);
20+}
21+
22 /**
23  * @brief initialise: window (TODO)
24  */
25@@ -67,6 +81,7 @@ int main(int argc, char* argv[])
26 	/* TODO: pledges */
27 	init();
28 	run();
29+	cleanup();
30 
31 	return EXIT_SUCCESS;
32 	(void) argc, (void) argv;