2020-11-10 15:26:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
2020-12-11 14:24:42 +01:00
|
|
|
#include <filesystem>
|
2020-11-10 15:26:38 +01:00
|
|
|
#include <memory>
|
2021-02-01 19:03:45 +01:00
|
|
|
#include <string>
|
2021-09-26 21:18:25 +02:00
|
|
|
#include <list>
|
2020-11-10 15:26:38 +01:00
|
|
|
#include <vector>
|
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
#include <hex/ui/view.hpp>
|
2020-11-10 15:26:38 +01:00
|
|
|
|
|
|
|
struct GLFWwindow;
|
2020-11-23 23:57:19 +01:00
|
|
|
struct ImGuiSettingsHandler;
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2021-08-18 22:36:46 +02:00
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
namespace hex {
|
|
|
|
|
2023-05-27 17:45:41 +02:00
|
|
|
void nativeErrorMessage(const std::string &message);
|
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
class Window {
|
|
|
|
public:
|
2022-02-15 23:07:48 +01:00
|
|
|
Window();
|
2020-11-10 15:26:38 +01:00
|
|
|
~Window();
|
|
|
|
|
|
|
|
void loop();
|
2023-09-07 20:33:49 +02:00
|
|
|
void fullFrame();
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2021-08-22 20:24:42 +02:00
|
|
|
static void initNative();
|
2021-08-17 22:54:09 +02:00
|
|
|
|
2023-10-04 12:00:32 +02:00
|
|
|
void resize(i32 width, i32 height);
|
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
private:
|
2021-08-18 22:36:46 +02:00
|
|
|
void setupNativeWindow();
|
2021-12-10 16:09:55 +01:00
|
|
|
void beginNativeWindowFrame();
|
|
|
|
void endNativeWindowFrame();
|
2023-12-06 11:05:02 +01:00
|
|
|
void drawTitleBar() const;
|
2023-05-25 09:26:40 +02:00
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
void frameBegin();
|
2021-06-07 18:14:40 +02:00
|
|
|
void frame();
|
2020-11-10 15:26:38 +01:00
|
|
|
void frameEnd();
|
|
|
|
|
2023-12-19 13:10:25 +01:00
|
|
|
void processEvent() { m_hadEvent = true; }
|
2022-08-03 23:32:34 +02:00
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
void initGLFW();
|
|
|
|
void initImGui();
|
2022-01-18 00:10:10 +01:00
|
|
|
void exitGLFW();
|
|
|
|
void exitImGui();
|
2020-11-10 15:26:38 +01:00
|
|
|
|
2023-02-17 12:03:53 +01:00
|
|
|
void registerEventHandlers();
|
2021-08-22 20:24:42 +02:00
|
|
|
|
2022-01-24 20:53:17 +01:00
|
|
|
GLFWwindow *m_window = nullptr;
|
2020-11-23 23:57:19 +01:00
|
|
|
|
2023-12-14 13:50:26 +01:00
|
|
|
std::string m_windowTitle, m_windowTitleFull;
|
2021-08-18 22:36:46 +02:00
|
|
|
|
2023-12-11 11:42:33 +01:00
|
|
|
double m_lastStartFrameTime = 0;
|
2022-02-15 22:36:36 +01:00
|
|
|
double m_lastFrameTime = 0;
|
2021-03-06 13:09:20 +01:00
|
|
|
|
2023-11-16 22:24:06 +01:00
|
|
|
ImGuiExt::Texture m_logoTexture;
|
2021-08-18 22:36:46 +02:00
|
|
|
|
2022-09-19 16:09:22 +02:00
|
|
|
std::mutex m_popupMutex;
|
2021-09-26 21:18:25 +02:00
|
|
|
std::list<std::string> m_popupsToOpen;
|
2021-12-23 15:11:38 +01:00
|
|
|
std::vector<int> m_pressedKeys;
|
2022-02-21 21:55:04 +01:00
|
|
|
|
2023-06-02 14:43:45 +02:00
|
|
|
bool m_buttonDown = false;
|
2022-08-03 23:32:34 +02:00
|
|
|
|
|
|
|
bool m_hadEvent = false;
|
|
|
|
bool m_frameRateTemporarilyUnlocked = false;
|
|
|
|
double m_frameRateUnlockTime = 0;
|
2023-08-25 23:54:39 +02:00
|
|
|
|
2023-11-16 22:24:06 +01:00
|
|
|
ImGuiExt::ImHexCustomData m_imguiCustomData;
|
2020-11-10 15:26:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|