initial commit

This commit is contained in:
cosmonaut 2023-12-21 15:03:12 -08:00
commit d6c32ef340
128 changed files with 37831 additions and 0 deletions

5
.gitattributes vendored Normal file
View File

@ -0,0 +1,5 @@
*.dll filter=lfs diff=lfs merge=lfs -text
*.dylib filter=lfs diff=lfs merge=lfs -text
*.so filter=lfs diff=lfs merge=lfs -text
*.so.* filter=lfs diff=lfs merge=lfs -text
*.refresh filter=lfs diff=lfs merge=lfs -text

347
.gitignore vendored Normal file
View File

@ -0,0 +1,347 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
imgui.ini
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*[.json, .xml, .info]
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "lib/MoonWorks"]
path = lib/MoonWorks
url = https://gitea.moonside.games/MoonsideGames/MoonWorks.git

16
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to .NET 8 Debugger",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "Build: .NET 8 Debug",
"program": "${workspaceFolder}/bin/Debug/net8.0/MoonWorksDearImGuiScaffold.dll",
"args": [],
"cwd": "${workspaceFolder}/bin/Debug/net8.0",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}

129
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,129 @@
{
"version": "2.0.0",
"options": {
"cwd": "${workspaceRoot}"
},
"windows": {
"options": {
"shell": {
"executable": "cmd.exe",
"args": [
"/d",
"/c"
]
}
}
},
"presentation": {
"reveal": "always",
"focus": true,
"panel": "shared"
},
"tasks": [
{
"label": "Build & Run with Hot Reload: .NET 8 Debug",
"command": "dotnet",
"args": [
"watch"
],
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Build & Run: .NET 8 Debug",
"type": "shell",
"dependsOrder": "sequence",
"dependsOn": [
"Build: .NET 8 Debug",
"Run: .NET 8 Debug"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Build: .NET 8 Debug",
"command": "dotnet",
"args": [
"build",
"./MoonWorksDearImGuiScaffold.csproj",
"-p:SolutionDir=${workspaceFolder}/"
],
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Run: .NET 8 Debug",
"command": "MoonWorksDearImGuiScaffold",
"windows": {
"command": "MoonWorksDearImGuiScaffold.exe"
},
"options": {
"cwd": "${workspaceFolder}/bin/Debug/net8.0"
},
"type": "process",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Build: .NET 8 Release",
"command": "dotnet",
"args": [
"build",
"./MoonWorksDearImGuiScaffold.csproj",
"--configuration",
"Release",
"-p:SolutionDir=${workspaceFolder}/"
],
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Run: .NET 8 Release",
"command": "MoonWorksDearImGuiScaffold",
"windows": {
"command": "MoonWorksDearImGuiScaffold.exe"
},
"options": {
"cwd": "${workspaceFolder}/bin/Debug/net8.0"
},
"type": "process",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
},
{
"label": "Build & Run: .NET 8 Release",
"dependsOrder": "sequence",
"dependsOn": [
"Build: .NET 8 Release",
"Run: .NET 8 Release"
],
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}

BIN
Content/Shaders/ImGui.frag.refresh (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Shaders/ImGui.vert.refresh (Stored with Git LFS) Normal file

Binary file not shown.

27
CopyMoonlibs.targets Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Runtime ID" AfterTargets="Build">
<Message Text="Runtime ID: $(RuntimeIdentifier)" Importance="high"/>
</Target>
<ItemGroup Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))">
<Content Include=".\moonlibs\x64\**\*.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))">
<Content Include=".\moonlibs\lib64\**\*.*">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup Condition="$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))">
<Content Include=".\moonlibs\osx\**\*.*" >
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetName>MoonWorksDearImGuiScaffold</TargetName>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<StartupObject>MoonWorksDearImGuiScaffold.Program</StartupObject>
<AssemblyName>MoonWorksDearImGuiScaffold</AssemblyName>
<RootNamespace>MoonWorksDearImGuiScaffold</RootNamespace>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplicationIcon />
</PropertyGroup>
<ItemGroup>
<Content Include="Content\**\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);lib\**\*</DefaultItemExcludes>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="lib\MoonWorks\MoonWorks.csproj" />
<ProjectReference Include="lib\ImGui.NET\ImGui.NET.csproj" />
</ItemGroup>
<Import Project=".\CopyMoonlibs.targets" />
</Project>

View File

@ -0,0 +1,64 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonWorksDearImGuiScaffold", "MoonWorksDearImGuiScaffold.csproj", "{6CCE887D-748D-4806-8900-E79945B03F06}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoonWorks", "lib\MoonWorks\MoonWorks.csproj", "{181A0E72-417D-49B2-89F6-1D042CE8AF7D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dav1dfile-CS", "lib\MoonWorks\lib\dav1dfile\csharp\dav1dfile-CS.csproj", "{2F4FA1A6-02D5-480A-9C83-E9B40C6D29AC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FAudio-CS.Core", "lib\MoonWorks\lib\FAudio\csharp\FAudio-CS.Core.csproj", "{5B6ACF3C-BB48-432F-98D2-35BE84A00539}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RefreshCS", "lib\MoonWorks\lib\RefreshCS\RefreshCS.csproj", "{CCFCA552-3DEA-4F4E-938D-F5ED022063D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL2-CS.Core", "lib\MoonWorks\lib\SDL2-CS\SDL2-CS.Core.csproj", "{1243BB8E-F065-446A-9B1C-629D731F3B63}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WellspringCS", "lib\MoonWorks\lib\WellspringCS\WellspringCS.csproj", "{00D0DD4D-959F-4B95-85D9-B3CC9AD2AA66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImGui.NET", "lib\ImGui.NET\ImGui.NET.csproj", "{3ABD7C60-D069-484F-A0B2-2F0C2C1BD5A5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6CCE887D-748D-4806-8900-E79945B03F06}.Debug|x64.ActiveCfg = Debug|Any CPU
{6CCE887D-748D-4806-8900-E79945B03F06}.Debug|x64.Build.0 = Debug|Any CPU
{6CCE887D-748D-4806-8900-E79945B03F06}.Release|x64.ActiveCfg = Release|Any CPU
{6CCE887D-748D-4806-8900-E79945B03F06}.Release|x64.Build.0 = Release|Any CPU
{181A0E72-417D-49B2-89F6-1D042CE8AF7D}.Debug|x64.ActiveCfg = Debug|Any CPU
{181A0E72-417D-49B2-89F6-1D042CE8AF7D}.Debug|x64.Build.0 = Debug|Any CPU
{181A0E72-417D-49B2-89F6-1D042CE8AF7D}.Release|x64.ActiveCfg = Release|Any CPU
{181A0E72-417D-49B2-89F6-1D042CE8AF7D}.Release|x64.Build.0 = Release|Any CPU
{2F4FA1A6-02D5-480A-9C83-E9B40C6D29AC}.Debug|x64.ActiveCfg = Debug|x64
{2F4FA1A6-02D5-480A-9C83-E9B40C6D29AC}.Debug|x64.Build.0 = Debug|x64
{2F4FA1A6-02D5-480A-9C83-E9B40C6D29AC}.Release|x64.ActiveCfg = Release|x64
{2F4FA1A6-02D5-480A-9C83-E9B40C6D29AC}.Release|x64.Build.0 = Release|x64
{5B6ACF3C-BB48-432F-98D2-35BE84A00539}.Debug|x64.ActiveCfg = Debug|x64
{5B6ACF3C-BB48-432F-98D2-35BE84A00539}.Debug|x64.Build.0 = Debug|x64
{5B6ACF3C-BB48-432F-98D2-35BE84A00539}.Release|x64.ActiveCfg = Release|x64
{5B6ACF3C-BB48-432F-98D2-35BE84A00539}.Release|x64.Build.0 = Release|x64
{CCFCA552-3DEA-4F4E-938D-F5ED022063D2}.Debug|x64.ActiveCfg = Debug|x64
{CCFCA552-3DEA-4F4E-938D-F5ED022063D2}.Debug|x64.Build.0 = Debug|x64
{CCFCA552-3DEA-4F4E-938D-F5ED022063D2}.Release|x64.ActiveCfg = Release|x64
{CCFCA552-3DEA-4F4E-938D-F5ED022063D2}.Release|x64.Build.0 = Release|x64
{1243BB8E-F065-446A-9B1C-629D731F3B63}.Debug|x64.ActiveCfg = Debug|x64
{1243BB8E-F065-446A-9B1C-629D731F3B63}.Debug|x64.Build.0 = Debug|x64
{1243BB8E-F065-446A-9B1C-629D731F3B63}.Release|x64.ActiveCfg = Release|x64
{1243BB8E-F065-446A-9B1C-629D731F3B63}.Release|x64.Build.0 = Release|x64
{00D0DD4D-959F-4B95-85D9-B3CC9AD2AA66}.Debug|x64.ActiveCfg = Debug|x64
{00D0DD4D-959F-4B95-85D9-B3CC9AD2AA66}.Debug|x64.Build.0 = Debug|x64
{00D0DD4D-959F-4B95-85D9-B3CC9AD2AA66}.Release|x64.ActiveCfg = Release|x64
{00D0DD4D-959F-4B95-85D9-B3CC9AD2AA66}.Release|x64.Build.0 = Release|x64
{3ABD7C60-D069-484F-A0B2-2F0C2C1BD5A5}.Debug|x64.ActiveCfg = Debug|Any CPU
{3ABD7C60-D069-484F-A0B2-2F0C2C1BD5A5}.Debug|x64.Build.0 = Debug|Any CPU
{3ABD7C60-D069-484F-A0B2-2F0C2C1BD5A5}.Release|x64.ActiveCfg = Release|Any CPU
{3ABD7C60-D069-484F-A0B2-2F0C2C1BD5A5}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

3
README.md Normal file
View File

@ -0,0 +1,3 @@
# MoonWorksDearImGuiScaffold
This is a project that you can use to get a MoonWorks + Dear ImGui application up and running.

View File

@ -0,0 +1,17 @@
using System;
using System.Numerics;
namespace ImGuiNET
{
public delegate void Platform_CreateWindow(ImGuiViewportPtr vp); // Create a new platform window for the given viewport
public delegate void Platform_DestroyWindow(ImGuiViewportPtr vp);
public delegate void Platform_ShowWindow(ImGuiViewportPtr vp); // Newly created windows are initially hidden so SetWindowPos/Size/Title can be called on them first
public delegate void Platform_SetWindowPos(ImGuiViewportPtr vp, Vector2 pos);
public unsafe delegate void Platform_GetWindowPos(ImGuiViewportPtr vp, Vector2* outPos);
public delegate void Platform_SetWindowSize(ImGuiViewportPtr vp, Vector2 size);
public unsafe delegate void Platform_GetWindowSize(ImGuiViewportPtr vp, Vector2* outSize);
public delegate void Platform_SetWindowFocus(ImGuiViewportPtr vp); // Move window to front and set input focus
public delegate byte Platform_GetWindowFocus(ImGuiViewportPtr vp);
public delegate byte Platform_GetWindowMinimized(ImGuiViewportPtr vp);
public delegate void Platform_SetWindowTitle(ImGuiViewportPtr vp, IntPtr title);
}

View File

@ -0,0 +1,48 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImColor
{
public Vector4 Value;
}
public unsafe partial struct ImColorPtr
{
public ImColor* NativePtr { get; }
public ImColorPtr(ImColor* nativePtr) => NativePtr = nativePtr;
public ImColorPtr(IntPtr nativePtr) => NativePtr = (ImColor*)nativePtr;
public static implicit operator ImColorPtr(ImColor* nativePtr) => new ImColorPtr(nativePtr);
public static implicit operator ImColor* (ImColorPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImColorPtr(IntPtr nativePtr) => new ImColorPtr(nativePtr);
public ref Vector4 Value => ref Unsafe.AsRef<Vector4>(&NativePtr->Value);
public void Destroy()
{
ImGuiNative.ImColor_destroy((ImColor*)(NativePtr));
}
public ImColor HSV(float h, float s, float v)
{
ImColor __retval;
float a = 1.0f;
ImGuiNative.ImColor_HSV(&__retval, h, s, v, a);
return __retval;
}
public ImColor HSV(float h, float s, float v, float a)
{
ImColor __retval;
ImGuiNative.ImColor_HSV(&__retval, h, s, v, a);
return __retval;
}
public void SetHSV(float h, float s, float v)
{
float a = 1.0f;
ImGuiNative.ImColor_SetHSV((ImColor*)(NativePtr), h, s, v, a);
}
public void SetHSV(float h, float s, float v, float a)
{
ImGuiNative.ImColor_SetHSV((ImColor*)(NativePtr), h, s, v, a);
}
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawChannel
{
public ImVector _CmdBuffer;
public ImVector _IdxBuffer;
}
public unsafe partial struct ImDrawChannelPtr
{
public ImDrawChannel* NativePtr { get; }
public ImDrawChannelPtr(ImDrawChannel* nativePtr) => NativePtr = nativePtr;
public ImDrawChannelPtr(IntPtr nativePtr) => NativePtr = (ImDrawChannel*)nativePtr;
public static implicit operator ImDrawChannelPtr(ImDrawChannel* nativePtr) => new ImDrawChannelPtr(nativePtr);
public static implicit operator ImDrawChannel* (ImDrawChannelPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawChannelPtr(IntPtr nativePtr) => new ImDrawChannelPtr(nativePtr);
public ImPtrVector<ImDrawCmdPtr> _CmdBuffer => new ImPtrVector<ImDrawCmdPtr>(NativePtr->_CmdBuffer, Unsafe.SizeOf<ImDrawCmd>());
public ImVector<ushort> _IdxBuffer => new ImVector<ushort>(NativePtr->_IdxBuffer);
}
}

View File

@ -0,0 +1,43 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawCmd
{
public Vector4 ClipRect;
public IntPtr TextureId;
public uint VtxOffset;
public uint IdxOffset;
public uint ElemCount;
public IntPtr UserCallback;
public void* UserCallbackData;
}
public unsafe partial struct ImDrawCmdPtr
{
public ImDrawCmd* NativePtr { get; }
public ImDrawCmdPtr(ImDrawCmd* nativePtr) => NativePtr = nativePtr;
public ImDrawCmdPtr(IntPtr nativePtr) => NativePtr = (ImDrawCmd*)nativePtr;
public static implicit operator ImDrawCmdPtr(ImDrawCmd* nativePtr) => new ImDrawCmdPtr(nativePtr);
public static implicit operator ImDrawCmd* (ImDrawCmdPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawCmdPtr(IntPtr nativePtr) => new ImDrawCmdPtr(nativePtr);
public ref Vector4 ClipRect => ref Unsafe.AsRef<Vector4>(&NativePtr->ClipRect);
public ref IntPtr TextureId => ref Unsafe.AsRef<IntPtr>(&NativePtr->TextureId);
public ref uint VtxOffset => ref Unsafe.AsRef<uint>(&NativePtr->VtxOffset);
public ref uint IdxOffset => ref Unsafe.AsRef<uint>(&NativePtr->IdxOffset);
public ref uint ElemCount => ref Unsafe.AsRef<uint>(&NativePtr->ElemCount);
public ref IntPtr UserCallback => ref Unsafe.AsRef<IntPtr>(&NativePtr->UserCallback);
public IntPtr UserCallbackData { get => (IntPtr)NativePtr->UserCallbackData; set => NativePtr->UserCallbackData = (void*)value; }
public void Destroy()
{
ImGuiNative.ImDrawCmd_destroy((ImDrawCmd*)(NativePtr));
}
public IntPtr GetTexID()
{
IntPtr ret = ImGuiNative.ImDrawCmd_GetTexID((ImDrawCmd*)(NativePtr));
return ret;
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawCmdHeader
{
public Vector4 ClipRect;
public IntPtr TextureId;
public uint VtxOffset;
}
public unsafe partial struct ImDrawCmdHeaderPtr
{
public ImDrawCmdHeader* NativePtr { get; }
public ImDrawCmdHeaderPtr(ImDrawCmdHeader* nativePtr) => NativePtr = nativePtr;
public ImDrawCmdHeaderPtr(IntPtr nativePtr) => NativePtr = (ImDrawCmdHeader*)nativePtr;
public static implicit operator ImDrawCmdHeaderPtr(ImDrawCmdHeader* nativePtr) => new ImDrawCmdHeaderPtr(nativePtr);
public static implicit operator ImDrawCmdHeader* (ImDrawCmdHeaderPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawCmdHeaderPtr(IntPtr nativePtr) => new ImDrawCmdHeaderPtr(nativePtr);
public ref Vector4 ClipRect => ref Unsafe.AsRef<Vector4>(&NativePtr->ClipRect);
public ref IntPtr TextureId => ref Unsafe.AsRef<IntPtr>(&NativePtr->TextureId);
public ref uint VtxOffset => ref Unsafe.AsRef<uint>(&NativePtr->VtxOffset);
}
}

View File

@ -0,0 +1,59 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawData
{
public byte Valid;
public int CmdListsCount;
public int TotalIdxCount;
public int TotalVtxCount;
public ImVector CmdLists;
public Vector2 DisplayPos;
public Vector2 DisplaySize;
public Vector2 FramebufferScale;
public ImGuiViewport* OwnerViewport;
}
public unsafe partial struct ImDrawDataPtr
{
public ImDrawData* NativePtr { get; }
public ImDrawDataPtr(ImDrawData* nativePtr) => NativePtr = nativePtr;
public ImDrawDataPtr(IntPtr nativePtr) => NativePtr = (ImDrawData*)nativePtr;
public static implicit operator ImDrawDataPtr(ImDrawData* nativePtr) => new ImDrawDataPtr(nativePtr);
public static implicit operator ImDrawData* (ImDrawDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawDataPtr(IntPtr nativePtr) => new ImDrawDataPtr(nativePtr);
public ref bool Valid => ref Unsafe.AsRef<bool>(&NativePtr->Valid);
public ref int CmdListsCount => ref Unsafe.AsRef<int>(&NativePtr->CmdListsCount);
public ref int TotalIdxCount => ref Unsafe.AsRef<int>(&NativePtr->TotalIdxCount);
public ref int TotalVtxCount => ref Unsafe.AsRef<int>(&NativePtr->TotalVtxCount);
public ImVector<ImDrawListPtr> CmdLists => new ImVector<ImDrawListPtr>(NativePtr->CmdLists);
public ref Vector2 DisplayPos => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayPos);
public ref Vector2 DisplaySize => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplaySize);
public ref Vector2 FramebufferScale => ref Unsafe.AsRef<Vector2>(&NativePtr->FramebufferScale);
public ImGuiViewportPtr OwnerViewport => new ImGuiViewportPtr(NativePtr->OwnerViewport);
public void AddDrawList(ImDrawListPtr draw_list)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
ImGuiNative.ImDrawData_AddDrawList((ImDrawData*)(NativePtr), native_draw_list);
}
public void Clear()
{
ImGuiNative.ImDrawData_Clear((ImDrawData*)(NativePtr));
}
public void DeIndexAllBuffers()
{
ImGuiNative.ImDrawData_DeIndexAllBuffers((ImDrawData*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImDrawData_destroy((ImDrawData*)(NativePtr));
}
public void ScaleClipRects(Vector2 fb_scale)
{
ImGuiNative.ImDrawData_ScaleClipRects((ImDrawData*)(NativePtr), fb_scale);
}
}
}

View File

@ -0,0 +1,21 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImDrawFlags
{
None = 0,
Closed = 1,
RoundCornersTopLeft = 16,
RoundCornersTopRight = 32,
RoundCornersBottomLeft = 64,
RoundCornersBottomRight = 128,
RoundCornersNone = 256,
RoundCornersTop = 48,
RoundCornersBottom = 192,
RoundCornersLeft = 80,
RoundCornersRight = 160,
RoundCornersAll = 240,
RoundCornersDefault = 240,
RoundCornersMask = 496,
}
}

View File

@ -0,0 +1,731 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawList
{
public ImVector CmdBuffer;
public ImVector IdxBuffer;
public ImVector VtxBuffer;
public ImDrawListFlags Flags;
public uint _VtxCurrentIdx;
public IntPtr _Data;
public byte* _OwnerName;
public ImDrawVert* _VtxWritePtr;
public ushort* _IdxWritePtr;
public ImVector _ClipRectStack;
public ImVector _TextureIdStack;
public ImVector _Path;
public ImDrawCmdHeader _CmdHeader;
public ImDrawListSplitter _Splitter;
public float _FringeScale;
}
public unsafe partial struct ImDrawListPtr
{
public ImDrawList* NativePtr { get; }
public ImDrawListPtr(ImDrawList* nativePtr) => NativePtr = nativePtr;
public ImDrawListPtr(IntPtr nativePtr) => NativePtr = (ImDrawList*)nativePtr;
public static implicit operator ImDrawListPtr(ImDrawList* nativePtr) => new ImDrawListPtr(nativePtr);
public static implicit operator ImDrawList* (ImDrawListPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawListPtr(IntPtr nativePtr) => new ImDrawListPtr(nativePtr);
public ImPtrVector<ImDrawCmdPtr> CmdBuffer => new ImPtrVector<ImDrawCmdPtr>(NativePtr->CmdBuffer, Unsafe.SizeOf<ImDrawCmd>());
public ImVector<ushort> IdxBuffer => new ImVector<ushort>(NativePtr->IdxBuffer);
public ImPtrVector<ImDrawVertPtr> VtxBuffer => new ImPtrVector<ImDrawVertPtr>(NativePtr->VtxBuffer, Unsafe.SizeOf<ImDrawVert>());
public ref ImDrawListFlags Flags => ref Unsafe.AsRef<ImDrawListFlags>(&NativePtr->Flags);
public ref uint _VtxCurrentIdx => ref Unsafe.AsRef<uint>(&NativePtr->_VtxCurrentIdx);
public ref IntPtr _Data => ref Unsafe.AsRef<IntPtr>(&NativePtr->_Data);
public NullTerminatedString _OwnerName => new NullTerminatedString(NativePtr->_OwnerName);
public ImDrawVertPtr _VtxWritePtr => new ImDrawVertPtr(NativePtr->_VtxWritePtr);
public IntPtr _IdxWritePtr { get => (IntPtr)NativePtr->_IdxWritePtr; set => NativePtr->_IdxWritePtr = (ushort*)value; }
public ImVector<Vector4> _ClipRectStack => new ImVector<Vector4>(NativePtr->_ClipRectStack);
public ImVector<IntPtr> _TextureIdStack => new ImVector<IntPtr>(NativePtr->_TextureIdStack);
public ImVector<Vector2> _Path => new ImVector<Vector2>(NativePtr->_Path);
public ref ImDrawCmdHeader _CmdHeader => ref Unsafe.AsRef<ImDrawCmdHeader>(&NativePtr->_CmdHeader);
public ref ImDrawListSplitter _Splitter => ref Unsafe.AsRef<ImDrawListSplitter>(&NativePtr->_Splitter);
public ref float _FringeScale => ref Unsafe.AsRef<float>(&NativePtr->_FringeScale);
public int _CalcCircleAutoSegmentCount(float radius)
{
int ret = ImGuiNative.ImDrawList__CalcCircleAutoSegmentCount((ImDrawList*)(NativePtr), radius);
return ret;
}
public void _ClearFreeMemory()
{
ImGuiNative.ImDrawList__ClearFreeMemory((ImDrawList*)(NativePtr));
}
public void _OnChangedClipRect()
{
ImGuiNative.ImDrawList__OnChangedClipRect((ImDrawList*)(NativePtr));
}
public void _OnChangedTextureID()
{
ImGuiNative.ImDrawList__OnChangedTextureID((ImDrawList*)(NativePtr));
}
public void _OnChangedVtxOffset()
{
ImGuiNative.ImDrawList__OnChangedVtxOffset((ImDrawList*)(NativePtr));
}
public void _PathArcToFastEx(Vector2 center, float radius, int a_min_sample, int a_max_sample, int a_step)
{
ImGuiNative.ImDrawList__PathArcToFastEx((ImDrawList*)(NativePtr), center, radius, a_min_sample, a_max_sample, a_step);
}
public void _PathArcToN(Vector2 center, float radius, float a_min, float a_max, int num_segments)
{
ImGuiNative.ImDrawList__PathArcToN((ImDrawList*)(NativePtr), center, radius, a_min, a_max, num_segments);
}
public void _PopUnusedDrawCmd()
{
ImGuiNative.ImDrawList__PopUnusedDrawCmd((ImDrawList*)(NativePtr));
}
public void _ResetForNewFrame()
{
ImGuiNative.ImDrawList__ResetForNewFrame((ImDrawList*)(NativePtr));
}
public void _TryMergeDrawCmds()
{
ImGuiNative.ImDrawList__TryMergeDrawCmds((ImDrawList*)(NativePtr));
}
public void AddBezierCubic(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col, float thickness)
{
int num_segments = 0;
ImGuiNative.ImDrawList_AddBezierCubic((ImDrawList*)(NativePtr), p1, p2, p3, p4, col, thickness, num_segments);
}
public void AddBezierCubic(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col, float thickness, int num_segments)
{
ImGuiNative.ImDrawList_AddBezierCubic((ImDrawList*)(NativePtr), p1, p2, p3, p4, col, thickness, num_segments);
}
public void AddBezierQuadratic(Vector2 p1, Vector2 p2, Vector2 p3, uint col, float thickness)
{
int num_segments = 0;
ImGuiNative.ImDrawList_AddBezierQuadratic((ImDrawList*)(NativePtr), p1, p2, p3, col, thickness, num_segments);
}
public void AddBezierQuadratic(Vector2 p1, Vector2 p2, Vector2 p3, uint col, float thickness, int num_segments)
{
ImGuiNative.ImDrawList_AddBezierQuadratic((ImDrawList*)(NativePtr), p1, p2, p3, col, thickness, num_segments);
}
public void AddCallback(IntPtr callback, IntPtr callback_data)
{
void* native_callback_data = (void*)callback_data.ToPointer();
ImGuiNative.ImDrawList_AddCallback((ImDrawList*)(NativePtr), callback, native_callback_data);
}
public void AddCircle(Vector2 center, float radius, uint col)
{
int num_segments = 0;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddCircle((ImDrawList*)(NativePtr), center, radius, col, num_segments, thickness);
}
public void AddCircle(Vector2 center, float radius, uint col, int num_segments)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddCircle((ImDrawList*)(NativePtr), center, radius, col, num_segments, thickness);
}
public void AddCircle(Vector2 center, float radius, uint col, int num_segments, float thickness)
{
ImGuiNative.ImDrawList_AddCircle((ImDrawList*)(NativePtr), center, radius, col, num_segments, thickness);
}
public void AddCircleFilled(Vector2 center, float radius, uint col)
{
int num_segments = 0;
ImGuiNative.ImDrawList_AddCircleFilled((ImDrawList*)(NativePtr), center, radius, col, num_segments);
}
public void AddCircleFilled(Vector2 center, float radius, uint col, int num_segments)
{
ImGuiNative.ImDrawList_AddCircleFilled((ImDrawList*)(NativePtr), center, radius, col, num_segments);
}
public void AddConvexPolyFilled(ref Vector2 points, int num_points, uint col)
{
fixed (Vector2* native_points = &points)
{
ImGuiNative.ImDrawList_AddConvexPolyFilled((ImDrawList*)(NativePtr), native_points, num_points, col);
}
}
public void AddDrawCmd()
{
ImGuiNative.ImDrawList_AddDrawCmd((ImDrawList*)(NativePtr));
}
public void AddEllipse(Vector2 center, float radius_x, float radius_y, uint col)
{
float rot = 0.0f;
int num_segments = 0;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddEllipse((ImDrawList*)(NativePtr), center, radius_x, radius_y, col, rot, num_segments, thickness);
}
public void AddEllipse(Vector2 center, float radius_x, float radius_y, uint col, float rot)
{
int num_segments = 0;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddEllipse((ImDrawList*)(NativePtr), center, radius_x, radius_y, col, rot, num_segments, thickness);
}
public void AddEllipse(Vector2 center, float radius_x, float radius_y, uint col, float rot, int num_segments)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddEllipse((ImDrawList*)(NativePtr), center, radius_x, radius_y, col, rot, num_segments, thickness);
}
public void AddEllipse(Vector2 center, float radius_x, float radius_y, uint col, float rot, int num_segments, float thickness)
{
ImGuiNative.ImDrawList_AddEllipse((ImDrawList*)(NativePtr), center, radius_x, radius_y, col, rot, num_segments, thickness);
}
public void AddEllipseFilled(Vector2 center, float radius_x, float radius_y, uint col)
{
float rot = 0.0f;
int num_segments = 0;
ImGuiNative.ImDrawList_AddEllipseFilled((ImDrawList*)(NativePtr), center, radius_x, radius_y, col, rot, num_segments);
}
public void AddEllipseFilled(Vector2 center, float radius_x, float radius_y, uint col, float rot)
{
int num_segments = 0;
ImGuiNative.ImDrawList_AddEllipseFilled((ImDrawList*)(NativePtr), center, radius_x, radius_y, col, rot, num_segments);
}
public void AddEllipseFilled(Vector2 center, float radius_x, float radius_y, uint col, float rot, int num_segments)
{
ImGuiNative.ImDrawList_AddEllipseFilled((ImDrawList*)(NativePtr), center, radius_x, radius_y, col, rot, num_segments);
}
public void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max)
{
Vector2 uv_min = new Vector2();
Vector2 uv_max = new Vector2(1, 1);
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImage((ImDrawList*)(NativePtr), user_texture_id, p_min, p_max, uv_min, uv_max, col);
}
public void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min)
{
Vector2 uv_max = new Vector2(1, 1);
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImage((ImDrawList*)(NativePtr), user_texture_id, p_min, p_max, uv_min, uv_max, col);
}
public void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max)
{
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImage((ImDrawList*)(NativePtr), user_texture_id, p_min, p_max, uv_min, uv_max, col);
}
public void AddImage(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max, uint col)
{
ImGuiNative.ImDrawList_AddImage((ImDrawList*)(NativePtr), user_texture_id, p_min, p_max, uv_min, uv_max, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4)
{
Vector2 uv1 = new Vector2();
Vector2 uv2 = new Vector2(1, 0);
Vector2 uv3 = new Vector2(1, 1);
Vector2 uv4 = new Vector2(0, 1);
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImageQuad((ImDrawList*)(NativePtr), user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1)
{
Vector2 uv2 = new Vector2(1, 0);
Vector2 uv3 = new Vector2(1, 1);
Vector2 uv4 = new Vector2(0, 1);
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImageQuad((ImDrawList*)(NativePtr), user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2)
{
Vector2 uv3 = new Vector2(1, 1);
Vector2 uv4 = new Vector2(0, 1);
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImageQuad((ImDrawList*)(NativePtr), user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2, Vector2 uv3)
{
Vector2 uv4 = new Vector2(0, 1);
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImageQuad((ImDrawList*)(NativePtr), user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2, Vector2 uv3, Vector2 uv4)
{
uint col = 4294967295;
ImGuiNative.ImDrawList_AddImageQuad((ImDrawList*)(NativePtr), user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
}
public void AddImageQuad(IntPtr user_texture_id, Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 uv1, Vector2 uv2, Vector2 uv3, Vector2 uv4, uint col)
{
ImGuiNative.ImDrawList_AddImageQuad((ImDrawList*)(NativePtr), user_texture_id, p1, p2, p3, p4, uv1, uv2, uv3, uv4, col);
}
public void AddImageRounded(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max, uint col, float rounding)
{
ImDrawFlags flags = (ImDrawFlags)0;
ImGuiNative.ImDrawList_AddImageRounded((ImDrawList*)(NativePtr), user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, flags);
}
public void AddImageRounded(IntPtr user_texture_id, Vector2 p_min, Vector2 p_max, Vector2 uv_min, Vector2 uv_max, uint col, float rounding, ImDrawFlags flags)
{
ImGuiNative.ImDrawList_AddImageRounded((ImDrawList*)(NativePtr), user_texture_id, p_min, p_max, uv_min, uv_max, col, rounding, flags);
}
public void AddLine(Vector2 p1, Vector2 p2, uint col)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddLine((ImDrawList*)(NativePtr), p1, p2, col, thickness);
}
public void AddLine(Vector2 p1, Vector2 p2, uint col, float thickness)
{
ImGuiNative.ImDrawList_AddLine((ImDrawList*)(NativePtr), p1, p2, col, thickness);
}
public void AddNgon(Vector2 center, float radius, uint col, int num_segments)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddNgon((ImDrawList*)(NativePtr), center, radius, col, num_segments, thickness);
}
public void AddNgon(Vector2 center, float radius, uint col, int num_segments, float thickness)
{
ImGuiNative.ImDrawList_AddNgon((ImDrawList*)(NativePtr), center, radius, col, num_segments, thickness);
}
public void AddNgonFilled(Vector2 center, float radius, uint col, int num_segments)
{
ImGuiNative.ImDrawList_AddNgonFilled((ImDrawList*)(NativePtr), center, radius, col, num_segments);
}
public void AddPolyline(ref Vector2 points, int num_points, uint col, ImDrawFlags flags, float thickness)
{
fixed (Vector2* native_points = &points)
{
ImGuiNative.ImDrawList_AddPolyline((ImDrawList*)(NativePtr), native_points, num_points, col, flags, thickness);
}
}
public void AddQuad(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddQuad((ImDrawList*)(NativePtr), p1, p2, p3, p4, col, thickness);
}
public void AddQuad(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col, float thickness)
{
ImGuiNative.ImDrawList_AddQuad((ImDrawList*)(NativePtr), p1, p2, p3, p4, col, thickness);
}
public void AddQuadFilled(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, uint col)
{
ImGuiNative.ImDrawList_AddQuadFilled((ImDrawList*)(NativePtr), p1, p2, p3, p4, col);
}
public void AddRect(Vector2 p_min, Vector2 p_max, uint col)
{
float rounding = 0.0f;
ImDrawFlags flags = (ImDrawFlags)0;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddRect((ImDrawList*)(NativePtr), p_min, p_max, col, rounding, flags, thickness);
}
public void AddRect(Vector2 p_min, Vector2 p_max, uint col, float rounding)
{
ImDrawFlags flags = (ImDrawFlags)0;
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddRect((ImDrawList*)(NativePtr), p_min, p_max, col, rounding, flags, thickness);
}
public void AddRect(Vector2 p_min, Vector2 p_max, uint col, float rounding, ImDrawFlags flags)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddRect((ImDrawList*)(NativePtr), p_min, p_max, col, rounding, flags, thickness);
}
public void AddRect(Vector2 p_min, Vector2 p_max, uint col, float rounding, ImDrawFlags flags, float thickness)
{
ImGuiNative.ImDrawList_AddRect((ImDrawList*)(NativePtr), p_min, p_max, col, rounding, flags, thickness);
}
public void AddRectFilled(Vector2 p_min, Vector2 p_max, uint col)
{
float rounding = 0.0f;
ImDrawFlags flags = (ImDrawFlags)0;
ImGuiNative.ImDrawList_AddRectFilled((ImDrawList*)(NativePtr), p_min, p_max, col, rounding, flags);
}
public void AddRectFilled(Vector2 p_min, Vector2 p_max, uint col, float rounding)
{
ImDrawFlags flags = (ImDrawFlags)0;
ImGuiNative.ImDrawList_AddRectFilled((ImDrawList*)(NativePtr), p_min, p_max, col, rounding, flags);
}
public void AddRectFilled(Vector2 p_min, Vector2 p_max, uint col, float rounding, ImDrawFlags flags)
{
ImGuiNative.ImDrawList_AddRectFilled((ImDrawList*)(NativePtr), p_min, p_max, col, rounding, flags);
}
public void AddRectFilledMultiColor(Vector2 p_min, Vector2 p_max, uint col_upr_left, uint col_upr_right, uint col_bot_right, uint col_bot_left)
{
ImGuiNative.ImDrawList_AddRectFilledMultiColor((ImDrawList*)(NativePtr), p_min, p_max, col_upr_left, col_upr_right, col_bot_right, col_bot_left);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void AddText(Vector2 pos, uint col, ReadOnlySpan<char> text_begin)
{
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
ImGuiNative.ImDrawList_AddText_Vec2((ImDrawList*)(NativePtr), pos, col, native_text_begin, native_text_begin+text_begin_byteCount);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#endif
public void AddText(Vector2 pos, uint col, string text_begin)
{
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
ImGuiNative.ImDrawList_AddText_Vec2((ImDrawList*)(NativePtr), pos, col, native_text_begin, native_text_begin+text_begin_byteCount);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, ReadOnlySpan<char> text_begin)
{
ImFont* native_font = font.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
float wrap_width = 0.0f;
Vector4* cpu_fine_clip_rect = null;
ImGuiNative.ImDrawList_AddText_FontPtr((ImDrawList*)(NativePtr), native_font, font_size, pos, col, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip_rect);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#endif
public void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, string text_begin)
{
ImFont* native_font = font.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
float wrap_width = 0.0f;
Vector4* cpu_fine_clip_rect = null;
ImGuiNative.ImDrawList_AddText_FontPtr((ImDrawList*)(NativePtr), native_font, font_size, pos, col, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip_rect);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, ReadOnlySpan<char> text_begin, float wrap_width)
{
ImFont* native_font = font.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
Vector4* cpu_fine_clip_rect = null;
ImGuiNative.ImDrawList_AddText_FontPtr((ImDrawList*)(NativePtr), native_font, font_size, pos, col, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip_rect);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#endif
public void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, string text_begin, float wrap_width)
{
ImFont* native_font = font.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
Vector4* cpu_fine_clip_rect = null;
ImGuiNative.ImDrawList_AddText_FontPtr((ImDrawList*)(NativePtr), native_font, font_size, pos, col, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip_rect);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, ReadOnlySpan<char> text_begin, float wrap_width, ref Vector4 cpu_fine_clip_rect)
{
ImFont* native_font = font.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
fixed (Vector4* native_cpu_fine_clip_rect = &cpu_fine_clip_rect)
{
ImGuiNative.ImDrawList_AddText_FontPtr((ImDrawList*)(NativePtr), native_font, font_size, pos, col, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, native_cpu_fine_clip_rect);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
}
#endif
public void AddText(ImFontPtr font, float font_size, Vector2 pos, uint col, string text_begin, float wrap_width, ref Vector4 cpu_fine_clip_rect)
{
ImFont* native_font = font.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
fixed (Vector4* native_cpu_fine_clip_rect = &cpu_fine_clip_rect)
{
ImGuiNative.ImDrawList_AddText_FontPtr((ImDrawList*)(NativePtr), native_font, font_size, pos, col, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, native_cpu_fine_clip_rect);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
}
public void AddTriangle(Vector2 p1, Vector2 p2, Vector2 p3, uint col)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_AddTriangle((ImDrawList*)(NativePtr), p1, p2, p3, col, thickness);
}
public void AddTriangle(Vector2 p1, Vector2 p2, Vector2 p3, uint col, float thickness)
{
ImGuiNative.ImDrawList_AddTriangle((ImDrawList*)(NativePtr), p1, p2, p3, col, thickness);
}
public void AddTriangleFilled(Vector2 p1, Vector2 p2, Vector2 p3, uint col)
{
ImGuiNative.ImDrawList_AddTriangleFilled((ImDrawList*)(NativePtr), p1, p2, p3, col);
}
public void ChannelsMerge()
{
ImGuiNative.ImDrawList_ChannelsMerge((ImDrawList*)(NativePtr));
}
public void ChannelsSetCurrent(int n)
{
ImGuiNative.ImDrawList_ChannelsSetCurrent((ImDrawList*)(NativePtr), n);
}
public void ChannelsSplit(int count)
{
ImGuiNative.ImDrawList_ChannelsSplit((ImDrawList*)(NativePtr), count);
}
public ImDrawListPtr CloneOutput()
{
ImDrawList* ret = ImGuiNative.ImDrawList_CloneOutput((ImDrawList*)(NativePtr));
return new ImDrawListPtr(ret);
}
public void Destroy()
{
ImGuiNative.ImDrawList_destroy((ImDrawList*)(NativePtr));
}
public Vector2 GetClipRectMax()
{
Vector2 __retval;
ImGuiNative.ImDrawList_GetClipRectMax(&__retval, (ImDrawList*)(NativePtr));
return __retval;
}
public Vector2 GetClipRectMin()
{
Vector2 __retval;
ImGuiNative.ImDrawList_GetClipRectMin(&__retval, (ImDrawList*)(NativePtr));
return __retval;
}
public void PathArcTo(Vector2 center, float radius, float a_min, float a_max)
{
int num_segments = 0;
ImGuiNative.ImDrawList_PathArcTo((ImDrawList*)(NativePtr), center, radius, a_min, a_max, num_segments);
}
public void PathArcTo(Vector2 center, float radius, float a_min, float a_max, int num_segments)
{
ImGuiNative.ImDrawList_PathArcTo((ImDrawList*)(NativePtr), center, radius, a_min, a_max, num_segments);
}
public void PathArcToFast(Vector2 center, float radius, int a_min_of_12, int a_max_of_12)
{
ImGuiNative.ImDrawList_PathArcToFast((ImDrawList*)(NativePtr), center, radius, a_min_of_12, a_max_of_12);
}
public void PathBezierCubicCurveTo(Vector2 p2, Vector2 p3, Vector2 p4)
{
int num_segments = 0;
ImGuiNative.ImDrawList_PathBezierCubicCurveTo((ImDrawList*)(NativePtr), p2, p3, p4, num_segments);
}
public void PathBezierCubicCurveTo(Vector2 p2, Vector2 p3, Vector2 p4, int num_segments)
{
ImGuiNative.ImDrawList_PathBezierCubicCurveTo((ImDrawList*)(NativePtr), p2, p3, p4, num_segments);
}
public void PathBezierQuadraticCurveTo(Vector2 p2, Vector2 p3)
{
int num_segments = 0;
ImGuiNative.ImDrawList_PathBezierQuadraticCurveTo((ImDrawList*)(NativePtr), p2, p3, num_segments);
}
public void PathBezierQuadraticCurveTo(Vector2 p2, Vector2 p3, int num_segments)
{
ImGuiNative.ImDrawList_PathBezierQuadraticCurveTo((ImDrawList*)(NativePtr), p2, p3, num_segments);
}
public void PathClear()
{
ImGuiNative.ImDrawList_PathClear((ImDrawList*)(NativePtr));
}
public void PathEllipticalArcTo(Vector2 center, float radius_x, float radius_y, float rot, float a_min, float a_max)
{
int num_segments = 0;
ImGuiNative.ImDrawList_PathEllipticalArcTo((ImDrawList*)(NativePtr), center, radius_x, radius_y, rot, a_min, a_max, num_segments);
}
public void PathEllipticalArcTo(Vector2 center, float radius_x, float radius_y, float rot, float a_min, float a_max, int num_segments)
{
ImGuiNative.ImDrawList_PathEllipticalArcTo((ImDrawList*)(NativePtr), center, radius_x, radius_y, rot, a_min, a_max, num_segments);
}
public void PathFillConvex(uint col)
{
ImGuiNative.ImDrawList_PathFillConvex((ImDrawList*)(NativePtr), col);
}
public void PathLineTo(Vector2 pos)
{
ImGuiNative.ImDrawList_PathLineTo((ImDrawList*)(NativePtr), pos);
}
public void PathLineToMergeDuplicate(Vector2 pos)
{
ImGuiNative.ImDrawList_PathLineToMergeDuplicate((ImDrawList*)(NativePtr), pos);
}
public void PathRect(Vector2 rect_min, Vector2 rect_max)
{
float rounding = 0.0f;
ImDrawFlags flags = (ImDrawFlags)0;
ImGuiNative.ImDrawList_PathRect((ImDrawList*)(NativePtr), rect_min, rect_max, rounding, flags);
}
public void PathRect(Vector2 rect_min, Vector2 rect_max, float rounding)
{
ImDrawFlags flags = (ImDrawFlags)0;
ImGuiNative.ImDrawList_PathRect((ImDrawList*)(NativePtr), rect_min, rect_max, rounding, flags);
}
public void PathRect(Vector2 rect_min, Vector2 rect_max, float rounding, ImDrawFlags flags)
{
ImGuiNative.ImDrawList_PathRect((ImDrawList*)(NativePtr), rect_min, rect_max, rounding, flags);
}
public void PathStroke(uint col)
{
ImDrawFlags flags = (ImDrawFlags)0;
float thickness = 1.0f;
ImGuiNative.ImDrawList_PathStroke((ImDrawList*)(NativePtr), col, flags, thickness);
}
public void PathStroke(uint col, ImDrawFlags flags)
{
float thickness = 1.0f;
ImGuiNative.ImDrawList_PathStroke((ImDrawList*)(NativePtr), col, flags, thickness);
}
public void PathStroke(uint col, ImDrawFlags flags, float thickness)
{
ImGuiNative.ImDrawList_PathStroke((ImDrawList*)(NativePtr), col, flags, thickness);
}
public void PopClipRect()
{
ImGuiNative.ImDrawList_PopClipRect((ImDrawList*)(NativePtr));
}
public void PopTextureID()
{
ImGuiNative.ImDrawList_PopTextureID((ImDrawList*)(NativePtr));
}
public void PrimQuadUV(Vector2 a, Vector2 b, Vector2 c, Vector2 d, Vector2 uv_a, Vector2 uv_b, Vector2 uv_c, Vector2 uv_d, uint col)
{
ImGuiNative.ImDrawList_PrimQuadUV((ImDrawList*)(NativePtr), a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);
}
public void PrimRect(Vector2 a, Vector2 b, uint col)
{
ImGuiNative.ImDrawList_PrimRect((ImDrawList*)(NativePtr), a, b, col);
}
public void PrimRectUV(Vector2 a, Vector2 b, Vector2 uv_a, Vector2 uv_b, uint col)
{
ImGuiNative.ImDrawList_PrimRectUV((ImDrawList*)(NativePtr), a, b, uv_a, uv_b, col);
}
public void PrimReserve(int idx_count, int vtx_count)
{
ImGuiNative.ImDrawList_PrimReserve((ImDrawList*)(NativePtr), idx_count, vtx_count);
}
public void PrimUnreserve(int idx_count, int vtx_count)
{
ImGuiNative.ImDrawList_PrimUnreserve((ImDrawList*)(NativePtr), idx_count, vtx_count);
}
public void PrimVtx(Vector2 pos, Vector2 uv, uint col)
{
ImGuiNative.ImDrawList_PrimVtx((ImDrawList*)(NativePtr), pos, uv, col);
}
public void PrimWriteIdx(ushort idx)
{
ImGuiNative.ImDrawList_PrimWriteIdx((ImDrawList*)(NativePtr), idx);
}
public void PrimWriteVtx(Vector2 pos, Vector2 uv, uint col)
{
ImGuiNative.ImDrawList_PrimWriteVtx((ImDrawList*)(NativePtr), pos, uv, col);
}
public void PushClipRect(Vector2 clip_rect_min, Vector2 clip_rect_max)
{
byte intersect_with_current_clip_rect = 0;
ImGuiNative.ImDrawList_PushClipRect((ImDrawList*)(NativePtr), clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);
}
public void PushClipRect(Vector2 clip_rect_min, Vector2 clip_rect_max, bool intersect_with_current_clip_rect)
{
byte native_intersect_with_current_clip_rect = intersect_with_current_clip_rect ? (byte)1 : (byte)0;
ImGuiNative.ImDrawList_PushClipRect((ImDrawList*)(NativePtr), clip_rect_min, clip_rect_max, native_intersect_with_current_clip_rect);
}
public void PushClipRectFullScreen()
{
ImGuiNative.ImDrawList_PushClipRectFullScreen((ImDrawList*)(NativePtr));
}
public void PushTextureID(IntPtr texture_id)
{
ImGuiNative.ImDrawList_PushTextureID((ImDrawList*)(NativePtr), texture_id);
}
}
}

View File

@ -0,0 +1,12 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImDrawListFlags
{
None = 0,
AntiAliasedLines = 1,
AntiAliasedLinesUseTex = 2,
AntiAliasedFill = 4,
AllowVtxOffset = 8,
}
}

View File

@ -0,0 +1,53 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawListSplitter
{
public int _Current;
public int _Count;
public ImVector _Channels;
}
public unsafe partial struct ImDrawListSplitterPtr
{
public ImDrawListSplitter* NativePtr { get; }
public ImDrawListSplitterPtr(ImDrawListSplitter* nativePtr) => NativePtr = nativePtr;
public ImDrawListSplitterPtr(IntPtr nativePtr) => NativePtr = (ImDrawListSplitter*)nativePtr;
public static implicit operator ImDrawListSplitterPtr(ImDrawListSplitter* nativePtr) => new ImDrawListSplitterPtr(nativePtr);
public static implicit operator ImDrawListSplitter* (ImDrawListSplitterPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawListSplitterPtr(IntPtr nativePtr) => new ImDrawListSplitterPtr(nativePtr);
public ref int _Current => ref Unsafe.AsRef<int>(&NativePtr->_Current);
public ref int _Count => ref Unsafe.AsRef<int>(&NativePtr->_Count);
public ImPtrVector<ImDrawChannelPtr> _Channels => new ImPtrVector<ImDrawChannelPtr>(NativePtr->_Channels, Unsafe.SizeOf<ImDrawChannel>());
public void Clear()
{
ImGuiNative.ImDrawListSplitter_Clear((ImDrawListSplitter*)(NativePtr));
}
public void ClearFreeMemory()
{
ImGuiNative.ImDrawListSplitter_ClearFreeMemory((ImDrawListSplitter*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImDrawListSplitter_destroy((ImDrawListSplitter*)(NativePtr));
}
public void Merge(ImDrawListPtr draw_list)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
ImGuiNative.ImDrawListSplitter_Merge((ImDrawListSplitter*)(NativePtr), native_draw_list);
}
public void SetCurrentChannel(ImDrawListPtr draw_list, int channel_idx)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
ImGuiNative.ImDrawListSplitter_SetCurrentChannel((ImDrawListSplitter*)(NativePtr), native_draw_list, channel_idx);
}
public void Split(ImDrawListPtr draw_list, int count)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
ImGuiNative.ImDrawListSplitter_Split((ImDrawListSplitter*)(NativePtr), native_draw_list, count);
}
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImDrawVert
{
public Vector2 pos;
public Vector2 uv;
public uint col;
}
public unsafe partial struct ImDrawVertPtr
{
public ImDrawVert* NativePtr { get; }
public ImDrawVertPtr(ImDrawVert* nativePtr) => NativePtr = nativePtr;
public ImDrawVertPtr(IntPtr nativePtr) => NativePtr = (ImDrawVert*)nativePtr;
public static implicit operator ImDrawVertPtr(ImDrawVert* nativePtr) => new ImDrawVertPtr(nativePtr);
public static implicit operator ImDrawVert* (ImDrawVertPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImDrawVertPtr(IntPtr nativePtr) => new ImDrawVertPtr(nativePtr);
public ref Vector2 pos => ref Unsafe.AsRef<Vector2>(&NativePtr->pos);
public ref Vector2 uv => ref Unsafe.AsRef<Vector2>(&NativePtr->uv);
public ref uint col => ref Unsafe.AsRef<uint>(&NativePtr->col);
}
}

View File

@ -0,0 +1,442 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFont
{
public ImVector IndexAdvanceX;
public float FallbackAdvanceX;
public float FontSize;
public ImVector IndexLookup;
public ImVector Glyphs;
public ImFontGlyph* FallbackGlyph;
public ImFontAtlas* ContainerAtlas;
public ImFontConfig* ConfigData;
public short ConfigDataCount;
public ushort FallbackChar;
public ushort EllipsisChar;
public short EllipsisCharCount;
public float EllipsisWidth;
public float EllipsisCharStep;
public byte DirtyLookupTables;
public float Scale;
public float Ascent;
public float Descent;
public int MetricsTotalSurface;
public fixed byte Used4kPagesMap[2];
}
public unsafe partial struct ImFontPtr
{
public ImFont* NativePtr { get; }
public ImFontPtr(ImFont* nativePtr) => NativePtr = nativePtr;
public ImFontPtr(IntPtr nativePtr) => NativePtr = (ImFont*)nativePtr;
public static implicit operator ImFontPtr(ImFont* nativePtr) => new ImFontPtr(nativePtr);
public static implicit operator ImFont* (ImFontPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontPtr(IntPtr nativePtr) => new ImFontPtr(nativePtr);
public ImVector<float> IndexAdvanceX => new ImVector<float>(NativePtr->IndexAdvanceX);
public ref float FallbackAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->FallbackAdvanceX);
public ref float FontSize => ref Unsafe.AsRef<float>(&NativePtr->FontSize);
public ImVector<ushort> IndexLookup => new ImVector<ushort>(NativePtr->IndexLookup);
public ImPtrVector<ImFontGlyphPtr> Glyphs => new ImPtrVector<ImFontGlyphPtr>(NativePtr->Glyphs, Unsafe.SizeOf<ImFontGlyph>());
public ImFontGlyphPtr FallbackGlyph => new ImFontGlyphPtr(NativePtr->FallbackGlyph);
public ImFontAtlasPtr ContainerAtlas => new ImFontAtlasPtr(NativePtr->ContainerAtlas);
public ImFontConfigPtr ConfigData => new ImFontConfigPtr(NativePtr->ConfigData);
public ref short ConfigDataCount => ref Unsafe.AsRef<short>(&NativePtr->ConfigDataCount);
public ref ushort FallbackChar => ref Unsafe.AsRef<ushort>(&NativePtr->FallbackChar);
public ref ushort EllipsisChar => ref Unsafe.AsRef<ushort>(&NativePtr->EllipsisChar);
public ref short EllipsisCharCount => ref Unsafe.AsRef<short>(&NativePtr->EllipsisCharCount);
public ref float EllipsisWidth => ref Unsafe.AsRef<float>(&NativePtr->EllipsisWidth);
public ref float EllipsisCharStep => ref Unsafe.AsRef<float>(&NativePtr->EllipsisCharStep);
public ref bool DirtyLookupTables => ref Unsafe.AsRef<bool>(&NativePtr->DirtyLookupTables);
public ref float Scale => ref Unsafe.AsRef<float>(&NativePtr->Scale);
public ref float Ascent => ref Unsafe.AsRef<float>(&NativePtr->Ascent);
public ref float Descent => ref Unsafe.AsRef<float>(&NativePtr->Descent);
public ref int MetricsTotalSurface => ref Unsafe.AsRef<int>(&NativePtr->MetricsTotalSurface);
public RangeAccessor<byte> Used4kPagesMap => new RangeAccessor<byte>(NativePtr->Used4kPagesMap, 2);
public void AddGlyph(ImFontConfigPtr src_cfg, ushort c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x)
{
ImFontConfig* native_src_cfg = src_cfg.NativePtr;
ImGuiNative.ImFont_AddGlyph((ImFont*)(NativePtr), native_src_cfg, c, x0, y0, x1, y1, u0, v0, u1, v1, advance_x);
}
public void AddRemapChar(ushort dst, ushort src)
{
byte overwrite_dst = 1;
ImGuiNative.ImFont_AddRemapChar((ImFont*)(NativePtr), dst, src, overwrite_dst);
}
public void AddRemapChar(ushort dst, ushort src, bool overwrite_dst)
{
byte native_overwrite_dst = overwrite_dst ? (byte)1 : (byte)0;
ImGuiNative.ImFont_AddRemapChar((ImFont*)(NativePtr), dst, src, native_overwrite_dst);
}
public void BuildLookupTable()
{
ImGuiNative.ImFont_BuildLookupTable((ImFont*)(NativePtr));
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public Vector2 CalcTextSizeA(float size, float max_width, float wrap_width, ReadOnlySpan<char> text_begin)
{
Vector2 __retval;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
byte** remaining = null;
ImGuiNative.ImFont_CalcTextSizeA(&__retval, (ImFont*)(NativePtr), size, max_width, wrap_width, native_text_begin, native_text_begin+text_begin_byteCount, remaining);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
return __retval;
}
#endif
public Vector2 CalcTextSizeA(float size, float max_width, float wrap_width, string text_begin)
{
Vector2 __retval;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
byte** remaining = null;
ImGuiNative.ImFont_CalcTextSizeA(&__retval, (ImFont*)(NativePtr), size, max_width, wrap_width, native_text_begin, native_text_begin+text_begin_byteCount, remaining);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
return __retval;
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public Vector2 CalcTextSizeA(float size, float max_width, float wrap_width, ReadOnlySpan<char> text_begin, ref byte* remaining)
{
Vector2 __retval;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
fixed (byte** native_remaining = &remaining)
{
ImGuiNative.ImFont_CalcTextSizeA(&__retval, (ImFont*)(NativePtr), size, max_width, wrap_width, native_text_begin, native_text_begin+text_begin_byteCount, native_remaining);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
return __retval;
}
}
#endif
public Vector2 CalcTextSizeA(float size, float max_width, float wrap_width, string text_begin, ref byte* remaining)
{
Vector2 __retval;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
fixed (byte** native_remaining = &remaining)
{
ImGuiNative.ImFont_CalcTextSizeA(&__retval, (ImFont*)(NativePtr), size, max_width, wrap_width, native_text_begin, native_text_begin+text_begin_byteCount, native_remaining);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
return __retval;
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public string CalcWordWrapPositionA(float scale, ReadOnlySpan<char> text, float wrap_width)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
byte* ret = ImGuiNative.ImFont_CalcWordWrapPositionA((ImFont*)(NativePtr), scale, native_text, native_text+text_byteCount, wrap_width);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
return Util.StringFromPtr(ret);
}
#endif
public string CalcWordWrapPositionA(float scale, string text, float wrap_width)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
byte* ret = ImGuiNative.ImFont_CalcWordWrapPositionA((ImFont*)(NativePtr), scale, native_text, native_text+text_byteCount, wrap_width);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
return Util.StringFromPtr(ret);
}
public void ClearOutputData()
{
ImGuiNative.ImFont_ClearOutputData((ImFont*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImFont_destroy((ImFont*)(NativePtr));
}
public ImFontGlyphPtr FindGlyph(ushort c)
{
ImFontGlyph* ret = ImGuiNative.ImFont_FindGlyph((ImFont*)(NativePtr), c);
return new ImFontGlyphPtr(ret);
}
public ImFontGlyphPtr FindGlyphNoFallback(ushort c)
{
ImFontGlyph* ret = ImGuiNative.ImFont_FindGlyphNoFallback((ImFont*)(NativePtr), c);
return new ImFontGlyphPtr(ret);
}
public float GetCharAdvance(ushort c)
{
float ret = ImGuiNative.ImFont_GetCharAdvance((ImFont*)(NativePtr), c);
return ret;
}
public string GetDebugName()
{
byte* ret = ImGuiNative.ImFont_GetDebugName((ImFont*)(NativePtr));
return Util.StringFromPtr(ret);
}
public void GrowIndex(int new_size)
{
ImGuiNative.ImFont_GrowIndex((ImFont*)(NativePtr), new_size);
}
public bool IsLoaded()
{
byte ret = ImGuiNative.ImFont_IsLoaded((ImFont*)(NativePtr));
return ret != 0;
}
public void RenderChar(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, ushort c)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
ImGuiNative.ImFont_RenderChar((ImFont*)(NativePtr), native_draw_list, size, pos, col, c);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void RenderText(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, Vector4 clip_rect, ReadOnlySpan<char> text_begin)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
float wrap_width = 0.0f;
byte cpu_fine_clip = 0;
ImGuiNative.ImFont_RenderText((ImFont*)(NativePtr), native_draw_list, size, pos, col, clip_rect, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#endif
public void RenderText(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, Vector4 clip_rect, string text_begin)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
float wrap_width = 0.0f;
byte cpu_fine_clip = 0;
ImGuiNative.ImFont_RenderText((ImFont*)(NativePtr), native_draw_list, size, pos, col, clip_rect, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void RenderText(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, Vector4 clip_rect, ReadOnlySpan<char> text_begin, float wrap_width)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
byte cpu_fine_clip = 0;
ImGuiNative.ImFont_RenderText((ImFont*)(NativePtr), native_draw_list, size, pos, col, clip_rect, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#endif
public void RenderText(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, Vector4 clip_rect, string text_begin, float wrap_width)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
byte cpu_fine_clip = 0;
ImGuiNative.ImFont_RenderText((ImFont*)(NativePtr), native_draw_list, size, pos, col, clip_rect, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, cpu_fine_clip);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void RenderText(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, Vector4 clip_rect, ReadOnlySpan<char> text_begin, float wrap_width, bool cpu_fine_clip)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
byte native_cpu_fine_clip = cpu_fine_clip ? (byte)1 : (byte)0;
ImGuiNative.ImFont_RenderText((ImFont*)(NativePtr), native_draw_list, size, pos, col, clip_rect, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, native_cpu_fine_clip);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
#endif
public void RenderText(ImDrawListPtr draw_list, float size, Vector2 pos, uint col, Vector4 clip_rect, string text_begin, float wrap_width, bool cpu_fine_clip)
{
ImDrawList* native_draw_list = draw_list.NativePtr;
byte* native_text_begin;
int text_begin_byteCount = 0;
text_begin_byteCount = Encoding.UTF8.GetByteCount(text_begin);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
native_text_begin = Util.Allocate(text_begin_byteCount + 1);
}
else
{
byte* native_text_begin_stackBytes = stackalloc byte[text_begin_byteCount + 1];
native_text_begin = native_text_begin_stackBytes;
}
int native_text_begin_offset = Util.GetUtf8(text_begin, native_text_begin, text_begin_byteCount);
native_text_begin[native_text_begin_offset] = 0;
byte native_cpu_fine_clip = cpu_fine_clip ? (byte)1 : (byte)0;
ImGuiNative.ImFont_RenderText((ImFont*)(NativePtr), native_draw_list, size, pos, col, clip_rect, native_text_begin, native_text_begin+text_begin_byteCount, wrap_width, native_cpu_fine_clip);
if (text_begin_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text_begin);
}
}
public void SetGlyphVisible(ushort c, bool visible)
{
byte native_visible = visible ? (byte)1 : (byte)0;
ImGuiNative.ImFont_SetGlyphVisible((ImFont*)(NativePtr), c, native_visible);
}
}
}

View File

@ -0,0 +1,803 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontAtlas
{
public ImFontAtlasFlags Flags;
public IntPtr TexID;
public int TexDesiredWidth;
public int TexGlyphPadding;
public byte Locked;
public void* UserData;
public byte TexReady;
public byte TexPixelsUseColors;
public byte* TexPixelsAlpha8;
public uint* TexPixelsRGBA32;
public int TexWidth;
public int TexHeight;
public Vector2 TexUvScale;
public Vector2 TexUvWhitePixel;
public ImVector Fonts;
public ImVector CustomRects;
public ImVector ConfigData;
public Vector4 TexUvLines_0;
public Vector4 TexUvLines_1;
public Vector4 TexUvLines_2;
public Vector4 TexUvLines_3;
public Vector4 TexUvLines_4;
public Vector4 TexUvLines_5;
public Vector4 TexUvLines_6;
public Vector4 TexUvLines_7;
public Vector4 TexUvLines_8;
public Vector4 TexUvLines_9;
public Vector4 TexUvLines_10;
public Vector4 TexUvLines_11;
public Vector4 TexUvLines_12;
public Vector4 TexUvLines_13;
public Vector4 TexUvLines_14;
public Vector4 TexUvLines_15;
public Vector4 TexUvLines_16;
public Vector4 TexUvLines_17;
public Vector4 TexUvLines_18;
public Vector4 TexUvLines_19;
public Vector4 TexUvLines_20;
public Vector4 TexUvLines_21;
public Vector4 TexUvLines_22;
public Vector4 TexUvLines_23;
public Vector4 TexUvLines_24;
public Vector4 TexUvLines_25;
public Vector4 TexUvLines_26;
public Vector4 TexUvLines_27;
public Vector4 TexUvLines_28;
public Vector4 TexUvLines_29;
public Vector4 TexUvLines_30;
public Vector4 TexUvLines_31;
public Vector4 TexUvLines_32;
public Vector4 TexUvLines_33;
public Vector4 TexUvLines_34;
public Vector4 TexUvLines_35;
public Vector4 TexUvLines_36;
public Vector4 TexUvLines_37;
public Vector4 TexUvLines_38;
public Vector4 TexUvLines_39;
public Vector4 TexUvLines_40;
public Vector4 TexUvLines_41;
public Vector4 TexUvLines_42;
public Vector4 TexUvLines_43;
public Vector4 TexUvLines_44;
public Vector4 TexUvLines_45;
public Vector4 TexUvLines_46;
public Vector4 TexUvLines_47;
public Vector4 TexUvLines_48;
public Vector4 TexUvLines_49;
public Vector4 TexUvLines_50;
public Vector4 TexUvLines_51;
public Vector4 TexUvLines_52;
public Vector4 TexUvLines_53;
public Vector4 TexUvLines_54;
public Vector4 TexUvLines_55;
public Vector4 TexUvLines_56;
public Vector4 TexUvLines_57;
public Vector4 TexUvLines_58;
public Vector4 TexUvLines_59;
public Vector4 TexUvLines_60;
public Vector4 TexUvLines_61;
public Vector4 TexUvLines_62;
public Vector4 TexUvLines_63;
public IntPtr* FontBuilderIO;
public uint FontBuilderFlags;
public int PackIdMouseCursors;
public int PackIdLines;
}
public unsafe partial struct ImFontAtlasPtr
{
public ImFontAtlas* NativePtr { get; }
public ImFontAtlasPtr(ImFontAtlas* nativePtr) => NativePtr = nativePtr;
public ImFontAtlasPtr(IntPtr nativePtr) => NativePtr = (ImFontAtlas*)nativePtr;
public static implicit operator ImFontAtlasPtr(ImFontAtlas* nativePtr) => new ImFontAtlasPtr(nativePtr);
public static implicit operator ImFontAtlas* (ImFontAtlasPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontAtlasPtr(IntPtr nativePtr) => new ImFontAtlasPtr(nativePtr);
public ref ImFontAtlasFlags Flags => ref Unsafe.AsRef<ImFontAtlasFlags>(&NativePtr->Flags);
public ref IntPtr TexID => ref Unsafe.AsRef<IntPtr>(&NativePtr->TexID);
public ref int TexDesiredWidth => ref Unsafe.AsRef<int>(&NativePtr->TexDesiredWidth);
public ref int TexGlyphPadding => ref Unsafe.AsRef<int>(&NativePtr->TexGlyphPadding);
public ref bool Locked => ref Unsafe.AsRef<bool>(&NativePtr->Locked);
public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; }
public ref bool TexReady => ref Unsafe.AsRef<bool>(&NativePtr->TexReady);
public ref bool TexPixelsUseColors => ref Unsafe.AsRef<bool>(&NativePtr->TexPixelsUseColors);
public IntPtr TexPixelsAlpha8 { get => (IntPtr)NativePtr->TexPixelsAlpha8; set => NativePtr->TexPixelsAlpha8 = (byte*)value; }
public IntPtr TexPixelsRGBA32 { get => (IntPtr)NativePtr->TexPixelsRGBA32; set => NativePtr->TexPixelsRGBA32 = (uint*)value; }
public ref int TexWidth => ref Unsafe.AsRef<int>(&NativePtr->TexWidth);
public ref int TexHeight => ref Unsafe.AsRef<int>(&NativePtr->TexHeight);
public ref Vector2 TexUvScale => ref Unsafe.AsRef<Vector2>(&NativePtr->TexUvScale);
public ref Vector2 TexUvWhitePixel => ref Unsafe.AsRef<Vector2>(&NativePtr->TexUvWhitePixel);
public ImVector<ImFontPtr> Fonts => new ImVector<ImFontPtr>(NativePtr->Fonts);
public ImPtrVector<ImFontAtlasCustomRectPtr> CustomRects => new ImPtrVector<ImFontAtlasCustomRectPtr>(NativePtr->CustomRects, Unsafe.SizeOf<ImFontAtlasCustomRect>());
public ImPtrVector<ImFontConfigPtr> ConfigData => new ImPtrVector<ImFontConfigPtr>(NativePtr->ConfigData, Unsafe.SizeOf<ImFontConfig>());
public RangeAccessor<Vector4> TexUvLines => new RangeAccessor<Vector4>(&NativePtr->TexUvLines_0, 64);
public IntPtr FontBuilderIO { get => (IntPtr)NativePtr->FontBuilderIO; set => NativePtr->FontBuilderIO = (IntPtr*)value; }
public ref uint FontBuilderFlags => ref Unsafe.AsRef<uint>(&NativePtr->FontBuilderFlags);
public ref int PackIdMouseCursors => ref Unsafe.AsRef<int>(&NativePtr->PackIdMouseCursors);
public ref int PackIdLines => ref Unsafe.AsRef<int>(&NativePtr->PackIdLines);
public int AddCustomRectFontGlyph(ImFontPtr font, ushort id, int width, int height, float advance_x)
{
ImFont* native_font = font.NativePtr;
Vector2 offset = new Vector2();
int ret = ImGuiNative.ImFontAtlas_AddCustomRectFontGlyph((ImFontAtlas*)(NativePtr), native_font, id, width, height, advance_x, offset);
return ret;
}
public int AddCustomRectFontGlyph(ImFontPtr font, ushort id, int width, int height, float advance_x, Vector2 offset)
{
ImFont* native_font = font.NativePtr;
int ret = ImGuiNative.ImFontAtlas_AddCustomRectFontGlyph((ImFontAtlas*)(NativePtr), native_font, id, width, height, advance_x, offset);
return ret;
}
public int AddCustomRectRegular(int width, int height)
{
int ret = ImGuiNative.ImFontAtlas_AddCustomRectRegular((ImFontAtlas*)(NativePtr), width, height);
return ret;
}
public ImFontPtr AddFont(ImFontConfigPtr font_cfg)
{
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFont((ImFontAtlas*)(NativePtr), native_font_cfg);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontDefault()
{
ImFontConfig* font_cfg = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontDefault((ImFontAtlas*)(NativePtr), font_cfg);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontDefault(ImFontConfigPtr font_cfg)
{
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontDefault((ImFontAtlas*)(NativePtr), native_font_cfg);
return new ImFontPtr(ret);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public ImFontPtr AddFontFromFileTTF(ReadOnlySpan<char> filename, float size_pixels)
{
byte* native_filename;
int filename_byteCount = 0;
if (filename != null)
{
filename_byteCount = Encoding.UTF8.GetByteCount(filename);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
native_filename = Util.Allocate(filename_byteCount + 1);
}
else
{
byte* native_filename_stackBytes = stackalloc byte[filename_byteCount + 1];
native_filename = native_filename_stackBytes;
}
int native_filename_offset = Util.GetUtf8(filename, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
else { native_filename = null; }
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF((ImFontAtlas*)(NativePtr), native_filename, size_pixels, font_cfg, glyph_ranges);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_filename);
}
return new ImFontPtr(ret);
}
#endif
public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels)
{
byte* native_filename;
int filename_byteCount = 0;
if (filename != null)
{
filename_byteCount = Encoding.UTF8.GetByteCount(filename);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
native_filename = Util.Allocate(filename_byteCount + 1);
}
else
{
byte* native_filename_stackBytes = stackalloc byte[filename_byteCount + 1];
native_filename = native_filename_stackBytes;
}
int native_filename_offset = Util.GetUtf8(filename, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
else { native_filename = null; }
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF((ImFontAtlas*)(NativePtr), native_filename, size_pixels, font_cfg, glyph_ranges);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_filename);
}
return new ImFontPtr(ret);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public ImFontPtr AddFontFromFileTTF(ReadOnlySpan<char> filename, float size_pixels, ImFontConfigPtr font_cfg)
{
byte* native_filename;
int filename_byteCount = 0;
if (filename != null)
{
filename_byteCount = Encoding.UTF8.GetByteCount(filename);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
native_filename = Util.Allocate(filename_byteCount + 1);
}
else
{
byte* native_filename_stackBytes = stackalloc byte[filename_byteCount + 1];
native_filename = native_filename_stackBytes;
}
int native_filename_offset = Util.GetUtf8(filename, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
else { native_filename = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF((ImFontAtlas*)(NativePtr), native_filename, size_pixels, native_font_cfg, glyph_ranges);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_filename);
}
return new ImFontPtr(ret);
}
#endif
public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg)
{
byte* native_filename;
int filename_byteCount = 0;
if (filename != null)
{
filename_byteCount = Encoding.UTF8.GetByteCount(filename);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
native_filename = Util.Allocate(filename_byteCount + 1);
}
else
{
byte* native_filename_stackBytes = stackalloc byte[filename_byteCount + 1];
native_filename = native_filename_stackBytes;
}
int native_filename_offset = Util.GetUtf8(filename, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
else { native_filename = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF((ImFontAtlas*)(NativePtr), native_filename, size_pixels, native_font_cfg, glyph_ranges);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_filename);
}
return new ImFontPtr(ret);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public ImFontPtr AddFontFromFileTTF(ReadOnlySpan<char> filename, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
{
byte* native_filename;
int filename_byteCount = 0;
if (filename != null)
{
filename_byteCount = Encoding.UTF8.GetByteCount(filename);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
native_filename = Util.Allocate(filename_byteCount + 1);
}
else
{
byte* native_filename_stackBytes = stackalloc byte[filename_byteCount + 1];
native_filename = native_filename_stackBytes;
}
int native_filename_offset = Util.GetUtf8(filename, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
else { native_filename = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer();
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF((ImFontAtlas*)(NativePtr), native_filename, size_pixels, native_font_cfg, native_glyph_ranges);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_filename);
}
return new ImFontPtr(ret);
}
#endif
public ImFontPtr AddFontFromFileTTF(string filename, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
{
byte* native_filename;
int filename_byteCount = 0;
if (filename != null)
{
filename_byteCount = Encoding.UTF8.GetByteCount(filename);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
native_filename = Util.Allocate(filename_byteCount + 1);
}
else
{
byte* native_filename_stackBytes = stackalloc byte[filename_byteCount + 1];
native_filename = native_filename_stackBytes;
}
int native_filename_offset = Util.GetUtf8(filename, native_filename, filename_byteCount);
native_filename[native_filename_offset] = 0;
}
else { native_filename = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer();
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromFileTTF((ImFontAtlas*)(NativePtr), native_filename, size_pixels, native_font_cfg, native_glyph_ranges);
if (filename_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_filename);
}
return new ImFontPtr(ret);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(ReadOnlySpan<char> compressed_font_data_base85, float size_pixels)
{
byte* native_compressed_font_data_base85;
int compressed_font_data_base85_byteCount = 0;
if (compressed_font_data_base85 != null)
{
compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
native_compressed_font_data_base85 = Util.Allocate(compressed_font_data_base85_byteCount + 1);
}
else
{
byte* native_compressed_font_data_base85_stackBytes = stackalloc byte[compressed_font_data_base85_byteCount + 1];
native_compressed_font_data_base85 = native_compressed_font_data_base85_stackBytes;
}
int native_compressed_font_data_base85_offset = Util.GetUtf8(compressed_font_data_base85, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
else { native_compressed_font_data_base85 = null; }
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF((ImFontAtlas*)(NativePtr), native_compressed_font_data_base85, size_pixels, font_cfg, glyph_ranges);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_compressed_font_data_base85);
}
return new ImFontPtr(ret);
}
#endif
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels)
{
byte* native_compressed_font_data_base85;
int compressed_font_data_base85_byteCount = 0;
if (compressed_font_data_base85 != null)
{
compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
native_compressed_font_data_base85 = Util.Allocate(compressed_font_data_base85_byteCount + 1);
}
else
{
byte* native_compressed_font_data_base85_stackBytes = stackalloc byte[compressed_font_data_base85_byteCount + 1];
native_compressed_font_data_base85 = native_compressed_font_data_base85_stackBytes;
}
int native_compressed_font_data_base85_offset = Util.GetUtf8(compressed_font_data_base85, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
else { native_compressed_font_data_base85 = null; }
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF((ImFontAtlas*)(NativePtr), native_compressed_font_data_base85, size_pixels, font_cfg, glyph_ranges);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_compressed_font_data_base85);
}
return new ImFontPtr(ret);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(ReadOnlySpan<char> compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg)
{
byte* native_compressed_font_data_base85;
int compressed_font_data_base85_byteCount = 0;
if (compressed_font_data_base85 != null)
{
compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
native_compressed_font_data_base85 = Util.Allocate(compressed_font_data_base85_byteCount + 1);
}
else
{
byte* native_compressed_font_data_base85_stackBytes = stackalloc byte[compressed_font_data_base85_byteCount + 1];
native_compressed_font_data_base85 = native_compressed_font_data_base85_stackBytes;
}
int native_compressed_font_data_base85_offset = Util.GetUtf8(compressed_font_data_base85, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
else { native_compressed_font_data_base85 = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF((ImFontAtlas*)(NativePtr), native_compressed_font_data_base85, size_pixels, native_font_cfg, glyph_ranges);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_compressed_font_data_base85);
}
return new ImFontPtr(ret);
}
#endif
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg)
{
byte* native_compressed_font_data_base85;
int compressed_font_data_base85_byteCount = 0;
if (compressed_font_data_base85 != null)
{
compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
native_compressed_font_data_base85 = Util.Allocate(compressed_font_data_base85_byteCount + 1);
}
else
{
byte* native_compressed_font_data_base85_stackBytes = stackalloc byte[compressed_font_data_base85_byteCount + 1];
native_compressed_font_data_base85 = native_compressed_font_data_base85_stackBytes;
}
int native_compressed_font_data_base85_offset = Util.GetUtf8(compressed_font_data_base85, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
else { native_compressed_font_data_base85 = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF((ImFontAtlas*)(NativePtr), native_compressed_font_data_base85, size_pixels, native_font_cfg, glyph_ranges);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_compressed_font_data_base85);
}
return new ImFontPtr(ret);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(ReadOnlySpan<char> compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
{
byte* native_compressed_font_data_base85;
int compressed_font_data_base85_byteCount = 0;
if (compressed_font_data_base85 != null)
{
compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
native_compressed_font_data_base85 = Util.Allocate(compressed_font_data_base85_byteCount + 1);
}
else
{
byte* native_compressed_font_data_base85_stackBytes = stackalloc byte[compressed_font_data_base85_byteCount + 1];
native_compressed_font_data_base85 = native_compressed_font_data_base85_stackBytes;
}
int native_compressed_font_data_base85_offset = Util.GetUtf8(compressed_font_data_base85, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
else { native_compressed_font_data_base85 = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer();
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF((ImFontAtlas*)(NativePtr), native_compressed_font_data_base85, size_pixels, native_font_cfg, native_glyph_ranges);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_compressed_font_data_base85);
}
return new ImFontPtr(ret);
}
#endif
public ImFontPtr AddFontFromMemoryCompressedBase85TTF(string compressed_font_data_base85, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
{
byte* native_compressed_font_data_base85;
int compressed_font_data_base85_byteCount = 0;
if (compressed_font_data_base85 != null)
{
compressed_font_data_base85_byteCount = Encoding.UTF8.GetByteCount(compressed_font_data_base85);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
native_compressed_font_data_base85 = Util.Allocate(compressed_font_data_base85_byteCount + 1);
}
else
{
byte* native_compressed_font_data_base85_stackBytes = stackalloc byte[compressed_font_data_base85_byteCount + 1];
native_compressed_font_data_base85 = native_compressed_font_data_base85_stackBytes;
}
int native_compressed_font_data_base85_offset = Util.GetUtf8(compressed_font_data_base85, native_compressed_font_data_base85, compressed_font_data_base85_byteCount);
native_compressed_font_data_base85[native_compressed_font_data_base85_offset] = 0;
}
else { native_compressed_font_data_base85 = null; }
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer();
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedBase85TTF((ImFontAtlas*)(NativePtr), native_compressed_font_data_base85, size_pixels, native_font_cfg, native_glyph_ranges);
if (compressed_font_data_base85_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_compressed_font_data_base85);
}
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_data_size, float size_pixels)
{
void* native_compressed_font_data = (void*)compressed_font_data.ToPointer();
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF((ImFontAtlas*)(NativePtr), native_compressed_font_data, compressed_font_data_size, size_pixels, font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_data_size, float size_pixels, ImFontConfigPtr font_cfg)
{
void* native_compressed_font_data = (void*)compressed_font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF((ImFontAtlas*)(NativePtr), native_compressed_font_data, compressed_font_data_size, size_pixels, native_font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryCompressedTTF(IntPtr compressed_font_data, int compressed_font_data_size, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
{
void* native_compressed_font_data = (void*)compressed_font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer();
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryCompressedTTF((ImFontAtlas*)(NativePtr), native_compressed_font_data, compressed_font_data_size, size_pixels, native_font_cfg, native_glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_data_size, float size_pixels)
{
void* native_font_data = (void*)font_data.ToPointer();
ImFontConfig* font_cfg = null;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF((ImFontAtlas*)(NativePtr), native_font_data, font_data_size, size_pixels, font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_data_size, float size_pixels, ImFontConfigPtr font_cfg)
{
void* native_font_data = (void*)font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* glyph_ranges = null;
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF((ImFontAtlas*)(NativePtr), native_font_data, font_data_size, size_pixels, native_font_cfg, glyph_ranges);
return new ImFontPtr(ret);
}
public ImFontPtr AddFontFromMemoryTTF(IntPtr font_data, int font_data_size, float size_pixels, ImFontConfigPtr font_cfg, IntPtr glyph_ranges)
{
void* native_font_data = (void*)font_data.ToPointer();
ImFontConfig* native_font_cfg = font_cfg.NativePtr;
ushort* native_glyph_ranges = (ushort*)glyph_ranges.ToPointer();
ImFont* ret = ImGuiNative.ImFontAtlas_AddFontFromMemoryTTF((ImFontAtlas*)(NativePtr), native_font_data, font_data_size, size_pixels, native_font_cfg, native_glyph_ranges);
return new ImFontPtr(ret);
}
public bool Build()
{
byte ret = ImGuiNative.ImFontAtlas_Build((ImFontAtlas*)(NativePtr));
return ret != 0;
}
public void CalcCustomRectUV(ImFontAtlasCustomRectPtr rect, out Vector2 out_uv_min, out Vector2 out_uv_max)
{
ImFontAtlasCustomRect* native_rect = rect.NativePtr;
fixed (Vector2* native_out_uv_min = &out_uv_min)
{
fixed (Vector2* native_out_uv_max = &out_uv_max)
{
ImGuiNative.ImFontAtlas_CalcCustomRectUV((ImFontAtlas*)(NativePtr), native_rect, native_out_uv_min, native_out_uv_max);
}
}
}
public void Clear()
{
ImGuiNative.ImFontAtlas_Clear((ImFontAtlas*)(NativePtr));
}
public void ClearFonts()
{
ImGuiNative.ImFontAtlas_ClearFonts((ImFontAtlas*)(NativePtr));
}
public void ClearInputData()
{
ImGuiNative.ImFontAtlas_ClearInputData((ImFontAtlas*)(NativePtr));
}
public void ClearTexData()
{
ImGuiNative.ImFontAtlas_ClearTexData((ImFontAtlas*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImFontAtlas_destroy((ImFontAtlas*)(NativePtr));
}
public ImFontAtlasCustomRectPtr GetCustomRectByIndex(int index)
{
ImFontAtlasCustomRect* ret = ImGuiNative.ImFontAtlas_GetCustomRectByIndex((ImFontAtlas*)(NativePtr), index);
return new ImFontAtlasCustomRectPtr(ret);
}
public IntPtr GetGlyphRangesChineseFull()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesChineseFull((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesChineseSimplifiedCommon()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesCyrillic()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesCyrillic((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesDefault()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesDefault((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesGreek()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesGreek((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesJapanese()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesJapanese((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesKorean()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesKorean((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesThai()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesThai((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public IntPtr GetGlyphRangesVietnamese()
{
ushort* ret = ImGuiNative.ImFontAtlas_GetGlyphRangesVietnamese((ImFontAtlas*)(NativePtr));
return (IntPtr)ret;
}
public bool GetMouseCursorTexData(ImGuiMouseCursor cursor, out Vector2 out_offset, out Vector2 out_size, out Vector2 out_uv_border, out Vector2 out_uv_fill)
{
fixed (Vector2* native_out_offset = &out_offset)
{
fixed (Vector2* native_out_size = &out_size)
{
fixed (Vector2* native_out_uv_border = &out_uv_border)
{
fixed (Vector2* native_out_uv_fill = &out_uv_fill)
{
byte ret = ImGuiNative.ImFontAtlas_GetMouseCursorTexData((ImFontAtlas*)(NativePtr), cursor, native_out_offset, native_out_size, native_out_uv_border, native_out_uv_fill);
return ret != 0;
}
}
}
}
}
public void GetTexDataAsAlpha8(out byte* out_pixels, out int out_width, out int out_height)
{
int* out_bytes_per_pixel = null;
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, out_bytes_per_pixel);
}
}
}
}
public void GetTexDataAsAlpha8(out byte* out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
{
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
fixed (int* native_out_bytes_per_pixel = &out_bytes_per_pixel)
{
ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, native_out_bytes_per_pixel);
}
}
}
}
}
public void GetTexDataAsAlpha8(out IntPtr out_pixels, out int out_width, out int out_height)
{
int* out_bytes_per_pixel = null;
fixed (IntPtr* native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, out_bytes_per_pixel);
}
}
}
}
public void GetTexDataAsAlpha8(out IntPtr out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
{
fixed (IntPtr* native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
fixed (int* native_out_bytes_per_pixel = &out_bytes_per_pixel)
{
ImGuiNative.ImFontAtlas_GetTexDataAsAlpha8((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, native_out_bytes_per_pixel);
}
}
}
}
}
public void GetTexDataAsRGBA32(out byte* out_pixels, out int out_width, out int out_height)
{
int* out_bytes_per_pixel = null;
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, out_bytes_per_pixel);
}
}
}
}
public void GetTexDataAsRGBA32(out byte* out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
{
fixed (byte** native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
fixed (int* native_out_bytes_per_pixel = &out_bytes_per_pixel)
{
ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, native_out_bytes_per_pixel);
}
}
}
}
}
public void GetTexDataAsRGBA32(out IntPtr out_pixels, out int out_width, out int out_height)
{
int* out_bytes_per_pixel = null;
fixed (IntPtr* native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, out_bytes_per_pixel);
}
}
}
}
public void GetTexDataAsRGBA32(out IntPtr out_pixels, out int out_width, out int out_height, out int out_bytes_per_pixel)
{
fixed (IntPtr* native_out_pixels = &out_pixels)
{
fixed (int* native_out_width = &out_width)
{
fixed (int* native_out_height = &out_height)
{
fixed (int* native_out_bytes_per_pixel = &out_bytes_per_pixel)
{
ImGuiNative.ImFontAtlas_GetTexDataAsRGBA32((ImFontAtlas*)(NativePtr), native_out_pixels, native_out_width, native_out_height, native_out_bytes_per_pixel);
}
}
}
}
}
public bool IsBuilt()
{
byte ret = ImGuiNative.ImFontAtlas_IsBuilt((ImFontAtlas*)(NativePtr));
return ret != 0;
}
public void SetTexID(IntPtr id)
{
ImGuiNative.ImFontAtlas_SetTexID((ImFontAtlas*)(NativePtr), id);
}
}
}

View File

@ -0,0 +1,45 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontAtlasCustomRect
{
public ushort Width;
public ushort Height;
public ushort X;
public ushort Y;
public uint GlyphID;
public float GlyphAdvanceX;
public Vector2 GlyphOffset;
public ImFont* Font;
}
public unsafe partial struct ImFontAtlasCustomRectPtr
{
public ImFontAtlasCustomRect* NativePtr { get; }
public ImFontAtlasCustomRectPtr(ImFontAtlasCustomRect* nativePtr) => NativePtr = nativePtr;
public ImFontAtlasCustomRectPtr(IntPtr nativePtr) => NativePtr = (ImFontAtlasCustomRect*)nativePtr;
public static implicit operator ImFontAtlasCustomRectPtr(ImFontAtlasCustomRect* nativePtr) => new ImFontAtlasCustomRectPtr(nativePtr);
public static implicit operator ImFontAtlasCustomRect* (ImFontAtlasCustomRectPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontAtlasCustomRectPtr(IntPtr nativePtr) => new ImFontAtlasCustomRectPtr(nativePtr);
public ref ushort Width => ref Unsafe.AsRef<ushort>(&NativePtr->Width);
public ref ushort Height => ref Unsafe.AsRef<ushort>(&NativePtr->Height);
public ref ushort X => ref Unsafe.AsRef<ushort>(&NativePtr->X);
public ref ushort Y => ref Unsafe.AsRef<ushort>(&NativePtr->Y);
public ref uint GlyphID => ref Unsafe.AsRef<uint>(&NativePtr->GlyphID);
public ref float GlyphAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphAdvanceX);
public ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);
public ImFontPtr Font => new ImFontPtr(NativePtr->Font);
public void Destroy()
{
ImGuiNative.ImFontAtlasCustomRect_destroy((ImFontAtlasCustomRect*)(NativePtr));
}
public bool IsPacked()
{
byte ret = ImGuiNative.ImFontAtlasCustomRect_IsPacked((ImFontAtlasCustomRect*)(NativePtr));
return ret != 0;
}
}
}

View File

@ -0,0 +1,11 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImFontAtlasFlags
{
None = 0,
NoPowerOfTwoHeight = 1,
NoMouseCursors = 2,
NoBakedLines = 4,
}
}

View File

@ -0,0 +1,64 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontConfig
{
public void* FontData;
public int FontDataSize;
public byte FontDataOwnedByAtlas;
public int FontNo;
public float SizePixels;
public int OversampleH;
public int OversampleV;
public byte PixelSnapH;
public Vector2 GlyphExtraSpacing;
public Vector2 GlyphOffset;
public ushort* GlyphRanges;
public float GlyphMinAdvanceX;
public float GlyphMaxAdvanceX;
public byte MergeMode;
public uint FontBuilderFlags;
public float RasterizerMultiply;
public float RasterizerDensity;
public ushort EllipsisChar;
public fixed byte Name[40];
public ImFont* DstFont;
}
public unsafe partial struct ImFontConfigPtr
{
public ImFontConfig* NativePtr { get; }
public ImFontConfigPtr(ImFontConfig* nativePtr) => NativePtr = nativePtr;
public ImFontConfigPtr(IntPtr nativePtr) => NativePtr = (ImFontConfig*)nativePtr;
public static implicit operator ImFontConfigPtr(ImFontConfig* nativePtr) => new ImFontConfigPtr(nativePtr);
public static implicit operator ImFontConfig* (ImFontConfigPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontConfigPtr(IntPtr nativePtr) => new ImFontConfigPtr(nativePtr);
public IntPtr FontData { get => (IntPtr)NativePtr->FontData; set => NativePtr->FontData = (void*)value; }
public ref int FontDataSize => ref Unsafe.AsRef<int>(&NativePtr->FontDataSize);
public ref bool FontDataOwnedByAtlas => ref Unsafe.AsRef<bool>(&NativePtr->FontDataOwnedByAtlas);
public ref int FontNo => ref Unsafe.AsRef<int>(&NativePtr->FontNo);
public ref float SizePixels => ref Unsafe.AsRef<float>(&NativePtr->SizePixels);
public ref int OversampleH => ref Unsafe.AsRef<int>(&NativePtr->OversampleH);
public ref int OversampleV => ref Unsafe.AsRef<int>(&NativePtr->OversampleV);
public ref bool PixelSnapH => ref Unsafe.AsRef<bool>(&NativePtr->PixelSnapH);
public ref Vector2 GlyphExtraSpacing => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphExtraSpacing);
public ref Vector2 GlyphOffset => ref Unsafe.AsRef<Vector2>(&NativePtr->GlyphOffset);
public IntPtr GlyphRanges { get => (IntPtr)NativePtr->GlyphRanges; set => NativePtr->GlyphRanges = (ushort*)value; }
public ref float GlyphMinAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphMinAdvanceX);
public ref float GlyphMaxAdvanceX => ref Unsafe.AsRef<float>(&NativePtr->GlyphMaxAdvanceX);
public ref bool MergeMode => ref Unsafe.AsRef<bool>(&NativePtr->MergeMode);
public ref uint FontBuilderFlags => ref Unsafe.AsRef<uint>(&NativePtr->FontBuilderFlags);
public ref float RasterizerMultiply => ref Unsafe.AsRef<float>(&NativePtr->RasterizerMultiply);
public ref float RasterizerDensity => ref Unsafe.AsRef<float>(&NativePtr->RasterizerDensity);
public ref ushort EllipsisChar => ref Unsafe.AsRef<ushort>(&NativePtr->EllipsisChar);
public RangeAccessor<byte> Name => new RangeAccessor<byte>(NativePtr->Name, 40);
public ImFontPtr DstFont => new ImFontPtr(NativePtr->DstFont);
public void Destroy()
{
ImGuiNative.ImFontConfig_destroy((ImFontConfig*)(NativePtr));
}
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontGlyph
{
public uint Colored;
public uint Visible;
public uint Codepoint;
public float AdvanceX;
public float X0;
public float Y0;
public float X1;
public float Y1;
public float U0;
public float V0;
public float U1;
public float V1;
}
public unsafe partial struct ImFontGlyphPtr
{
public ImFontGlyph* NativePtr { get; }
public ImFontGlyphPtr(ImFontGlyph* nativePtr) => NativePtr = nativePtr;
public ImFontGlyphPtr(IntPtr nativePtr) => NativePtr = (ImFontGlyph*)nativePtr;
public static implicit operator ImFontGlyphPtr(ImFontGlyph* nativePtr) => new ImFontGlyphPtr(nativePtr);
public static implicit operator ImFontGlyph* (ImFontGlyphPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontGlyphPtr(IntPtr nativePtr) => new ImFontGlyphPtr(nativePtr);
public ref uint Colored => ref Unsafe.AsRef<uint>(&NativePtr->Colored);
public ref uint Visible => ref Unsafe.AsRef<uint>(&NativePtr->Visible);
public ref uint Codepoint => ref Unsafe.AsRef<uint>(&NativePtr->Codepoint);
public ref float AdvanceX => ref Unsafe.AsRef<float>(&NativePtr->AdvanceX);
public ref float X0 => ref Unsafe.AsRef<float>(&NativePtr->X0);
public ref float Y0 => ref Unsafe.AsRef<float>(&NativePtr->Y0);
public ref float X1 => ref Unsafe.AsRef<float>(&NativePtr->X1);
public ref float Y1 => ref Unsafe.AsRef<float>(&NativePtr->Y1);
public ref float U0 => ref Unsafe.AsRef<float>(&NativePtr->U0);
public ref float V0 => ref Unsafe.AsRef<float>(&NativePtr->V0);
public ref float U1 => ref Unsafe.AsRef<float>(&NativePtr->U1);
public ref float V1 => ref Unsafe.AsRef<float>(&NativePtr->V1);
}
}

View File

@ -0,0 +1,109 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImFontGlyphRangesBuilder
{
public ImVector UsedChars;
}
public unsafe partial struct ImFontGlyphRangesBuilderPtr
{
public ImFontGlyphRangesBuilder* NativePtr { get; }
public ImFontGlyphRangesBuilderPtr(ImFontGlyphRangesBuilder* nativePtr) => NativePtr = nativePtr;
public ImFontGlyphRangesBuilderPtr(IntPtr nativePtr) => NativePtr = (ImFontGlyphRangesBuilder*)nativePtr;
public static implicit operator ImFontGlyphRangesBuilderPtr(ImFontGlyphRangesBuilder* nativePtr) => new ImFontGlyphRangesBuilderPtr(nativePtr);
public static implicit operator ImFontGlyphRangesBuilder* (ImFontGlyphRangesBuilderPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImFontGlyphRangesBuilderPtr(IntPtr nativePtr) => new ImFontGlyphRangesBuilderPtr(nativePtr);
public ImVector<uint> UsedChars => new ImVector<uint>(NativePtr->UsedChars);
public void AddChar(ushort c)
{
ImGuiNative.ImFontGlyphRangesBuilder_AddChar((ImFontGlyphRangesBuilder*)(NativePtr), c);
}
public void AddRanges(IntPtr ranges)
{
ushort* native_ranges = (ushort*)ranges.ToPointer();
ImGuiNative.ImFontGlyphRangesBuilder_AddRanges((ImFontGlyphRangesBuilder*)(NativePtr), native_ranges);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void AddText(ReadOnlySpan<char> text)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
ImGuiNative.ImFontGlyphRangesBuilder_AddText((ImFontGlyphRangesBuilder*)(NativePtr), native_text, native_text+text_byteCount);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
}
#endif
public void AddText(string text)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
ImGuiNative.ImFontGlyphRangesBuilder_AddText((ImFontGlyphRangesBuilder*)(NativePtr), native_text, native_text+text_byteCount);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
}
public void BuildRanges(out ImVector out_ranges)
{
fixed (ImVector* native_out_ranges = &out_ranges)
{
ImGuiNative.ImFontGlyphRangesBuilder_BuildRanges((ImFontGlyphRangesBuilder*)(NativePtr), native_out_ranges);
}
}
public void Clear()
{
ImGuiNative.ImFontGlyphRangesBuilder_Clear((ImFontGlyphRangesBuilder*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImFontGlyphRangesBuilder_destroy((ImFontGlyphRangesBuilder*)(NativePtr));
}
public bool GetBit(uint n)
{
byte ret = ImGuiNative.ImFontGlyphRangesBuilder_GetBit((ImFontGlyphRangesBuilder*)(NativePtr), n);
return ret != 0;
}
public void SetBit(uint n)
{
ImGuiNative.ImFontGlyphRangesBuilder_SetBit((ImFontGlyphRangesBuilder*)(NativePtr), n);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiBackendFlags
{
None = 0,
HasGamepad = 1,
HasMouseCursors = 2,
HasSetMousePos = 4,
RendererHasVtxOffset = 8,
PlatformHasViewports = 1024,
HasMouseHoveredViewport = 2048,
RendererHasViewports = 4096,
}
}

View File

@ -0,0 +1,13 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiButtonFlags
{
None = 0,
MouseButtonLeft = 1,
MouseButtonRight = 2,
MouseButtonMiddle = 4,
MouseButtonMask = 7,
MouseButtonDefault = 1,
}
}

View File

@ -0,0 +1,16 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiChildFlags
{
None = 0,
Border = 1,
AlwaysUseWindowPadding = 2,
ResizeX = 4,
ResizeY = 8,
AutoResizeX = 16,
AutoResizeY = 32,
AlwaysAutoResize = 64,
FrameStyle = 128,
}
}

View File

@ -0,0 +1,62 @@
namespace ImGuiNET
{
public enum ImGuiCol
{
Text = 0,
TextDisabled = 1,
WindowBg = 2,
ChildBg = 3,
PopupBg = 4,
Border = 5,
BorderShadow = 6,
FrameBg = 7,
FrameBgHovered = 8,
FrameBgActive = 9,
TitleBg = 10,
TitleBgActive = 11,
TitleBgCollapsed = 12,
MenuBarBg = 13,
ScrollbarBg = 14,
ScrollbarGrab = 15,
ScrollbarGrabHovered = 16,
ScrollbarGrabActive = 17,
CheckMark = 18,
SliderGrab = 19,
SliderGrabActive = 20,
Button = 21,
ButtonHovered = 22,
ButtonActive = 23,
Header = 24,
HeaderHovered = 25,
HeaderActive = 26,
Separator = 27,
SeparatorHovered = 28,
SeparatorActive = 29,
ResizeGrip = 30,
ResizeGripHovered = 31,
ResizeGripActive = 32,
Tab = 33,
TabHovered = 34,
TabActive = 35,
TabUnfocused = 36,
TabUnfocusedActive = 37,
DockingPreview = 38,
DockingEmptyBg = 39,
PlotLines = 40,
PlotLinesHovered = 41,
PlotHistogram = 42,
PlotHistogramHovered = 43,
TableHeaderBg = 44,
TableBorderStrong = 45,
TableBorderLight = 46,
TableRowBg = 47,
TableRowBgAlt = 48,
TextSelectedBg = 49,
DragDropTarget = 50,
NavHighlight = 51,
NavWindowingHighlight = 52,
NavWindowingDimBg = 53,
ModalWindowDimBg = 54,
COUNT = 55,
}
}

View File

@ -0,0 +1,36 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiColorEditFlags
{
None = 0,
NoAlpha = 2,
NoPicker = 4,
NoOptions = 8,
NoSmallPreview = 16,
NoInputs = 32,
NoTooltip = 64,
NoLabel = 128,
NoSidePreview = 256,
NoDragDrop = 512,
NoBorder = 1024,
AlphaBar = 65536,
AlphaPreview = 131072,
AlphaPreviewHalf = 262144,
HDR = 524288,
DisplayRGB = 1048576,
DisplayHSV = 2097152,
DisplayHex = 4194304,
Uint8 = 8388608,
Float = 16777216,
PickerHueBar = 33554432,
PickerHueWheel = 67108864,
InputRGB = 134217728,
InputHSV = 268435456,
DefaultOptions = 177209344,
DisplayMask = 7340032,
DataTypeMask = 25165824,
PickerMask = 100663296,
InputMask = 402653184,
}
}

View File

@ -0,0 +1,17 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiComboFlags
{
None = 0,
PopupAlignLeft = 1,
HeightSmall = 2,
HeightRegular = 4,
HeightLarge = 8,
HeightLargest = 16,
NoArrowButton = 32,
NoPreview = 64,
WidthFitPreview = 128,
HeightMask = 30,
}
}

View File

@ -0,0 +1,11 @@
namespace ImGuiNET
{
public enum ImGuiCond
{
None = 0,
Always = 1,
Once = 2,
FirstUseEver = 4,
Appearing = 8,
}
}

View File

@ -0,0 +1,20 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiConfigFlags
{
None = 0,
NavEnableKeyboard = 1,
NavEnableGamepad = 2,
NavEnableSetMousePos = 4,
NavNoCaptureKeyboard = 8,
NoMouse = 16,
NoMouseCursorChange = 32,
DockingEnable = 64,
ViewportsEnable = 1024,
DpiEnableScaleViewports = 16384,
DpiEnableScaleFonts = 32768,
IsSRGB = 1048576,
IsTouchScreen = 2097152,
}
}

View File

@ -0,0 +1,17 @@
namespace ImGuiNET
{
public enum ImGuiDataType
{
S8 = 0,
U8 = 1,
S16 = 2,
U16 = 3,
S32 = 4,
U32 = 5,
S64 = 6,
U64 = 7,
Float = 8,
Double = 9,
COUNT = 10,
}
}

View File

@ -0,0 +1,12 @@
namespace ImGuiNET
{
public enum ImGuiDir
{
None = -1,
Left = 0,
Right = 1,
Up = 2,
Down = 3,
COUNT = 4,
}
}

View File

@ -0,0 +1,15 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiDockNodeFlags
{
None = 0,
KeepAliveOnly = 1,
NoDockingOverCentralNode = 4,
PassthruCentralNode = 8,
NoDockingSplit = 16,
NoResize = 32,
AutoHideTabBar = 64,
NoUndocking = 128,
}
}

View File

@ -0,0 +1,18 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiDragDropFlags
{
None = 0,
SourceNoPreviewTooltip = 1,
SourceNoDisableHover = 2,
SourceNoHoldToOpenOthers = 4,
SourceAllowNullID = 8,
SourceExtern = 16,
SourceAutoExpirePayload = 32,
AcceptBeforeDelivery = 1024,
AcceptNoDrawDefaultRect = 2048,
AcceptNoPreviewTooltip = 4096,
AcceptPeekOnly = 3072,
}
}

View File

@ -0,0 +1,14 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiFocusedFlags
{
None = 0,
ChildWindows = 1,
RootWindow = 2,
AnyWindow = 4,
NoPopupHierarchy = 8,
DockHierarchy = 16,
RootAndChildWindows = 3,
}
}

View File

@ -0,0 +1,28 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiHoveredFlags
{
None = 0,
ChildWindows = 1,
RootWindow = 2,
AnyWindow = 4,
NoPopupHierarchy = 8,
DockHierarchy = 16,
AllowWhenBlockedByPopup = 32,
AllowWhenBlockedByActiveItem = 128,
AllowWhenOverlappedByItem = 256,
AllowWhenOverlappedByWindow = 512,
AllowWhenDisabled = 1024,
NoNavOverride = 2048,
AllowWhenOverlapped = 768,
RectOnly = 928,
RootAndChildWindows = 3,
ForTooltip = 4096,
Stationary = 8192,
DelayNone = 16384,
DelayShort = 32768,
DelayNormal = 65536,
NoSharedDelay = 131072,
}
}

View File

@ -0,0 +1,503 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiIO
{
public ImGuiConfigFlags ConfigFlags;
public ImGuiBackendFlags BackendFlags;
public Vector2 DisplaySize;
public float DeltaTime;
public float IniSavingRate;
public byte* IniFilename;
public byte* LogFilename;
public void* UserData;
public ImFontAtlas* Fonts;
public float FontGlobalScale;
public byte FontAllowUserScaling;
public ImFont* FontDefault;
public Vector2 DisplayFramebufferScale;
public byte ConfigDockingNoSplit;
public byte ConfigDockingWithShift;
public byte ConfigDockingAlwaysTabBar;
public byte ConfigDockingTransparentPayload;
public byte ConfigViewportsNoAutoMerge;
public byte ConfigViewportsNoTaskBarIcon;
public byte ConfigViewportsNoDecoration;
public byte ConfigViewportsNoDefaultParent;
public byte MouseDrawCursor;
public byte ConfigMacOSXBehaviors;
public byte ConfigInputTrickleEventQueue;
public byte ConfigInputTextCursorBlink;
public byte ConfigInputTextEnterKeepActive;
public byte ConfigDragClickToInputText;
public byte ConfigWindowsResizeFromEdges;
public byte ConfigWindowsMoveFromTitleBarOnly;
public float ConfigMemoryCompactTimer;
public float MouseDoubleClickTime;
public float MouseDoubleClickMaxDist;
public float MouseDragThreshold;
public float KeyRepeatDelay;
public float KeyRepeatRate;
public byte ConfigDebugBeginReturnValueOnce;
public byte ConfigDebugBeginReturnValueLoop;
public byte ConfigDebugIgnoreFocusLoss;
public byte ConfigDebugIniSettings;
public byte* BackendPlatformName;
public byte* BackendRendererName;
public void* BackendPlatformUserData;
public void* BackendRendererUserData;
public void* BackendLanguageUserData;
public IntPtr GetClipboardTextFn;
public IntPtr SetClipboardTextFn;
public void* ClipboardUserData;
public IntPtr SetPlatformImeDataFn;
public ushort PlatformLocaleDecimalPoint;
public byte WantCaptureMouse;
public byte WantCaptureKeyboard;
public byte WantTextInput;
public byte WantSetMousePos;
public byte WantSaveIniSettings;
public byte NavActive;
public byte NavVisible;
public float Framerate;
public int MetricsRenderVertices;
public int MetricsRenderIndices;
public int MetricsRenderWindows;
public int MetricsActiveWindows;
public Vector2 MouseDelta;
public void* _UnusedPadding;
public IntPtr Ctx;
public Vector2 MousePos;
public fixed byte MouseDown[5];
public float MouseWheel;
public float MouseWheelH;
public ImGuiMouseSource MouseSource;
public uint MouseHoveredViewport;
public byte KeyCtrl;
public byte KeyShift;
public byte KeyAlt;
public byte KeySuper;
public ImGuiKey KeyMods;
public ImGuiKeyData KeysData_0;
public ImGuiKeyData KeysData_1;
public ImGuiKeyData KeysData_2;
public ImGuiKeyData KeysData_3;
public ImGuiKeyData KeysData_4;
public ImGuiKeyData KeysData_5;
public ImGuiKeyData KeysData_6;
public ImGuiKeyData KeysData_7;
public ImGuiKeyData KeysData_8;
public ImGuiKeyData KeysData_9;
public ImGuiKeyData KeysData_10;
public ImGuiKeyData KeysData_11;
public ImGuiKeyData KeysData_12;
public ImGuiKeyData KeysData_13;
public ImGuiKeyData KeysData_14;
public ImGuiKeyData KeysData_15;
public ImGuiKeyData KeysData_16;
public ImGuiKeyData KeysData_17;
public ImGuiKeyData KeysData_18;
public ImGuiKeyData KeysData_19;
public ImGuiKeyData KeysData_20;
public ImGuiKeyData KeysData_21;
public ImGuiKeyData KeysData_22;
public ImGuiKeyData KeysData_23;
public ImGuiKeyData KeysData_24;
public ImGuiKeyData KeysData_25;
public ImGuiKeyData KeysData_26;
public ImGuiKeyData KeysData_27;
public ImGuiKeyData KeysData_28;
public ImGuiKeyData KeysData_29;
public ImGuiKeyData KeysData_30;
public ImGuiKeyData KeysData_31;
public ImGuiKeyData KeysData_32;
public ImGuiKeyData KeysData_33;
public ImGuiKeyData KeysData_34;
public ImGuiKeyData KeysData_35;
public ImGuiKeyData KeysData_36;
public ImGuiKeyData KeysData_37;
public ImGuiKeyData KeysData_38;
public ImGuiKeyData KeysData_39;
public ImGuiKeyData KeysData_40;
public ImGuiKeyData KeysData_41;
public ImGuiKeyData KeysData_42;
public ImGuiKeyData KeysData_43;
public ImGuiKeyData KeysData_44;
public ImGuiKeyData KeysData_45;
public ImGuiKeyData KeysData_46;
public ImGuiKeyData KeysData_47;
public ImGuiKeyData KeysData_48;
public ImGuiKeyData KeysData_49;
public ImGuiKeyData KeysData_50;
public ImGuiKeyData KeysData_51;
public ImGuiKeyData KeysData_52;
public ImGuiKeyData KeysData_53;
public ImGuiKeyData KeysData_54;
public ImGuiKeyData KeysData_55;
public ImGuiKeyData KeysData_56;
public ImGuiKeyData KeysData_57;
public ImGuiKeyData KeysData_58;
public ImGuiKeyData KeysData_59;
public ImGuiKeyData KeysData_60;
public ImGuiKeyData KeysData_61;
public ImGuiKeyData KeysData_62;
public ImGuiKeyData KeysData_63;
public ImGuiKeyData KeysData_64;
public ImGuiKeyData KeysData_65;
public ImGuiKeyData KeysData_66;
public ImGuiKeyData KeysData_67;
public ImGuiKeyData KeysData_68;
public ImGuiKeyData KeysData_69;
public ImGuiKeyData KeysData_70;
public ImGuiKeyData KeysData_71;
public ImGuiKeyData KeysData_72;
public ImGuiKeyData KeysData_73;
public ImGuiKeyData KeysData_74;
public ImGuiKeyData KeysData_75;
public ImGuiKeyData KeysData_76;
public ImGuiKeyData KeysData_77;
public ImGuiKeyData KeysData_78;
public ImGuiKeyData KeysData_79;
public ImGuiKeyData KeysData_80;
public ImGuiKeyData KeysData_81;
public ImGuiKeyData KeysData_82;
public ImGuiKeyData KeysData_83;
public ImGuiKeyData KeysData_84;
public ImGuiKeyData KeysData_85;
public ImGuiKeyData KeysData_86;
public ImGuiKeyData KeysData_87;
public ImGuiKeyData KeysData_88;
public ImGuiKeyData KeysData_89;
public ImGuiKeyData KeysData_90;
public ImGuiKeyData KeysData_91;
public ImGuiKeyData KeysData_92;
public ImGuiKeyData KeysData_93;
public ImGuiKeyData KeysData_94;
public ImGuiKeyData KeysData_95;
public ImGuiKeyData KeysData_96;
public ImGuiKeyData KeysData_97;
public ImGuiKeyData KeysData_98;
public ImGuiKeyData KeysData_99;
public ImGuiKeyData KeysData_100;
public ImGuiKeyData KeysData_101;
public ImGuiKeyData KeysData_102;
public ImGuiKeyData KeysData_103;
public ImGuiKeyData KeysData_104;
public ImGuiKeyData KeysData_105;
public ImGuiKeyData KeysData_106;
public ImGuiKeyData KeysData_107;
public ImGuiKeyData KeysData_108;
public ImGuiKeyData KeysData_109;
public ImGuiKeyData KeysData_110;
public ImGuiKeyData KeysData_111;
public ImGuiKeyData KeysData_112;
public ImGuiKeyData KeysData_113;
public ImGuiKeyData KeysData_114;
public ImGuiKeyData KeysData_115;
public ImGuiKeyData KeysData_116;
public ImGuiKeyData KeysData_117;
public ImGuiKeyData KeysData_118;
public ImGuiKeyData KeysData_119;
public ImGuiKeyData KeysData_120;
public ImGuiKeyData KeysData_121;
public ImGuiKeyData KeysData_122;
public ImGuiKeyData KeysData_123;
public ImGuiKeyData KeysData_124;
public ImGuiKeyData KeysData_125;
public ImGuiKeyData KeysData_126;
public ImGuiKeyData KeysData_127;
public ImGuiKeyData KeysData_128;
public ImGuiKeyData KeysData_129;
public ImGuiKeyData KeysData_130;
public ImGuiKeyData KeysData_131;
public ImGuiKeyData KeysData_132;
public ImGuiKeyData KeysData_133;
public ImGuiKeyData KeysData_134;
public ImGuiKeyData KeysData_135;
public ImGuiKeyData KeysData_136;
public ImGuiKeyData KeysData_137;
public ImGuiKeyData KeysData_138;
public ImGuiKeyData KeysData_139;
public ImGuiKeyData KeysData_140;
public ImGuiKeyData KeysData_141;
public ImGuiKeyData KeysData_142;
public ImGuiKeyData KeysData_143;
public ImGuiKeyData KeysData_144;
public ImGuiKeyData KeysData_145;
public ImGuiKeyData KeysData_146;
public ImGuiKeyData KeysData_147;
public ImGuiKeyData KeysData_148;
public ImGuiKeyData KeysData_149;
public ImGuiKeyData KeysData_150;
public ImGuiKeyData KeysData_151;
public ImGuiKeyData KeysData_152;
public ImGuiKeyData KeysData_153;
public byte WantCaptureMouseUnlessPopupClose;
public Vector2 MousePosPrev;
public Vector2 MouseClickedPos_0;
public Vector2 MouseClickedPos_1;
public Vector2 MouseClickedPos_2;
public Vector2 MouseClickedPos_3;
public Vector2 MouseClickedPos_4;
public fixed double MouseClickedTime[5];
public fixed byte MouseClicked[5];
public fixed byte MouseDoubleClicked[5];
public fixed ushort MouseClickedCount[5];
public fixed ushort MouseClickedLastCount[5];
public fixed byte MouseReleased[5];
public fixed byte MouseDownOwned[5];
public fixed byte MouseDownOwnedUnlessPopupClose[5];
public byte MouseWheelRequestAxisSwap;
public fixed float MouseDownDuration[5];
public fixed float MouseDownDurationPrev[5];
public Vector2 MouseDragMaxDistanceAbs_0;
public Vector2 MouseDragMaxDistanceAbs_1;
public Vector2 MouseDragMaxDistanceAbs_2;
public Vector2 MouseDragMaxDistanceAbs_3;
public Vector2 MouseDragMaxDistanceAbs_4;
public fixed float MouseDragMaxDistanceSqr[5];
public float PenPressure;
public byte AppFocusLost;
public byte AppAcceptingEvents;
public sbyte BackendUsingLegacyKeyArrays;
public byte BackendUsingLegacyNavInputArray;
public ushort InputQueueSurrogate;
public ImVector InputQueueCharacters;
}
public unsafe partial struct ImGuiIOPtr
{
public ImGuiIO* NativePtr { get; }
public ImGuiIOPtr(ImGuiIO* nativePtr) => NativePtr = nativePtr;
public ImGuiIOPtr(IntPtr nativePtr) => NativePtr = (ImGuiIO*)nativePtr;
public static implicit operator ImGuiIOPtr(ImGuiIO* nativePtr) => new ImGuiIOPtr(nativePtr);
public static implicit operator ImGuiIO* (ImGuiIOPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiIOPtr(IntPtr nativePtr) => new ImGuiIOPtr(nativePtr);
public ref ImGuiConfigFlags ConfigFlags => ref Unsafe.AsRef<ImGuiConfigFlags>(&NativePtr->ConfigFlags);
public ref ImGuiBackendFlags BackendFlags => ref Unsafe.AsRef<ImGuiBackendFlags>(&NativePtr->BackendFlags);
public ref Vector2 DisplaySize => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplaySize);
public ref float DeltaTime => ref Unsafe.AsRef<float>(&NativePtr->DeltaTime);
public ref float IniSavingRate => ref Unsafe.AsRef<float>(&NativePtr->IniSavingRate);
public NullTerminatedString IniFilename => new NullTerminatedString(NativePtr->IniFilename);
public NullTerminatedString LogFilename => new NullTerminatedString(NativePtr->LogFilename);
public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; }
public ImFontAtlasPtr Fonts => new ImFontAtlasPtr(NativePtr->Fonts);
public ref float FontGlobalScale => ref Unsafe.AsRef<float>(&NativePtr->FontGlobalScale);
public ref bool FontAllowUserScaling => ref Unsafe.AsRef<bool>(&NativePtr->FontAllowUserScaling);
public ImFontPtr FontDefault => new ImFontPtr(NativePtr->FontDefault);
public ref Vector2 DisplayFramebufferScale => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayFramebufferScale);
public ref bool ConfigDockingNoSplit => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDockingNoSplit);
public ref bool ConfigDockingWithShift => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDockingWithShift);
public ref bool ConfigDockingAlwaysTabBar => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDockingAlwaysTabBar);
public ref bool ConfigDockingTransparentPayload => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDockingTransparentPayload);
public ref bool ConfigViewportsNoAutoMerge => ref Unsafe.AsRef<bool>(&NativePtr->ConfigViewportsNoAutoMerge);
public ref bool ConfigViewportsNoTaskBarIcon => ref Unsafe.AsRef<bool>(&NativePtr->ConfigViewportsNoTaskBarIcon);
public ref bool ConfigViewportsNoDecoration => ref Unsafe.AsRef<bool>(&NativePtr->ConfigViewportsNoDecoration);
public ref bool ConfigViewportsNoDefaultParent => ref Unsafe.AsRef<bool>(&NativePtr->ConfigViewportsNoDefaultParent);
public ref bool MouseDrawCursor => ref Unsafe.AsRef<bool>(&NativePtr->MouseDrawCursor);
public ref bool ConfigMacOSXBehaviors => ref Unsafe.AsRef<bool>(&NativePtr->ConfigMacOSXBehaviors);
public ref bool ConfigInputTrickleEventQueue => ref Unsafe.AsRef<bool>(&NativePtr->ConfigInputTrickleEventQueue);
public ref bool ConfigInputTextCursorBlink => ref Unsafe.AsRef<bool>(&NativePtr->ConfigInputTextCursorBlink);
public ref bool ConfigInputTextEnterKeepActive => ref Unsafe.AsRef<bool>(&NativePtr->ConfigInputTextEnterKeepActive);
public ref bool ConfigDragClickToInputText => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDragClickToInputText);
public ref bool ConfigWindowsResizeFromEdges => ref Unsafe.AsRef<bool>(&NativePtr->ConfigWindowsResizeFromEdges);
public ref bool ConfigWindowsMoveFromTitleBarOnly => ref Unsafe.AsRef<bool>(&NativePtr->ConfigWindowsMoveFromTitleBarOnly);
public ref float ConfigMemoryCompactTimer => ref Unsafe.AsRef<float>(&NativePtr->ConfigMemoryCompactTimer);
public ref float MouseDoubleClickTime => ref Unsafe.AsRef<float>(&NativePtr->MouseDoubleClickTime);
public ref float MouseDoubleClickMaxDist => ref Unsafe.AsRef<float>(&NativePtr->MouseDoubleClickMaxDist);
public ref float MouseDragThreshold => ref Unsafe.AsRef<float>(&NativePtr->MouseDragThreshold);
public ref float KeyRepeatDelay => ref Unsafe.AsRef<float>(&NativePtr->KeyRepeatDelay);
public ref float KeyRepeatRate => ref Unsafe.AsRef<float>(&NativePtr->KeyRepeatRate);
public ref bool ConfigDebugBeginReturnValueOnce => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDebugBeginReturnValueOnce);
public ref bool ConfigDebugBeginReturnValueLoop => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDebugBeginReturnValueLoop);
public ref bool ConfigDebugIgnoreFocusLoss => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDebugIgnoreFocusLoss);
public ref bool ConfigDebugIniSettings => ref Unsafe.AsRef<bool>(&NativePtr->ConfigDebugIniSettings);
public NullTerminatedString BackendPlatformName => new NullTerminatedString(NativePtr->BackendPlatformName);
public NullTerminatedString BackendRendererName => new NullTerminatedString(NativePtr->BackendRendererName);
public IntPtr BackendPlatformUserData { get => (IntPtr)NativePtr->BackendPlatformUserData; set => NativePtr->BackendPlatformUserData = (void*)value; }
public IntPtr BackendRendererUserData { get => (IntPtr)NativePtr->BackendRendererUserData; set => NativePtr->BackendRendererUserData = (void*)value; }
public IntPtr BackendLanguageUserData { get => (IntPtr)NativePtr->BackendLanguageUserData; set => NativePtr->BackendLanguageUserData = (void*)value; }
public ref IntPtr GetClipboardTextFn => ref Unsafe.AsRef<IntPtr>(&NativePtr->GetClipboardTextFn);
public ref IntPtr SetClipboardTextFn => ref Unsafe.AsRef<IntPtr>(&NativePtr->SetClipboardTextFn);
public IntPtr ClipboardUserData { get => (IntPtr)NativePtr->ClipboardUserData; set => NativePtr->ClipboardUserData = (void*)value; }
public ref IntPtr SetPlatformImeDataFn => ref Unsafe.AsRef<IntPtr>(&NativePtr->SetPlatformImeDataFn);
public ref ushort PlatformLocaleDecimalPoint => ref Unsafe.AsRef<ushort>(&NativePtr->PlatformLocaleDecimalPoint);
public ref bool WantCaptureMouse => ref Unsafe.AsRef<bool>(&NativePtr->WantCaptureMouse);
public ref bool WantCaptureKeyboard => ref Unsafe.AsRef<bool>(&NativePtr->WantCaptureKeyboard);
public ref bool WantTextInput => ref Unsafe.AsRef<bool>(&NativePtr->WantTextInput);
public ref bool WantSetMousePos => ref Unsafe.AsRef<bool>(&NativePtr->WantSetMousePos);
public ref bool WantSaveIniSettings => ref Unsafe.AsRef<bool>(&NativePtr->WantSaveIniSettings);
public ref bool NavActive => ref Unsafe.AsRef<bool>(&NativePtr->NavActive);
public ref bool NavVisible => ref Unsafe.AsRef<bool>(&NativePtr->NavVisible);
public ref float Framerate => ref Unsafe.AsRef<float>(&NativePtr->Framerate);
public ref int MetricsRenderVertices => ref Unsafe.AsRef<int>(&NativePtr->MetricsRenderVertices);
public ref int MetricsRenderIndices => ref Unsafe.AsRef<int>(&NativePtr->MetricsRenderIndices);
public ref int MetricsRenderWindows => ref Unsafe.AsRef<int>(&NativePtr->MetricsRenderWindows);
public ref int MetricsActiveWindows => ref Unsafe.AsRef<int>(&NativePtr->MetricsActiveWindows);
public ref Vector2 MouseDelta => ref Unsafe.AsRef<Vector2>(&NativePtr->MouseDelta);
public IntPtr _UnusedPadding { get => (IntPtr)NativePtr->_UnusedPadding; set => NativePtr->_UnusedPadding = (void*)value; }
public ref IntPtr Ctx => ref Unsafe.AsRef<IntPtr>(&NativePtr->Ctx);
public ref Vector2 MousePos => ref Unsafe.AsRef<Vector2>(&NativePtr->MousePos);
public RangeAccessor<bool> MouseDown => new RangeAccessor<bool>(NativePtr->MouseDown, 5);
public ref float MouseWheel => ref Unsafe.AsRef<float>(&NativePtr->MouseWheel);
public ref float MouseWheelH => ref Unsafe.AsRef<float>(&NativePtr->MouseWheelH);
public ref ImGuiMouseSource MouseSource => ref Unsafe.AsRef<ImGuiMouseSource>(&NativePtr->MouseSource);
public ref uint MouseHoveredViewport => ref Unsafe.AsRef<uint>(&NativePtr->MouseHoveredViewport);
public ref bool KeyCtrl => ref Unsafe.AsRef<bool>(&NativePtr->KeyCtrl);
public ref bool KeyShift => ref Unsafe.AsRef<bool>(&NativePtr->KeyShift);
public ref bool KeyAlt => ref Unsafe.AsRef<bool>(&NativePtr->KeyAlt);
public ref bool KeySuper => ref Unsafe.AsRef<bool>(&NativePtr->KeySuper);
public ref ImGuiKey KeyMods => ref Unsafe.AsRef<ImGuiKey>(&NativePtr->KeyMods);
public RangeAccessor<ImGuiKeyData> KeysData => new RangeAccessor<ImGuiKeyData>(&NativePtr->KeysData_0, 154);
public ref bool WantCaptureMouseUnlessPopupClose => ref Unsafe.AsRef<bool>(&NativePtr->WantCaptureMouseUnlessPopupClose);
public ref Vector2 MousePosPrev => ref Unsafe.AsRef<Vector2>(&NativePtr->MousePosPrev);
public RangeAccessor<Vector2> MouseClickedPos => new RangeAccessor<Vector2>(&NativePtr->MouseClickedPos_0, 5);
public RangeAccessor<double> MouseClickedTime => new RangeAccessor<double>(NativePtr->MouseClickedTime, 5);
public RangeAccessor<bool> MouseClicked => new RangeAccessor<bool>(NativePtr->MouseClicked, 5);
public RangeAccessor<bool> MouseDoubleClicked => new RangeAccessor<bool>(NativePtr->MouseDoubleClicked, 5);
public RangeAccessor<ushort> MouseClickedCount => new RangeAccessor<ushort>(NativePtr->MouseClickedCount, 5);
public RangeAccessor<ushort> MouseClickedLastCount => new RangeAccessor<ushort>(NativePtr->MouseClickedLastCount, 5);
public RangeAccessor<bool> MouseReleased => new RangeAccessor<bool>(NativePtr->MouseReleased, 5);
public RangeAccessor<bool> MouseDownOwned => new RangeAccessor<bool>(NativePtr->MouseDownOwned, 5);
public RangeAccessor<bool> MouseDownOwnedUnlessPopupClose => new RangeAccessor<bool>(NativePtr->MouseDownOwnedUnlessPopupClose, 5);
public ref bool MouseWheelRequestAxisSwap => ref Unsafe.AsRef<bool>(&NativePtr->MouseWheelRequestAxisSwap);
public RangeAccessor<float> MouseDownDuration => new RangeAccessor<float>(NativePtr->MouseDownDuration, 5);
public RangeAccessor<float> MouseDownDurationPrev => new RangeAccessor<float>(NativePtr->MouseDownDurationPrev, 5);
public RangeAccessor<Vector2> MouseDragMaxDistanceAbs => new RangeAccessor<Vector2>(&NativePtr->MouseDragMaxDistanceAbs_0, 5);
public RangeAccessor<float> MouseDragMaxDistanceSqr => new RangeAccessor<float>(NativePtr->MouseDragMaxDistanceSqr, 5);
public ref float PenPressure => ref Unsafe.AsRef<float>(&NativePtr->PenPressure);
public ref bool AppFocusLost => ref Unsafe.AsRef<bool>(&NativePtr->AppFocusLost);
public ref bool AppAcceptingEvents => ref Unsafe.AsRef<bool>(&NativePtr->AppAcceptingEvents);
public ref sbyte BackendUsingLegacyKeyArrays => ref Unsafe.AsRef<sbyte>(&NativePtr->BackendUsingLegacyKeyArrays);
public ref bool BackendUsingLegacyNavInputArray => ref Unsafe.AsRef<bool>(&NativePtr->BackendUsingLegacyNavInputArray);
public ref ushort InputQueueSurrogate => ref Unsafe.AsRef<ushort>(&NativePtr->InputQueueSurrogate);
public ImVector<ushort> InputQueueCharacters => new ImVector<ushort>(NativePtr->InputQueueCharacters);
public void AddFocusEvent(bool focused)
{
byte native_focused = focused ? (byte)1 : (byte)0;
ImGuiNative.ImGuiIO_AddFocusEvent((ImGuiIO*)(NativePtr), native_focused);
}
public void AddInputCharacter(uint c)
{
ImGuiNative.ImGuiIO_AddInputCharacter((ImGuiIO*)(NativePtr), c);
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void AddInputCharactersUTF8(ReadOnlySpan<char> str)
{
byte* native_str;
int str_byteCount = 0;
if (str != null)
{
str_byteCount = Encoding.UTF8.GetByteCount(str);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
native_str = Util.Allocate(str_byteCount + 1);
}
else
{
byte* native_str_stackBytes = stackalloc byte[str_byteCount + 1];
native_str = native_str_stackBytes;
}
int native_str_offset = Util.GetUtf8(str, native_str, str_byteCount);
native_str[native_str_offset] = 0;
}
else { native_str = null; }
ImGuiNative.ImGuiIO_AddInputCharactersUTF8((ImGuiIO*)(NativePtr), native_str);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_str);
}
}
#endif
public void AddInputCharactersUTF8(string str)
{
byte* native_str;
int str_byteCount = 0;
if (str != null)
{
str_byteCount = Encoding.UTF8.GetByteCount(str);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
native_str = Util.Allocate(str_byteCount + 1);
}
else
{
byte* native_str_stackBytes = stackalloc byte[str_byteCount + 1];
native_str = native_str_stackBytes;
}
int native_str_offset = Util.GetUtf8(str, native_str, str_byteCount);
native_str[native_str_offset] = 0;
}
else { native_str = null; }
ImGuiNative.ImGuiIO_AddInputCharactersUTF8((ImGuiIO*)(NativePtr), native_str);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_str);
}
}
public void AddInputCharacterUTF16(ushort c)
{
ImGuiNative.ImGuiIO_AddInputCharacterUTF16((ImGuiIO*)(NativePtr), c);
}
public void AddKeyAnalogEvent(ImGuiKey key, bool down, float v)
{
byte native_down = down ? (byte)1 : (byte)0;
ImGuiNative.ImGuiIO_AddKeyAnalogEvent((ImGuiIO*)(NativePtr), key, native_down, v);
}
public void AddKeyEvent(ImGuiKey key, bool down)
{
byte native_down = down ? (byte)1 : (byte)0;
ImGuiNative.ImGuiIO_AddKeyEvent((ImGuiIO*)(NativePtr), key, native_down);
}
public void AddMouseButtonEvent(int button, bool down)
{
byte native_down = down ? (byte)1 : (byte)0;
ImGuiNative.ImGuiIO_AddMouseButtonEvent((ImGuiIO*)(NativePtr), button, native_down);
}
public void AddMousePosEvent(float x, float y)
{
ImGuiNative.ImGuiIO_AddMousePosEvent((ImGuiIO*)(NativePtr), x, y);
}
public void AddMouseSourceEvent(ImGuiMouseSource source)
{
ImGuiNative.ImGuiIO_AddMouseSourceEvent((ImGuiIO*)(NativePtr), source);
}
public void AddMouseViewportEvent(uint id)
{
ImGuiNative.ImGuiIO_AddMouseViewportEvent((ImGuiIO*)(NativePtr), id);
}
public void AddMouseWheelEvent(float wheel_x, float wheel_y)
{
ImGuiNative.ImGuiIO_AddMouseWheelEvent((ImGuiIO*)(NativePtr), wheel_x, wheel_y);
}
public void ClearEventsQueue()
{
ImGuiNative.ImGuiIO_ClearEventsQueue((ImGuiIO*)(NativePtr));
}
public void ClearInputKeys()
{
ImGuiNative.ImGuiIO_ClearInputKeys((ImGuiIO*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImGuiIO_destroy((ImGuiIO*)(NativePtr));
}
public void SetAppAcceptingEvents(bool accepting_events)
{
byte native_accepting_events = accepting_events ? (byte)1 : (byte)0;
ImGuiNative.ImGuiIO_SetAppAcceptingEvents((ImGuiIO*)(NativePtr), native_accepting_events);
}
public void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode)
{
int native_legacy_index = -1;
ImGuiNative.ImGuiIO_SetKeyEventNativeData((ImGuiIO*)(NativePtr), key, native_keycode, native_scancode, native_legacy_index);
}
public void SetKeyEventNativeData(ImGuiKey key, int native_keycode, int native_scancode, int native_legacy_index)
{
ImGuiNative.ImGuiIO_SetKeyEventNativeData((ImGuiIO*)(NativePtr), key, native_keycode, native_scancode, native_legacy_index);
}
}
}

View File

@ -0,0 +1,121 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiInputTextCallbackData
{
public IntPtr Ctx;
public ImGuiInputTextFlags EventFlag;
public ImGuiInputTextFlags Flags;
public void* UserData;
public ushort EventChar;
public ImGuiKey EventKey;
public byte* Buf;
public int BufTextLen;
public int BufSize;
public byte BufDirty;
public int CursorPos;
public int SelectionStart;
public int SelectionEnd;
}
public unsafe partial struct ImGuiInputTextCallbackDataPtr
{
public ImGuiInputTextCallbackData* NativePtr { get; }
public ImGuiInputTextCallbackDataPtr(ImGuiInputTextCallbackData* nativePtr) => NativePtr = nativePtr;
public ImGuiInputTextCallbackDataPtr(IntPtr nativePtr) => NativePtr = (ImGuiInputTextCallbackData*)nativePtr;
public static implicit operator ImGuiInputTextCallbackDataPtr(ImGuiInputTextCallbackData* nativePtr) => new ImGuiInputTextCallbackDataPtr(nativePtr);
public static implicit operator ImGuiInputTextCallbackData* (ImGuiInputTextCallbackDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiInputTextCallbackDataPtr(IntPtr nativePtr) => new ImGuiInputTextCallbackDataPtr(nativePtr);
public ref IntPtr Ctx => ref Unsafe.AsRef<IntPtr>(&NativePtr->Ctx);
public ref ImGuiInputTextFlags EventFlag => ref Unsafe.AsRef<ImGuiInputTextFlags>(&NativePtr->EventFlag);
public ref ImGuiInputTextFlags Flags => ref Unsafe.AsRef<ImGuiInputTextFlags>(&NativePtr->Flags);
public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; }
public ref ushort EventChar => ref Unsafe.AsRef<ushort>(&NativePtr->EventChar);
public ref ImGuiKey EventKey => ref Unsafe.AsRef<ImGuiKey>(&NativePtr->EventKey);
public IntPtr Buf { get => (IntPtr)NativePtr->Buf; set => NativePtr->Buf = (byte*)value; }
public ref int BufTextLen => ref Unsafe.AsRef<int>(&NativePtr->BufTextLen);
public ref int BufSize => ref Unsafe.AsRef<int>(&NativePtr->BufSize);
public ref bool BufDirty => ref Unsafe.AsRef<bool>(&NativePtr->BufDirty);
public ref int CursorPos => ref Unsafe.AsRef<int>(&NativePtr->CursorPos);
public ref int SelectionStart => ref Unsafe.AsRef<int>(&NativePtr->SelectionStart);
public ref int SelectionEnd => ref Unsafe.AsRef<int>(&NativePtr->SelectionEnd);
public void ClearSelection()
{
ImGuiNative.ImGuiInputTextCallbackData_ClearSelection((ImGuiInputTextCallbackData*)(NativePtr));
}
public void DeleteChars(int pos, int bytes_count)
{
ImGuiNative.ImGuiInputTextCallbackData_DeleteChars((ImGuiInputTextCallbackData*)(NativePtr), pos, bytes_count);
}
public void Destroy()
{
ImGuiNative.ImGuiInputTextCallbackData_destroy((ImGuiInputTextCallbackData*)(NativePtr));
}
public bool HasSelection()
{
byte ret = ImGuiNative.ImGuiInputTextCallbackData_HasSelection((ImGuiInputTextCallbackData*)(NativePtr));
return ret != 0;
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void InsertChars(int pos, ReadOnlySpan<char> text)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
ImGuiNative.ImGuiInputTextCallbackData_InsertChars((ImGuiInputTextCallbackData*)(NativePtr), pos, native_text, native_text+text_byteCount);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
}
#endif
public void InsertChars(int pos, string text)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
ImGuiNative.ImGuiInputTextCallbackData_InsertChars((ImGuiInputTextCallbackData*)(NativePtr), pos, native_text, native_text+text_byteCount);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
}
public void SelectAll()
{
ImGuiNative.ImGuiInputTextCallbackData_SelectAll((ImGuiInputTextCallbackData*)(NativePtr));
}
}
}

View File

@ -0,0 +1,29 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiInputTextFlags
{
None = 0,
CharsDecimal = 1,
CharsHexadecimal = 2,
CharsUppercase = 4,
CharsNoBlank = 8,
AutoSelectAll = 16,
EnterReturnsTrue = 32,
CallbackCompletion = 64,
CallbackHistory = 128,
CallbackAlways = 256,
CallbackCharFilter = 512,
AllowTabInput = 1024,
CtrlEnterForNewLine = 2048,
NoHorizontalScroll = 4096,
AlwaysOverwrite = 8192,
ReadOnly = 16384,
Password = 32768,
NoUndoRedo = 65536,
CharsScientific = 131072,
CallbackResize = 262144,
CallbackEdit = 524288,
EscapeClearsAll = 1048576,
}
}

View File

@ -0,0 +1,174 @@
namespace ImGuiNET
{
public enum ImGuiKey
{
None = 0,
Tab = 512,
LeftArrow = 513,
RightArrow = 514,
UpArrow = 515,
DownArrow = 516,
PageUp = 517,
PageDown = 518,
Home = 519,
End = 520,
Insert = 521,
Delete = 522,
Backspace = 523,
Space = 524,
Enter = 525,
Escape = 526,
LeftCtrl = 527,
LeftShift = 528,
LeftAlt = 529,
LeftSuper = 530,
RightCtrl = 531,
RightShift = 532,
RightAlt = 533,
RightSuper = 534,
Menu = 535,
_0 = 536,
_1 = 537,
_2 = 538,
_3 = 539,
_4 = 540,
_5 = 541,
_6 = 542,
_7 = 543,
_8 = 544,
_9 = 545,
A = 546,
B = 547,
C = 548,
D = 549,
E = 550,
F = 551,
G = 552,
H = 553,
I = 554,
J = 555,
K = 556,
L = 557,
M = 558,
N = 559,
O = 560,
P = 561,
Q = 562,
R = 563,
S = 564,
T = 565,
U = 566,
V = 567,
W = 568,
X = 569,
Y = 570,
Z = 571,
F1 = 572,
F2 = 573,
F3 = 574,
F4 = 575,
F5 = 576,
F6 = 577,
F7 = 578,
F8 = 579,
F9 = 580,
F10 = 581,
F11 = 582,
F12 = 583,
F13 = 584,
F14 = 585,
F15 = 586,
F16 = 587,
F17 = 588,
F18 = 589,
F19 = 590,
F20 = 591,
F21 = 592,
F22 = 593,
F23 = 594,
F24 = 595,
Apostrophe = 596,
Comma = 597,
Minus = 598,
Period = 599,
Slash = 600,
Semicolon = 601,
Equal = 602,
LeftBracket = 603,
Backslash = 604,
RightBracket = 605,
GraveAccent = 606,
CapsLock = 607,
ScrollLock = 608,
NumLock = 609,
PrintScreen = 610,
Pause = 611,
Keypad0 = 612,
Keypad1 = 613,
Keypad2 = 614,
Keypad3 = 615,
Keypad4 = 616,
Keypad5 = 617,
Keypad6 = 618,
Keypad7 = 619,
Keypad8 = 620,
Keypad9 = 621,
KeypadDecimal = 622,
KeypadDivide = 623,
KeypadMultiply = 624,
KeypadSubtract = 625,
KeypadAdd = 626,
KeypadEnter = 627,
KeypadEqual = 628,
AppBack = 629,
AppForward = 630,
GamepadStart = 631,
GamepadBack = 632,
GamepadFaceLeft = 633,
GamepadFaceRight = 634,
GamepadFaceUp = 635,
GamepadFaceDown = 636,
GamepadDpadLeft = 637,
GamepadDpadRight = 638,
GamepadDpadUp = 639,
GamepadDpadDown = 640,
GamepadL1 = 641,
GamepadR1 = 642,
GamepadL2 = 643,
GamepadR2 = 644,
GamepadL3 = 645,
GamepadR3 = 646,
GamepadLStickLeft = 647,
GamepadLStickRight = 648,
GamepadLStickUp = 649,
GamepadLStickDown = 650,
GamepadRStickLeft = 651,
GamepadRStickRight = 652,
GamepadRStickUp = 653,
GamepadRStickDown = 654,
MouseLeft = 655,
MouseRight = 656,
MouseMiddle = 657,
MouseX1 = 658,
MouseX2 = 659,
MouseWheelX = 660,
MouseWheelY = 661,
ReservedForModCtrl = 662,
ReservedForModShift = 663,
ReservedForModAlt = 664,
ReservedForModSuper = 665,
COUNT = 666,
ModNone = 0,
ModCtrl = 4096,
ModShift = 8192,
ModAlt = 16384,
ModSuper = 32768,
ModShortcut = 2048,
ModMask = 63488,
NamedKey_BEGIN = 512,
NamedKey_END = 666,
NamedKey_COUNT = 154,
KeysData_SIZE = 154,
KeysData_OFFSET = 512,
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiKeyData
{
public byte Down;
public float DownDuration;
public float DownDurationPrev;
public float AnalogValue;
}
public unsafe partial struct ImGuiKeyDataPtr
{
public ImGuiKeyData* NativePtr { get; }
public ImGuiKeyDataPtr(ImGuiKeyData* nativePtr) => NativePtr = nativePtr;
public ImGuiKeyDataPtr(IntPtr nativePtr) => NativePtr = (ImGuiKeyData*)nativePtr;
public static implicit operator ImGuiKeyDataPtr(ImGuiKeyData* nativePtr) => new ImGuiKeyDataPtr(nativePtr);
public static implicit operator ImGuiKeyData* (ImGuiKeyDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiKeyDataPtr(IntPtr nativePtr) => new ImGuiKeyDataPtr(nativePtr);
public ref bool Down => ref Unsafe.AsRef<bool>(&NativePtr->Down);
public ref float DownDuration => ref Unsafe.AsRef<float>(&NativePtr->DownDuration);
public ref float DownDurationPrev => ref Unsafe.AsRef<float>(&NativePtr->DownDurationPrev);
public ref float AnalogValue => ref Unsafe.AsRef<float>(&NativePtr->AnalogValue);
}
}

View File

@ -0,0 +1,60 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiListClipper
{
public IntPtr Ctx;
public int DisplayStart;
public int DisplayEnd;
public int ItemsCount;
public float ItemsHeight;
public float StartPosY;
public void* TempData;
}
public unsafe partial struct ImGuiListClipperPtr
{
public ImGuiListClipper* NativePtr { get; }
public ImGuiListClipperPtr(ImGuiListClipper* nativePtr) => NativePtr = nativePtr;
public ImGuiListClipperPtr(IntPtr nativePtr) => NativePtr = (ImGuiListClipper*)nativePtr;
public static implicit operator ImGuiListClipperPtr(ImGuiListClipper* nativePtr) => new ImGuiListClipperPtr(nativePtr);
public static implicit operator ImGuiListClipper* (ImGuiListClipperPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiListClipperPtr(IntPtr nativePtr) => new ImGuiListClipperPtr(nativePtr);
public ref IntPtr Ctx => ref Unsafe.AsRef<IntPtr>(&NativePtr->Ctx);
public ref int DisplayStart => ref Unsafe.AsRef<int>(&NativePtr->DisplayStart);
public ref int DisplayEnd => ref Unsafe.AsRef<int>(&NativePtr->DisplayEnd);
public ref int ItemsCount => ref Unsafe.AsRef<int>(&NativePtr->ItemsCount);
public ref float ItemsHeight => ref Unsafe.AsRef<float>(&NativePtr->ItemsHeight);
public ref float StartPosY => ref Unsafe.AsRef<float>(&NativePtr->StartPosY);
public IntPtr TempData { get => (IntPtr)NativePtr->TempData; set => NativePtr->TempData = (void*)value; }
public void Begin(int items_count)
{
float items_height = -1.0f;
ImGuiNative.ImGuiListClipper_Begin((ImGuiListClipper*)(NativePtr), items_count, items_height);
}
public void Begin(int items_count, float items_height)
{
ImGuiNative.ImGuiListClipper_Begin((ImGuiListClipper*)(NativePtr), items_count, items_height);
}
public void Destroy()
{
ImGuiNative.ImGuiListClipper_destroy((ImGuiListClipper*)(NativePtr));
}
public void End()
{
ImGuiNative.ImGuiListClipper_End((ImGuiListClipper*)(NativePtr));
}
public void IncludeItemByIndex(int item_index)
{
ImGuiNative.ImGuiListClipper_IncludeItemByIndex((ImGuiListClipper*)(NativePtr), item_index);
}
public bool Step()
{
byte ret = ImGuiNative.ImGuiListClipper_Step((ImGuiListClipper*)(NativePtr));
return ret != 0;
}
}
}

View File

@ -0,0 +1,12 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiModFlags
{
None = 0,
Ctrl = 1,
Shift = 2,
Alt = 4,
Super = 8,
}
}

View File

@ -0,0 +1,10 @@
namespace ImGuiNET
{
public enum ImGuiMouseButton
{
Left = 0,
Right = 1,
Middle = 2,
COUNT = 5,
}
}

View File

@ -0,0 +1,17 @@
namespace ImGuiNET
{
public enum ImGuiMouseCursor
{
None = -1,
Arrow = 0,
TextInput = 1,
ResizeAll = 2,
ResizeNS = 3,
ResizeEW = 4,
ResizeNESW = 5,
ResizeNWSE = 6,
Hand = 7,
NotAllowed = 8,
COUNT = 9,
}
}

View File

@ -0,0 +1,10 @@
namespace ImGuiNET
{
public enum ImGuiMouseSource
{
Mouse = 0,
TouchScreen = 1,
Pen = 2,
COUNT = 3,
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
namespace ImGuiNET
{
public enum ImGuiNavInput
{
Activate = 0,
Cancel = 1,
Input = 2,
Menu = 3,
DpadLeft = 4,
DpadRight = 5,
DpadUp = 6,
DpadDown = 7,
LStickLeft = 8,
LStickRight = 9,
LStickUp = 10,
LStickDown = 11,
FocusPrev = 12,
FocusNext = 13,
TweakSlow = 14,
TweakFast = 15,
COUNT = 16,
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiOnceUponAFrame
{
public int RefFrame;
}
public unsafe partial struct ImGuiOnceUponAFramePtr
{
public ImGuiOnceUponAFrame* NativePtr { get; }
public ImGuiOnceUponAFramePtr(ImGuiOnceUponAFrame* nativePtr) => NativePtr = nativePtr;
public ImGuiOnceUponAFramePtr(IntPtr nativePtr) => NativePtr = (ImGuiOnceUponAFrame*)nativePtr;
public static implicit operator ImGuiOnceUponAFramePtr(ImGuiOnceUponAFrame* nativePtr) => new ImGuiOnceUponAFramePtr(nativePtr);
public static implicit operator ImGuiOnceUponAFrame* (ImGuiOnceUponAFramePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiOnceUponAFramePtr(IntPtr nativePtr) => new ImGuiOnceUponAFramePtr(nativePtr);
public ref int RefFrame => ref Unsafe.AsRef<int>(&NativePtr->RefFrame);
public void Destroy()
{
ImGuiNative.ImGuiOnceUponAFrame_destroy((ImGuiOnceUponAFrame*)(NativePtr));
}
}
}

View File

@ -0,0 +1,110 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiPayload
{
public void* Data;
public int DataSize;
public uint SourceId;
public uint SourceParentId;
public int DataFrameCount;
public fixed byte DataType[33];
public byte Preview;
public byte Delivery;
}
public unsafe partial struct ImGuiPayloadPtr
{
public ImGuiPayload* NativePtr { get; }
public ImGuiPayloadPtr(ImGuiPayload* nativePtr) => NativePtr = nativePtr;
public ImGuiPayloadPtr(IntPtr nativePtr) => NativePtr = (ImGuiPayload*)nativePtr;
public static implicit operator ImGuiPayloadPtr(ImGuiPayload* nativePtr) => new ImGuiPayloadPtr(nativePtr);
public static implicit operator ImGuiPayload* (ImGuiPayloadPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiPayloadPtr(IntPtr nativePtr) => new ImGuiPayloadPtr(nativePtr);
public IntPtr Data { get => (IntPtr)NativePtr->Data; set => NativePtr->Data = (void*)value; }
public ref int DataSize => ref Unsafe.AsRef<int>(&NativePtr->DataSize);
public ref uint SourceId => ref Unsafe.AsRef<uint>(&NativePtr->SourceId);
public ref uint SourceParentId => ref Unsafe.AsRef<uint>(&NativePtr->SourceParentId);
public ref int DataFrameCount => ref Unsafe.AsRef<int>(&NativePtr->DataFrameCount);
public RangeAccessor<byte> DataType => new RangeAccessor<byte>(NativePtr->DataType, 33);
public ref bool Preview => ref Unsafe.AsRef<bool>(&NativePtr->Preview);
public ref bool Delivery => ref Unsafe.AsRef<bool>(&NativePtr->Delivery);
public void Clear()
{
ImGuiNative.ImGuiPayload_Clear((ImGuiPayload*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImGuiPayload_destroy((ImGuiPayload*)(NativePtr));
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public bool IsDataType(ReadOnlySpan<char> type)
{
byte* native_type;
int type_byteCount = 0;
if (type != null)
{
type_byteCount = Encoding.UTF8.GetByteCount(type);
if (type_byteCount > Util.StackAllocationSizeLimit)
{
native_type = Util.Allocate(type_byteCount + 1);
}
else
{
byte* native_type_stackBytes = stackalloc byte[type_byteCount + 1];
native_type = native_type_stackBytes;
}
int native_type_offset = Util.GetUtf8(type, native_type, type_byteCount);
native_type[native_type_offset] = 0;
}
else { native_type = null; }
byte ret = ImGuiNative.ImGuiPayload_IsDataType((ImGuiPayload*)(NativePtr), native_type);
if (type_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_type);
}
return ret != 0;
}
#endif
public bool IsDataType(string type)
{
byte* native_type;
int type_byteCount = 0;
if (type != null)
{
type_byteCount = Encoding.UTF8.GetByteCount(type);
if (type_byteCount > Util.StackAllocationSizeLimit)
{
native_type = Util.Allocate(type_byteCount + 1);
}
else
{
byte* native_type_stackBytes = stackalloc byte[type_byteCount + 1];
native_type = native_type_stackBytes;
}
int native_type_offset = Util.GetUtf8(type, native_type, type_byteCount);
native_type[native_type_offset] = 0;
}
else { native_type = null; }
byte ret = ImGuiNative.ImGuiPayload_IsDataType((ImGuiPayload*)(NativePtr), native_type);
if (type_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_type);
}
return ret != 0;
}
public bool IsDelivery()
{
byte ret = ImGuiNative.ImGuiPayload_IsDelivery((ImGuiPayload*)(NativePtr));
return ret != 0;
}
public bool IsPreview()
{
byte ret = ImGuiNative.ImGuiPayload_IsPreview((ImGuiPayload*)(NativePtr));
return ret != 0;
}
}
}

View File

@ -0,0 +1,74 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiPlatformIO
{
public IntPtr Platform_CreateWindow;
public IntPtr Platform_DestroyWindow;
public IntPtr Platform_ShowWindow;
public IntPtr Platform_SetWindowPos;
public IntPtr Platform_GetWindowPos;
public IntPtr Platform_SetWindowSize;
public IntPtr Platform_GetWindowSize;
public IntPtr Platform_SetWindowFocus;
public IntPtr Platform_GetWindowFocus;
public IntPtr Platform_GetWindowMinimized;
public IntPtr Platform_SetWindowTitle;
public IntPtr Platform_SetWindowAlpha;
public IntPtr Platform_UpdateWindow;
public IntPtr Platform_RenderWindow;
public IntPtr Platform_SwapBuffers;
public IntPtr Platform_GetWindowDpiScale;
public IntPtr Platform_OnChangedViewport;
public IntPtr Platform_CreateVkSurface;
public IntPtr Renderer_CreateWindow;
public IntPtr Renderer_DestroyWindow;
public IntPtr Renderer_SetWindowSize;
public IntPtr Renderer_RenderWindow;
public IntPtr Renderer_SwapBuffers;
public ImVector Monitors;
public ImVector Viewports;
}
public unsafe partial struct ImGuiPlatformIOPtr
{
public ImGuiPlatformIO* NativePtr { get; }
public ImGuiPlatformIOPtr(ImGuiPlatformIO* nativePtr) => NativePtr = nativePtr;
public ImGuiPlatformIOPtr(IntPtr nativePtr) => NativePtr = (ImGuiPlatformIO*)nativePtr;
public static implicit operator ImGuiPlatformIOPtr(ImGuiPlatformIO* nativePtr) => new ImGuiPlatformIOPtr(nativePtr);
public static implicit operator ImGuiPlatformIO* (ImGuiPlatformIOPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiPlatformIOPtr(IntPtr nativePtr) => new ImGuiPlatformIOPtr(nativePtr);
public ref IntPtr Platform_CreateWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_CreateWindow);
public ref IntPtr Platform_DestroyWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_DestroyWindow);
public ref IntPtr Platform_ShowWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_ShowWindow);
public ref IntPtr Platform_SetWindowPos => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_SetWindowPos);
public ref IntPtr Platform_GetWindowPos => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_GetWindowPos);
public ref IntPtr Platform_SetWindowSize => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_SetWindowSize);
public ref IntPtr Platform_GetWindowSize => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_GetWindowSize);
public ref IntPtr Platform_SetWindowFocus => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_SetWindowFocus);
public ref IntPtr Platform_GetWindowFocus => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_GetWindowFocus);
public ref IntPtr Platform_GetWindowMinimized => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_GetWindowMinimized);
public ref IntPtr Platform_SetWindowTitle => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_SetWindowTitle);
public ref IntPtr Platform_SetWindowAlpha => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_SetWindowAlpha);
public ref IntPtr Platform_UpdateWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_UpdateWindow);
public ref IntPtr Platform_RenderWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_RenderWindow);
public ref IntPtr Platform_SwapBuffers => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_SwapBuffers);
public ref IntPtr Platform_GetWindowDpiScale => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_GetWindowDpiScale);
public ref IntPtr Platform_OnChangedViewport => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_OnChangedViewport);
public ref IntPtr Platform_CreateVkSurface => ref Unsafe.AsRef<IntPtr>(&NativePtr->Platform_CreateVkSurface);
public ref IntPtr Renderer_CreateWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Renderer_CreateWindow);
public ref IntPtr Renderer_DestroyWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Renderer_DestroyWindow);
public ref IntPtr Renderer_SetWindowSize => ref Unsafe.AsRef<IntPtr>(&NativePtr->Renderer_SetWindowSize);
public ref IntPtr Renderer_RenderWindow => ref Unsafe.AsRef<IntPtr>(&NativePtr->Renderer_RenderWindow);
public ref IntPtr Renderer_SwapBuffers => ref Unsafe.AsRef<IntPtr>(&NativePtr->Renderer_SwapBuffers);
public ImPtrVector<ImGuiPlatformMonitorPtr> Monitors => new ImPtrVector<ImGuiPlatformMonitorPtr>(NativePtr->Monitors, Unsafe.SizeOf<ImGuiPlatformMonitor>());
public ImVector<ImGuiViewportPtr> Viewports => new ImVector<ImGuiViewportPtr>(NativePtr->Viewports);
public void Destroy()
{
ImGuiNative.ImGuiPlatformIO_destroy((ImGuiPlatformIO*)(NativePtr));
}
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiPlatformImeData
{
public byte WantVisible;
public Vector2 InputPos;
public float InputLineHeight;
}
public unsafe partial struct ImGuiPlatformImeDataPtr
{
public ImGuiPlatformImeData* NativePtr { get; }
public ImGuiPlatformImeDataPtr(ImGuiPlatformImeData* nativePtr) => NativePtr = nativePtr;
public ImGuiPlatformImeDataPtr(IntPtr nativePtr) => NativePtr = (ImGuiPlatformImeData*)nativePtr;
public static implicit operator ImGuiPlatformImeDataPtr(ImGuiPlatformImeData* nativePtr) => new ImGuiPlatformImeDataPtr(nativePtr);
public static implicit operator ImGuiPlatformImeData* (ImGuiPlatformImeDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiPlatformImeDataPtr(IntPtr nativePtr) => new ImGuiPlatformImeDataPtr(nativePtr);
public ref bool WantVisible => ref Unsafe.AsRef<bool>(&NativePtr->WantVisible);
public ref Vector2 InputPos => ref Unsafe.AsRef<Vector2>(&NativePtr->InputPos);
public ref float InputLineHeight => ref Unsafe.AsRef<float>(&NativePtr->InputLineHeight);
public void Destroy()
{
ImGuiNative.ImGuiPlatformImeData_destroy((ImGuiPlatformImeData*)(NativePtr));
}
}
}

View File

@ -0,0 +1,36 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiPlatformMonitor
{
public Vector2 MainPos;
public Vector2 MainSize;
public Vector2 WorkPos;
public Vector2 WorkSize;
public float DpiScale;
public void* PlatformHandle;
}
public unsafe partial struct ImGuiPlatformMonitorPtr
{
public ImGuiPlatformMonitor* NativePtr { get; }
public ImGuiPlatformMonitorPtr(ImGuiPlatformMonitor* nativePtr) => NativePtr = nativePtr;
public ImGuiPlatformMonitorPtr(IntPtr nativePtr) => NativePtr = (ImGuiPlatformMonitor*)nativePtr;
public static implicit operator ImGuiPlatformMonitorPtr(ImGuiPlatformMonitor* nativePtr) => new ImGuiPlatformMonitorPtr(nativePtr);
public static implicit operator ImGuiPlatformMonitor* (ImGuiPlatformMonitorPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiPlatformMonitorPtr(IntPtr nativePtr) => new ImGuiPlatformMonitorPtr(nativePtr);
public ref Vector2 MainPos => ref Unsafe.AsRef<Vector2>(&NativePtr->MainPos);
public ref Vector2 MainSize => ref Unsafe.AsRef<Vector2>(&NativePtr->MainSize);
public ref Vector2 WorkPos => ref Unsafe.AsRef<Vector2>(&NativePtr->WorkPos);
public ref Vector2 WorkSize => ref Unsafe.AsRef<Vector2>(&NativePtr->WorkSize);
public ref float DpiScale => ref Unsafe.AsRef<float>(&NativePtr->DpiScale);
public IntPtr PlatformHandle { get => (IntPtr)NativePtr->PlatformHandle; set => NativePtr->PlatformHandle = (void*)value; }
public void Destroy()
{
ImGuiNative.ImGuiPlatformMonitor_destroy((ImGuiPlatformMonitor*)(NativePtr));
}
}
}

View File

@ -0,0 +1,18 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiPopupFlags
{
None = 0,
MouseButtonLeft = 0,
MouseButtonRight = 1,
MouseButtonMiddle = 2,
MouseButtonMask = 31,
MouseButtonDefault = 1,
NoOpenOverExistingPopup = 32,
NoOpenOverItems = 64,
AnyPopupId = 128,
AnyPopupLevel = 256,
AnyPopup = 384,
}
}

View File

@ -0,0 +1,13 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiSelectableFlags
{
None = 0,
DontClosePopups = 1,
SpanAllColumns = 2,
AllowDoubleClick = 4,
Disabled = 8,
AllowOverlap = 16,
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiSizeCallbackData
{
public void* UserData;
public Vector2 Pos;
public Vector2 CurrentSize;
public Vector2 DesiredSize;
}
public unsafe partial struct ImGuiSizeCallbackDataPtr
{
public ImGuiSizeCallbackData* NativePtr { get; }
public ImGuiSizeCallbackDataPtr(ImGuiSizeCallbackData* nativePtr) => NativePtr = nativePtr;
public ImGuiSizeCallbackDataPtr(IntPtr nativePtr) => NativePtr = (ImGuiSizeCallbackData*)nativePtr;
public static implicit operator ImGuiSizeCallbackDataPtr(ImGuiSizeCallbackData* nativePtr) => new ImGuiSizeCallbackDataPtr(nativePtr);
public static implicit operator ImGuiSizeCallbackData* (ImGuiSizeCallbackDataPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiSizeCallbackDataPtr(IntPtr nativePtr) => new ImGuiSizeCallbackDataPtr(nativePtr);
public IntPtr UserData { get => (IntPtr)NativePtr->UserData; set => NativePtr->UserData = (void*)value; }
public ref Vector2 Pos => ref Unsafe.AsRef<Vector2>(&NativePtr->Pos);
public ref Vector2 CurrentSize => ref Unsafe.AsRef<Vector2>(&NativePtr->CurrentSize);
public ref Vector2 DesiredSize => ref Unsafe.AsRef<Vector2>(&NativePtr->DesiredSize);
}
}

View File

@ -0,0 +1,13 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiSliderFlags
{
None = 0,
AlwaysClamp = 16,
Logarithmic = 32,
NoRoundToFormat = 64,
NoInput = 128,
InvalidMask = 1879048207,
}
}

View File

@ -0,0 +1,9 @@
namespace ImGuiNET
{
public enum ImGuiSortDirection
{
None = 0,
Ascending = 1,
Descending = 2,
}
}

View File

@ -0,0 +1,137 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiStorage
{
public ImVector Data;
}
public unsafe partial struct ImGuiStoragePtr
{
public ImGuiStorage* NativePtr { get; }
public ImGuiStoragePtr(ImGuiStorage* nativePtr) => NativePtr = nativePtr;
public ImGuiStoragePtr(IntPtr nativePtr) => NativePtr = (ImGuiStorage*)nativePtr;
public static implicit operator ImGuiStoragePtr(ImGuiStorage* nativePtr) => new ImGuiStoragePtr(nativePtr);
public static implicit operator ImGuiStorage* (ImGuiStoragePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiStoragePtr(IntPtr nativePtr) => new ImGuiStoragePtr(nativePtr);
public ImPtrVector<ImGuiStoragePairPtr> Data => new ImPtrVector<ImGuiStoragePairPtr>(NativePtr->Data, Unsafe.SizeOf<ImGuiStoragePair>());
public void BuildSortByKey()
{
ImGuiNative.ImGuiStorage_BuildSortByKey((ImGuiStorage*)(NativePtr));
}
public void Clear()
{
ImGuiNative.ImGuiStorage_Clear((ImGuiStorage*)(NativePtr));
}
public bool GetBool(uint key)
{
byte default_val = 0;
byte ret = ImGuiNative.ImGuiStorage_GetBool((ImGuiStorage*)(NativePtr), key, default_val);
return ret != 0;
}
public bool GetBool(uint key, bool default_val)
{
byte native_default_val = default_val ? (byte)1 : (byte)0;
byte ret = ImGuiNative.ImGuiStorage_GetBool((ImGuiStorage*)(NativePtr), key, native_default_val);
return ret != 0;
}
public byte* GetBoolRef(uint key)
{
byte default_val = 0;
byte* ret = ImGuiNative.ImGuiStorage_GetBoolRef((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public byte* GetBoolRef(uint key, bool default_val)
{
byte native_default_val = default_val ? (byte)1 : (byte)0;
byte* ret = ImGuiNative.ImGuiStorage_GetBoolRef((ImGuiStorage*)(NativePtr), key, native_default_val);
return ret;
}
public float GetFloat(uint key)
{
float default_val = 0.0f;
float ret = ImGuiNative.ImGuiStorage_GetFloat((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public float GetFloat(uint key, float default_val)
{
float ret = ImGuiNative.ImGuiStorage_GetFloat((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public float* GetFloatRef(uint key)
{
float default_val = 0.0f;
float* ret = ImGuiNative.ImGuiStorage_GetFloatRef((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public float* GetFloatRef(uint key, float default_val)
{
float* ret = ImGuiNative.ImGuiStorage_GetFloatRef((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public int GetInt(uint key)
{
int default_val = 0;
int ret = ImGuiNative.ImGuiStorage_GetInt((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public int GetInt(uint key, int default_val)
{
int ret = ImGuiNative.ImGuiStorage_GetInt((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public int* GetIntRef(uint key)
{
int default_val = 0;
int* ret = ImGuiNative.ImGuiStorage_GetIntRef((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public int* GetIntRef(uint key, int default_val)
{
int* ret = ImGuiNative.ImGuiStorage_GetIntRef((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public IntPtr GetVoidPtr(uint key)
{
void* ret = ImGuiNative.ImGuiStorage_GetVoidPtr((ImGuiStorage*)(NativePtr), key);
return (IntPtr)ret;
}
public void** GetVoidPtrRef(uint key)
{
void* default_val = null;
void** ret = ImGuiNative.ImGuiStorage_GetVoidPtrRef((ImGuiStorage*)(NativePtr), key, default_val);
return ret;
}
public void** GetVoidPtrRef(uint key, IntPtr default_val)
{
void* native_default_val = (void*)default_val.ToPointer();
void** ret = ImGuiNative.ImGuiStorage_GetVoidPtrRef((ImGuiStorage*)(NativePtr), key, native_default_val);
return ret;
}
public void SetAllInt(int val)
{
ImGuiNative.ImGuiStorage_SetAllInt((ImGuiStorage*)(NativePtr), val);
}
public void SetBool(uint key, bool val)
{
byte native_val = val ? (byte)1 : (byte)0;
ImGuiNative.ImGuiStorage_SetBool((ImGuiStorage*)(NativePtr), key, native_val);
}
public void SetFloat(uint key, float val)
{
ImGuiNative.ImGuiStorage_SetFloat((ImGuiStorage*)(NativePtr), key, val);
}
public void SetInt(uint key, int val)
{
ImGuiNative.ImGuiStorage_SetInt((ImGuiStorage*)(NativePtr), key, val);
}
public void SetVoidPtr(uint key, IntPtr val)
{
void* native_val = (void*)val.ToPointer();
ImGuiNative.ImGuiStorage_SetVoidPtr((ImGuiStorage*)(NativePtr), key, native_val);
}
}
}

View File

@ -0,0 +1,186 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiStyle
{
public float Alpha;
public float DisabledAlpha;
public Vector2 WindowPadding;
public float WindowRounding;
public float WindowBorderSize;
public Vector2 WindowMinSize;
public Vector2 WindowTitleAlign;
public ImGuiDir WindowMenuButtonPosition;
public float ChildRounding;
public float ChildBorderSize;
public float PopupRounding;
public float PopupBorderSize;
public Vector2 FramePadding;
public float FrameRounding;
public float FrameBorderSize;
public Vector2 ItemSpacing;
public Vector2 ItemInnerSpacing;
public Vector2 CellPadding;
public Vector2 TouchExtraPadding;
public float IndentSpacing;
public float ColumnsMinSpacing;
public float ScrollbarSize;
public float ScrollbarRounding;
public float GrabMinSize;
public float GrabRounding;
public float LogSliderDeadzone;
public float TabRounding;
public float TabBorderSize;
public float TabMinWidthForCloseButton;
public float TabBarBorderSize;
public float TableAngledHeadersAngle;
public ImGuiDir ColorButtonPosition;
public Vector2 ButtonTextAlign;
public Vector2 SelectableTextAlign;
public float SeparatorTextBorderSize;
public Vector2 SeparatorTextAlign;
public Vector2 SeparatorTextPadding;
public Vector2 DisplayWindowPadding;
public Vector2 DisplaySafeAreaPadding;
public float DockingSeparatorSize;
public float MouseCursorScale;
public byte AntiAliasedLines;
public byte AntiAliasedLinesUseTex;
public byte AntiAliasedFill;
public float CurveTessellationTol;
public float CircleTessellationMaxError;
public Vector4 Colors_0;
public Vector4 Colors_1;
public Vector4 Colors_2;
public Vector4 Colors_3;
public Vector4 Colors_4;
public Vector4 Colors_5;
public Vector4 Colors_6;
public Vector4 Colors_7;
public Vector4 Colors_8;
public Vector4 Colors_9;
public Vector4 Colors_10;
public Vector4 Colors_11;
public Vector4 Colors_12;
public Vector4 Colors_13;
public Vector4 Colors_14;
public Vector4 Colors_15;
public Vector4 Colors_16;
public Vector4 Colors_17;
public Vector4 Colors_18;
public Vector4 Colors_19;
public Vector4 Colors_20;
public Vector4 Colors_21;
public Vector4 Colors_22;
public Vector4 Colors_23;
public Vector4 Colors_24;
public Vector4 Colors_25;
public Vector4 Colors_26;
public Vector4 Colors_27;
public Vector4 Colors_28;
public Vector4 Colors_29;
public Vector4 Colors_30;
public Vector4 Colors_31;
public Vector4 Colors_32;
public Vector4 Colors_33;
public Vector4 Colors_34;
public Vector4 Colors_35;
public Vector4 Colors_36;
public Vector4 Colors_37;
public Vector4 Colors_38;
public Vector4 Colors_39;
public Vector4 Colors_40;
public Vector4 Colors_41;
public Vector4 Colors_42;
public Vector4 Colors_43;
public Vector4 Colors_44;
public Vector4 Colors_45;
public Vector4 Colors_46;
public Vector4 Colors_47;
public Vector4 Colors_48;
public Vector4 Colors_49;
public Vector4 Colors_50;
public Vector4 Colors_51;
public Vector4 Colors_52;
public Vector4 Colors_53;
public Vector4 Colors_54;
public float HoverStationaryDelay;
public float HoverDelayShort;
public float HoverDelayNormal;
public ImGuiHoveredFlags HoverFlagsForTooltipMouse;
public ImGuiHoveredFlags HoverFlagsForTooltipNav;
}
public unsafe partial struct ImGuiStylePtr
{
public ImGuiStyle* NativePtr { get; }
public ImGuiStylePtr(ImGuiStyle* nativePtr) => NativePtr = nativePtr;
public ImGuiStylePtr(IntPtr nativePtr) => NativePtr = (ImGuiStyle*)nativePtr;
public static implicit operator ImGuiStylePtr(ImGuiStyle* nativePtr) => new ImGuiStylePtr(nativePtr);
public static implicit operator ImGuiStyle* (ImGuiStylePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiStylePtr(IntPtr nativePtr) => new ImGuiStylePtr(nativePtr);
public ref float Alpha => ref Unsafe.AsRef<float>(&NativePtr->Alpha);
public ref float DisabledAlpha => ref Unsafe.AsRef<float>(&NativePtr->DisabledAlpha);
public ref Vector2 WindowPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->WindowPadding);
public ref float WindowRounding => ref Unsafe.AsRef<float>(&NativePtr->WindowRounding);
public ref float WindowBorderSize => ref Unsafe.AsRef<float>(&NativePtr->WindowBorderSize);
public ref Vector2 WindowMinSize => ref Unsafe.AsRef<Vector2>(&NativePtr->WindowMinSize);
public ref Vector2 WindowTitleAlign => ref Unsafe.AsRef<Vector2>(&NativePtr->WindowTitleAlign);
public ref ImGuiDir WindowMenuButtonPosition => ref Unsafe.AsRef<ImGuiDir>(&NativePtr->WindowMenuButtonPosition);
public ref float ChildRounding => ref Unsafe.AsRef<float>(&NativePtr->ChildRounding);
public ref float ChildBorderSize => ref Unsafe.AsRef<float>(&NativePtr->ChildBorderSize);
public ref float PopupRounding => ref Unsafe.AsRef<float>(&NativePtr->PopupRounding);
public ref float PopupBorderSize => ref Unsafe.AsRef<float>(&NativePtr->PopupBorderSize);
public ref Vector2 FramePadding => ref Unsafe.AsRef<Vector2>(&NativePtr->FramePadding);
public ref float FrameRounding => ref Unsafe.AsRef<float>(&NativePtr->FrameRounding);
public ref float FrameBorderSize => ref Unsafe.AsRef<float>(&NativePtr->FrameBorderSize);
public ref Vector2 ItemSpacing => ref Unsafe.AsRef<Vector2>(&NativePtr->ItemSpacing);
public ref Vector2 ItemInnerSpacing => ref Unsafe.AsRef<Vector2>(&NativePtr->ItemInnerSpacing);
public ref Vector2 CellPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->CellPadding);
public ref Vector2 TouchExtraPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->TouchExtraPadding);
public ref float IndentSpacing => ref Unsafe.AsRef<float>(&NativePtr->IndentSpacing);
public ref float ColumnsMinSpacing => ref Unsafe.AsRef<float>(&NativePtr->ColumnsMinSpacing);
public ref float ScrollbarSize => ref Unsafe.AsRef<float>(&NativePtr->ScrollbarSize);
public ref float ScrollbarRounding => ref Unsafe.AsRef<float>(&NativePtr->ScrollbarRounding);
public ref float GrabMinSize => ref Unsafe.AsRef<float>(&NativePtr->GrabMinSize);
public ref float GrabRounding => ref Unsafe.AsRef<float>(&NativePtr->GrabRounding);
public ref float LogSliderDeadzone => ref Unsafe.AsRef<float>(&NativePtr->LogSliderDeadzone);
public ref float TabRounding => ref Unsafe.AsRef<float>(&NativePtr->TabRounding);
public ref float TabBorderSize => ref Unsafe.AsRef<float>(&NativePtr->TabBorderSize);
public ref float TabMinWidthForCloseButton => ref Unsafe.AsRef<float>(&NativePtr->TabMinWidthForCloseButton);
public ref float TabBarBorderSize => ref Unsafe.AsRef<float>(&NativePtr->TabBarBorderSize);
public ref float TableAngledHeadersAngle => ref Unsafe.AsRef<float>(&NativePtr->TableAngledHeadersAngle);
public ref ImGuiDir ColorButtonPosition => ref Unsafe.AsRef<ImGuiDir>(&NativePtr->ColorButtonPosition);
public ref Vector2 ButtonTextAlign => ref Unsafe.AsRef<Vector2>(&NativePtr->ButtonTextAlign);
public ref Vector2 SelectableTextAlign => ref Unsafe.AsRef<Vector2>(&NativePtr->SelectableTextAlign);
public ref float SeparatorTextBorderSize => ref Unsafe.AsRef<float>(&NativePtr->SeparatorTextBorderSize);
public ref Vector2 SeparatorTextAlign => ref Unsafe.AsRef<Vector2>(&NativePtr->SeparatorTextAlign);
public ref Vector2 SeparatorTextPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->SeparatorTextPadding);
public ref Vector2 DisplayWindowPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplayWindowPadding);
public ref Vector2 DisplaySafeAreaPadding => ref Unsafe.AsRef<Vector2>(&NativePtr->DisplaySafeAreaPadding);
public ref float DockingSeparatorSize => ref Unsafe.AsRef<float>(&NativePtr->DockingSeparatorSize);
public ref float MouseCursorScale => ref Unsafe.AsRef<float>(&NativePtr->MouseCursorScale);
public ref bool AntiAliasedLines => ref Unsafe.AsRef<bool>(&NativePtr->AntiAliasedLines);
public ref bool AntiAliasedLinesUseTex => ref Unsafe.AsRef<bool>(&NativePtr->AntiAliasedLinesUseTex);
public ref bool AntiAliasedFill => ref Unsafe.AsRef<bool>(&NativePtr->AntiAliasedFill);
public ref float CurveTessellationTol => ref Unsafe.AsRef<float>(&NativePtr->CurveTessellationTol);
public ref float CircleTessellationMaxError => ref Unsafe.AsRef<float>(&NativePtr->CircleTessellationMaxError);
public RangeAccessor<Vector4> Colors => new RangeAccessor<Vector4>(&NativePtr->Colors_0, 55);
public ref float HoverStationaryDelay => ref Unsafe.AsRef<float>(&NativePtr->HoverStationaryDelay);
public ref float HoverDelayShort => ref Unsafe.AsRef<float>(&NativePtr->HoverDelayShort);
public ref float HoverDelayNormal => ref Unsafe.AsRef<float>(&NativePtr->HoverDelayNormal);
public ref ImGuiHoveredFlags HoverFlagsForTooltipMouse => ref Unsafe.AsRef<ImGuiHoveredFlags>(&NativePtr->HoverFlagsForTooltipMouse);
public ref ImGuiHoveredFlags HoverFlagsForTooltipNav => ref Unsafe.AsRef<ImGuiHoveredFlags>(&NativePtr->HoverFlagsForTooltipNav);
public void Destroy()
{
ImGuiNative.ImGuiStyle_destroy((ImGuiStyle*)(NativePtr));
}
public void ScaleAllSizes(float scale_factor)
{
ImGuiNative.ImGuiStyle_ScaleAllSizes((ImGuiStyle*)(NativePtr), scale_factor);
}
}
}

View File

@ -0,0 +1,37 @@
namespace ImGuiNET
{
public enum ImGuiStyleVar
{
Alpha = 0,
DisabledAlpha = 1,
WindowPadding = 2,
WindowRounding = 3,
WindowBorderSize = 4,
WindowMinSize = 5,
WindowTitleAlign = 6,
ChildRounding = 7,
ChildBorderSize = 8,
PopupRounding = 9,
PopupBorderSize = 10,
FramePadding = 11,
FrameRounding = 12,
FrameBorderSize = 13,
ItemSpacing = 14,
ItemInnerSpacing = 15,
IndentSpacing = 16,
CellPadding = 17,
ScrollbarSize = 18,
ScrollbarRounding = 19,
GrabMinSize = 20,
GrabRounding = 21,
TabRounding = 22,
TabBarBorderSize = 23,
ButtonTextAlign = 24,
SelectableTextAlign = 25,
SeparatorTextBorderSize = 26,
SeparatorTextAlign = 27,
SeparatorTextPadding = 28,
DockingSeparatorSize = 29,
COUNT = 30,
}
}

View File

@ -0,0 +1,18 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiTabBarFlags
{
None = 0,
Reorderable = 1,
AutoSelectNewTabs = 2,
TabListPopupButton = 4,
NoCloseWithMiddleMouseButton = 8,
NoTabListScrollingButtons = 16,
NoTooltip = 32,
FittingPolicyResizeDown = 64,
FittingPolicyScroll = 128,
FittingPolicyMask = 192,
FittingPolicyDefault = 64,
}
}

View File

@ -0,0 +1,16 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiTabItemFlags
{
None = 0,
UnsavedDocument = 1,
SetSelected = 2,
NoCloseWithMiddleMouseButton = 4,
NoPushId = 8,
NoTooltip = 16,
NoReorder = 32,
Leading = 64,
Trailing = 128,
}
}

View File

@ -0,0 +1,10 @@
namespace ImGuiNET
{
public enum ImGuiTableBgTarget
{
None = 0,
RowBg0 = 1,
RowBg1 = 2,
CellBg = 3,
}
}

View File

@ -0,0 +1,35 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiTableColumnFlags
{
None = 0,
Disabled = 1,
DefaultHide = 2,
DefaultSort = 4,
WidthStretch = 8,
WidthFixed = 16,
NoResize = 32,
NoReorder = 64,
NoHide = 128,
NoClip = 256,
NoSort = 512,
NoSortAscending = 1024,
NoSortDescending = 2048,
NoHeaderLabel = 4096,
NoHeaderWidth = 8192,
PreferSortAscending = 16384,
PreferSortDescending = 32768,
IndentEnable = 65536,
IndentDisable = 131072,
AngledHeader = 262144,
IsEnabled = 16777216,
IsVisible = 33554432,
IsSorted = 67108864,
IsHovered = 134217728,
WidthMask = 24,
IndentMask = 196608,
StatusMask = 251658240,
NoDirectResize = 1073741824,
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiTableColumnSortSpecs
{
public uint ColumnUserID;
public short ColumnIndex;
public short SortOrder;
public ImGuiSortDirection SortDirection;
}
public unsafe partial struct ImGuiTableColumnSortSpecsPtr
{
public ImGuiTableColumnSortSpecs* NativePtr { get; }
public ImGuiTableColumnSortSpecsPtr(ImGuiTableColumnSortSpecs* nativePtr) => NativePtr = nativePtr;
public ImGuiTableColumnSortSpecsPtr(IntPtr nativePtr) => NativePtr = (ImGuiTableColumnSortSpecs*)nativePtr;
public static implicit operator ImGuiTableColumnSortSpecsPtr(ImGuiTableColumnSortSpecs* nativePtr) => new ImGuiTableColumnSortSpecsPtr(nativePtr);
public static implicit operator ImGuiTableColumnSortSpecs* (ImGuiTableColumnSortSpecsPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiTableColumnSortSpecsPtr(IntPtr nativePtr) => new ImGuiTableColumnSortSpecsPtr(nativePtr);
public ref uint ColumnUserID => ref Unsafe.AsRef<uint>(&NativePtr->ColumnUserID);
public ref short ColumnIndex => ref Unsafe.AsRef<short>(&NativePtr->ColumnIndex);
public ref short SortOrder => ref Unsafe.AsRef<short>(&NativePtr->SortOrder);
public ref ImGuiSortDirection SortDirection => ref Unsafe.AsRef<ImGuiSortDirection>(&NativePtr->SortDirection);
public void Destroy()
{
ImGuiNative.ImGuiTableColumnSortSpecs_destroy((ImGuiTableColumnSortSpecs*)(NativePtr));
}
}
}

View File

@ -0,0 +1,44 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiTableFlags
{
None = 0,
Resizable = 1,
Reorderable = 2,
Hideable = 4,
Sortable = 8,
NoSavedSettings = 16,
ContextMenuInBody = 32,
RowBg = 64,
BordersInnerH = 128,
BordersOuterH = 256,
BordersInnerV = 512,
BordersOuterV = 1024,
BordersH = 384,
BordersV = 1536,
BordersInner = 640,
BordersOuter = 1280,
Borders = 1920,
NoBordersInBody = 2048,
NoBordersInBodyUntilResize = 4096,
SizingFixedFit = 8192,
SizingFixedSame = 16384,
SizingStretchProp = 24576,
SizingStretchSame = 32768,
NoHostExtendX = 65536,
NoHostExtendY = 131072,
NoKeepColumnsVisible = 262144,
PreciseWidths = 524288,
NoClip = 1048576,
PadOuterX = 2097152,
NoPadOuterX = 4194304,
NoPadInnerX = 8388608,
ScrollX = 16777216,
ScrollY = 33554432,
SortMulti = 67108864,
SortTristate = 134217728,
HighlightHoveredColumn = 268435456,
SizingMask = 57344,
}
}

View File

@ -0,0 +1,9 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiTableRowFlags
{
None = 0,
Headers = 1,
}
}

View File

@ -0,0 +1,30 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiTableSortSpecs
{
public ImGuiTableColumnSortSpecs* Specs;
public int SpecsCount;
public byte SpecsDirty;
}
public unsafe partial struct ImGuiTableSortSpecsPtr
{
public ImGuiTableSortSpecs* NativePtr { get; }
public ImGuiTableSortSpecsPtr(ImGuiTableSortSpecs* nativePtr) => NativePtr = nativePtr;
public ImGuiTableSortSpecsPtr(IntPtr nativePtr) => NativePtr = (ImGuiTableSortSpecs*)nativePtr;
public static implicit operator ImGuiTableSortSpecsPtr(ImGuiTableSortSpecs* nativePtr) => new ImGuiTableSortSpecsPtr(nativePtr);
public static implicit operator ImGuiTableSortSpecs* (ImGuiTableSortSpecsPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiTableSortSpecsPtr(IntPtr nativePtr) => new ImGuiTableSortSpecsPtr(nativePtr);
public ImGuiTableColumnSortSpecsPtr Specs => new ImGuiTableColumnSortSpecsPtr(NativePtr->Specs);
public ref int SpecsCount => ref Unsafe.AsRef<int>(&NativePtr->SpecsCount);
public ref bool SpecsDirty => ref Unsafe.AsRef<bool>(&NativePtr->SpecsDirty);
public void Destroy()
{
ImGuiNative.ImGuiTableSortSpecs_destroy((ImGuiTableSortSpecs*)(NativePtr));
}
}
}

View File

@ -0,0 +1,167 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiTextBuffer
{
public ImVector Buf;
}
public unsafe partial struct ImGuiTextBufferPtr
{
public ImGuiTextBuffer* NativePtr { get; }
public ImGuiTextBufferPtr(ImGuiTextBuffer* nativePtr) => NativePtr = nativePtr;
public ImGuiTextBufferPtr(IntPtr nativePtr) => NativePtr = (ImGuiTextBuffer*)nativePtr;
public static implicit operator ImGuiTextBufferPtr(ImGuiTextBuffer* nativePtr) => new ImGuiTextBufferPtr(nativePtr);
public static implicit operator ImGuiTextBuffer* (ImGuiTextBufferPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiTextBufferPtr(IntPtr nativePtr) => new ImGuiTextBufferPtr(nativePtr);
public ImVector<byte> Buf => new ImVector<byte>(NativePtr->Buf);
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void append(ReadOnlySpan<char> str)
{
byte* native_str;
int str_byteCount = 0;
if (str != null)
{
str_byteCount = Encoding.UTF8.GetByteCount(str);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
native_str = Util.Allocate(str_byteCount + 1);
}
else
{
byte* native_str_stackBytes = stackalloc byte[str_byteCount + 1];
native_str = native_str_stackBytes;
}
int native_str_offset = Util.GetUtf8(str, native_str, str_byteCount);
native_str[native_str_offset] = 0;
}
else { native_str = null; }
ImGuiNative.ImGuiTextBuffer_append((ImGuiTextBuffer*)(NativePtr), native_str, native_str+str_byteCount);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_str);
}
}
#endif
public void append(string str)
{
byte* native_str;
int str_byteCount = 0;
if (str != null)
{
str_byteCount = Encoding.UTF8.GetByteCount(str);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
native_str = Util.Allocate(str_byteCount + 1);
}
else
{
byte* native_str_stackBytes = stackalloc byte[str_byteCount + 1];
native_str = native_str_stackBytes;
}
int native_str_offset = Util.GetUtf8(str, native_str, str_byteCount);
native_str[native_str_offset] = 0;
}
else { native_str = null; }
ImGuiNative.ImGuiTextBuffer_append((ImGuiTextBuffer*)(NativePtr), native_str, native_str+str_byteCount);
if (str_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_str);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public void appendf(ReadOnlySpan<char> fmt)
{
byte* native_fmt;
int fmt_byteCount = 0;
if (fmt != null)
{
fmt_byteCount = Encoding.UTF8.GetByteCount(fmt);
if (fmt_byteCount > Util.StackAllocationSizeLimit)
{
native_fmt = Util.Allocate(fmt_byteCount + 1);
}
else
{
byte* native_fmt_stackBytes = stackalloc byte[fmt_byteCount + 1];
native_fmt = native_fmt_stackBytes;
}
int native_fmt_offset = Util.GetUtf8(fmt, native_fmt, fmt_byteCount);
native_fmt[native_fmt_offset] = 0;
}
else { native_fmt = null; }
ImGuiNative.ImGuiTextBuffer_appendf((ImGuiTextBuffer*)(NativePtr), native_fmt);
if (fmt_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_fmt);
}
}
#endif
public void appendf(string fmt)
{
byte* native_fmt;
int fmt_byteCount = 0;
if (fmt != null)
{
fmt_byteCount = Encoding.UTF8.GetByteCount(fmt);
if (fmt_byteCount > Util.StackAllocationSizeLimit)
{
native_fmt = Util.Allocate(fmt_byteCount + 1);
}
else
{
byte* native_fmt_stackBytes = stackalloc byte[fmt_byteCount + 1];
native_fmt = native_fmt_stackBytes;
}
int native_fmt_offset = Util.GetUtf8(fmt, native_fmt, fmt_byteCount);
native_fmt[native_fmt_offset] = 0;
}
else { native_fmt = null; }
ImGuiNative.ImGuiTextBuffer_appendf((ImGuiTextBuffer*)(NativePtr), native_fmt);
if (fmt_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_fmt);
}
}
public string begin()
{
byte* ret = ImGuiNative.ImGuiTextBuffer_begin((ImGuiTextBuffer*)(NativePtr));
return Util.StringFromPtr(ret);
}
public string c_str()
{
byte* ret = ImGuiNative.ImGuiTextBuffer_c_str((ImGuiTextBuffer*)(NativePtr));
return Util.StringFromPtr(ret);
}
public void clear()
{
ImGuiNative.ImGuiTextBuffer_clear((ImGuiTextBuffer*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImGuiTextBuffer_destroy((ImGuiTextBuffer*)(NativePtr));
}
public bool empty()
{
byte ret = ImGuiNative.ImGuiTextBuffer_empty((ImGuiTextBuffer*)(NativePtr));
return ret != 0;
}
public string end()
{
byte* ret = ImGuiNative.ImGuiTextBuffer_end((ImGuiTextBuffer*)(NativePtr));
return Util.StringFromPtr(ret);
}
public void reserve(int capacity)
{
ImGuiNative.ImGuiTextBuffer_reserve((ImGuiTextBuffer*)(NativePtr), capacity);
}
public int size()
{
int ret = ImGuiNative.ImGuiTextBuffer_size((ImGuiTextBuffer*)(NativePtr));
return ret;
}
}
}

View File

@ -0,0 +1,237 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiTextFilter
{
public fixed byte InputBuf[256];
public ImVector Filters;
public int CountGrep;
}
public unsafe partial struct ImGuiTextFilterPtr
{
public ImGuiTextFilter* NativePtr { get; }
public ImGuiTextFilterPtr(ImGuiTextFilter* nativePtr) => NativePtr = nativePtr;
public ImGuiTextFilterPtr(IntPtr nativePtr) => NativePtr = (ImGuiTextFilter*)nativePtr;
public static implicit operator ImGuiTextFilterPtr(ImGuiTextFilter* nativePtr) => new ImGuiTextFilterPtr(nativePtr);
public static implicit operator ImGuiTextFilter* (ImGuiTextFilterPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiTextFilterPtr(IntPtr nativePtr) => new ImGuiTextFilterPtr(nativePtr);
public RangeAccessor<byte> InputBuf => new RangeAccessor<byte>(NativePtr->InputBuf, 256);
public ImPtrVector<ImGuiTextRangePtr> Filters => new ImPtrVector<ImGuiTextRangePtr>(NativePtr->Filters, Unsafe.SizeOf<ImGuiTextRange>());
public ref int CountGrep => ref Unsafe.AsRef<int>(&NativePtr->CountGrep);
public void Build()
{
ImGuiNative.ImGuiTextFilter_Build((ImGuiTextFilter*)(NativePtr));
}
public void Clear()
{
ImGuiNative.ImGuiTextFilter_Clear((ImGuiTextFilter*)(NativePtr));
}
public void Destroy()
{
ImGuiNative.ImGuiTextFilter_destroy((ImGuiTextFilter*)(NativePtr));
}
public bool Draw()
{
byte* native_label;
int label_byteCount = 0;
label_byteCount = Encoding.UTF8.GetByteCount("Filter(inc,-exc)");
if (label_byteCount > Util.StackAllocationSizeLimit)
{
native_label = Util.Allocate(label_byteCount + 1);
}
else
{
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1];
native_label = native_label_stackBytes;
}
int native_label_offset = Util.GetUtf8("Filter(inc,-exc)", native_label, label_byteCount);
native_label[native_label_offset] = 0;
float width = 0.0f;
byte ret = ImGuiNative.ImGuiTextFilter_Draw((ImGuiTextFilter*)(NativePtr), native_label, width);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_label);
}
return ret != 0;
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public bool Draw(ReadOnlySpan<char> label)
{
byte* native_label;
int label_byteCount = 0;
if (label != null)
{
label_byteCount = Encoding.UTF8.GetByteCount(label);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
native_label = Util.Allocate(label_byteCount + 1);
}
else
{
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1];
native_label = native_label_stackBytes;
}
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount);
native_label[native_label_offset] = 0;
}
else { native_label = null; }
float width = 0.0f;
byte ret = ImGuiNative.ImGuiTextFilter_Draw((ImGuiTextFilter*)(NativePtr), native_label, width);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_label);
}
return ret != 0;
}
#endif
public bool Draw(string label)
{
byte* native_label;
int label_byteCount = 0;
if (label != null)
{
label_byteCount = Encoding.UTF8.GetByteCount(label);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
native_label = Util.Allocate(label_byteCount + 1);
}
else
{
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1];
native_label = native_label_stackBytes;
}
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount);
native_label[native_label_offset] = 0;
}
else { native_label = null; }
float width = 0.0f;
byte ret = ImGuiNative.ImGuiTextFilter_Draw((ImGuiTextFilter*)(NativePtr), native_label, width);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_label);
}
return ret != 0;
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public bool Draw(ReadOnlySpan<char> label, float width)
{
byte* native_label;
int label_byteCount = 0;
if (label != null)
{
label_byteCount = Encoding.UTF8.GetByteCount(label);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
native_label = Util.Allocate(label_byteCount + 1);
}
else
{
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1];
native_label = native_label_stackBytes;
}
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount);
native_label[native_label_offset] = 0;
}
else { native_label = null; }
byte ret = ImGuiNative.ImGuiTextFilter_Draw((ImGuiTextFilter*)(NativePtr), native_label, width);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_label);
}
return ret != 0;
}
#endif
public bool Draw(string label, float width)
{
byte* native_label;
int label_byteCount = 0;
if (label != null)
{
label_byteCount = Encoding.UTF8.GetByteCount(label);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
native_label = Util.Allocate(label_byteCount + 1);
}
else
{
byte* native_label_stackBytes = stackalloc byte[label_byteCount + 1];
native_label = native_label_stackBytes;
}
int native_label_offset = Util.GetUtf8(label, native_label, label_byteCount);
native_label[native_label_offset] = 0;
}
else { native_label = null; }
byte ret = ImGuiNative.ImGuiTextFilter_Draw((ImGuiTextFilter*)(NativePtr), native_label, width);
if (label_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_label);
}
return ret != 0;
}
public bool IsActive()
{
byte ret = ImGuiNative.ImGuiTextFilter_IsActive((ImGuiTextFilter*)(NativePtr));
return ret != 0;
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
public bool PassFilter(ReadOnlySpan<char> text)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
byte ret = ImGuiNative.ImGuiTextFilter_PassFilter((ImGuiTextFilter*)(NativePtr), native_text, native_text+text_byteCount);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
return ret != 0;
}
#endif
public bool PassFilter(string text)
{
byte* native_text;
int text_byteCount = 0;
if (text != null)
{
text_byteCount = Encoding.UTF8.GetByteCount(text);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
native_text = Util.Allocate(text_byteCount + 1);
}
else
{
byte* native_text_stackBytes = stackalloc byte[text_byteCount + 1];
native_text = native_text_stackBytes;
}
int native_text_offset = Util.GetUtf8(text, native_text, text_byteCount);
native_text[native_text_offset] = 0;
}
else { native_text = null; }
byte ret = ImGuiNative.ImGuiTextFilter_PassFilter((ImGuiTextFilter*)(NativePtr), native_text, native_text+text_byteCount);
if (text_byteCount > Util.StackAllocationSizeLimit)
{
Util.Free(native_text);
}
return ret != 0;
}
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiTextRange
{
public byte* b;
public byte* e;
}
public unsafe partial struct ImGuiTextRangePtr
{
public ImGuiTextRange* NativePtr { get; }
public ImGuiTextRangePtr(ImGuiTextRange* nativePtr) => NativePtr = nativePtr;
public ImGuiTextRangePtr(IntPtr nativePtr) => NativePtr = (ImGuiTextRange*)nativePtr;
public static implicit operator ImGuiTextRangePtr(ImGuiTextRange* nativePtr) => new ImGuiTextRangePtr(nativePtr);
public static implicit operator ImGuiTextRange* (ImGuiTextRangePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiTextRangePtr(IntPtr nativePtr) => new ImGuiTextRangePtr(nativePtr);
public IntPtr b { get => (IntPtr)NativePtr->b; set => NativePtr->b = (byte*)value; }
public IntPtr e { get => (IntPtr)NativePtr->e; set => NativePtr->e = (byte*)value; }
public void Destroy()
{
ImGuiNative.ImGuiTextRange_destroy((ImGuiTextRange*)(NativePtr));
}
public bool empty()
{
byte ret = ImGuiNative.ImGuiTextRange_empty((ImGuiTextRange*)(NativePtr));
return ret != 0;
}
public void split(byte separator, out ImVector @out)
{
fixed (ImVector* native_out = &@out)
{
ImGuiNative.ImGuiTextRange_split((ImGuiTextRange*)(NativePtr), separator, native_out);
}
}
}
}

View File

@ -0,0 +1,24 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiTreeNodeFlags
{
None = 0,
Selected = 1,
Framed = 2,
AllowOverlap = 4,
NoTreePushOnOpen = 8,
NoAutoOpenOnLog = 16,
DefaultOpen = 32,
OpenOnDoubleClick = 64,
OpenOnArrow = 128,
Leaf = 256,
Bullet = 512,
FramePadding = 1024,
SpanAvailWidth = 2048,
SpanFullWidth = 4096,
SpanAllColumns = 8192,
NavLeftJumpsBackHere = 16384,
CollapsingHeader = 26,
}
}

View File

@ -0,0 +1,70 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiViewport
{
public uint ID;
public ImGuiViewportFlags Flags;
public Vector2 Pos;
public Vector2 Size;
public Vector2 WorkPos;
public Vector2 WorkSize;
public float DpiScale;
public uint ParentViewportId;
public ImDrawData* DrawData;
public void* RendererUserData;
public void* PlatformUserData;
public void* PlatformHandle;
public void* PlatformHandleRaw;
public byte PlatformWindowCreated;
public byte PlatformRequestMove;
public byte PlatformRequestResize;
public byte PlatformRequestClose;
}
public unsafe partial struct ImGuiViewportPtr
{
public ImGuiViewport* NativePtr { get; }
public ImGuiViewportPtr(ImGuiViewport* nativePtr) => NativePtr = nativePtr;
public ImGuiViewportPtr(IntPtr nativePtr) => NativePtr = (ImGuiViewport*)nativePtr;
public static implicit operator ImGuiViewportPtr(ImGuiViewport* nativePtr) => new ImGuiViewportPtr(nativePtr);
public static implicit operator ImGuiViewport* (ImGuiViewportPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiViewportPtr(IntPtr nativePtr) => new ImGuiViewportPtr(nativePtr);
public ref uint ID => ref Unsafe.AsRef<uint>(&NativePtr->ID);
public ref ImGuiViewportFlags Flags => ref Unsafe.AsRef<ImGuiViewportFlags>(&NativePtr->Flags);
public ref Vector2 Pos => ref Unsafe.AsRef<Vector2>(&NativePtr->Pos);
public ref Vector2 Size => ref Unsafe.AsRef<Vector2>(&NativePtr->Size);
public ref Vector2 WorkPos => ref Unsafe.AsRef<Vector2>(&NativePtr->WorkPos);
public ref Vector2 WorkSize => ref Unsafe.AsRef<Vector2>(&NativePtr->WorkSize);
public ref float DpiScale => ref Unsafe.AsRef<float>(&NativePtr->DpiScale);
public ref uint ParentViewportId => ref Unsafe.AsRef<uint>(&NativePtr->ParentViewportId);
public ImDrawDataPtr DrawData => new ImDrawDataPtr(NativePtr->DrawData);
public IntPtr RendererUserData { get => (IntPtr)NativePtr->RendererUserData; set => NativePtr->RendererUserData = (void*)value; }
public IntPtr PlatformUserData { get => (IntPtr)NativePtr->PlatformUserData; set => NativePtr->PlatformUserData = (void*)value; }
public IntPtr PlatformHandle { get => (IntPtr)NativePtr->PlatformHandle; set => NativePtr->PlatformHandle = (void*)value; }
public IntPtr PlatformHandleRaw { get => (IntPtr)NativePtr->PlatformHandleRaw; set => NativePtr->PlatformHandleRaw = (void*)value; }
public ref bool PlatformWindowCreated => ref Unsafe.AsRef<bool>(&NativePtr->PlatformWindowCreated);
public ref bool PlatformRequestMove => ref Unsafe.AsRef<bool>(&NativePtr->PlatformRequestMove);
public ref bool PlatformRequestResize => ref Unsafe.AsRef<bool>(&NativePtr->PlatformRequestResize);
public ref bool PlatformRequestClose => ref Unsafe.AsRef<bool>(&NativePtr->PlatformRequestClose);
public void Destroy()
{
ImGuiNative.ImGuiViewport_destroy((ImGuiViewport*)(NativePtr));
}
public Vector2 GetCenter()
{
Vector2 __retval;
ImGuiNative.ImGuiViewport_GetCenter(&__retval, (ImGuiViewport*)(NativePtr));
return __retval;
}
public Vector2 GetWorkCenter()
{
Vector2 __retval;
ImGuiNative.ImGuiViewport_GetWorkCenter(&__retval, (ImGuiViewport*)(NativePtr));
return __retval;
}
}
}

View File

@ -0,0 +1,22 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiViewportFlags
{
None = 0,
IsPlatformWindow = 1,
IsPlatformMonitor = 2,
OwnedByApp = 4,
NoDecoration = 8,
NoTaskBarIcon = 16,
NoFocusOnAppearing = 32,
NoFocusOnClick = 64,
NoInputs = 128,
NoRendererClear = 256,
NoAutoMerge = 512,
TopMost = 1024,
CanHostOtherWindows = 2048,
IsMinimized = 4096,
IsFocused = 8192,
}
}

View File

@ -0,0 +1,40 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct ImGuiWindowClass
{
public uint ClassId;
public uint ParentViewportId;
public ImGuiViewportFlags ViewportFlagsOverrideSet;
public ImGuiViewportFlags ViewportFlagsOverrideClear;
public ImGuiTabItemFlags TabItemFlagsOverrideSet;
public ImGuiDockNodeFlags DockNodeFlagsOverrideSet;
public byte DockingAlwaysTabBar;
public byte DockingAllowUnclassed;
}
public unsafe partial struct ImGuiWindowClassPtr
{
public ImGuiWindowClass* NativePtr { get; }
public ImGuiWindowClassPtr(ImGuiWindowClass* nativePtr) => NativePtr = nativePtr;
public ImGuiWindowClassPtr(IntPtr nativePtr) => NativePtr = (ImGuiWindowClass*)nativePtr;
public static implicit operator ImGuiWindowClassPtr(ImGuiWindowClass* nativePtr) => new ImGuiWindowClassPtr(nativePtr);
public static implicit operator ImGuiWindowClass* (ImGuiWindowClassPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiWindowClassPtr(IntPtr nativePtr) => new ImGuiWindowClassPtr(nativePtr);
public ref uint ClassId => ref Unsafe.AsRef<uint>(&NativePtr->ClassId);
public ref uint ParentViewportId => ref Unsafe.AsRef<uint>(&NativePtr->ParentViewportId);
public ref ImGuiViewportFlags ViewportFlagsOverrideSet => ref Unsafe.AsRef<ImGuiViewportFlags>(&NativePtr->ViewportFlagsOverrideSet);
public ref ImGuiViewportFlags ViewportFlagsOverrideClear => ref Unsafe.AsRef<ImGuiViewportFlags>(&NativePtr->ViewportFlagsOverrideClear);
public ref ImGuiTabItemFlags TabItemFlagsOverrideSet => ref Unsafe.AsRef<ImGuiTabItemFlags>(&NativePtr->TabItemFlagsOverrideSet);
public ref ImGuiDockNodeFlags DockNodeFlagsOverrideSet => ref Unsafe.AsRef<ImGuiDockNodeFlags>(&NativePtr->DockNodeFlagsOverrideSet);
public ref bool DockingAlwaysTabBar => ref Unsafe.AsRef<bool>(&NativePtr->DockingAlwaysTabBar);
public ref bool DockingAllowUnclassed => ref Unsafe.AsRef<bool>(&NativePtr->DockingAllowUnclassed);
public void Destroy()
{
ImGuiNative.ImGuiWindowClass_destroy((ImGuiWindowClass*)(NativePtr));
}
}
}

View File

@ -0,0 +1,38 @@
namespace ImGuiNET
{
[System.Flags]
public enum ImGuiWindowFlags
{
None = 0,
NoTitleBar = 1,
NoResize = 2,
NoMove = 4,
NoScrollbar = 8,
NoScrollWithMouse = 16,
NoCollapse = 32,
AlwaysAutoResize = 64,
NoBackground = 128,
NoSavedSettings = 256,
NoMouseInputs = 512,
MenuBar = 1024,
HorizontalScrollbar = 2048,
NoFocusOnAppearing = 4096,
NoBringToFrontOnFocus = 8192,
AlwaysVerticalScrollbar = 16384,
AlwaysHorizontalScrollbar = 32768,
NoNavInputs = 65536,
NoNavFocus = 131072,
UnsavedDocument = 262144,
NoDocking = 524288,
NoNav = 196608,
NoDecoration = 43,
NoInputs = 197120,
NavFlattened = 8388608,
ChildWindow = 16777216,
Tooltip = 33554432,
Popup = 67108864,
Modal = 134217728,
ChildMenu = 268435456,
DockNodeHost = 536870912,
}
}

View File

@ -0,0 +1,48 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct STB_TexteditState
{
public int cursor;
public int select_start;
public int select_end;
public byte insert_mode;
public int row_count_per_page;
public byte cursor_at_end_of_line;
public byte initialized;
public byte has_preferred_x;
public byte single_line;
public byte padding1;
public byte padding2;
public byte padding3;
public float preferred_x;
public StbUndoState undostate;
}
public unsafe partial struct STB_TexteditStatePtr
{
public STB_TexteditState* NativePtr { get; }
public STB_TexteditStatePtr(STB_TexteditState* nativePtr) => NativePtr = nativePtr;
public STB_TexteditStatePtr(IntPtr nativePtr) => NativePtr = (STB_TexteditState*)nativePtr;
public static implicit operator STB_TexteditStatePtr(STB_TexteditState* nativePtr) => new STB_TexteditStatePtr(nativePtr);
public static implicit operator STB_TexteditState* (STB_TexteditStatePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator STB_TexteditStatePtr(IntPtr nativePtr) => new STB_TexteditStatePtr(nativePtr);
public ref int cursor => ref Unsafe.AsRef<int>(&NativePtr->cursor);
public ref int select_start => ref Unsafe.AsRef<int>(&NativePtr->select_start);
public ref int select_end => ref Unsafe.AsRef<int>(&NativePtr->select_end);
public ref byte insert_mode => ref Unsafe.AsRef<byte>(&NativePtr->insert_mode);
public ref int row_count_per_page => ref Unsafe.AsRef<int>(&NativePtr->row_count_per_page);
public ref byte cursor_at_end_of_line => ref Unsafe.AsRef<byte>(&NativePtr->cursor_at_end_of_line);
public ref byte initialized => ref Unsafe.AsRef<byte>(&NativePtr->initialized);
public ref byte has_preferred_x => ref Unsafe.AsRef<byte>(&NativePtr->has_preferred_x);
public ref byte single_line => ref Unsafe.AsRef<byte>(&NativePtr->single_line);
public ref byte padding1 => ref Unsafe.AsRef<byte>(&NativePtr->padding1);
public ref byte padding2 => ref Unsafe.AsRef<byte>(&NativePtr->padding2);
public ref byte padding3 => ref Unsafe.AsRef<byte>(&NativePtr->padding3);
public ref float preferred_x => ref Unsafe.AsRef<float>(&NativePtr->preferred_x);
public ref StbUndoState undostate => ref Unsafe.AsRef<StbUndoState>(&NativePtr->undostate);
}
}

View File

@ -0,0 +1,32 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct StbTexteditRow
{
public float x0;
public float x1;
public float baseline_y_delta;
public float ymin;
public float ymax;
public int num_chars;
}
public unsafe partial struct StbTexteditRowPtr
{
public StbTexteditRow* NativePtr { get; }
public StbTexteditRowPtr(StbTexteditRow* nativePtr) => NativePtr = nativePtr;
public StbTexteditRowPtr(IntPtr nativePtr) => NativePtr = (StbTexteditRow*)nativePtr;
public static implicit operator StbTexteditRowPtr(StbTexteditRow* nativePtr) => new StbTexteditRowPtr(nativePtr);
public static implicit operator StbTexteditRow* (StbTexteditRowPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator StbTexteditRowPtr(IntPtr nativePtr) => new StbTexteditRowPtr(nativePtr);
public ref float x0 => ref Unsafe.AsRef<float>(&NativePtr->x0);
public ref float x1 => ref Unsafe.AsRef<float>(&NativePtr->x1);
public ref float baseline_y_delta => ref Unsafe.AsRef<float>(&NativePtr->baseline_y_delta);
public ref float ymin => ref Unsafe.AsRef<float>(&NativePtr->ymin);
public ref float ymax => ref Unsafe.AsRef<float>(&NativePtr->ymax);
public ref int num_chars => ref Unsafe.AsRef<int>(&NativePtr->num_chars);
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct StbUndoRecord
{
public int where;
public int insert_length;
public int delete_length;
public int char_storage;
}
public unsafe partial struct StbUndoRecordPtr
{
public StbUndoRecord* NativePtr { get; }
public StbUndoRecordPtr(StbUndoRecord* nativePtr) => NativePtr = nativePtr;
public StbUndoRecordPtr(IntPtr nativePtr) => NativePtr = (StbUndoRecord*)nativePtr;
public static implicit operator StbUndoRecordPtr(StbUndoRecord* nativePtr) => new StbUndoRecordPtr(nativePtr);
public static implicit operator StbUndoRecord* (StbUndoRecordPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator StbUndoRecordPtr(IntPtr nativePtr) => new StbUndoRecordPtr(nativePtr);
public ref int where => ref Unsafe.AsRef<int>(&NativePtr->where);
public ref int insert_length => ref Unsafe.AsRef<int>(&NativePtr->insert_length);
public ref int delete_length => ref Unsafe.AsRef<int>(&NativePtr->delete_length);
public ref int char_storage => ref Unsafe.AsRef<int>(&NativePtr->char_storage);
}
}

View File

@ -0,0 +1,130 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe partial struct StbUndoState
{
public StbUndoRecord undo_rec_0;
public StbUndoRecord undo_rec_1;
public StbUndoRecord undo_rec_2;
public StbUndoRecord undo_rec_3;
public StbUndoRecord undo_rec_4;
public StbUndoRecord undo_rec_5;
public StbUndoRecord undo_rec_6;
public StbUndoRecord undo_rec_7;
public StbUndoRecord undo_rec_8;
public StbUndoRecord undo_rec_9;
public StbUndoRecord undo_rec_10;
public StbUndoRecord undo_rec_11;
public StbUndoRecord undo_rec_12;
public StbUndoRecord undo_rec_13;
public StbUndoRecord undo_rec_14;
public StbUndoRecord undo_rec_15;
public StbUndoRecord undo_rec_16;
public StbUndoRecord undo_rec_17;
public StbUndoRecord undo_rec_18;
public StbUndoRecord undo_rec_19;
public StbUndoRecord undo_rec_20;
public StbUndoRecord undo_rec_21;
public StbUndoRecord undo_rec_22;
public StbUndoRecord undo_rec_23;
public StbUndoRecord undo_rec_24;
public StbUndoRecord undo_rec_25;
public StbUndoRecord undo_rec_26;
public StbUndoRecord undo_rec_27;
public StbUndoRecord undo_rec_28;
public StbUndoRecord undo_rec_29;
public StbUndoRecord undo_rec_30;
public StbUndoRecord undo_rec_31;
public StbUndoRecord undo_rec_32;
public StbUndoRecord undo_rec_33;
public StbUndoRecord undo_rec_34;
public StbUndoRecord undo_rec_35;
public StbUndoRecord undo_rec_36;
public StbUndoRecord undo_rec_37;
public StbUndoRecord undo_rec_38;
public StbUndoRecord undo_rec_39;
public StbUndoRecord undo_rec_40;
public StbUndoRecord undo_rec_41;
public StbUndoRecord undo_rec_42;
public StbUndoRecord undo_rec_43;
public StbUndoRecord undo_rec_44;
public StbUndoRecord undo_rec_45;
public StbUndoRecord undo_rec_46;
public StbUndoRecord undo_rec_47;
public StbUndoRecord undo_rec_48;
public StbUndoRecord undo_rec_49;
public StbUndoRecord undo_rec_50;
public StbUndoRecord undo_rec_51;
public StbUndoRecord undo_rec_52;
public StbUndoRecord undo_rec_53;
public StbUndoRecord undo_rec_54;
public StbUndoRecord undo_rec_55;
public StbUndoRecord undo_rec_56;
public StbUndoRecord undo_rec_57;
public StbUndoRecord undo_rec_58;
public StbUndoRecord undo_rec_59;
public StbUndoRecord undo_rec_60;
public StbUndoRecord undo_rec_61;
public StbUndoRecord undo_rec_62;
public StbUndoRecord undo_rec_63;
public StbUndoRecord undo_rec_64;
public StbUndoRecord undo_rec_65;
public StbUndoRecord undo_rec_66;
public StbUndoRecord undo_rec_67;
public StbUndoRecord undo_rec_68;
public StbUndoRecord undo_rec_69;
public StbUndoRecord undo_rec_70;
public StbUndoRecord undo_rec_71;
public StbUndoRecord undo_rec_72;
public StbUndoRecord undo_rec_73;
public StbUndoRecord undo_rec_74;
public StbUndoRecord undo_rec_75;
public StbUndoRecord undo_rec_76;
public StbUndoRecord undo_rec_77;
public StbUndoRecord undo_rec_78;
public StbUndoRecord undo_rec_79;
public StbUndoRecord undo_rec_80;
public StbUndoRecord undo_rec_81;
public StbUndoRecord undo_rec_82;
public StbUndoRecord undo_rec_83;
public StbUndoRecord undo_rec_84;
public StbUndoRecord undo_rec_85;
public StbUndoRecord undo_rec_86;
public StbUndoRecord undo_rec_87;
public StbUndoRecord undo_rec_88;
public StbUndoRecord undo_rec_89;
public StbUndoRecord undo_rec_90;
public StbUndoRecord undo_rec_91;
public StbUndoRecord undo_rec_92;
public StbUndoRecord undo_rec_93;
public StbUndoRecord undo_rec_94;
public StbUndoRecord undo_rec_95;
public StbUndoRecord undo_rec_96;
public StbUndoRecord undo_rec_97;
public StbUndoRecord undo_rec_98;
public fixed ushort undo_char[999];
public short undo_point;
public short redo_point;
public int undo_char_point;
public int redo_char_point;
}
public unsafe partial struct StbUndoStatePtr
{
public StbUndoState* NativePtr { get; }
public StbUndoStatePtr(StbUndoState* nativePtr) => NativePtr = nativePtr;
public StbUndoStatePtr(IntPtr nativePtr) => NativePtr = (StbUndoState*)nativePtr;
public static implicit operator StbUndoStatePtr(StbUndoState* nativePtr) => new StbUndoStatePtr(nativePtr);
public static implicit operator StbUndoState* (StbUndoStatePtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator StbUndoStatePtr(IntPtr nativePtr) => new StbUndoStatePtr(nativePtr);
public RangeAccessor<StbUndoRecord> undo_rec => new RangeAccessor<StbUndoRecord>(&NativePtr->undo_rec_0, 99);
public RangeAccessor<ushort> undo_char => new RangeAccessor<ushort>(NativePtr->undo_char, 999);
public ref short undo_point => ref Unsafe.AsRef<short>(&NativePtr->undo_point);
public ref short redo_point => ref Unsafe.AsRef<short>(&NativePtr->redo_point);
public ref int undo_char_point => ref Unsafe.AsRef<int>(&NativePtr->undo_char_point);
public ref int redo_char_point => ref Unsafe.AsRef<int>(&NativePtr->redo_char_point);
}
}

View File

@ -0,0 +1,485 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
// NOTE:
// This is a direct copy from ImGui.Manual.cs with all string parameters (not ref string) changed to ReadOnlySpan<char>.
// This is far from ideal right now, maybe we could update the generator to do this for us.
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
namespace ImGuiNET
{
public static unsafe partial class ImGui
{
public static bool InputText(
ReadOnlySpan<char> label,
byte[] buf,
uint buf_size)
{
return InputText(label, buf, buf_size, 0, null, IntPtr.Zero);
}
public static bool InputText(
ReadOnlySpan<char> label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags)
{
return InputText(label, buf, buf_size, flags, null, IntPtr.Zero);
}
public static bool InputText(
ReadOnlySpan<char> label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback)
{
return InputText(label, buf, buf_size, flags, callback, IntPtr.Zero);
}
public static bool InputText(
ReadOnlySpan<char> label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
bool ret;
fixed (byte* bufPtr = buf)
{
ret = ImGuiNative.igInputText(utf8LabelBytes, bufPtr, buf_size, flags, callback, user_data.ToPointer()) != 0;
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
return ret;
}
public static bool InputText(
ReadOnlySpan<char> label,
ref string input,
uint maxLength) => InputText(label, ref input, maxLength, 0, null, IntPtr.Zero);
public static bool InputText(
ReadOnlySpan<char> label,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags) => InputText(label, ref input, maxLength, flags, null, IntPtr.Zero);
public static bool InputText(
ReadOnlySpan<char> label,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback) => InputText(label, ref input, maxLength, flags, callback, IntPtr.Zero);
public static bool InputText(
ReadOnlySpan<char> label,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
byte* utf8InputBytes;
byte* originalUtf8InputBytes;
if (inputBufSize > Util.StackAllocationSizeLimit)
{
utf8InputBytes = Util.Allocate(inputBufSize);
originalUtf8InputBytes = Util.Allocate(inputBufSize);
}
else
{
byte* inputStackBytes = stackalloc byte[inputBufSize];
utf8InputBytes = inputStackBytes;
byte* originalInputStackBytes = stackalloc byte[inputBufSize];
originalUtf8InputBytes = originalInputStackBytes;
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputText(
utf8LabelBytes,
utf8InputBytes,
(uint)inputBufSize,
flags,
callback,
user_data.ToPointer());
if (!Util.AreStringsEqual(originalUtf8InputBytes, inputBufSize, utf8InputBytes))
{
input = Util.StringFromPtr(utf8InputBytes);
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
if (inputBufSize > Util.StackAllocationSizeLimit)
{
Util.Free(utf8InputBytes);
Util.Free(originalUtf8InputBytes);
}
return result != 0;
}
public static bool InputTextMultiline(
ReadOnlySpan<char> label,
ref string input,
uint maxLength,
Vector2 size) => InputTextMultiline(label, ref input, maxLength, size, 0, null, IntPtr.Zero);
public static bool InputTextMultiline(
ReadOnlySpan<char> label,
ref string input,
uint maxLength,
Vector2 size,
ImGuiInputTextFlags flags) => InputTextMultiline(label, ref input, maxLength, size, flags, null, IntPtr.Zero);
public static bool InputTextMultiline(
ReadOnlySpan<char> label,
ref string input,
uint maxLength,
Vector2 size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback) => InputTextMultiline(label, ref input, maxLength, size, flags, callback, IntPtr.Zero);
public static bool InputTextMultiline(
ReadOnlySpan<char> label,
ref string input,
uint maxLength,
Vector2 size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
byte* utf8InputBytes;
byte* originalUtf8InputBytes;
if (inputBufSize > Util.StackAllocationSizeLimit)
{
utf8InputBytes = Util.Allocate(inputBufSize);
originalUtf8InputBytes = Util.Allocate(inputBufSize);
}
else
{
byte* inputStackBytes = stackalloc byte[inputBufSize];
utf8InputBytes = inputStackBytes;
byte* originalInputStackBytes = stackalloc byte[inputBufSize];
originalUtf8InputBytes = originalInputStackBytes;
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputTextMultiline(
utf8LabelBytes,
utf8InputBytes,
(uint)inputBufSize,
size,
flags,
callback,
user_data.ToPointer());
if (!Util.AreStringsEqual(originalUtf8InputBytes, inputBufSize, utf8InputBytes))
{
input = Util.StringFromPtr(utf8InputBytes);
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
if (inputBufSize > Util.StackAllocationSizeLimit)
{
Util.Free(utf8InputBytes);
Util.Free(originalUtf8InputBytes);
}
return result != 0;
}
public static bool InputTextWithHint(
ReadOnlySpan<char> label,
ReadOnlySpan<char> hint,
ref string input,
uint maxLength) => InputTextWithHint(label, hint, ref input, maxLength, 0, null, IntPtr.Zero);
public static bool InputTextWithHint(
ReadOnlySpan<char> label,
ReadOnlySpan<char> hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags) => InputTextWithHint(label, hint, ref input, maxLength, flags, null, IntPtr.Zero);
public static bool InputTextWithHint(
ReadOnlySpan<char> label,
ReadOnlySpan<char> hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback) => InputTextWithHint(label, hint, ref input, maxLength, flags, callback, IntPtr.Zero);
public static bool InputTextWithHint(
ReadOnlySpan<char> label,
ReadOnlySpan<char> hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
int utf8HintByteCount = Encoding.UTF8.GetByteCount(hint);
byte* utf8HintBytes;
if (utf8HintByteCount > Util.StackAllocationSizeLimit)
{
utf8HintBytes = Util.Allocate(utf8HintByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8HintByteCount + 1];
utf8HintBytes = stackPtr;
}
Util.GetUtf8(hint, utf8HintBytes, utf8HintByteCount);
int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
byte* utf8InputBytes;
byte* originalUtf8InputBytes;
if (inputBufSize > Util.StackAllocationSizeLimit)
{
utf8InputBytes = Util.Allocate(inputBufSize);
originalUtf8InputBytes = Util.Allocate(inputBufSize);
}
else
{
byte* inputStackBytes = stackalloc byte[inputBufSize];
utf8InputBytes = inputStackBytes;
byte* originalInputStackBytes = stackalloc byte[inputBufSize];
originalUtf8InputBytes = originalInputStackBytes;
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputTextWithHint(
utf8LabelBytes,
utf8HintBytes,
utf8InputBytes,
(uint)inputBufSize,
flags,
callback,
user_data.ToPointer());
if (!Util.AreStringsEqual(originalUtf8InputBytes, inputBufSize, utf8InputBytes))
{
input = Util.StringFromPtr(utf8InputBytes);
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
if (utf8HintByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8HintBytes);
}
if (inputBufSize > Util.StackAllocationSizeLimit)
{
Util.Free(utf8InputBytes);
Util.Free(originalUtf8InputBytes);
}
return result != 0;
}
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, int start)
=> CalcTextSizeImpl(text, start);
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, float wrapWidth)
=> CalcTextSizeImpl(text, wrapWidth: wrapWidth);
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, int start, int length)
=> CalcTextSizeImpl(text, start, length);
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, int start, bool hideTextAfterDoubleHash)
=> CalcTextSizeImpl(text, start, hideTextAfterDoubleHash: hideTextAfterDoubleHash);
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, int start, float wrapWidth)
=> CalcTextSizeImpl(text, start, wrapWidth: wrapWidth);
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, int start, int length, bool hideTextAfterDoubleHash)
=> CalcTextSizeImpl(text, start, length, hideTextAfterDoubleHash);
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, int start, int length, float wrapWidth)
=> CalcTextSizeImpl(text, start, length, wrapWidth: wrapWidth);
public static Vector2 CalcTextSize(ReadOnlySpan<char> text, int start, int length, bool hideTextAfterDoubleHash, float wrapWidth)
=> CalcTextSizeImpl(text, start, length, hideTextAfterDoubleHash, wrapWidth);
private static Vector2 CalcTextSizeImpl(
ReadOnlySpan<char> text,
int start = 0,
int? length = null,
bool hideTextAfterDoubleHash = false,
float wrapWidth = -1.0f)
{
return CalcTextSize(text.Slice(start, length ?? text.Length-start), hideTextAfterDoubleHash, wrapWidth);
}
public static bool InputText(
ReadOnlySpan<char> label,
IntPtr buf,
uint buf_size)
{
return InputText(label, buf, buf_size, 0, null, IntPtr.Zero);
}
public static bool InputText(
ReadOnlySpan<char> label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags)
{
return InputText(label, buf, buf_size, flags, null, IntPtr.Zero);
}
public static bool InputText(
ReadOnlySpan<char> label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback)
{
return InputText(label, buf, buf_size, flags, callback, IntPtr.Zero);
}
public static bool InputText(
ReadOnlySpan<char> label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
bool ret = ImGuiNative.igInputText(utf8LabelBytes, (byte*)buf.ToPointer(), buf_size, flags, callback, user_data.ToPointer()) != 0;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
return ret;
}
public static bool Begin(ReadOnlySpan<char> name, ImGuiWindowFlags flags)
{
int utf8NameByteCount = Encoding.UTF8.GetByteCount(name);
byte* utf8NameBytes;
if (utf8NameByteCount > Util.StackAllocationSizeLimit)
{
utf8NameBytes = Util.Allocate(utf8NameByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8NameByteCount + 1];
utf8NameBytes = stackPtr;
}
Util.GetUtf8(name, utf8NameBytes, utf8NameByteCount);
byte* p_open = null;
byte ret = ImGuiNative.igBegin(utf8NameBytes, p_open, flags);
if (utf8NameByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8NameBytes);
}
return ret != 0;
}
public static bool MenuItem(ReadOnlySpan<char> label, bool enabled)
{
return MenuItem(label, string.Empty, false, enabled);
}
}
}
#endif

View File

@ -0,0 +1,481 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
namespace ImGuiNET
{
public static unsafe partial class ImGui
{
public static bool InputText(
string label,
byte[] buf,
uint buf_size)
{
return InputText(label, buf, buf_size, 0, null, IntPtr.Zero);
}
public static bool InputText(
string label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags)
{
return InputText(label, buf, buf_size, flags, null, IntPtr.Zero);
}
public static bool InputText(
string label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback)
{
return InputText(label, buf, buf_size, flags, callback, IntPtr.Zero);
}
public static bool InputText(
string label,
byte[] buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
bool ret;
fixed (byte* bufPtr = buf)
{
ret = ImGuiNative.igInputText(utf8LabelBytes, bufPtr, buf_size, flags, callback, user_data.ToPointer()) != 0;
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
return ret;
}
public static bool InputText(
string label,
ref string input,
uint maxLength) => InputText(label, ref input, maxLength, 0, null, IntPtr.Zero);
public static bool InputText(
string label,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags) => InputText(label, ref input, maxLength, flags, null, IntPtr.Zero);
public static bool InputText(
string label,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback) => InputText(label, ref input, maxLength, flags, callback, IntPtr.Zero);
public static bool InputText(
string label,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
byte* utf8InputBytes;
byte* originalUtf8InputBytes;
if (inputBufSize > Util.StackAllocationSizeLimit)
{
utf8InputBytes = Util.Allocate(inputBufSize);
originalUtf8InputBytes = Util.Allocate(inputBufSize);
}
else
{
byte* inputStackBytes = stackalloc byte[inputBufSize];
utf8InputBytes = inputStackBytes;
byte* originalInputStackBytes = stackalloc byte[inputBufSize];
originalUtf8InputBytes = originalInputStackBytes;
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputText(
utf8LabelBytes,
utf8InputBytes,
(uint)inputBufSize,
flags,
callback,
user_data.ToPointer());
if (!Util.AreStringsEqual(originalUtf8InputBytes, inputBufSize, utf8InputBytes))
{
input = Util.StringFromPtr(utf8InputBytes);
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
if (inputBufSize > Util.StackAllocationSizeLimit)
{
Util.Free(utf8InputBytes);
Util.Free(originalUtf8InputBytes);
}
return result != 0;
}
public static bool InputTextMultiline(
string label,
ref string input,
uint maxLength,
Vector2 size) => InputTextMultiline(label, ref input, maxLength, size, 0, null, IntPtr.Zero);
public static bool InputTextMultiline(
string label,
ref string input,
uint maxLength,
Vector2 size,
ImGuiInputTextFlags flags) => InputTextMultiline(label, ref input, maxLength, size, flags, null, IntPtr.Zero);
public static bool InputTextMultiline(
string label,
ref string input,
uint maxLength,
Vector2 size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback) => InputTextMultiline(label, ref input, maxLength, size, flags, callback, IntPtr.Zero);
public static bool InputTextMultiline(
string label,
ref string input,
uint maxLength,
Vector2 size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
byte* utf8InputBytes;
byte* originalUtf8InputBytes;
if (inputBufSize > Util.StackAllocationSizeLimit)
{
utf8InputBytes = Util.Allocate(inputBufSize);
originalUtf8InputBytes = Util.Allocate(inputBufSize);
}
else
{
byte* inputStackBytes = stackalloc byte[inputBufSize];
utf8InputBytes = inputStackBytes;
byte* originalInputStackBytes = stackalloc byte[inputBufSize];
originalUtf8InputBytes = originalInputStackBytes;
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputTextMultiline(
utf8LabelBytes,
utf8InputBytes,
(uint)inputBufSize,
size,
flags,
callback,
user_data.ToPointer());
if (!Util.AreStringsEqual(originalUtf8InputBytes, inputBufSize, utf8InputBytes))
{
input = Util.StringFromPtr(utf8InputBytes);
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
if (inputBufSize > Util.StackAllocationSizeLimit)
{
Util.Free(utf8InputBytes);
Util.Free(originalUtf8InputBytes);
}
return result != 0;
}
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength) => InputTextWithHint(label, hint, ref input, maxLength, 0, null, IntPtr.Zero);
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags) => InputTextWithHint(label, hint, ref input, maxLength, flags, null, IntPtr.Zero);
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback) => InputTextWithHint(label, hint, ref input, maxLength, flags, callback, IntPtr.Zero);
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
int utf8HintByteCount = Encoding.UTF8.GetByteCount(hint);
byte* utf8HintBytes;
if (utf8HintByteCount > Util.StackAllocationSizeLimit)
{
utf8HintBytes = Util.Allocate(utf8HintByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8HintByteCount + 1];
utf8HintBytes = stackPtr;
}
Util.GetUtf8(hint, utf8HintBytes, utf8HintByteCount);
int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
byte* utf8InputBytes;
byte* originalUtf8InputBytes;
if (inputBufSize > Util.StackAllocationSizeLimit)
{
utf8InputBytes = Util.Allocate(inputBufSize);
originalUtf8InputBytes = Util.Allocate(inputBufSize);
}
else
{
byte* inputStackBytes = stackalloc byte[inputBufSize];
utf8InputBytes = inputStackBytes;
byte* originalInputStackBytes = stackalloc byte[inputBufSize];
originalUtf8InputBytes = originalInputStackBytes;
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputTextWithHint(
utf8LabelBytes,
utf8HintBytes,
utf8InputBytes,
(uint)inputBufSize,
flags,
callback,
user_data.ToPointer());
if (!Util.AreStringsEqual(originalUtf8InputBytes, inputBufSize, utf8InputBytes))
{
input = Util.StringFromPtr(utf8InputBytes);
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
if (utf8HintByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8HintBytes);
}
if (inputBufSize > Util.StackAllocationSizeLimit)
{
Util.Free(utf8InputBytes);
Util.Free(originalUtf8InputBytes);
}
return result != 0;
}
public static Vector2 CalcTextSize(string text, int start)
=> CalcTextSizeImpl(text, start);
public static Vector2 CalcTextSize(string text, float wrapWidth)
=> CalcTextSizeImpl(text, wrapWidth: wrapWidth);
public static Vector2 CalcTextSize(string text, int start, int length)
=> CalcTextSizeImpl(text, start, length);
public static Vector2 CalcTextSize(string text, int start, bool hideTextAfterDoubleHash)
=> CalcTextSizeImpl(text, start, hideTextAfterDoubleHash: hideTextAfterDoubleHash);
public static Vector2 CalcTextSize(string text, int start, float wrapWidth)
=> CalcTextSizeImpl(text, start, wrapWidth: wrapWidth);
public static Vector2 CalcTextSize(string text, int start, int length, bool hideTextAfterDoubleHash)
=> CalcTextSizeImpl(text, start, length, hideTextAfterDoubleHash);
public static Vector2 CalcTextSize(string text, int start, int length, float wrapWidth)
=> CalcTextSizeImpl(text, start, length, wrapWidth: wrapWidth);
public static Vector2 CalcTextSize(string text, int start, int length, bool hideTextAfterDoubleHash, float wrapWidth)
=> CalcTextSizeImpl(text, start, length, hideTextAfterDoubleHash, wrapWidth);
private static Vector2 CalcTextSizeImpl(
string text,
int start = 0,
int? length = null,
bool hideTextAfterDoubleHash = false,
float wrapWidth = -1.0f)
{
return CalcTextSize(text.Substring(start, length ?? text.Length-start), hideTextAfterDoubleHash, wrapWidth);
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size)
{
return InputText(label, buf, buf_size, 0, null, IntPtr.Zero);
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags)
{
return InputText(label, buf, buf_size, flags, null, IntPtr.Zero);
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback)
{
return InputText(label, buf, buf_size, flags, callback, IntPtr.Zero);
}
public static bool InputText(
string label,
IntPtr buf,
uint buf_size,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
bool ret = ImGuiNative.igInputText(utf8LabelBytes, (byte*)buf.ToPointer(), buf_size, flags, callback, user_data.ToPointer()) != 0;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
return ret;
}
public static bool Begin(string name, ImGuiWindowFlags flags)
{
int utf8NameByteCount = Encoding.UTF8.GetByteCount(name);
byte* utf8NameBytes;
if (utf8NameByteCount > Util.StackAllocationSizeLimit)
{
utf8NameBytes = Util.Allocate(utf8NameByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8NameByteCount + 1];
utf8NameBytes = stackPtr;
}
Util.GetUtf8(name, utf8NameBytes, utf8NameByteCount);
byte* p_open = null;
byte ret = ImGuiNative.igBegin(utf8NameBytes, p_open, flags);
if (utf8NameByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8NameBytes);
}
return ret != 0;
}
public static bool MenuItem(string label, bool enabled)
{
return MenuItem(label, string.Empty, false, enabled);
}
}
}

View File

@ -0,0 +1,60 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>A .NET wrapper for the Dear ImGui library.</Description>
<AssemblyVersion>1.90.0.1</AssemblyVersion>
<Authors>Eric Mellino</Authors>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>portable</DebugType>
<AssemblyName>ImGui.NET</AssemblyName>
<PackageId>ImGui.NET</PackageId>
<PackagePrereleaseIdentifier></PackagePrereleaseIdentifier>
<PackageVersion>$(AssemblyVersion)$(PackagePrereleaseIdentifier)</PackageVersion>
<PackageTags>ImGui ImGui.NET Immediate Mode GUI</PackageTags>
<PackageProjectUrl>https://github.com/mellinoe/imgui.net</PackageProjectUrl>
<DocumentationFile Condition="'$(Configuration)' == 'Release'">$(OutputPath)\ImGui.NET.xml</DocumentationFile>
<RootNamespace>ImGuiNET</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Numerics.Vectors" Version="4.4.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" />
<PackageReference Include="System.Buffers" Version="4.4.0" />
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>ImPlot.NET</_Parameter1>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>ImNodes.NET</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\deps\cimgui\win-x86\cimgui.dll">
<PackagePath>runtimes/win-x86/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\..\deps\cimgui\win-x64\cimgui.dll">
<PackagePath>runtimes/win-x64/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\..\deps\cimgui\win-arm64\cimgui.dll">
<PackagePath>runtimes/win-arm64/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\..\deps\cimgui\linux-x64\cimgui.so">
<PackagePath>runtimes/linux-x64/native/libcimgui.so</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="..\..\deps\cimgui\osx\cimgui.dylib">
<PackagePath>runtimes/osx/native/libcimgui.dylib</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="build\net40\ImGui.NET.targets">
<PackagePath>build/net40/ImGui.NET.targets</PackagePath>
<Pack>true</Pack>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="Generated\" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
using System;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
public static unsafe partial class ImGuiNative
{
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
public static extern void ImGuiPlatformIO_Set_Platform_GetWindowPos(ImGuiPlatformIO* platform_io, IntPtr funcPtr);
[DllImport("cimgui", CallingConvention = CallingConvention.Cdecl)]
public static extern void ImGuiPlatformIO_Set_Platform_GetWindowSize(ImGuiPlatformIO* platform_io, IntPtr funcPtr);
}
}

View File

@ -0,0 +1,4 @@
namespace ImGuiNET
{
public unsafe delegate void ImGuiSizeCallback(ImGuiSizeCallbackData* data);
}

View File

@ -0,0 +1,7 @@
using System.Runtime.InteropServices;
namespace ImGuiNET
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
public unsafe delegate int ImGuiInputTextCallback(ImGuiInputTextCallbackData* data);
}

82
lib/ImGui.NET/ImVector.cs Normal file
View File

@ -0,0 +1,82 @@
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 ImVector(int size, int capacity, IntPtr data)
{
Size = size;
Capacity = capacity;
Data = 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;
}
}
}
}

View File

@ -0,0 +1,29 @@
using System.Text;
namespace ImGuiNET
{
public unsafe struct NullTerminatedString
{
public readonly byte* Data;
public NullTerminatedString(byte* data)
{
Data = data;
}
public override string ToString()
{
int length = 0;
byte* ptr = Data;
while (*ptr != 0)
{
length += 1;
ptr += 1;
}
return Encoding.ASCII.GetString(Data, length);
}
public static implicit operator string(NullTerminatedString nts) => nts.ToString();
}
}

32
lib/ImGui.NET/Pair.cs Normal file
View File

@ -0,0 +1,32 @@
using System;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
public struct ImGuiStoragePair
{
public uint Key;
public UnionValue Value;
}
public unsafe struct ImGuiStoragePairPtr
{
public ImGuiStoragePair* NativePtr { get; }
public ImGuiStoragePairPtr(ImGuiStoragePair* nativePtr) => NativePtr = nativePtr;
public ImGuiStoragePairPtr(IntPtr nativePtr) => NativePtr = (ImGuiStoragePair*)nativePtr;
public static implicit operator ImGuiStoragePairPtr(ImGuiStoragePair* nativePtr) => new ImGuiStoragePairPtr(nativePtr);
public static implicit operator ImGuiStoragePair*(ImGuiStoragePairPtr wrappedPtr) => wrappedPtr.NativePtr;
public static implicit operator ImGuiStoragePairPtr(IntPtr nativePtr) => new ImGuiStoragePairPtr(nativePtr);
}
[StructLayout(LayoutKind.Explicit)]
public struct UnionValue
{
[FieldOffset(0)]
public int ValueI32;
[FieldOffset(0)]
public float ValueF32;
[FieldOffset(0)]
public IntPtr ValuePtr;
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Runtime.CompilerServices;
using System.Text;
namespace ImGuiNET
{
public unsafe struct RangeAccessor<T> where T : struct
{
private static readonly int s_sizeOfT = Unsafe.SizeOf<T>();
public readonly void* Data;
public readonly int Count;
public RangeAccessor(IntPtr data, int count) : this(data.ToPointer(), count) { }
public RangeAccessor(void* data, int count)
{
Data = data;
Count = count;
}
public ref T this[int index]
{
get
{
if (index < 0 || index >= Count)
{
throw new IndexOutOfRangeException();
}
return ref Unsafe.AsRef<T>((byte*)Data + s_sizeOfT * index);
}
}
}
public unsafe struct RangePtrAccessor<T> where T : struct
{
public readonly void* Data;
public readonly int Count;
public RangePtrAccessor(IntPtr data, int count) : this(data.ToPointer(), count) { }
public RangePtrAccessor(void* data, int count)
{
Data = data;
Count = count;
}
public T this[int index]
{
get
{
if (index < 0 || index >= Count)
{
throw new IndexOutOfRangeException();
}
return Unsafe.Read<T>((byte*)Data + sizeof(void*) * index);
}
}
}
public static class RangeAccessorExtensions
{
public static unsafe string GetStringASCII(this RangeAccessor<byte> stringAccessor)
{
return Encoding.ASCII.GetString((byte*)stringAccessor.Data, stringAccessor.Count);
}
}
}

97
lib/ImGui.NET/Util.cs Normal file
View File

@ -0,0 +1,97 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace ImGuiNET
{
internal static unsafe class Util
{
internal const int StackAllocationSizeLimit = 2048;
public static string StringFromPtr(byte* ptr)
{
int characters = 0;
while (ptr[characters] != 0)
{
characters++;
}
return Encoding.UTF8.GetString(ptr, characters);
}
internal static bool AreStringsEqual(byte* a, int aLength, byte* b)
{
for (int i = 0; i < aLength; i++)
{
if (a[i] != b[i]) { return false; }
}
if (b[aLength] != 0) { return false; }
return true;
}
internal static byte* Allocate(int byteCount) => (byte*)Marshal.AllocHGlobal(byteCount);
internal static void Free(byte* ptr) => Marshal.FreeHGlobal((IntPtr)ptr);
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
internal static int CalcSizeInUtf8(ReadOnlySpan<char> s, int start, int length)
#else
internal static int CalcSizeInUtf8(string s, int start, int length)
#endif
{
if (start < 0 || length < 0 || start + length > s.Length)
{
throw new ArgumentOutOfRangeException();
}
if(s.Length == 0) return 0;
fixed (char* utf16Ptr = s)
{
return Encoding.UTF8.GetByteCount(utf16Ptr + start, length);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
internal static int GetUtf8(ReadOnlySpan<char> s, byte* utf8Bytes, int utf8ByteCount)
{
if (s.IsEmpty)
{
return 0;
}
fixed (char* utf16Ptr = s)
{
return Encoding.UTF8.GetBytes(utf16Ptr, s.Length, utf8Bytes, utf8ByteCount);
}
}
#endif
internal static int GetUtf8(string s, byte* utf8Bytes, int utf8ByteCount)
{
fixed (char* utf16Ptr = s)
{
return Encoding.UTF8.GetBytes(utf16Ptr, s.Length, utf8Bytes, utf8ByteCount);
}
}
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
internal static int GetUtf8(ReadOnlySpan<char> s, int start, int length, byte* utf8Bytes, int utf8ByteCount)
#else
internal static int GetUtf8(string s, int start, int length, byte* utf8Bytes, int utf8ByteCount)
#endif
{
if (start < 0 || length < 0 || start + length > s.Length)
{
throw new ArgumentOutOfRangeException();
}
if (s.Length == 0) return 0;
fixed (char* utf16Ptr = s)
{
return Encoding.UTF8.GetBytes(utf16Ptr + start, length, utf8Bytes, utf8ByteCount);
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More