mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added DebugNameComponent
This commit is contained in:
@@ -71,6 +71,11 @@ namespace GlitchyEngine.Content
|
||||
{
|
||||
Entity entity = world.NewEntity();
|
||||
|
||||
#if DEBUG
|
||||
var nameComponent = world.AssignComponent<DebugNameComponent>(entity);
|
||||
nameComponent.SetName(StringView(node.Name));
|
||||
#endif
|
||||
|
||||
if(parentEntity.HasValue)
|
||||
{
|
||||
var childParent = world.AssignComponent<ParentComponent>(entity);
|
||||
@@ -101,6 +106,7 @@ namespace GlitchyEngine.Content
|
||||
childTransform.Scale = .(1, 1, 1);
|
||||
}
|
||||
|
||||
// Invert the Z-Axis of the root Node to convert the coordinate system from right-handed to left-handed
|
||||
if(parentEntity == null)
|
||||
childTransform.Scale *= .(1, 1, -1);
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
namespace GlitchyEngine.World
|
||||
{
|
||||
struct DebugNameComponent : IDisposableComponent
|
||||
{
|
||||
private String _debugName;
|
||||
|
||||
public String DebugName
|
||||
{
|
||||
get => _debugName;
|
||||
set mut => SetName(value);
|
||||
}
|
||||
|
||||
public void SetName(StringView name) mut
|
||||
{
|
||||
delete _debugName;
|
||||
|
||||
_debugName = new String(name);
|
||||
}
|
||||
|
||||
public static void DisposeComponent(void* component)
|
||||
{
|
||||
Self* self = (Self*)component;
|
||||
|
||||
DeleteAndNullify!(self._debugName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,6 +307,7 @@ namespace Sandbox
|
||||
|
||||
void InitEcs()
|
||||
{
|
||||
_world.Register<DebugNameComponent>();
|
||||
_world.Register<TransformComponent>();
|
||||
_world.Register<ParentComponent>();
|
||||
_world.Register<MeshComponent>();
|
||||
|
||||
Reference in New Issue
Block a user