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
Engine::DefaultScene Class Reference

A generic, data-driven scene implementation that loads its structure from a JSON file. More...

#include <DefaultScene.hpp>

Inheritance diagram for Engine::DefaultScene:
Scene

Public Member Functions

 DefaultScene (Registry &registry, VulkanRenderer &renderer, const std::string &jsonPath)
 Construct a new Default Scene.
void load () override
 Loads the scene entities from JSON path if the file exists.
void update (float dt) override
 Updates the scene simulation. Left empty as ECS systems handle state updates.
Public Member Functions inherited from Scene
 Scene (Registry &registry, VulkanRenderer &renderer)
 Construct a new Scene object.
virtual ~Scene ()
 Destroy the Scene object, unloading remaining entities.
virtual void unload ()
 Method called to clean up scene state and entities.
virtual bool saveToFile (const std::string &path)
 Serializes scene entities to a JSON file.
virtual bool loadFromFile (const std::string &path)
 Deserializes scene entities from a JSON file.
virtual Entity createPrimitiveEntity (const std::string &primitiveType)
 Helper to spawn primitive geometric entities.
virtual Entity createEntityOfType (const std::string &entityType)
 Helper to spawn complex predefined entities (Camera, Grid).
virtual Entity duplicateEntity (Entity entity)
 Duplicates an existing entity.
virtual bool deleteEntity (Entity entity)
 Destroys an entity and removes it from scene tracking.
Entity trackEntity (Entity entity)
 Tracks an entity under scene ownership.
void untrackEntity (Entity entity)
 Stops tracking an entity.
std::string makeUniqueEntityName (const std::string &baseName) const
 Generates a unique name for an entity by appending indices if duplicate.

Private Attributes

std::string scenePath

Additional Inherited Members

Protected Member Functions inherited from Scene
Entity findEntityByName (const std::string &name) const
 Locates an entity by its Name component.
Protected Attributes inherited from Scene
Registry & registry
 Reference to registry.
VulkanRenderer & renderer
 Reference to Vulkan renderer.

Detailed Description

A generic, data-driven scene implementation that loads its structure from a JSON file.

Constructor & Destructor Documentation

◆ DefaultScene()

Engine::DefaultScene::DefaultScene ( Registry & registry,
VulkanRenderer & renderer,
const std::string & jsonPath )
inline

Construct a new Default Scene.

Parameters
registryReference to ECS registry.
rendererReference to Vulkan renderer.
jsonPathPath to the scene JSON file.

Member Function Documentation

◆ load()

void Engine::DefaultScene::load ( )
inlineoverridevirtual

Loads the scene entities from JSON path if the file exists.

Implements Scene.

◆ update()

void Engine::DefaultScene::update ( float dt)
inlineoverridevirtual

Updates the scene simulation. Left empty as ECS systems handle state updates.

Parameters
dtElapsed frame time.

Implements Scene.

Member Data Documentation

◆ scenePath

std::string Engine::DefaultScene::scenePath
private

The documentation for this class was generated from the following file: