|
|
|
@ -1,4 +1,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <cassert> |
|
|
|
|
|
|
|
|
|
|
|
#if defined (_WIN32) |
|
|
|
#if defined (_WIN32) |
|
|
|
#include <SDL.h> |
|
|
|
#include <SDL.h> |
|
|
|
#else |
|
|
|
#else |
|
|
|
@ -13,7 +15,7 @@ |
|
|
|
#include "gooey.h" |
|
|
|
#include "gooey.h" |
|
|
|
|
|
|
|
|
|
|
|
bool |
|
|
|
bool |
|
|
|
initGooey(SDL_Handles &handles, v2i vp_dims /*TODO: pass in game state*/) |
|
|
|
initGooey(SDL_Handles &handles, v2i vp_dims) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IMGUI_CHECKVERSION(); |
|
|
|
IMGUI_CHECKVERSION(); |
|
|
|
ImGui::CreateContext(); |
|
|
|
ImGui::CreateContext(); |
|
|
|
@ -46,9 +48,10 @@ gooeyProcessEvent(SDL_Event &event) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
renderGooey(SDL_Handles &handles, HexDrawMode &mode, bool &is_debug, |
|
|
|
renderGooey(SDL_Handles &handles, hexgrid* grid, bool &is_debug, camera* cam) |
|
|
|
hex_info* start_hex, hex_info* current_hex, bool &is_selecting, v3f camera_pos) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
assert(grid != nullptr); |
|
|
|
|
|
|
|
|
|
|
|
ImGui_ImplOpenGL3_NewFrame(); |
|
|
|
ImGui_ImplOpenGL3_NewFrame(); |
|
|
|
ImGui_ImplSDL2_NewFrame(handles.window); |
|
|
|
ImGui_ImplSDL2_NewFrame(handles.window); |
|
|
|
ImGui::NewFrame(); |
|
|
|
ImGui::NewFrame(); |
|
|
|
@ -63,32 +66,30 @@ renderGooey(SDL_Handles &handles, HexDrawMode &mode, bool &is_debug, |
|
|
|
ImGui::SetNextWindowPos(ImVec2(0,0)); |
|
|
|
ImGui::SetNextWindowPos(ImVec2(0,0)); |
|
|
|
ImGui::SetNextWindowSize(ImVec2(300, 720)); |
|
|
|
ImGui::SetNextWindowSize(ImVec2(300, 720)); |
|
|
|
ImGui::SetNextWindowBgAlpha(0.3f); |
|
|
|
ImGui::SetNextWindowBgAlpha(0.3f); |
|
|
|
bool show_window; |
|
|
|
ImGui::Begin("", nullptr, window_flags); |
|
|
|
ImGui::Begin("", &show_window, window_flags); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImGuiIO& io = ImGui::GetIO(); |
|
|
|
ImGuiIO& io = ImGui::GetIO(); |
|
|
|
ImGui::Text("%.3f ms/frame, (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
|
|
|
ImGui::Text("%.3f ms/frame, (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate); |
|
|
|
|
|
|
|
|
|
|
|
ImGui::Text("Draw Mode:"); |
|
|
|
ImGui::Text("Draw Mode:"); |
|
|
|
if (ImGui::RadioButton("None", (mode == NONE))) |
|
|
|
if (ImGui::RadioButton("None", (grid->draw_mode == NONE))) |
|
|
|
mode = NONE; |
|
|
|
grid->draw_mode = NONE; |
|
|
|
if (ImGui::RadioButton("Fill", (mode == FILL))) |
|
|
|
if (ImGui::RadioButton("Fill", (grid->draw_mode == FILL))) |
|
|
|
mode = FILL; |
|
|
|
grid->draw_mode = FILL; |
|
|
|
if (ImGui::RadioButton("Line", (mode == LINE))) |
|
|
|
if (ImGui::RadioButton("Line", (grid->draw_mode == LINE))) |
|
|
|
mode = LINE; |
|
|
|
grid->draw_mode = LINE; |
|
|
|
if (ImGui::RadioButton("Cone Fill", (mode == CONE_FILL))) |
|
|
|
if (ImGui::RadioButton("Cone Fill", (grid->draw_mode == CONE_FILL))) |
|
|
|
mode = CONE_FILL; |
|
|
|
grid->draw_mode = CONE_FILL; |
|
|
|
|
|
|
|
|
|
|
|
ImGui::Checkbox("Debug Render", &is_debug); |
|
|
|
ImGui::Checkbox("Debug Render", &is_debug); |
|
|
|
ImGui::SameLine(); ImGui::TextUnformatted(is_debug ? "true" : "false"); |
|
|
|
ImGui::SameLine(); ImGui::TextUnformatted(is_debug ? "true" : "false"); |
|
|
|
ImGui::Text("is_selecting"); |
|
|
|
ImGui::Text("is_selecting"); |
|
|
|
ImGui::SameLine(); ImGui::TextUnformatted(is_selecting ? "true" : "false"); |
|
|
|
ImGui::SameLine(); ImGui::TextUnformatted(grid->is_selecting ? "true" : "false"); |
|
|
|
|
|
|
|
|
|
|
|
ImGui::SetNextTreeNodeOpen(true); |
|
|
|
if (ImGui::CollapsingHeader("Camera Position", ImGuiTreeNodeFlags_DefaultOpen)) { |
|
|
|
if (ImGui::CollapsingHeader("Camera Position")) { |
|
|
|
ImGui::Text("x: %f", cam->position.x); |
|
|
|
ImGui::Text("x: %f", camera_pos.x); |
|
|
|
ImGui::Text("y: %f", cam->position.y); |
|
|
|
ImGui::Text("y: %f", camera_pos.y); |
|
|
|
ImGui::Text("z: %f", cam->position.z); |
|
|
|
ImGui::Text("z: %f", camera_pos.z); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
#if 0 |
|
|
|
@ -98,14 +99,12 @@ renderGooey(SDL_Handles &handles, HexDrawMode &mode, bool &is_debug, |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
//ImGui::ShowMetricsWindow();
|
|
|
|
//ImGui::ShowMetricsWindow();
|
|
|
|
|
|
|
|
|
|
|
|
if (current_hex) |
|
|
|
if (grid->current_hex) { |
|
|
|
{ |
|
|
|
Hex ch = grid->current_hex->hex; |
|
|
|
Hex ch = current_hex->hex; |
|
|
|
|
|
|
|
ImGui::Text("current_hex: %i, %i, %i", ch.q, ch.r, ch.s); |
|
|
|
ImGui::Text("current_hex: %i, %i, %i", ch.q, ch.r, ch.s); |
|
|
|
} |
|
|
|
} |
|
|
|
if (start_hex) |
|
|
|
if (grid->start_hex) { |
|
|
|
{ |
|
|
|
Hex sh = grid->start_hex->hex; |
|
|
|
Hex sh = start_hex->hex; |
|
|
|
|
|
|
|
ImGui::Text("start_hex: %i, %i, %i", sh.q, sh.r, sh.s); |
|
|
|
ImGui::Text("start_hex: %i, %i, %i", sh.q, sh.r, sh.s); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -114,4 +113,3 @@ renderGooey(SDL_Handles &handles, HexDrawMode &mode, bool &is_debug, |
|
|
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); |
|
|
|
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|