Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
Loading...
Searching...
No Matches
DefaultScene.hpp
Go to the documentation of this file.
1
#pragma once
2
#include "
scenes/Scene.hpp
"
3
#include <filesystem>
4
#include <iostream>
5
6
namespace
Engine
{
7
12
class
DefaultScene
:
public
Scene
{
13
public
:
20
DefaultScene
(
Registry
&
registry
,
VulkanRenderer
&
renderer
,
const
std::string& jsonPath)
21
:
Scene
(
registry
,
renderer
),
scenePath
(jsonPath) {}
22
26
void
load
()
override
{
27
if
(std::filesystem::exists(
scenePath
)) {
28
if
(
loadFromFile
(
scenePath
)) {
29
std::cout <<
"[DefaultScene] Loaded scene data from: "
<<
scenePath
<< std::endl;
30
}
else
{
31
std::cerr <<
"[DefaultScene] Failed to load scene data from: "
<<
scenePath
<< std::endl;
32
}
33
}
else
{
34
std::cout <<
"[DefaultScene] Scene file "
<<
scenePath
<<
" not found, starting with empty scene."
<< std::endl;
35
}
36
}
37
42
void
update
(
float
dt)
override
{
43
// Data-driven scenes rely solely on ECS system updates.
44
}
45
46
private
:
47
std::string
scenePath
;
48
};
49
50
}
// namespace Engine
Scene.hpp
Engine::DefaultScene::load
void load() override
Loads the scene entities from JSON path if the file exists.
Definition
DefaultScene.hpp:26
Engine::DefaultScene::scenePath
std::string scenePath
Definition
DefaultScene.hpp:47
Engine::DefaultScene::update
void update(float dt) override
Updates the scene simulation. Left empty as ECS systems handle state updates.
Definition
DefaultScene.hpp:42
Engine::DefaultScene::DefaultScene
DefaultScene(Registry ®istry, VulkanRenderer &renderer, const std::string &jsonPath)
Construct a new Default Scene.
Definition
DefaultScene.hpp:20
Registry
Coordinates entities and components, providing creation, removal, lookup, and views.
Definition
Registry.hpp:30
Scene::renderer
VulkanRenderer & renderer
Reference to Vulkan renderer.
Definition
Scene.hpp:109
Scene::Scene
Scene(Registry ®istry, VulkanRenderer &renderer)
Construct a new Scene object.
Definition
Scene.cpp:18
Scene::loadFromFile
virtual bool loadFromFile(const std::string &path)
Deserializes scene entities from a JSON file.
Definition
Scene.cpp:71
Scene::registry
Registry & registry
Reference to registry.
Definition
Scene.hpp:107
VulkanRenderer
Manages core Vulkan pipeline states, device interaction, frames, buffers, and command submissions.
Definition
VulkanRenderer.hpp:127
Engine
Definition
Application.hpp:16
engine
include
scenes
DefaultScene.hpp
Generated by
1.17.0