Files
pixelarium/src/AppGLFW.hpp
T

54 lines
1.2 KiB
C++
Raw Normal View History

2025-03-13 12:00:14 +01:00
#pragma once
#include <GLFW/glfw3.h>
2025-03-14 19:32:40 +01:00
2025-03-13 12:00:14 +01:00
#include <cstdio>
2025-03-17 18:50:31 +01:00
#include <memory>
2025-03-13 12:00:14 +01:00
2025-03-14 19:32:40 +01:00
#include "Image.hpp"
2025-03-13 12:00:14 +01:00
#include "imgui.h"
2025-03-17 10:44:56 +01:00
#include "rendering/CvMatRender.hpp"
2025-03-17 18:50:31 +01:00
#include "utilities/ILog.hpp"
2025-03-13 12:00:14 +01:00
2025-03-14 19:32:40 +01:00
namespace pixelarium::ui
2025-03-13 12:00:14 +01:00
{
2025-03-17 17:33:31 +01:00
static bool dim_changed_p(const ImVec2& ref_rect, const ImVec2& new_rect);
static ImVec2 ascpet_const_dimensions(const pixelarium::imaging::Image& img, const ImVec2& curr_dim);
2025-03-13 12:00:14 +01:00
enum LogLevelSelection
{
Debug = 0,
Info = 1,
Warning = 2,
Error = 3
};
class AppGLFW
{
public:
2025-03-18 21:22:41 +01:00
AppGLFW() { this->InitMainWindow(); }
AppGLFW(std::unique_ptr<utils::log::ILog>& log) : _logger(log.get()) { this->InitMainWindow(); }
2025-03-13 12:00:14 +01:00
int Run();
2025-03-14 19:32:40 +01:00
private:
2025-03-18 21:22:41 +01:00
void InitMainWindow();
2025-03-14 19:32:40 +01:00
void MenuBar();
void LoadImageProt();
2025-03-13 12:00:14 +01:00
private:
2025-03-17 17:33:31 +01:00
// LogLevelSelection log_level_ = static_cast<LogLevelSelection>(0);
2025-03-17 18:50:31 +01:00
utils::log::ILog* _logger;
2025-03-13 12:00:14 +01:00
GLFWwindow* window = nullptr;
ImGuiWindowFlags window_flags = 0;
2025-03-17 10:44:56 +01:00
std::shared_ptr<pixelarium::imaging::Image> _img;
pixelarium::render::CvMatRender _render;
2025-03-17 17:33:31 +01:00
bool _imagep{false};
ImVec2 _curr_dim;
2025-03-13 12:00:14 +01:00
};
static void glfw_error_callback(int error, const char* description)
{
fprintf(stderr, "GLFW Error %d: %s\n", error, description);
}
2025-03-17 17:33:31 +01:00
} // namespace pixelarium::ui