void seal_draw() { struct render* R = GAME->render; render_clear(R, C4B_COLOR(0, 0, 255, 255)); sprite_visit(GAME->root, GAME->global_dt); nk_draw(); CHECK_GL_ERROR }
void sprite_visit(struct sprite* self, float dt) { if (self->anim) { anim_update(self->anim, dt); sprite_set_sprite_frame(self, anim_current_frame(self->anim)); } sprite_update_transform(self); switch (self->type) { case SPRITE_TYPE_PIC: sprite_draw_pic(self); break; case SPRITE_TYPE_CONTAINER: // do nothing. break; case SPRITE_TYPE_CLIP: sprite_draw_clip(self); break; default: break; } struct array* children = self->children; for (int i = 0 ;i < array_size(children); ++i) { struct sprite* child = (struct sprite*)array_at(children, i); if (child) { // NULL indicates that the child has been removed // recursively visit the children. sprite_visit(child, dt); } } switch (self->type) { case SPRITE_TYPE_CLIP: sprite_clean_clip(self); break; default: break; } }