Minor - Enhances ECS component functionality - V13.5.0

Adds serialization/deserialization to components,
allowing saving and loading of entity states.
Provides ImGui widgets for editing component properties,
improving editor usability.
Passes the D3D device and context to entities and
components enabling resource creation within components.
This commit is contained in:
2025-09-16 18:26:33 +02:00
parent f875580197
commit de05631608
8 changed files with 346 additions and 16 deletions

View File

@@ -5,6 +5,8 @@
#include <memory>
#include <algorithm>
#include <cassert>
#include <WICTextureLoader.h>
#include <d3d11.h>
#include "camera_class.h"
#include <Fmod/core/inc/fmod.hpp>
@@ -138,12 +140,34 @@ public:
return m_Components;
}
/**
* Set the main camera of the scene to be used by components like AudioComponent.
* @param camera
*/
void SetCamera(camera_class* camera) {m_camera = camera; }
/**
* Get the main camera of the scene.
* @return A pointer to the main camera.
*/
camera_class* GetCamera() const { return m_camera; }
/**
* Set the FMOD sound system to be used by components like AudioComponent.
* @param soundSystem
*/
void SetSoundSystem(FMOD::System* soundSystem) {m_soundSystem = soundSystem; }
/**
* Get the FMOD sound system.
* @return A pointer to the FMOD sound system.
*/
FMOD::System* GetSoundSystem() const { return m_soundSystem; }
void SetDevice (ID3D11Device* dev) { device = dev; }
void SetContext(ID3D11DeviceContext* ctx) { context = ctx; }
ID3D11Device* GetDevice() const { return device; }
ID3D11DeviceContext* GetContext() const { return context; }
private:
/**
@@ -161,6 +185,9 @@ private:
// FMOD sound system
FMOD::System* m_soundSystem = nullptr;
ID3D11Device* device;
ID3D11DeviceContext* context;
};
} // namespace ecs