SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Window.h
1#pragma once
2
3#include "spark/core/Export.h"
4#include "spark/core/Renderer2D.h"
5
6#include "spark/events/Event.h"
7#include "spark/math/Vector2.h"
8#include "spark/patterns/Signal.h"
9#include "spark/render/vk/VulkanBackend.h"
10
11#include <functional>
12
13namespace spark::core
14{
18 class SPARK_CORE_EXPORT Window
19 {
20 public:
24 struct Settings
25 {
26 std::string title;
28 std::function<void(events::Event&)> eventCallback;
29 bool resizable;
30 };
31
34
35 public:
40 explicit Window(const Settings& settings);
41 ~Window();
42
43 Window(const Window& other) = delete;
44 Window(Window&& other) noexcept = default;
45 Window& operator=(const Window& other) = delete;
46 Window& operator=(Window&& other) noexcept = default;
47
51 void close();
52
56 void onUpdate();
57
62 bool isMinimized() const;
63
68 [[nodiscard]] math::Vector2<unsigned int> size() const;
69
74 [[nodiscard]] Renderer2D<render::vk::VulkanBackend>& renderer() const;
75
80 [[nodiscard]] void* nativeWindow() const;
81
82 private:
83 std::unique_ptr<Renderer2D<render::vk::VulkanBackend>> m_renderer;
84 Settings m_settings;
85 void* m_window;
86 };
87}
An object that can render 2D graphics on a surface.
Definition Renderer2D.h:22
An interface representing any window of any platform.
Definition Window.h:19
spark::patterns::Signal< spark::math::Vector2< unsigned int > > onResize
Event triggered when the window is resized.
Definition Window.h:33
A base class for all events in SPARK.
Definition Event.h:53
A vector with two components.
Definition Vector2.h:13
A signal is a class used to emit events.
Definition Slot.h:10
A struct containing the settings used to create a window.
Definition Window.h:25