test/snake/snake.c

changeset 110
29f8d0d586f8
parent 108
d619bf7dd87b
equal deleted inserted replaced
109:08548799ae4a 110:29f8d0d586f8
40 #define TEXTURE_BACKDROP &tex2d[TEX_BACKDROP] 40 #define TEXTURE_BACKDROP &tex2d[TEX_BACKDROP]
41 41
42 #define BACKDROP_SCENE asc_window_scene(0) 42 #define BACKDROP_SCENE asc_window_scene(0)
43 #define MAIN_SCENE asc_window_scene(1) 43 #define MAIN_SCENE asc_window_scene(1)
44 44
45 static void destroy_textures(__attribute__((__unused__)) void *dummy) { 45 static void destroy_textures(void) {
46 asc_texture_destroy(tex2d, TEX2D_COUNT); 46 asc_texture_destroy(tex2d, TEX2D_COUNT);
47 } 47 }
48 48
49 static void init_textures(void) { 49 static void init_textures(void) {
50 asc_texture_init_2d(tex2d, TEX2D_COUNT); 50 asc_texture_init_2d(tex2d, TEX2D_COUNT);
51 asc_texture_from_file(TEXTURE_SHIP, "ship.png"); 51 asc_texture_from_file(TEXTURE_SHIP, "ship.png");
52 asc_texture_from_file(TEXTURE_BACKDROP, "backdrop.png"); 52 asc_texture_from_file(TEXTURE_BACKDROP, "backdrop.png");
53 cxMempoolRegister(asc_active_glctx_mpool, tex2d, destroy_textures); 53 asc_gl_context_add_cleanup_func(asc_active_glctx, destroy_textures);
54 } 54 }
55 55
56 static void update_fps_counter(AscBehavior *behavior) { 56 static void update_fps_counter(AscBehavior *behavior) {
57 AscSceneNode *node = behavior->node; 57 AscSceneNode *node = behavior->node;
58 static uint64_t last_fps = 0; 58 static uint64_t last_fps = 0;

mercurial