diff --git a/docs/rendering.md b/docs/rendering.md index 8c0b846..0d8440b 100644 --- a/docs/rendering.md +++ b/docs/rendering.md @@ -26,6 +26,37 @@ struct UIState { int body_list_scroll; // Scroll position for body list int body_list_active; // Active item index in body list int selected_craft_index; // Selected spacecraft index (-1 = no selection) + + int maneuver_list_active; + int maneuver_list_scroll; + int selected_maneuver_index; + + int cached_body_count, cached_craft_count; + int cached_maneuver_count, cached_executed_count; + char* body_list_buffer; int body_list_buffer_size; + char* craft_list_buffer; int craft_list_buffer_size; + char* body_dropdown_buffer; int body_dropdown_buffer_size; + char* maneuver_list_buffer; int maneuver_list_buffer_size; + + ManeuverDialogState maneuver_dialog; +}; +``` + +### ManeuverDialogState (ui_renderer.h) +```cpp +struct ManeuverDialogState { + bool open; + ManeuverDialogTab active_tab; + int craft_index, direction_active; + double delta_v, trigger_value; + int edit_maneuver_index; + int target_body_index, current_body_index, transfer_body_index; + bool show_hohmann_preview; + HohmannTransfer last_calc; + bool show_preview, preview_valid; + OrbitalElements preview_elements; + char error_message[256]; + bool show_error, show_delete_confirm; }; ``` @@ -282,6 +313,8 @@ When a spacecraft is selected: **Dimensions:** 300×400 pixels **Position:** Y=320 (below info panel) +Dropdown lists use cached buffers, rebuilt only when object counts change. + ## Rendering Pipeline ### Main Loop Sequence @@ -354,9 +387,8 @@ Note: UI rendering functions are called after `render_simulation()` to ensure UI - Helps orient user in 3D space ### Memory Management -- UI panels allocate temporary buffers for lists -- List text freed after rendering -- No persistent UI state allocation +UI buffers persist between frames and rebuild when object counts change. +Buffers freed on shutdown via ui_state_free_buffers(). ## TODO Items