* get image returns optional<Mat> instead of unique_ptr<Mat>

* introduce complexity

* rename image load function

* add example for a basic reader for binary image files

* fix windows build?

* add a status bar underneath the menu bar

* use status bar in custom_0 example app

* clang formats

* packing w/ pragma push

* add "Save As" functions to image views

* resize over reserve

* rm local override uri

* add simple thread pool

* rename to simple_thread_pool

* get rid of useless renderlib

* document version inc

* extract hardcoded values to in-header

* clang format patch

* clone registered image in custom_0

* document binary-file header

* minor fixes

* clang format

* rm unused render cmake
This commit is contained in:
m-aXimilian
2026-01-23 23:00:35 +00:00
committed by Maximilian Kueffner
parent e3e161ce52
commit b37814204f
52 changed files with 712 additions and 207 deletions
+73
View File
@@ -4,6 +4,56 @@
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include "imgui_internal.h"
#include "utilities/simple_thread_pool.hpp"
// see https://github.com/ocornut/imgui/issues/3518
bool PixelBeginStatusBar()
{
using namespace ImGui;
ImGuiContext& g = *GImGui;
ImGuiViewportP* viewport = (ImGuiViewportP*)(void*)GetMainViewport();
SetCurrentViewport(NULL, viewport);
g.NextWindowData.MenuBarOffsetMinVal = ImVec2(
g.Style.DisplaySafeAreaPadding.x, ImMax(g.Style.DisplaySafeAreaPadding.y - g.Style.FramePadding.y, 0.0f));
ImGuiWindowFlags window_flags =
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar;
float height = GetFrameHeight();
bool is_open = BeginViewportSideBar("##MainStatusBar", viewport, ImGuiDir_Up, height, window_flags);
g.NextWindowData.MenuBarOffsetMinVal = ImVec2(0.0f, 0.0f);
if (!is_open)
{
End();
return false;
}
g.CurrentWindow->Flags &= ~ImGuiWindowFlags_NoSavedSettings;
BeginMenuBar();
return is_open;
}
void PixelEndStatusBar()
{
using namespace ImGui;
ImGuiContext& g = *GImGui;
if (!g.CurrentWindow->DC.MenuBarAppending)
{
IM_ASSERT_USER_ERROR(0, "Calling EndMainMenuBar() not from a menu-bar!");
return;
}
EndMenuBar();
g.CurrentWindow->Flags |= ImGuiWindowFlags_NoSavedSettings;
if (g.CurrentWindow == g.NavWindow && g.NavLayer == ImGuiNavLayer_Main && !g.NavAnyRequest && g.ActiveId == 0)
FocusTopMostWindowUnderOne(
g.NavWindow, NULL, NULL,
ImGuiFocusRequestFlags_UnlessBelowModal | ImGuiFocusRequestFlags_RestoreFocusedChild);
End();
}
/// @brief GLFW error callback function.
/// @param error The error code.
@@ -193,6 +243,18 @@ void pixelarium::application::AppGLFW::MenuBar()
ImGui::EndMainMenuBar();
}
if (show_status_ && PixelBeginStatusBar())
{
if (ImGui::Button("Ok", {20, 20}))
{
show_status_ = false;
status_message_.clear();
}
ImGui::Text("%s", status_message_.c_str());
PixelEndStatusBar();
}
}
/// @brief Allows the user to select the log level via a combo box.
@@ -213,3 +275,14 @@ void pixelarium::application::AppGLFW::LogLevelSelect()
ImGui::EndCombo();
}
}
void pixelarium::application::AppGLFW::SetStatusTimed(const std::string& status, size_t seconds)
{
SetStatus(status);
utils::simple_thread_pool::run_asynch(
[this, seconds]()
{
std::this_thread::sleep_for(std::chrono::seconds(seconds));
ResetStatus();
});
}