summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/bookmouse.cpp14
-rw-r--r--src/demo.cpp8
-rw-r--r--src/file_dialog.cpp1
-rw-r--r--src/sdl_context.cpp5
-rw-r--r--warnings.cmake1
6 files changed, 17 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e37e8ce..e9785f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,6 @@ add_executable(bookmouse
src/archive.cpp
src/image.cpp
src/fud_mem.cpp
- src/demo.cpp
src/sdl_context.cpp
src/sdl_main_window.cpp
src/imgui_context.cpp
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 <SDL_opengl.h>
#include <atomic>
+#include <fud_assert.hpp>
#include <fud_array.hpp>
#include <fud_directory.hpp>
#include <spdlog/spdlog.h>
@@ -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<FileDialog>(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 <spdlog/spdlog.h>
#include <vector>
+#include <fud_assert.hpp>
+
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 <fud_assert.hpp>
#include <SDL.h>
#include <cassert>
@@ -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
}
diff --git a/warnings.cmake b/warnings.cmake
index afecae1..ecd7773 100644
--- a/warnings.cmake
+++ b/warnings.cmake
@@ -18,6 +18,7 @@ set(BOOKMOUSE_WARNINGS
-Wuninitialized
-Wstack-protector
-Warray-bounds
+ -Wno-error=array-bounds
-Woverlength-strings
-Wwrite-strings
-Wcast-qual