diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-05-11 14:37:34 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-05-11 14:37:34 +0200 |
| commit | 2f9e8a6033075f68bbed46a66d22712a84b8f678 (patch) | |
| tree | 78a4062a238ae048d0b04fe3ceb9c9b368255457 /src/editor.c | |
| parent | 0ed1a617a897cf241406b3b7d5ddda5b74f4d9f4 (diff) | |
spawner
Diffstat (limited to 'src/editor.c')
| -rw-r--r-- | src/editor.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/editor.c b/src/editor.c index 1183517..79a5503 100644 --- a/src/editor.c +++ b/src/editor.c @@ -62,6 +62,25 @@ static void update_tile_editor(platform_window* window) { } } +void update_lighting_panel(platform_window* window, vec2 cursor_pos) { + if (keyboard_is_key_pressed(KEY_ENTER)) { + for (int i = 0; i < MAX_LIGHT_EMITTERS; i++) { + light_emitter emitter = loaded_map.light_emitters[i]; + if (emitter.active) continue; + + map_to_load.light_emitters[i].position.x = cursor_pos.x; + map_to_load.light_emitters[i].position.y = cursor_pos.y; + map_to_load.light_emitters[i].position.z = 1; + map_to_load.light_emitters[i].active = 1; + map_to_load.light_emitters[i].brightness = 1.0f; + map_to_load.light_emitters[i].range = 10.0f; + + load_mapdata_into_world(); + return; + } + } +} + void update_editor(platform_window* window) { if (keyboard_is_key_pressed(KEY_F1)) { @@ -97,11 +116,12 @@ void update_editor(platform_window* window) _next_camera_pos.x = -(window->width / 2) + camera_x; _next_camera_pos.y = -(window->height / 2) + camera_y; + vec2 pos = screen_pos_to_world_pos(window, _global_mouse.x + window->width/2, _global_mouse.y + window->height/2); switch (edit_state) { case EDITING_TILES: update_tile_editor(window); break; case EDITING_OBJECTS: update_object_editor(window); break; - case EDITING_LIGHTING: break; + case EDITING_LIGHTING: update_lighting_panel(window, pos); break; } @@ -418,7 +438,7 @@ void update_object_editor(platform_window* window) { case OBJECT_EDITOR_SELECTING: update_object_selection(window, pos); break; - + default: break; } |
