void Game_destroy(void* context) { CANCEL_IF_FALSE(context); Game* this = context; Hourglass_destroy(this->hourglass); Player_destroy(this->leftPlayer); Player_destroy(this->rightPlayer); // lua propbaby kills everything /* wtf is wrong with this too much headache to fix for (int i=0; i < PLAYER_COUNT; ++i) { Player_destroy(this->players[i]); } free(this->players); */ free(this); }
void Game_destroy(void* context) { CANCEL_IF_FALSE(context); Game* this = context; Player_destroy(this->player); // important: must be after player destroy, since player calls respawn on destroy, // TODO this will change though when destroy will be preceeded by a death event Scene_destroy(this->scene); // lua propbaby kills everything /* wtf is wrong with this too much headache to fix for (int i=0; i < PLAYER_COUNT; ++i) { Player_destroy(this->players[i]); } free(this->players); */ free(this); }
void InGame_destroy(InGame* self) { //Destroy everything if(self->map != NULL) Map_destroy(self->map); if(self->player != NULL) Player_destroy((Drawable*)(self->player)); if(self->scoreLabel != NULL) Text_destroy((Drawable*)(self->scoreLabel)); if(self->timeLabel != NULL) Text_destroy((Drawable*)(self->timeLabel)); if(self->gameOver != NULL) Text_destroy((Drawable*)(self->gameOver)); if(self->winLabel != NULL) Text_destroy((Drawable*)(self->winLabel)); if(self->lifeText) Text_destroy((Drawable*)(self->lifeText)); free(self); }
void NBody_destroy(NBody* self) { if (self == NULL) { return; } if (self->star_texture != 0) { glDeleteTextures(1, &self->star_texture); self->star_texture = 0; } if (self->player != NULL) { Player_destroy(self->player); self->player = NULL; } if (self->window != NULL) { Window_destroy(self->window); self->window = NULL; } free(self); }