Zen 0.3.0
Loading...
Searching...
No Matches
ZEN_Window.h
1#pragma once
2
3#include <zen/core/ZEN_Core.h>
4#include <zen/renderer/ZEN_GraphicsContext.h>
5#include <zen/zen_pch.h>
6
7#ifndef __ZEN_GLAD_H
8 #include <glad/gl.h>
9#endif // !__ZEN_GLAD_H
10
11namespace Zen {
12 struct WindowProperties {
13 std::string title;
14 uint32_t width;
15 uint32_t height;
16 bool vsync;
17 bool fullscreen;
18
19 WindowProperties(const std::string title = "Zen Application",
20 uint32_t width = 1280,
21 uint32_t height = 720,
22 bool vsync = false,
23 bool fullscreen = false) {
24 this->title = title;
25 this->width = width;
26 this->height = height;
27 this->vsync = vsync;
28 this->fullscreen = fullscreen;
29 };
30 };
31
32 class Window : public EventListener {
33 public:
34 virtual ~Window() {};
35
36 virtual void onUpdate() = 0;
37 virtual uint32_t getWidth() = 0;
38 virtual uint32_t getHeight() = 0;
39
40 virtual void setVSync(bool enabled) = 0;
41 virtual bool isVSyncEnabled() const = 0;
42 virtual void toggleFullscreen() = 0;
43
44 virtual void emitErrorMessage(const char *message) = 0;
45
46 static std::unique_ptr<Window>
47 create(const Zen::WindowProperties &properties = WindowProperties());
48
49 virtual bool onEvent(const ZenEvent &event) = 0;
50
51 virtual void *nativeWindow() const = 0; // SDL_Window* as void*
52 virtual GraphicsContext &context() = 0;
53 virtual const GraphicsContext &context() const = 0;
54 };
55}; // namespace Zen