Skip to content

Commit 2331347

Browse files
committed
.NET: Migrate to Hexa.NET.ImGui
1 parent 4285afc commit 2331347

18 files changed

+68
-43
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2215,6 +2215,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
22152215
${CMKR_TARGET}
22162216
REFRAMEWORK_EXPORTS
22172217
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
2218+
CIMGUI_VARGS0
22182219
)
22192220

22202221
if(DEVELOPER_MODE) # developer-mode-cond
@@ -2416,6 +2417,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
24162417
${CMKR_TARGET}
24172418
REFRAMEWORK_EXPORTS
24182419
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
2420+
CIMGUI_VARGS0
24192421
)
24202422

24212423
if(DEVELOPER_MODE) # developer-mode-cond
@@ -4268,6 +4270,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
42684270
${CMKR_TARGET}
42694271
REFRAMEWORK_EXPORTS
42704272
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
4273+
CIMGUI_VARGS0
42714274
)
42724275

42734276
if(DEVELOPER_MODE) # developer-mode-cond
@@ -4469,6 +4472,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
44694472
${CMKR_TARGET}
44704473
REFRAMEWORK_EXPORTS
44714474
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
4475+
CIMGUI_VARGS0
44724476
)
44734477

44744478
if(DEVELOPER_MODE) # developer-mode-cond
@@ -4670,6 +4674,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
46704674
${CMKR_TARGET}
46714675
REFRAMEWORK_EXPORTS
46724676
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
4677+
CIMGUI_VARGS0
46734678
)
46744679

46754680
if(DEVELOPER_MODE) # developer-mode-cond
@@ -7349,6 +7354,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
73497354
${CMKR_TARGET}
73507355
REFRAMEWORK_EXPORTS
73517356
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
7357+
CIMGUI_VARGS0
73527358
)
73537359

73547360
if(DEVELOPER_MODE) # developer-mode-cond
@@ -7550,6 +7556,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
75507556
${CMKR_TARGET}
75517557
REFRAMEWORK_EXPORTS
75527558
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
7559+
CIMGUI_VARGS0
75537560
)
75547561

75557562
if(DEVELOPER_MODE) # developer-mode-cond
@@ -8578,6 +8585,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
85788585
${CMKR_TARGET}
85798586
REFRAMEWORK_EXPORTS
85808587
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
8588+
CIMGUI_VARGS0
85818589
)
85828590

85838591
if(DEVELOPER_MODE) # developer-mode-cond
@@ -9604,6 +9612,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
96049612
${CMKR_TARGET}
96059613
REFRAMEWORK_EXPORTS
96069614
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
9615+
CIMGUI_VARGS0
96079616
)
96089617

96099618
if(DEVELOPER_MODE) # developer-mode-cond
@@ -10632,6 +10641,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
1063210641
${CMKR_TARGET}
1063310642
REFRAMEWORK_EXPORTS
1063410643
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
10644+
CIMGUI_VARGS0
1063510645
)
1063610646

1063710647
if(DEVELOPER_MODE) # developer-mode-cond
@@ -11660,6 +11670,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
1166011670
${CMKR_TARGET}
1166111671
REFRAMEWORK_EXPORTS
1166211672
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
11673+
CIMGUI_VARGS0
1166311674
)
1166411675

1166511676
if(DEVELOPER_MODE) # developer-mode-cond
@@ -12688,6 +12699,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
1268812699
${CMKR_TARGET}
1268912700
REFRAMEWORK_EXPORTS
1269012701
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
12702+
CIMGUI_VARGS0
1269112703
)
1269212704

1269312705
if(DEVELOPER_MODE) # developer-mode-cond
@@ -13716,6 +13728,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
1371613728
${CMKR_TARGET}
1371713729
REFRAMEWORK_EXPORTS
1371813730
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
13731+
CIMGUI_VARGS0
1371913732
)
1372013733

1372113734
if(DEVELOPER_MODE) # developer-mode-cond
@@ -14744,6 +14757,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
1474414757
${CMKR_TARGET}
1474514758
REFRAMEWORK_EXPORTS
1474614759
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
14760+
CIMGUI_VARGS0
1474714761
)
1474814762

1474914763
if(DEVELOPER_MODE) # developer-mode-cond
@@ -15772,6 +15786,7 @@ if(REF_BUILD_FRAMEWORK AND CMAKE_SIZEOF_VOID_P EQUAL 8) # build-framework
1577215786
${CMKR_TARGET}
1577315787
REFRAMEWORK_EXPORTS
1577415788
"REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""
15789+
CIMGUI_VARGS0
1577515790
)
1577615791

1577715792
if(DEVELOPER_MODE) # developer-mode-cond

cmake.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ include-directories = ["shared/", "src/", "include/", "${OPENXR_SOURCE_DIR}/src"
248248
link-directories = ["dependencies/openvr/lib/win64/"]
249249
compile-options = ["/GS-", "/bigobj", "/EHa"]
250250
compile-features = ["cxx_std_23"]
251-
compile-definitions = ["${CMKR_TARGET}", "REFRAMEWORK_EXPORTS", "REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\""]
251+
compile-definitions = ["${CMKR_TARGET}", "REFRAMEWORK_EXPORTS", "REFRAMEWORK_GAME_NAME=\"${CMKR_TARGET}\"", "CIMGUI_VARGS0"]
252252
developer-mode-cond.compile-definitions = ["DEVELOPER"]
253253
link-libraries = [
254254
"${CMKR_TARGET}SDK",

csharp-api/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ check_dlls_exist("mhwilds" "${MHWILDS_DLLS}" "REFRAMEWORK_REF_ASSEMBLIES_EXIST_M
136136
set(REFRAMEWORK_NUGET_PACKAGES
137137
"Microsoft.CodeAnalysis.Common:4.9.2:net7.0"
138138
"Microsoft.CodeAnalysis.CSharp:4.9.2:net7.0"
139-
"ImGui.NET:1.90.1.1:net6.0"
139+
"Hexa.NET.ImGui:2.2.9:net8.0"
140+
"HexaGen.Runtime:1.1.21:net8.0"
140141
)
141142

142143
# Generate the VS_PACKAGE_REFERENCES property value

csharp-api/REFCoreDeps/GarbageCollectionDisplay.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ImGuiNET;
1+
using Hexa.NET.ImGui;
22
using System;
33

44
namespace REFrameworkNET {

csharp-api/REFrameworkNET/ManagedObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "Utility.hpp"
1515

16-
using namespace ImGuiNET;
16+
using namespace Hexa::NET::ImGui;
1717

1818
namespace REFrameworkNET {
1919
void ManagedObject::CleanupKnownCaches() {

csharp-api/REFrameworkNET/ManagedObject.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ public ref class ManagedObject : public REFrameworkNET::UnifiedObject
117117
}
118118

119119
static void DisplayStats() {
120-
if (ImGuiNET::ImGui::TreeNode(T::typeid->Name + " Cache")) {
121-
ImGuiNET::ImGui::Text("Cache size: " + s_impl->cache->Count.ToString());
122-
ImGuiNET::ImGui::Text("Pool size: " + s_impl->pool->Count.ToString());
123-
ImGuiNET::ImGui::TreePop();
120+
if (Hexa::NET::ImGui::ImGui::TreeNode(T::typeid->Name + " Cache")) {
121+
Hexa::NET::ImGui::ImGui::Text("Cache size: " + s_impl->cache->Count.ToString());
122+
Hexa::NET::ImGui::ImGui::Text("Pool size: " + s_impl->pool->Count.ToString());
123+
Hexa::NET::ImGui::ImGui::TreePop();
124124
}
125125
}
126126

csharp-api/REFrameworkNET/NativePool.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ namespace REFrameworkNET {
3333
}
3434

3535
static void DisplayStats() {
36-
if (ImGuiNET::ImGui::TreeNode(T::typeid->Name + " Cache")) {
37-
if (ImGuiNET::ImGui::Button("Clear Cache")) {
36+
if (Hexa::NET::ImGui::ImGui::TreeNode(T::typeid->Name + " Cache")) {
37+
if (Hexa::NET::ImGui::ImGui::Button("Clear Cache")) {
3838
s_cache->Clear();
3939
}
4040

41-
ImGuiNET::ImGui::Text("Cache size: " + s_cache->Count.ToString());
42-
ImGuiNET::ImGui::TreePop();
41+
Hexa::NET::ImGui::ImGui::Text("Cache size: " + s_cache->Count.ToString());
42+
Hexa::NET::ImGui::ImGui::TreePop();
4343
}
4444
}
4545
};

csharp-api/REFrameworkNET/PluginManager.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -808,24 +808,24 @@ namespace REFrameworkNET {
808808

809809
void PluginManager::ImGuiDrawUICallback(::REFImGuiFrameCbData* data) {
810810
// Draw our REFramework.NET menu which has buttons like reload scripts
811-
ImGuiNET::ImGui::PushID("REFramework.NET");
812-
if (ImGuiNET::ImGui::CollapsingHeader("REFramework.NET")) {
813-
if (ImGuiNET::ImGui::Button("Reload Scripts")) {
811+
Hexa::NET::ImGui::ImGui::PushID("REFramework.NET");
812+
if (Hexa::NET::ImGui::ImGui::CollapsingHeader("REFramework.NET")) {
813+
if (Hexa::NET::ImGui::ImGui::Button("Reload Scripts")) {
814814
s_wants_reload = true;
815815
}
816816

817-
ImGuiNET::ImGui::SameLine();
817+
Hexa::NET::ImGui::ImGui::SameLine();
818818

819-
if (ImGuiNET::ImGui::Button("Unload Scripts")) {
819+
if (Hexa::NET::ImGui::ImGui::Button("Unload Scripts")) {
820820
PluginManager::UnloadPlugins();
821821
}
822822

823-
ImGuiNET::ImGui::Checkbox("Auto Reload", s_auto_reload_plugins);
823+
Hexa::NET::ImGui::ImGui::Checkbox("Auto Reload", s_auto_reload_plugins);
824824

825-
if (ImGuiNET::ImGui::TreeNode("Debug Stats")) {
826-
if (ImGuiNET::ImGui::TreeNode("Garbage Collection")) {
825+
if (Hexa::NET::ImGui::ImGui::TreeNode("Debug Stats")) {
826+
if (Hexa::NET::ImGui::ImGui::TreeNode("Garbage Collection")) {
827827
REFrameworkNET::GarbageCollectionDisplay::Render();
828-
ImGuiNET::ImGui::TreePop();
828+
Hexa::NET::ImGui::ImGui::TreePop();
829829
}
830830

831831
ManagedObject::Cache<ManagedObject>::DisplayStats();
@@ -835,7 +835,7 @@ namespace REFrameworkNET {
835835
NativePool<Field>::DisplayStats();
836836
UnifiedObject::ProxyPool::DisplayStats();
837837

838-
ImGuiNET::ImGui::TreePop();
838+
Hexa::NET::ImGui::ImGui::TreePop();
839839
}
840840

841841
for each (PluginState^ state in PluginManager::s_plugin_states) {
@@ -849,7 +849,7 @@ namespace REFrameworkNET {
849849
PluginManager::s_plugin_states_to_remove->Clear();
850850
}
851851

852-
if (ImGuiNET::ImGui::CollapsingHeader("REFramework.NET Script Generated UI")) {
852+
if (Hexa::NET::ImGui::ImGui::CollapsingHeader("REFramework.NET Script Generated UI")) {
853853
try {
854854
Callbacks::ImGuiDrawUI::TriggerPre();
855855
} catch (System::Exception^ e) {
@@ -871,7 +871,7 @@ namespace REFrameworkNET {
871871
}
872872
}
873873

874-
ImGuiNET::ImGui::PopID();
874+
Hexa::NET::ImGui::ImGui::PopID();
875875
}
876876

877877
void PluginManager::PluginState::Unload() {
@@ -910,8 +910,8 @@ namespace REFrameworkNET {
910910
}
911911

912912
void PluginManager::PluginState::DisplayOptions() {
913-
if (ImGuiNET::ImGui::TreeNode(System::IO::Path::GetFileName(script_path))) {
914-
if (ImGuiNET::ImGui::Button("Unload")) {
913+
if (Hexa::NET::ImGui::ImGui::TreeNode(System::IO::Path::GetFileName(script_path))) {
914+
if (Hexa::NET::ImGui::ImGui::Button("Unload")) {
915915
if (SynchronousUnload()) {
916916
REFrameworkNET::API::LogInfo("Successfully unloaded " + script_path);
917917
// Remove this state from the list
@@ -922,7 +922,7 @@ namespace REFrameworkNET {
922922
}
923923
}
924924

925-
ImGuiNET::ImGui::TreePop();
925+
Hexa::NET::ImGui::ImGui::TreePop();
926926
}
927927
}
928928
}

csharp-api/REFrameworkNET/UnifiedObject.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#pragma once
22

3+
#pragma warning(push)
4+
#pragma warning(disable: 4642) // could not import constraints for generic parameter
5+
36
#include "IObject.hpp"
47
#include "ObjectEnumerator.hpp"
58

@@ -211,9 +214,9 @@ public ref class UnifiedObject abstract : public System::Dynamic::DynamicObject,
211214
}
212215

213216
static void DisplayStats() {
214-
if (ImGuiNET::ImGui::TreeNode("ProxyPool")) {
215-
ImGuiNET::ImGui::Text("Cache size: " + s_cache->Count.ToString());
216-
ImGuiNET::ImGui::TreePop();
217+
if (Hexa::NET::ImGui::ImGui::TreeNode("ProxyPool")) {
218+
Hexa::NET::ImGui::ImGui::Text("Cache size: " + s_cache->Count.ToString());
219+
Hexa::NET::ImGui::ImGui::TreePop();
217220
}
218221
}
219222

@@ -224,4 +227,6 @@ public ref class UnifiedObject abstract : public System::Dynamic::DynamicObject,
224227
static DictT^ s_cache = gcnew DictT(System::Environment::ProcessorCount * 2, 8192);
225228
};
226229
};
227-
}
230+
}
231+
232+
#pragma warning(pop)

csharp-api/cmake.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ check_dlls_exist("mhwilds" "${MHWILDS_DLLS}" "REFRAMEWORK_REF_ASSEMBLIES_EXIST_M
109109
set(REFRAMEWORK_NUGET_PACKAGES
110110
"Microsoft.CodeAnalysis.Common:4.9.2:net7.0"
111111
"Microsoft.CodeAnalysis.CSharp:4.9.2:net7.0"
112-
"ImGui.NET:1.90.1.1:net6.0"
112+
"Hexa.NET.ImGui:2.2.9:net8.0"
113+
"HexaGen.Runtime:1.1.21:net8.0"
113114
)
114115
115116
# Generate the VS_PACKAGE_REFERENCES property value

0 commit comments

Comments
 (0)