Show More
Commit Description:
Add timers for Simulation and various engines...
Commit Description:
Add timers for Simulation and various engines Starting to add additional timers for different stages of the process of updating in order to get more insight into what is slowing it down. The update takes 9ms, which is much longer than it used to. Engine-specific timers are coming later.
File last commit:
Show/Diff file:
Action:
ImGui.NET/ImVector.cs
75 lines | 1.9 KiB | text/x-csharp | CSharpLexer
Add ImGui.
r16 using System;
using System.Runtime.CompilerServices;
namespace ImGuiNET
{
public unsafe struct ImVector
{
public readonly int Size;
public readonly int Capacity;
public readonly IntPtr Data;
public ref T Ref<T>(int index)
{
return ref Unsafe.AsRef<T>((byte*)Data + index * Unsafe.SizeOf<T>());
}
public IntPtr Address<T>(int index)
{
return (IntPtr)((byte*)Data + index * Unsafe.SizeOf<T>());
}
}
public unsafe struct ImVector<T>
{
public readonly int Size;
public readonly int Capacity;
public readonly IntPtr Data;
public ImVector(ImVector vector)
{
Size = vector.Size;
Capacity = vector.Capacity;
Data = vector.Data;
}
public ImVector(int size, int capacity, IntPtr data)
{
Size = size;
Capacity = capacity;
Data = data;
}
public ref T this[int index] => ref Unsafe.AsRef<T>((byte*)Data + index * Unsafe.SizeOf<T>());
}
public unsafe struct ImPtrVector<T>
{
public readonly int Size;
public readonly int Capacity;
public readonly IntPtr Data;
private readonly int _stride;
public ImPtrVector(ImVector vector, int stride)
: this(vector.Size, vector.Capacity, vector.Data, stride)
{ }
public ImPtrVector(int size, int capacity, IntPtr data, int stride)
{
Size = size;
Capacity = capacity;
Data = data;
_stride = stride;
}
public T this[int index]
{
get
{
byte* address = (byte*)Data + index * _stride;
T ret = Unsafe.Read<T>(&address);
return ret;
}
}
}
}