|
|
|
|
@ -549,10 +549,14 @@ void render_maneuver_create_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
Rectangle dir_label = {(float)x, (float)current_y, 80, 25}; |
|
|
|
|
GuiLabel(dir_label, "Direction:"); |
|
|
|
|
|
|
|
|
|
// FIXME: we need to handle state differently here: see raygui controls_test_suite.c example
|
|
|
|
|
if (ui_state->maneuver_dialog.craft_index >= 0 && ui_state->maneuver_dialog.craft_index < sim->craft_count) { |
|
|
|
|
static bool edit_mode_01 = false; |
|
|
|
|
Rectangle dir_combo = {(float)x + 85, (float)current_y, (float)(width - 95), 25}; |
|
|
|
|
GuiDropdownBox(dir_combo, "Prograde;Retrograde;Normal;Antinormal;Radial In;Radial Out;Custom", &ui_state->maneuver_dialog.direction_active, false); |
|
|
|
|
const char* directions = "Prograde;Retrograde;Normal;Antinormal;Radial In;Radial Out;Custom"; |
|
|
|
|
if (GuiDropdownBox(dir_combo, directions, &ui_state->maneuver_dialog.direction_active, edit_mode_01)) { |
|
|
|
|
edit_mode_01 = !edit_mode_01; |
|
|
|
|
} |
|
|
|
|
if (edit_mode_01) return; |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
@ -574,8 +578,13 @@ void render_maneuver_create_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
GuiLabel(trigger_label, "Trigger:"); |
|
|
|
|
|
|
|
|
|
if (ui_state->maneuver_dialog.craft_index >= 0 && ui_state->maneuver_dialog.craft_index < sim->craft_count) { |
|
|
|
|
static bool edit_mode_trigger_create = false; |
|
|
|
|
Rectangle trigger_combo = {(float)x + 85, (float)current_y, (float)(width - 95), 25}; |
|
|
|
|
GuiDropdownBox(trigger_combo, "Time;True Anomaly", &ui_state->maneuver_dialog.trigger_type_active, false); |
|
|
|
|
const char* trigger_types = "Time;True Anomaly"; |
|
|
|
|
if (GuiDropdownBox(trigger_combo, trigger_types, &ui_state->maneuver_dialog.trigger_type_active, edit_mode_trigger_create)) { |
|
|
|
|
edit_mode_trigger_create = !edit_mode_trigger_create; |
|
|
|
|
} |
|
|
|
|
if (edit_mode_trigger_create) return; |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
@ -711,6 +720,7 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
if (sim->craft_count > 0) { |
|
|
|
|
static bool edit_mode_spacecraft = false; |
|
|
|
|
int craft_buffer_size = sim->craft_count * 64 + 1; |
|
|
|
|
char* craft_list = (char*)malloc(craft_buffer_size); |
|
|
|
|
if (craft_list) { |
|
|
|
|
@ -723,9 +733,12 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
offset += snprintf(craft_list + offset, craft_buffer_size - offset, "%s", sim->spacecraft[i].name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
craft_list, &ui_state->maneuver_dialog.craft_index, false); |
|
|
|
|
if (GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
craft_list, &ui_state->maneuver_dialog.craft_index, edit_mode_spacecraft)) { |
|
|
|
|
edit_mode_spacecraft = !edit_mode_spacecraft; |
|
|
|
|
} |
|
|
|
|
free(craft_list); |
|
|
|
|
if (edit_mode_spacecraft) return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
@ -734,6 +747,7 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
if (sim->body_count > 0) { |
|
|
|
|
static bool edit_mode_transfer_parent = false; |
|
|
|
|
int body_buffer_size = sim->body_count * 64 + 1; |
|
|
|
|
char* body_list = (char*)malloc(body_buffer_size); |
|
|
|
|
if (body_list) { |
|
|
|
|
@ -746,9 +760,12 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
offset += snprintf(body_list + offset, body_buffer_size - offset, "%s", sim->bodies[i].name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
body_list, &ui_state->maneuver_dialog.transfer_body_index, false); |
|
|
|
|
if (GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
body_list, &ui_state->maneuver_dialog.transfer_body_index, edit_mode_transfer_parent)) { |
|
|
|
|
edit_mode_transfer_parent = !edit_mode_transfer_parent; |
|
|
|
|
} |
|
|
|
|
free(body_list); |
|
|
|
|
if (edit_mode_transfer_parent) return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
@ -757,6 +774,7 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
if (sim->body_count > 0) { |
|
|
|
|
static bool edit_mode_current_body = false; |
|
|
|
|
int body_buffer_size = sim->body_count * 64 + 1; |
|
|
|
|
char* body_list = (char*)malloc(body_buffer_size); |
|
|
|
|
if (body_list) { |
|
|
|
|
@ -769,9 +787,12 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
offset += snprintf(body_list + offset, body_buffer_size - offset, "%s", sim->bodies[i].name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
body_list, &ui_state->maneuver_dialog.current_body_index, false); |
|
|
|
|
if (GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
body_list, &ui_state->maneuver_dialog.current_body_index, edit_mode_current_body)) { |
|
|
|
|
edit_mode_current_body = !edit_mode_current_body; |
|
|
|
|
} |
|
|
|
|
free(body_list); |
|
|
|
|
if (edit_mode_current_body) return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
@ -780,6 +801,7 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
if (sim->body_count > 0) { |
|
|
|
|
static bool edit_mode_target_body = false; |
|
|
|
|
int body_buffer_size = sim->body_count * 64 + 1; |
|
|
|
|
char* body_list = (char*)malloc(body_buffer_size); |
|
|
|
|
if (body_list) { |
|
|
|
|
@ -792,9 +814,12 @@ void render_maneuver_hohmann_tab(SimulationState* sim, UIState* ui_state, int x,
|
|
|
|
|
offset += snprintf(body_list + offset, body_buffer_size - offset, "%s", sim->bodies[i].name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
body_list, &ui_state->maneuver_dialog.target_body_index, false); |
|
|
|
|
if (GuiDropdownBox({(float)x + 120, (float)(current_y - 35), (float)(width - 130), 25}, |
|
|
|
|
body_list, &ui_state->maneuver_dialog.target_body_index, edit_mode_target_body)) { |
|
|
|
|
edit_mode_target_body = !edit_mode_target_body; |
|
|
|
|
} |
|
|
|
|
free(body_list); |
|
|
|
|
if (edit_mode_target_body) return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
@ -1297,8 +1322,13 @@ void render_maneuver_edit_tab(SimulationState* sim, UIState* ui_state, int x, in
|
|
|
|
|
GuiLabel(dir_label, "Direction:"); |
|
|
|
|
|
|
|
|
|
if (ui_state->maneuver_dialog.craft_index >= 0 && ui_state->maneuver_dialog.craft_index < sim->craft_count) { |
|
|
|
|
static bool edit_mode_direction_edit = false; |
|
|
|
|
Rectangle dir_combo = {(float)x + 85, (float)current_y, (float)(width - 95), 25}; |
|
|
|
|
GuiDropdownBox(dir_combo, "Prograde;Retrograde;Normal;Antinormal;Radial In;Radial Out;Custom", &ui_state->maneuver_dialog.direction_active, false); |
|
|
|
|
const char* directions = "Prograde;Retrograde;Normal;Antinormal;Radial In;Radial Out;Custom"; |
|
|
|
|
if (GuiDropdownBox(dir_combo, directions, &ui_state->maneuver_dialog.direction_active, edit_mode_direction_edit)) { |
|
|
|
|
edit_mode_direction_edit = !edit_mode_direction_edit; |
|
|
|
|
} |
|
|
|
|
if (edit_mode_direction_edit) return; |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
@ -1320,8 +1350,13 @@ void render_maneuver_edit_tab(SimulationState* sim, UIState* ui_state, int x, in
|
|
|
|
|
GuiLabel(trigger_label, "Trigger:"); |
|
|
|
|
|
|
|
|
|
if (ui_state->maneuver_dialog.craft_index >= 0 && ui_state->maneuver_dialog.craft_index < sim->craft_count) { |
|
|
|
|
static bool edit_mode_trigger_edit = false; |
|
|
|
|
Rectangle trigger_combo = {(float)x + 85, (float)current_y, (float)(width - 95), 25}; |
|
|
|
|
GuiDropdownBox(trigger_combo, "Time;True Anomaly", &ui_state->maneuver_dialog.trigger_type_active, false); |
|
|
|
|
const char* trigger_types = "Time;True Anomaly"; |
|
|
|
|
if (GuiDropdownBox(trigger_combo, trigger_types, &ui_state->maneuver_dialog.trigger_type_active, edit_mode_trigger_edit)) { |
|
|
|
|
edit_mode_trigger_edit = !edit_mode_trigger_edit; |
|
|
|
|
} |
|
|
|
|
if (edit_mode_trigger_edit) return; |
|
|
|
|
} |
|
|
|
|
current_y += 35; |
|
|
|
|
|
|
|
|
|
|