diff --git a/src/game/editor.c b/src/game/editor.c index 5999e32..d0544d7 100755 --- a/src/game/editor.c +++ b/src/game/editor.c @@ -1164,6 +1164,12 @@ void editor_on_key_release(const struct Event* event) if(event->key.key == KEY_G) editor->grid_enabled = !editor->grid_enabled; if(event->key.key == KEY_ESCAPE) editor_entity_select(editor, NULL); + + if(event->key.key == KEY_DELETE && editor->selected_entity) + { + editor->selected_entity->marked_for_deletion = true; + editor_entity_select(editor, NULL); + } } void editor_tool_set(struct Editor* editor, int tool) diff --git a/src/game/scene.c b/src/game/scene.c index ef69931..170c0c0 100755 --- a/src/game/scene.c +++ b/src/game/scene.c @@ -78,7 +78,7 @@ void scene_destroy(struct Scene* scene) { assert(scene); - for(int i = 0; i < MAX_ENTITIES; i++) scene_entity_remove(scene, &scene->entities[i]); + for(int i = 0; i < MAX_ENTITIES; i++) scene_entity_base_remove(scene, &scene->entities[i]); for(int i = 0; i < MAX_CAMERAS; i++) scene_camera_remove(scene, &scene->cameras[i]); for(int i = 0; i < MAX_LIGHTS; i++) scene_light_remove(scene, &scene->lights[i]); for(int i = 0; i < MAX_STATIC_MESHES; i++) scene_static_mesh_remove(scene, &scene->static_meshes[i]); @@ -105,7 +105,7 @@ void scene_post_update(struct Scene* scene) if(entity->marked_for_deletion) { - scene_entity_remove(scene, entity); + scene_entity_base_remove(scene, entity); continue; } @@ -377,7 +377,7 @@ struct Sound_Source* scene_sound_source_create(struct Scene* scene, const char* return new_sound_source; } -void scene_entity_remove(struct Scene* scene, struct Entity* entity) +void scene_entity_base_remove(struct Scene* scene, struct Entity* entity) { assert(scene && entity && entity->id >= 0); @@ -393,13 +393,13 @@ void scene_entity_remove(struct Scene* scene, struct Entity* entity) void scene_light_remove(struct Scene* scene, struct Light* light) { assert(scene && light); - scene_entity_remove(scene, &light->base); + scene_entity_base_remove(scene, &light->base); } void scene_camera_remove(struct Scene* scene, struct Camera* camera) { assert(scene && camera); - scene_entity_remove(scene, &camera->base); + scene_entity_base_remove(scene, &camera->base); } void scene_static_mesh_remove(struct Scene* scene, struct Static_Mesh* mesh) @@ -411,7 +411,7 @@ void scene_static_mesh_remove(struct Scene* scene, struct Static_Mesh* mesh) if(mesh->collision.rigidbody) physics_body_remove(mesh->collision.rigidbody); model_reset(&mesh->model, mesh); - scene_entity_remove(scene, &mesh->base); + scene_entity_base_remove(scene, &mesh->base); } void scene_sound_source_remove(struct Scene* scene, struct Sound_Source* source) @@ -420,7 +420,7 @@ void scene_sound_source_remove(struct Scene* scene, struct Sound_Source* source) sound_source_instance_destroy(game_state_get()->sound, source->source_instance); source->source_instance = 0; - scene_entity_remove(scene, &source->base); + scene_entity_base_remove(scene, &source->base); } struct Entity* scene_entity_find(struct Scene* scene, const char* name) diff --git a/src/game/scene.h b/src/game/scene.h index ac0ccf3..df56cf1 100755 --- a/src/game/scene.h +++ b/src/game/scene.h @@ -39,7 +39,7 @@ struct Camera* scene_camera_create(struct Scene* scene, const char* name, struct Static_Mesh* scene_static_mesh_create(struct Scene* scene, const char* name, struct Entity* parent, const char* geometry_name, int material_type); struct Sound_Source* scene_sound_source_create(struct Scene* scene, const char* name, struct Entity* parent, const char* filename, int type, bool loop, bool play); -void scene_entity_remove(struct Scene* scene, struct Entity* entity); +void scene_entity_base_remove(struct Scene* scene, struct Entity* entity); void scene_light_remove(struct Scene* scene, struct Light* light); void scene_camera_remove(struct Scene* scene, struct Camera* camera); void scene_static_mesh_remove(struct Scene* scene, struct Static_Mesh* mesh); diff --git a/todo.txt b/todo.txt index a3c6a8b..10443d8 100644 --- a/todo.txt +++ b/todo.txt @@ -112,6 +112,7 @@ Bugs: - Fix hang on fullscreen toggle - Fix axis lines not aligning with grid lines - Fix arc angles resetting when rotating + - Fix editor camera right-click behaviour Done: * Input @@ -303,4 +304,5 @@ Done: axis * Disabled editor functionalites when console is toggled * Entity to file read/write + * Added editor shortcut key to delete selected entity