diff -r a35b39abe2b2 -r d619bf7dd87b test/snake/snake.c --- a/test/snake/snake.c Sat May 03 14:37:57 2025 +0200 +++ b/test/snake/snake.c Sat May 03 19:48:57 2025 +0200 @@ -53,7 +53,8 @@ cxMempoolRegister(asc_active_glctx_mpool, tex2d, destroy_textures); } -static void update_fps_counter(AscSceneNode *node) { +static void update_fps_counter(AscBehavior *behavior) { + AscSceneNode *node = behavior->node; static uint64_t last_fps = 0; static uint64_t debounce = ASC_NANOS_SECOND - 1; debounce += asc_context.frame_nanos; @@ -81,9 +82,10 @@ } } -static void scale_backdrop(AscSceneNode *node) { +static void scale_backdrop(AscBehavior *behavior) { // scale the backdrop to the size of the window if (asc_active_window->resized) { + AscSceneNode *node = behavior->node; asc_vec2u window_size = asc_active_window->dimensions; // TODO: replace scale with asc_sprite_set_size() asc_set_scale(node, (float)window_size.width, (float)window_size.height, 1); @@ -93,7 +95,7 @@ static void create_backdrop(void) { AscSceneNode *node = asc_sprite(.texture = TEXTURE_BACKDROP); - asc_scene_add_behavior(node, scale_backdrop); + asc_behavior_add(node, .func = scale_backdrop); asc_scene_add_node(BACKDROP_SCENE, node); } @@ -101,7 +103,7 @@ asc_font(ASC_FONT_REGULAR, 12); asc_ink_rgba(224, 224, 224, 196); AscSceneNode *node = asc_text(); - asc_scene_add_behavior(node, update_fps_counter); + asc_behavior_add(node, .func = update_fps_counter); asc_add_ui_node(node); }