|
|
|
@ -18,7 +18,7 @@ const int H_FLAGS = ImGuiTreeNodeFlags_DefaultOpen; |
|
|
|
// forward declarations
|
|
|
|
// forward declarations
|
|
|
|
|
|
|
|
|
|
|
|
void drawSimulationWindow(bool& running, u64 sim_time_ms, float& sim_speed); |
|
|
|
void drawSimulationWindow(bool& running, u64 sim_time_ms, float& sim_speed); |
|
|
|
void drawMemoryWindow(MemoryArena* arena); |
|
|
|
void drawMemoryWindow(MemoryArena* game_arena, RenderState* rs); |
|
|
|
void drawOrbitWindow(GameState* gs); |
|
|
|
void drawOrbitWindow(GameState* gs); |
|
|
|
void drawEllipseParameters(EllipseParameters& ep); |
|
|
|
void drawEllipseParameters(EllipseParameters& ep); |
|
|
|
void drawGravitationalBody(GravBody& body); |
|
|
|
void drawGravitationalBody(GravBody& body); |
|
|
|
@ -63,7 +63,7 @@ gooProcessEvent(SDL_Event& e) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
gooDraw(SDL_Window* window, GameState* gs) |
|
|
|
gooDraw(SDL_Window* window, GameState* gs, RenderState* rs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ImGui_ImplOpenGL3_NewFrame(); |
|
|
|
ImGui_ImplOpenGL3_NewFrame(); |
|
|
|
ImGui_ImplSDL2_NewFrame(window); |
|
|
|
ImGui_ImplSDL2_NewFrame(window); |
|
|
|
@ -76,7 +76,7 @@ gooDraw(SDL_Window* window, GameState* gs) |
|
|
|
Begin("Gooey"); |
|
|
|
Begin("Gooey"); |
|
|
|
|
|
|
|
|
|
|
|
drawSimulationWindow(gs->running, gs->sim_time_ms, gs->sim_speed); |
|
|
|
drawSimulationWindow(gs->running, gs->sim_time_ms, gs->sim_speed); |
|
|
|
drawMemoryWindow(gs->arena); |
|
|
|
drawMemoryWindow(gs->arena, rs); |
|
|
|
Separator(); |
|
|
|
Separator(); |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: split up orbit window into function calls here
|
|
|
|
// FIXME: split up orbit window into function calls here
|
|
|
|
@ -116,18 +116,41 @@ void drawSimulationWindow(bool& running, u64 sim_time_ms, float& sim_speed) |
|
|
|
InputFloat("sim speed", &sim_speed, 0.1, 4.0, "%.1f"); |
|
|
|
InputFloat("sim speed", &sim_speed, 0.1, 4.0, "%.1f"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void drawMemoryWindow(MemoryArena* arena) |
|
|
|
void drawMemoryWindow(MemoryArena* game_arena, RenderState* rs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
BeginChild("memory", ImVec2(G_WIDTH - 20, 50), true); |
|
|
|
MemoryArena* rg_arena = rs->rg_arena; |
|
|
|
|
|
|
|
MemoryArena* asset_arena = rs->assets.arena; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BeginChild("memory", ImVec2(G_WIDTH - 20, 125), true); |
|
|
|
Text("GameState Memory Arena"); |
|
|
|
Text("GameState Memory Arena"); |
|
|
|
float freeMB = (float) arena->free_size / (float) (1024 * 1024); |
|
|
|
float freeMB = (float) game_arena->free_size / (float) (1024 * 1024); |
|
|
|
float maxMB = (float) arena->max_size / (float) (1024 * 1024); |
|
|
|
float maxMB = (float) game_arena->max_size / (float) (1024 * 1024); |
|
|
|
float usedMB = maxMB - freeMB; |
|
|
|
float usedMB = maxMB - freeMB; |
|
|
|
Text("%.2f MB", usedMB); |
|
|
|
Text("%.2f MB", usedMB); |
|
|
|
SameLine(); |
|
|
|
SameLine(); |
|
|
|
ProgressBar(usedMB / maxMB, ImVec2(100, 15)); |
|
|
|
ProgressBar(usedMB / maxMB, ImVec2(100, 15)); |
|
|
|
SameLine(); |
|
|
|
SameLine(); |
|
|
|
Text("%.2f MB", maxMB); |
|
|
|
Text("%.2f MB", maxMB); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Text("RenderGroup Memory Arena"); |
|
|
|
|
|
|
|
freeMB = (float) rg_arena->free_size / (float) (1024 * 1024); |
|
|
|
|
|
|
|
maxMB = (float) rg_arena->max_size / (float) (1024 * 1024); |
|
|
|
|
|
|
|
usedMB = maxMB - freeMB; |
|
|
|
|
|
|
|
Text("%.2f MB", usedMB); |
|
|
|
|
|
|
|
SameLine(); |
|
|
|
|
|
|
|
ProgressBar(usedMB / maxMB, ImVec2(100, 15)); |
|
|
|
|
|
|
|
SameLine(); |
|
|
|
|
|
|
|
Text("%.2f MB", maxMB); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Text("Asset Memory Arena"); |
|
|
|
|
|
|
|
freeMB = (float) asset_arena->free_size / (float) (1024 * 1024); |
|
|
|
|
|
|
|
maxMB = (float) asset_arena->max_size / (float) (1024 * 1024); |
|
|
|
|
|
|
|
usedMB = maxMB - freeMB; |
|
|
|
|
|
|
|
Text("%.2f MB", usedMB); |
|
|
|
|
|
|
|
SameLine(); |
|
|
|
|
|
|
|
ProgressBar(usedMB / maxMB, ImVec2(100, 15)); |
|
|
|
|
|
|
|
SameLine(); |
|
|
|
|
|
|
|
Text("%.2f MB", maxMB); |
|
|
|
EndChild(); |
|
|
|
EndChild(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -135,7 +158,7 @@ void drawOrbitWindow(GameState* gs) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Text("Orbit Selection"); |
|
|
|
Text("Orbit Selection"); |
|
|
|
|
|
|
|
|
|
|
|
BeginChild("orbit selection", ImVec2(G_WIDTH - 20, 70), true); |
|
|
|
BeginChild("orbit selection", ImVec2(G_WIDTH - 20, 55), true); |
|
|
|
static u32 selected = UINT_MAX; |
|
|
|
static u32 selected = UINT_MAX; |
|
|
|
|
|
|
|
|
|
|
|
for (u32 i = 0; i < gs->num_orbits; i++) { |
|
|
|
for (u32 i = 0; i < gs->num_orbits; i++) { |
|
|
|
@ -159,7 +182,7 @@ void drawOrbitWindow(GameState* gs) |
|
|
|
&& gs->orbits[selected].in_use) |
|
|
|
&& gs->orbits[selected].in_use) |
|
|
|
{ |
|
|
|
{ |
|
|
|
TwoBodySystem& sys = gs->orbits[selected].system; |
|
|
|
TwoBodySystem& sys = gs->orbits[selected].system; |
|
|
|
BeginChild("orbit details", ImVec2(G_WIDTH - 20, 500), true); |
|
|
|
BeginChild("orbit details", ImVec2(G_WIDTH - 20, 450), true); |
|
|
|
Text("Selected Orbit#: %d", selected); |
|
|
|
Text("Selected Orbit#: %d", selected); |
|
|
|
//Text("Orbital Period: %.2fs", sys.orbital_period);
|
|
|
|
//Text("Orbital Period: %.2fs", sys.orbital_period);
|
|
|
|
drawSystemWindow(sys); |
|
|
|
drawSystemWindow(sys); |
|
|
|
|