From 09d715b9f7f31b6de862a99091e4a7e21fd4d123 Mon Sep 17 00:00:00 2001 From: LandaMm Date: Sat, 4 Oct 2025 12:22:45 +0200 Subject: [PATCH] feat: window + engine header --- include/renderer/engine.h | 30 ++++++++++++++++++++++++++++++ include/window/window.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 include/renderer/engine.h create mode 100644 include/window/window.h diff --git a/include/renderer/engine.h b/include/renderer/engine.h new file mode 100644 index 0000000..60ecf77 --- /dev/null +++ b/include/renderer/engine.h @@ -0,0 +1,30 @@ +#ifndef ENGINE_H_ +#define ENGINE_H_ + +#include +#include + +#include "window/window.h" +#include "window/events/window.h" + +class Engine { +private: + std::unique_ptr m_window; + bool m_isRunning; +private: + glm::mat4 m_projection; +public: + Engine(); + ~Engine(); +private: + void Stop(); + void Destroy() const; + [[nodiscard]] bool Running() const; +private: + void HandleWindowResized(const WindowResized& event); +public: + void Run(); +}; + + +#endif // ENGINE_H_ \ No newline at end of file diff --git a/include/window/window.h b/include/window/window.h new file mode 100644 index 0000000..5a01b87 --- /dev/null +++ b/include/window/window.h @@ -0,0 +1,36 @@ +#ifndef WINDOW_H_ +#define WINDOW_H_ +#include + +#include "event.hpp" + +#define ENGINE_GL_MAJOR_VERSION 4 +#define ENGINE_GL_MINOR_VERSION 6 +#define ENGINE_GL_MULTISAMPLE_BUFFERS 1 +#define ENGINE_GL_MULTISAMPLE_SAMPLES 8 + +#define DEFAULT_WIDTH 1024 +#define DEFAULT_HEIGHT 768 + +class Window : public EventBus { +private: + SDL_Window *m_window; + SDL_GLContext m_context; + + int m_width; + int m_height; +public: + Window(); + ~Window(); +public: + [[nodiscard]] inline int GetWidth() const { return m_width; } + [[nodiscard]] inline int GetHeight() const { return m_height; } +public: + void ProcessEvents(); +public: + void SwapBuffers() const; +public: + void Destroy() const; +}; + +#endif //WINDOW_H_ \ No newline at end of file