| 135 |
135 |
| 136 static void backdrop_scale(AscBehavior *behavior) { |
136 static void backdrop_scale(AscBehavior *behavior) { |
| 137 // scale the backdrop to the size of the window |
137 // scale the backdrop to the size of the window |
| 138 if (!asc_active_window->resized) return; |
138 if (!asc_active_window->resized) return; |
| 139 asc_ptr_cast(AscSprite, sprite, behavior->node); |
139 asc_ptr_cast(AscSprite, sprite, behavior->node); |
| 140 asc_vec2u window_size = asc_active_window->dimensions; |
140 asc_vec2u window_size = asc_active_window->rect.size; |
| 141 asc_sprite_set_size(sprite, window_size); |
141 asc_sprite_set_size(sprite, window_size); |
| 142 } |
142 } |
| 143 |
143 |
| 144 static void main_scene_frame_scale(AscBehavior *behavior) { |
144 static void main_scene_frame_scale(AscBehavior *behavior) { |
| 145 if (!asc_active_window->resized) return; |
145 if (!asc_active_window->resized) return; |
| 176 static void fps_counter_tie_to_corner(AscBehavior *behavior) { |
176 static void fps_counter_tie_to_corner(AscBehavior *behavior) { |
| 177 // TODO: this should be replaced with some sort of UI layout manager |
177 // TODO: this should be replaced with some sort of UI layout manager |
| 178 AscSceneNode *node = behavior->node; |
178 AscSceneNode *node = behavior->node; |
| 179 if (asc_test_flag(node->flags, ASC_SCENE_NODE_GRAPHICS_UPDATED) || asc_active_window->resized) { |
179 if (asc_test_flag(node->flags, ASC_SCENE_NODE_GRAPHICS_UPDATED) || asc_active_window->resized) { |
| 180 asc_scene_node_set_position2f(node, ASC_VEC2F(10, |
180 asc_scene_node_set_position2f(node, ASC_VEC2F(10, |
| 181 asc_active_window->dimensions.y - ((AscText*)node)->dimension.height - 10 |
181 asc_active_window->rect.size.height - ((AscText*)node)->dimension.height - 10 |
| 182 )); |
182 )); |
| 183 } |
183 } |
| 184 } |
184 } |
| 185 |
185 |
| 186 static AscSceneNode *fps_counter_create(void) { |
186 static AscSceneNode *fps_counter_create(void) { |
| 616 do { |
616 do { |
| 617 // quit application on any error |
617 // quit application on any error |
| 618 if (asc_has_error()) { |
618 if (asc_has_error()) { |
| 619 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, |
619 SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, |
| 620 "Fatal Error", asc_get_error(), |
620 "Fatal Error", asc_get_error(), |
| 621 asc_active_window->window); |
621 asc_active_window->sdl); |
| 622 asc_clear_error(); |
622 asc_clear_error(); |
| 623 asc_context_quit(); |
623 asc_context_quit(); |
| 624 } |
624 } |
| 625 |
625 |
| 626 // game states |
626 // game states |