test/snake.c

changeset 45
18de2af03531
parent 44
b3da4096c607
child 46
d3285aed65b3
     1.1 --- a/test/snake.c	Tue Mar 26 20:37:21 2024 +0100
     1.2 +++ b/test/snake.c	Thu Mar 28 23:30:21 2024 +0100
     1.3 @@ -55,14 +55,15 @@
     1.4  }
     1.5  
     1.6  static void update_score_counter(AscSceneNode *node) {
     1.7 -    AscText *text = asc_text_data(node);
     1.8 -
     1.9      // tie to bottom left of the screen
    1.10      if (asc_window_active->resized) {
    1.11          asc_vec2i bottom_left = asc_window_active->dimensions;
    1.12 -        text->position.x = bottom_left.x - text->dimension.width - 10;
    1.13 -        text->position.y = bottom_left.y - text->dimension.height - 10;
    1.14 -        asc_node_update_transform(text);
    1.15 +        asc_vec2i scale = asc_get_scale2d(node);
    1.16 +        asc_set_position2d(
    1.17 +                node,
    1.18 +                bottom_left.x - scale.width - 10,
    1.19 +                bottom_left.y - scale.height - 10
    1.20 +        );
    1.21      }
    1.22  }
    1.23  

mercurial