Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
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
6namespace 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)) {
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
void load() override
Loads the scene entities from JSON path if the file exists.
Definition DefaultScene.hpp:26
std::string scenePath
Definition DefaultScene.hpp:47
void update(float dt) override
Updates the scene simulation. Left empty as ECS systems handle state updates.
Definition DefaultScene.hpp:42
DefaultScene(Registry &registry, VulkanRenderer &renderer, const std::string &jsonPath)
Construct a new Default Scene.
Definition DefaultScene.hpp:20
Coordinates entities and components, providing creation, removal, lookup, and views.
Definition Registry.hpp:30
VulkanRenderer & renderer
Reference to Vulkan renderer.
Definition Scene.hpp:109
Scene(Registry &registry, VulkanRenderer &renderer)
Construct a new Scene object.
Definition Scene.cpp:18
virtual bool loadFromFile(const std::string &path)
Deserializes scene entities from a JSON file.
Definition Scene.cpp:71
Registry & registry
Reference to registry.
Definition Scene.hpp:107
Manages core Vulkan pipeline states, device interaction, frames, buffers, and command submissions.
Definition VulkanRenderer.hpp:127
Definition Application.hpp:16