test/snake/snake.c

changeset 93
52611a99e574
parent 89
e1f682a8a145
--- a/test/snake/snake.c	Wed Apr 23 23:43:45 2025 +0200
+++ b/test/snake/snake.c	Wed Apr 23 23:59:34 2025 +0200
@@ -37,13 +37,14 @@
 static AscTexture tex2d[TEX2D_COUNT];
 #define TEXTURE_SHIP &tex2d[TEX_SHIP]
 
+static void destroy_textures(void *dummy) {
+    asc_texture_destroy(tex2d, TEX2D_COUNT);
+}
+
 static void init_textures(void) {
     asc_texture_init_2d(tex2d, TEX2D_COUNT);
     asc_texture_from_file(TEXTURE_SHIP, "ship.png");
-}
-
-static void destroy_textures(void) {
-    asc_texture_destroy(tex2d, TEX2D_COUNT);
+    cxMempoolRegister(asc_active_glctx_mpool, tex2d, destroy_textures);
 }
 
 static void update_fps_counter(AscSceneNode *node) {
@@ -155,7 +156,6 @@
     } while (asc_loop_next());
 
     // cleanup
-    destroy_textures();
     asc_context_destroy();
     return 0;
 }

mercurial