summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-09-28 20:47:33 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-09-28 20:47:33 -0500
commit678464d24c9c5b689788c0ec17854611f127f863 (patch)
treebb02a16a60f09e9c1adaab23c5f61fc3e800a698 /src
parent6f44617d0a378d980de71e6a5e1d634bff95bbcb (diff)
Compile against release.HEADmaster
Diffstat (limited to 'src')
-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
4 files changed, 16 insertions, 12 deletions
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
}