2024-11-10 00:13:15 +00:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using LyraApi;
|
|
|
|
using LyraApi.Ecs;
|
|
|
|
using static ExampleWorld.wit.imports.lyra.api.IEcs;
|
|
|
|
|
|
|
|
namespace LyraApi.Engine;
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
public struct DeltaTime : IResource {
|
|
|
|
public float Seconds;
|
|
|
|
|
|
|
|
public static ulong TypeId => 83716348954;
|
|
|
|
|
|
|
|
public static object? FromWasmResult(WorldResourceResult result)
|
|
|
|
{
|
|
|
|
return result.Tag switch
|
|
|
|
{
|
2024-11-14 00:11:26 +00:00
|
|
|
WorldResourceResult.NONE | WorldResourceResult.WASM_RESOURCE => null,
|
2024-11-10 00:13:15 +00:00
|
|
|
WorldResourceResult.BYTES => MarshalUtils.FromBytes<DeltaTime>(result.AsBytes),
|
|
|
|
_ => null,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|