SPARK  0.1.0
A general purpose game engine written in C++.
Loading...
Searching...
No Matches
Application.h
1#pragma once
2
3#include "spark/core/Export.h"
4#include "spark/core/Registries.h"
5#include "spark/core/Window.h"
6
7#include <filesystem>
8#include <string>
9
10namespace spark::core
11{
12 class SceneManager;
13 class Scene;
14
18 class SPARK_CORE_EXPORT Application final
19 {
20 friend class SceneManager;
21
22 template <typename... Tags>
23 friend class ApplicationBuilder;
24
25 public:
29 struct Settings
30 {
31 std::string name;
33 bool resizable = false;
34 };
35
40 {
41 core::GameObjectRegistry gameObject;
43 };
44
49 static Application* Instance();
50
51 public:
52 ~Application() = default;
53
54 Application(const Application& other) = delete;
55 Application(Application&& other) noexcept = default;
56 Application& operator=(const Application& other) = delete;
57 Application& operator=(Application&& other) noexcept = default;
58
62 void run();
63
67 void close();
68
73 [[nodiscard]] Settings settings() const;
74
79 [[nodiscard]] Window& window();
80
85 void setScene(std::shared_ptr<core::Scene> scene);
86
91 [[nodiscard]] core::Scene& scene();
92
97 [[nodiscard]] Registries& registries();
98
99 private:
104 explicit Application(const Settings& settings);
105
110 void onEvent(events::Event& event);
111
112 private:
113 static Application* s_instance;
114
115 private:
116 std::unique_ptr<Window> m_window;
117 std::shared_ptr<core::Scene> m_scene;
118 Settings m_settings;
119 Registries m_registries;
120 bool m_isRunning = true;
121 };
122}
Definition ApplicationBuilder.h:18
A class representing a SPARK application.
Definition Application.h:19
A registry used to create Component instances and get serialization objects for it.
Definition Registries.h:42
A registry used to create GameObject instances and get serialization objects for it.
Definition Registries.h:20
A class used to manage scenes in the game.
Definition SceneManager.h:16
Definition Scene.h:13
An interface representing any window of any platform.
Definition Window.h:19
A base class for all events in SPARK.
Definition Event.h:53
A vector with two components.
Definition Vector2.h:13
A struct containing all the registries for the application.
Definition Application.h:40
A struct containing the settings for the application.
Definition Application.h:30