test/snake.c

changeset 65
9c44c55d327a
parent 63
e3cacdd636e4
     1.1 --- a/test/snake.c	Thu Apr 18 21:53:53 2024 +0200
     1.2 +++ b/test/snake.c	Thu Apr 18 22:53:55 2024 +0200
     1.3 @@ -47,7 +47,7 @@
     1.4  }
     1.5  
     1.6  static void create_fps_counter(void) {
     1.7 -    asc_set_font(asc_font(ASC_FONT_REGULAR, 24));
     1.8 +    asc_font(ASC_FONT_REGULAR, 24);
     1.9      asc_ink_rgb(255, 0, 0);
    1.10      AscSceneNode* node = asc_text( .x = 10, .y = 10 );
    1.11      asc_scene_add_behavior(node, update_fps_counter);
    1.12 @@ -56,8 +56,8 @@
    1.13  
    1.14  static void update_score_counter(AscSceneNode *node) {
    1.15      // tie to bottom right of the screen
    1.16 -    if (asc_window_active->resized) {
    1.17 -        asc_vec2i bottom_right = asc_window_active->dimensions;
    1.18 +    if (asc_active_window->resized) {
    1.19 +        asc_vec2i bottom_right = asc_active_window->dimensions;
    1.20          asc_vec2i scale = asc_get_scale2d(node);
    1.21          asc_set_position2d(
    1.22                  node,
    1.23 @@ -68,7 +68,7 @@
    1.24  }
    1.25  
    1.26  static void create_score_counter(void) {
    1.27 -    asc_set_font(asc_font(ASC_FONT_BOLD, 14));
    1.28 +    asc_font(ASC_FONT_BOLD, 14);
    1.29      asc_ink_rgb(0, 255, 0);
    1.30      AscSceneNode* node = asc_text(.text = "Score: 0" );
    1.31      asc_scene_add_behavior(node, update_score_counter);
    1.32 @@ -87,7 +87,7 @@
    1.33      AscWindowSettings settings;
    1.34      asc_window_settings_init_defaults(&settings);
    1.35      settings.title = "Snake";
    1.36 -    AscWindow *window = asc_window_initialize(0, &settings);
    1.37 +    asc_window_initialize(0, &settings);
    1.38  
    1.39      // create UI elements
    1.40      create_fps_counter();
    1.41 @@ -98,7 +98,8 @@
    1.42          // quit application on any error
    1.43          if (asc_has_error()) {
    1.44              SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
    1.45 -                    "Fatal Error", asc_get_error(), window->window);
    1.46 +                    "Fatal Error", asc_get_error(),
    1.47 +                    asc_active_window->window);
    1.48              asc_clear_error();
    1.49              asc_context_quit();
    1.50          }

mercurial