2025-08-18 22:39:43 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <GLFW/glfw3.h>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "imgui.h"
|
|
|
|
|
#include "utilities/ILog.hpp"
|
|
|
|
|
|
|
|
|
|
namespace pixelarium::application
|
|
|
|
|
{
|
2025-09-26 21:09:51 +02:00
|
|
|
/// @brief Base class providing scaffolding with GLFW and some default
|
|
|
|
|
/// implementations that can be extended and/or overridden by consumers
|
2025-08-18 22:39:43 +00:00
|
|
|
class AppGLFW
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
explicit AppGLFW(const utils::log::ILog& log) : logger_(log) { this->InitMainWindow(); }
|
|
|
|
|
|
2025-09-26 21:09:51 +02:00
|
|
|
/// @brief Start the main render loop
|
2025-08-18 22:39:43 +00:00
|
|
|
void Start() { this->RunLoop(); }
|
|
|
|
|
|
|
|
|
|
protected:
|
2025-09-26 21:09:51 +02:00
|
|
|
/// @brief Function implementing the first column of the menu bar (e.g. "Menu")
|
2025-08-18 22:39:43 +00:00
|
|
|
virtual void MenuBarOptionsColumn1() {}
|
2025-09-26 21:09:51 +02:00
|
|
|
|
|
|
|
|
/// @brief Function implementing the second column of the menu bar (e.g. "File")
|
2025-08-18 22:39:43 +00:00
|
|
|
virtual void MenuBarOptionsColumn2() {}
|
2025-09-26 21:09:51 +02:00
|
|
|
|
|
|
|
|
/// @brief Function implementing the third column of the menu bar (e.g. "Options")
|
2025-08-18 22:39:43 +00:00
|
|
|
virtual void MenuBarOptionsColumn3() {}
|
2025-09-26 21:09:51 +02:00
|
|
|
|
|
|
|
|
/// @brief Function implementing the fourth column of the menu bar (e.g. "More")
|
2025-08-18 22:39:43 +00:00
|
|
|
virtual void MenuBarOptionsColumn4() {}
|
2025-09-26 21:09:51 +02:00
|
|
|
|
|
|
|
|
/// @brief Function implementing the first column of the menu bar (e.g. "Help")
|
2025-08-18 22:39:43 +00:00
|
|
|
virtual void MenuBarOptionsColumn5() {}
|
2025-09-26 21:09:51 +02:00
|
|
|
|
|
|
|
|
/// @brief Main function that gets called within the render loop.
|
2025-08-18 22:39:43 +00:00
|
|
|
virtual void Run() {}
|
|
|
|
|
|
|
|
|
|
const utils::log::ILog& logger_;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
int RunLoop();
|
|
|
|
|
void InitMainWindow();
|
|
|
|
|
void MenuBar();
|
|
|
|
|
void LogLevelSelect();
|
|
|
|
|
int log_level_{0};
|
|
|
|
|
GLFWwindow* window = nullptr;
|
|
|
|
|
};
|
|
|
|
|
} // namespace pixelarium::application
|