Return entity id and use later? #63
-
|
How would I fetch a entity from it's id in a super fast and thread safe way? using System.Numerics;
using Silk.NET.Maths;
using Friflo.Engine.ECS;
using Silk.NET.Windowing;
namespace OpenStarbound3D.Engine.Servers;
public static class WindowServer
{
private static readonly EntityStore _entityStore = new EntityStore();
public static int WindowCreate()
{
var window = new Window();
var entity = _entityStore.CreateEntity(window);
return entity.Id;
}
public static void WindowSetPosition(int window, int x, int y)
{
// Some how get entity from window id?
}
public readonly struct Window() : IComponent
{
internal Silk.NET.Windowing.IWindow SilkWindow { get; } = Silk.NET.Windowing.Window.Create(WindowOptions.Default with
{
IsVisible = false,
});
}
}I am trying not to expose the ecs interface so friflo isn't required to use my library. |
Beta Was this translation helpful? Give feedback.
Answered by
Shadowblitz16
Apr 1, 2025
Replies: 1 comment 2 replies
-
|
_store.TryGetEntityById |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
friflo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
_store.TryGetEntityById