// using HexaGen.Runtime; using System; using System.Diagnostics; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Dalamud.Bindings.ImGui; public unsafe partial struct ImGuiIO { public unsafe void AddFocusEvent(bool focused) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddFocusEvent(@this, focused ? (byte)1 : (byte)0); } } public unsafe void AddInputCharacter(uint c) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddInputCharacter(@this, c); } } public unsafe void AddInputCharactersUTF8(byte* str) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddInputCharactersUTF8(@this, str); } } public unsafe void AddInputCharactersUTF8(ref byte str) { fixed (ImGuiIO* @this = &this) { fixed (byte* pstr = &str) { ImGuiNative.AddInputCharactersUTF8(@this, (byte*)pstr); } } } public unsafe void AddInputCharactersUTF8(ReadOnlySpan str) { fixed (ImGuiIO* @this = &this) { fixed (byte* pstr = str) { ImGuiNative.AddInputCharactersUTF8(@this, (byte*)pstr); } } } public unsafe void AddInputCharactersUTF8(string str) { fixed (ImGuiIO* @this = &this) { byte* pStr0 = null; int pStrSize0 = 0; if (str != null) { pStrSize0 = Utils.GetByteCountUTF8(str); if (pStrSize0 >= Utils.MaxStackallocSize) { pStr0 = Utils.Alloc(pStrSize0 + 1); } else { byte* pStrStack0 = stackalloc byte[pStrSize0 + 1]; pStr0 = pStrStack0; } int pStrOffset0 = Utils.EncodeStringUTF8(str, pStr0, pStrSize0); pStr0[pStrOffset0] = 0; } ImGuiNative.AddInputCharactersUTF8(@this, pStr0); if (pStrSize0 >= Utils.MaxStackallocSize) { Utils.Free(pStr0); } } } public unsafe void AddInputCharacterUTF16(ushort c) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddInputCharacterUTF16(@this, c); } } public unsafe void AddKeyAnalogEvent(ImGuiKey key, bool down, float v) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddKeyAnalogEvent(@this, key, down ? (byte)1 : (byte)0, v); } } public unsafe void AddKeyEvent(ImGuiKey key, bool down) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddKeyEvent(@this, key, down ? (byte)1 : (byte)0); } } public unsafe void AddMouseButtonEvent(int button, bool down) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddMouseButtonEvent(@this, button, down ? (byte)1 : (byte)0); } } public unsafe void AddMousePosEvent(float x, float y) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddMousePosEvent(@this, x, y); } } public unsafe void AddMouseViewportEvent(uint id) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddMouseViewportEvent(@this, id); } } public unsafe void AddMouseWheelEvent(float whX, float whY) { fixed (ImGuiIO* @this = &this) { ImGuiNative.AddMouseWheelEvent(@this, whX, whY); } } public unsafe void ClearInputCharacters() { fixed (ImGuiIO* @this = &this) { ImGuiNative.ClearInputCharacters(@this); } } public unsafe void ClearInputKeys() { fixed (ImGuiIO* @this = &this) { ImGuiNative.ClearInputKeys(@this); } } public unsafe void Destroy() { fixed (ImGuiIO* @this = &this) { ImGuiNative.Destroy(@this); } } public unsafe void SetAppAcceptingEvents(bool acceptingEvents) { fixed (ImGuiIO* @this = &this) { ImGuiNative.SetAppAcceptingEvents(@this, acceptingEvents ? (byte)1 : (byte)0); } } public unsafe void SetKeyEventNativeData(ImGuiKey key, int nativeKeycode, int nativeScancode, int nativeLegacyIndex) { fixed (ImGuiIO* @this = &this) { ImGuiNative.SetKeyEventNativeData(@this, key, nativeKeycode, nativeScancode, nativeLegacyIndex); } } public unsafe void SetKeyEventNativeData(ImGuiKey key, int nativeKeycode, int nativeScancode) { fixed (ImGuiIO* @this = &this) { ImGuiNative.SetKeyEventNativeData(@this, key, nativeKeycode, nativeScancode, (int)(-1)); } } }