ALed jeanne
This commit is contained in:
+13
@@ -47,6 +47,7 @@ static void buildCache(SceneObject_t * object) {
|
||||
|
||||
RenderId_t scene_addRenderObject(Scene_t * scene, RenderObject_t object, int x, int y) {
|
||||
RenderId_t itemId = scene->objectCount++;
|
||||
scene->objects = realloc(scene->objects, scene->objectCount * sizeof(SceneObject_t));
|
||||
|
||||
SceneObject_t item = {
|
||||
x, y,
|
||||
@@ -78,3 +79,15 @@ void scene_removeRenderObject(Scene_t * scene, RenderId_t id) {
|
||||
}
|
||||
scene->objectCount--;
|
||||
}
|
||||
|
||||
void scene_free(Scene_t * scene) {
|
||||
for(int i = 0; i < scene->objectCount - 1; i++) {
|
||||
SDL_FreeSurface(scene->objects[i].renderObj.surface);
|
||||
if(scene->objects[i].cache != NULL) {
|
||||
SDL_DestroyTexture(scene->objects[i].cache);
|
||||
}
|
||||
}
|
||||
free(scene->objects);
|
||||
scene->objectCount = 0;
|
||||
scene->objects = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user