test/snake/snake.c

changeset 262
b47de42f4598
parent 260
2649d04f0287
equal deleted inserted replaced
261:bfd15f5a3948 262:b47de42f4598
119 asc_vec2u window_size = asc_active_window->dimensions; 119 asc_vec2u window_size = asc_active_window->dimensions;
120 asc_sprite_set_size(sprite, window_size); 120 asc_sprite_set_size(sprite, window_size);
121 } 121 }
122 122
123 static void main_scene_frame_scale(AscBehavior *behavior) { 123 static void main_scene_frame_scale(AscBehavior *behavior) {
124 // TODO: we cannot skip this behavior when window is resized, 124 if (!asc_active_window->resized) return;
125 // because the viewport is updated after executing all behaviors
126 // and then the resized flag is cleared already.
127 // A possible solution is to add something like a post-rendering behavior.
128 // Another solution would be a viewport-changed-event (once we implement events)
129 asc_ptr_cast(AscRectangle, frame, behavior->node); 125 asc_ptr_cast(AscRectangle, frame, behavior->node);
130 asc_rectangle_set_bounds(frame, MAIN_SCENE->camera.viewport); 126 asc_rectangle_set_bounds(frame, MAIN_SCENE->camera.viewport);
131 } 127 }
132 128
133 static void backdrop_create(void) { 129 static void backdrop_create(void) {

mercurial