From 415b342d3c131d2e7cd2e2eec4dd2b0c1e93d098 Mon Sep 17 00:00:00 2001 From: anulax1225 Date: Sat, 20 Jan 2024 02:59:07 +0100 Subject: [PATCH] Added window abstraction and will be implemented in app --- bakara/src/bakara/core/application.h | 1 + bakara/src/bakara/core/window.h | 33 +++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/bakara/src/bakara/core/application.h b/bakara/src/bakara/core/application.h index 8b39155..1435d74 100644 --- a/bakara/src/bakara/core/application.h +++ b/bakara/src/bakara/core/application.h @@ -1,6 +1,7 @@ #pragma once #include +#include "window.h" namespace Bk { class Application diff --git a/bakara/src/bakara/core/window.h b/bakara/src/bakara/core/window.h index 67a6cae..a9abdd0 100644 --- a/bakara/src/bakara/core/window.h +++ b/bakara/src/bakara/core/window.h @@ -1,7 +1,34 @@ #pragma once +#include +#include + namespace Bk { - class Window { - - } + struct WindowPros + { + std::string title; + uint width; + uint height; + + WindowPros(std::string title = "Bakara engine", uint width = 1000, uint height = 800) + : title(title), width(width), height(height) {} + }; + + class Window + { + public: + using EventCallback = std::function; + virtual ~Window(){} + + virtual uint get_width() const = 0; + virtual uint get_height() const = 0; + + virtual void on_update() = 0; + virtual void set_event_callback(const EventCallback callback) = 0; + + virtual void set_vsync(bool enable) = 0; + virtual bool is_vsync() const = 0; + + static std::unique_ptr create_window(const WindowPros& props = WindowPros()); + }; } \ No newline at end of file