vibe coding an orbital mechanics simulation to try out claude code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

92 lines
3.0 KiB

#ifndef UI_RENDERER_H
#define UI_RENDERER_H
#include "simulation.h"
#include "renderer.h"
#include "raylib.h"
#include "maneuver.h"
#include <string.h>
enum ManeuverDialogTab {
MD_TAB_CREATE,
MD_TAB_HOHMANN,
MD_TAB_EDIT
};
struct ManeuverDialogState {
bool open;
ManeuverDialogTab active_tab;
int craft_index;
char name[64];
int direction_active;
double delta_v;
int trigger_type_active;
double trigger_value;
int edit_maneuver_index;
int target_body_index;
int current_body_index;
int transfer_body_index;
bool show_hohmann_preview;
HohmannTransfer last_calc;
bool show_preview;
bool preview_valid;
OrbitalElements preview_elements;
char error_message[256];
bool show_error;
bool show_delete_confirm;
};
// UI state
struct UIState {
int body_list_scroll;
int body_list_active;
int selected_craft_index;
ManeuverDialogState maneuver_dialog;
int maneuver_list_active;
int maneuver_list_scroll;
int selected_maneuver_index;
int cached_body_count;
int cached_craft_count;
int cached_maneuver_count;
int cached_executed_count;
int body_list_buffer_size;
char* body_list_buffer;
int craft_list_buffer_size;
char* craft_list_buffer;
int body_dropdown_buffer_size;
char* body_dropdown_buffer;
int maneuver_list_buffer_size;
char* maneuver_list_buffer;
};
void gui_init();
// UI rendering functions
void render_info(SimulationState* sim);
void render_body_list_ui(SimulationState* sim, RenderState* render_state, UIState* ui_state);
void render_body_info_ui(SimulationState* sim, RenderState* render_state, UIState* ui_state);
void render_maneuver_list_ui(SimulationState* sim, RenderState* render_state, UIState* ui_state);
void render_maneuver_dialog(SimulationState* sim, RenderState* render_state, UIState* ui_state);
void render_maneuver_create_tab(SimulationState* sim, UIState* ui_state, int x, int y, int width, int height);
void render_maneuver_edit_tab(SimulationState* sim, UIState* ui_state, int x, int y, int width, int height);
void update_orbital_preview(SimulationState* sim, UIState* ui_state);
void render_orbital_preview(SimulationState* sim, UIState* ui_state, Rectangle bounds);
bool validate_maneuver_inputs(SimulationState* sim, UIState* ui_state);
void generate_maneuver_name(SimulationState* sim, UIState* ui_state);
void create_maneuver_from_dialog(SimulationState* sim, UIState* ui_state);
void update_maneuver_from_dialog(SimulationState* sim, UIState* ui_state);
void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x, int y, int width, int height);
void calculate_hohmann_for_dialog(SimulationState* sim, UIState* ui_state);
void create_hohmann_burns(SimulationState* sim, UIState* ui_state, bool create_both_burns);
void load_maneuver_into_dialog(SimulationState* sim, UIState* ui_state, int maneuver_index);
void delete_maneuver_from_dialog(SimulationState* sim, UIState* ui_state);
void ui_state_init_buffers(UIState* ui_state);
void ui_state_free_buffers(UIState* ui_state);
#endif