From 678464d24c9c5b689788c0ec17854611f127f863 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sat, 28 Sep 2024 20:47:33 -0500 Subject: Compile against release. --- src/bookmouse.cpp | 14 +++++--------- src/demo.cpp | 8 ++++++-- src/file_dialog.cpp | 1 + src/sdl_context.cpp | 5 ++++- 4 files changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/bookmouse.cpp b/src/bookmouse.cpp index d367af1..d6c5490 100644 --- a/src/bookmouse.cpp +++ b/src/bookmouse.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -12,7 +13,7 @@ namespace bookmouse { -using fud::FudStatus; +using fud::assertFail; constexpr const char* OpenDialogHandle = "Open File"; @@ -101,15 +102,9 @@ void Bookmouse::updateState() ImGui::SetNextWindowSize(m_imgui.getIO().DisplaySize); auto stateResult = ImBegin( "My First Tool", - &m_running, // Is this right? + &m_running, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_MenuBar); - IM_ASSERT(stateResult); - - // m_imgui.getIO().AddKeyEvent() - - // if (ImGui::IsKeyPressed(ImGuiKey_O) && m_imgui.getIO().KeyCtrl && !m_openDialog) { - // m_openDialog = true; - // } + fudAssert(stateResult); if (ImMenuBar menuBar{}) { IM_ASSERT(menuBar); @@ -172,6 +167,7 @@ void Bookmouse::openDialog() if (m_fileDialog == nullptr) { m_fileDialog = std::make_unique(m_directoryName, m_timeFormat); if (!m_fileDialog->valid()) { + spdlog::error("WHAT {}", m_directoryName.c_str()); m_openDialog = false; ImGui::CloseCurrentPopup(); } diff --git a/src/demo.cpp b/src/demo.cpp index 14bd8d5..ad6207a 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -17,8 +17,12 @@ #include #include +#include + namespace bookmouse { +using fud::assertFail; + // Simple helper function to load an image into a OpenGL texture with common settings bool LoadTextureFromMemory( // force newline const void* data, @@ -143,7 +147,7 @@ int demo(const fud::String& m_filename) GLuint my_image_texture = 0; bool ret = LoadTextureFromFile( // force m_filename, &my_image_texture, &my_image_width, &my_image_height); - IM_ASSERT(ret); + fudAssert(ret); // Our state bool show_demo_window = true; @@ -213,7 +217,7 @@ int demo(const fud::String& m_filename) // Edit 1 float using a slider from 0.0f to 1.0f ImGui::SliderFloat("float", &f, 0.0f, 1.0f); // Edit 3 floats representing a color - ImGui::ColorEdit3("clear color", (float*)&clear_color); + ImGui::ColorEdit3("clear color", &clear_color.x); // Buttons return true when clicked (most widgets return true when edited/activated) if (ImGui::Button("Button")) diff --git a/src/file_dialog.cpp b/src/file_dialog.cpp index 80e994d..3b84722 100644 --- a/src/file_dialog.cpp +++ b/src/file_dialog.cpp @@ -43,6 +43,7 @@ FileDialog::FileDialog(const fud::String& directoryName, TimeFormat& timeFormat) if (status != FudStatus::Success) { return; } + m_valid = true; } FudStatus FileDialog::getDirectoryContents() diff --git a/src/sdl_context.cpp b/src/sdl_context.cpp index f52bbe9..7601d72 100644 --- a/src/sdl_context.cpp +++ b/src/sdl_context.cpp @@ -1,4 +1,5 @@ #include "sdl_context.hpp" +#include #include #include @@ -6,6 +7,8 @@ namespace bookmouse { +using fud::assertFail; + SdlContext::SdlContext() { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0) { const auto* lastError = SDL_GetError(); @@ -36,7 +39,7 @@ SdlContext::SdlContext() { // From 2.0.18: Enable native IME. #ifdef SDL_HINT_IME_SHOW_UI auto hintSet = SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1"); - assert(hintSet == SDL_TRUE); + fudAssert(hintSet == SDL_TRUE); #endif } -- cgit v1.2.3