From bbb3a4ff5cc16a8165dc8307b31c77b8f7045311 Mon Sep 17 00:00:00 2001 From: muit Date: Fri, 8 Dec 2023 09:48:54 +0100 Subject: [PATCH] Updated Imgui to 1.90 --- Extern/Pipe | 2 +- Extern/imgui | 2 +- Libs/AST/Src/Compiler/Compiler.cpp | 38 +++++++++---------- Libs/Backends/MIR/Compiler/Src/C2MIR.cpp | 4 ++ .../MIR/Compiler/Src/IRGeneration.cpp | 2 +- Libs/Backends/MIR/Compiler/Src/IRGeneration.h | 2 +- .../MIR/Compiler/Src/MIRBackendModule.cpp | 14 +------ Libs/Editor/Src/Panels/FileExplorerPanel.cpp | 4 +- .../Src/Tools/BigBestFitArenaDebugger.cpp | 6 +-- Libs/Editor/Src/Utils/DetailsPanel.cpp | 7 ++-- Libs/Editor/Src/Utils/ElementsPanel.cpp | 5 +-- Libs/Editor/Src/Utils/FunctionGraph.cpp | 3 +- Libs/UI/Src/Inspection.cpp | 4 +- 13 files changed, 41 insertions(+), 52 deletions(-) diff --git a/Extern/Pipe b/Extern/Pipe index 62f032cd..f25626b0 160000 --- a/Extern/Pipe +++ b/Extern/Pipe @@ -1 +1 @@ -Subproject commit 62f032cd0d0bc24c2a060bc825d3bd3173781605 +Subproject commit f25626b02e50c6cd6fe1bee97c892bfe6153aec4 diff --git a/Extern/imgui b/Extern/imgui index bac748fa..ce0d0ac8 160000 --- a/Extern/imgui +++ b/Extern/imgui @@ -1 +1 @@ -Subproject commit bac748fa95ac003c7b354139980f8b4b7f6ac5da +Subproject commit ce0d0ac8298ce164b5d862577e8b087d92f6e90e diff --git a/Libs/AST/Src/Compiler/Compiler.cpp b/Libs/AST/Src/Compiler/Compiler.cpp index 882b9a7b..2dffe997 100644 --- a/Libs/AST/Src/Compiler/Compiler.cpp +++ b/Libs/AST/Src/Compiler/Compiler.cpp @@ -34,28 +34,28 @@ namespace rift return; } + if (!AST::HasProject(ast)) { - if (!AST::HasProject(ast)) - { - p::Error("No existing project to build."); - return; - } - compiler.config.Init(ast); - - if (auto* nativeBindings = GetModule().Get()) - { - p::Info("Interpret native modules"); - nativeBindings->SyncIncludes(ast); - } - - p::Info("Loading files"); - AST::LoadSystem::Run(ast); - - OptimizationSystem::PruneDisconnectedExpressions(ast); - AST::TypeSystem::PropagateVariableTypes(ast); - AST::TypeSystem::PropagateExpressionTypes(ast); + p::Error("No existing project to build."); + return; + } + + compiler.config.Init(ast); + + if (auto* nativeBindings = GetModule().Get()) + { + p::Info("Interpret native modules"); + nativeBindings->SyncIncludes(ast); } + p::Info("Loading files"); + AST::LoadSystem::Run(ast); + + OptimizationSystem::PruneDisconnectedExpressions(ast); + AST::TypeSystem::PropagateVariableTypes(ast); + AST::TypeSystem::PropagateExpressionTypes(ast); + + p::Info("Building project '{}'", AST::GetProjectName(compiler.ast)); // Clean build folders p::Info("Cleaning previous build"); diff --git a/Libs/Backends/MIR/Compiler/Src/C2MIR.cpp b/Libs/Backends/MIR/Compiler/Src/C2MIR.cpp index 21aaa968..40bbb8c6 100644 --- a/Libs/Backends/MIR/Compiler/Src/C2MIR.cpp +++ b/Libs/Backends/MIR/Compiler/Src/C2MIR.cpp @@ -26,6 +26,8 @@ namespace rift::MIR void CToMIR(Compiler& compiler, MIR_context* ctx) { + c2mir_init(ctx); + c2mir_options options; InitCToMIROptions(options); @@ -35,6 +37,8 @@ namespace rift::MIR auto& mirModule = compiler.ast.Get(moduleId); CToMIRModule(compiler, ctx, options, name, mirModule); } + + c2mir_finish(ctx); } void CToMIRModule(Compiler& compiler, MIR_context* ctx, c2mir_options& options, p::Tag name, diff --git a/Libs/Backends/MIR/Compiler/Src/IRGeneration.cpp b/Libs/Backends/MIR/Compiler/Src/IRGeneration.cpp index a15fc2c7..2e499998 100644 --- a/Libs/Backends/MIR/Compiler/Src/IRGeneration.cpp +++ b/Libs/Backends/MIR/Compiler/Src/IRGeneration.cpp @@ -13,7 +13,7 @@ namespace rift::MIR { - void Generate(Compiler& compiler) + void GenerateC(Compiler& compiler) { MIRAccess access{compiler.ast}; CGenerator cGen{compiler, access}; diff --git a/Libs/Backends/MIR/Compiler/Src/IRGeneration.h b/Libs/Backends/MIR/Compiler/Src/IRGeneration.h index a754b6b8..0bf04f73 100644 --- a/Libs/Backends/MIR/Compiler/Src/IRGeneration.h +++ b/Libs/Backends/MIR/Compiler/Src/IRGeneration.h @@ -44,7 +44,7 @@ namespace rift::MIR CDeclCStruct, CDeclCStatic, p::TWrite, p::TWrite, p::TWrite>; - void Generate(Compiler& compiler); + void GenerateC(Compiler& compiler); struct CGenerator diff --git a/Libs/Backends/MIR/Compiler/Src/MIRBackendModule.cpp b/Libs/Backends/MIR/Compiler/Src/MIRBackendModule.cpp index e38b6895..8dd1362b 100644 --- a/Libs/Backends/MIR/Compiler/Src/MIRBackendModule.cpp +++ b/Libs/Backends/MIR/Compiler/Src/MIRBackendModule.cpp @@ -16,7 +16,6 @@ extern "C" { -#include #include #include } @@ -41,15 +40,6 @@ namespace rift void* handler = nullptr; }; - struct Input - { - const char* name = nullptr; - p::u8* currentChar = nullptr; - p::TArray code; - struct c2mir_options options; - }; - - // clang-format off static Lib gStdLibs[] { #if defined(_WIN32) @@ -242,10 +232,9 @@ namespace rift using EntryFunctionPtr = p::i32 (*)(); void MIRBackend::Build(Compiler& compiler) { - MIR::Generate(compiler); + MIR::GenerateC(compiler); MIR_context* ctx = MIR_init(); - c2mir_init(ctx); MIR::CToMIR(compiler, ctx); @@ -307,7 +296,6 @@ namespace rift } CloseSTDLibs(); - c2mir_finish(ctx); MIR_finish(ctx); } } // namespace rift \ No newline at end of file diff --git a/Libs/Editor/Src/Panels/FileExplorerPanel.cpp b/Libs/Editor/Src/Panels/FileExplorerPanel.cpp index c7094028..33654423 100644 --- a/Libs/Editor/Src/Panels/FileExplorerPanel.cpp +++ b/Libs/Editor/Src/Panels/FileExplorerPanel.cpp @@ -378,7 +378,7 @@ namespace rift::Editor { UI::TreeNodeEx( text.c_str(), ImGuiTreeNodeFlags_Leaf | ImGuiTreeNodeFlags_NoTreePushOnOpen); - if (UI::IsItemHovered() && UI::IsKeyReleased(GLFW_KEY_F2)) + if (UI::IsItemHovered() && UI::IsKeyReleased(ImGuiKey_F2)) { renameId = item.id; renameBuffer = Strings::RemoveFromEnd(fileName, ".rf"); @@ -458,7 +458,7 @@ namespace rift::Editor if (IsTypeOpen(ast, item.id)) { - UI::SameLine(ImGui::GetContentRegionAvailWidth(), 0); + UI::SameLine(ImGui::GetContentRegionAvail().x, 0); UI::Bullet(); UI::NewLine(); } diff --git a/Libs/Editor/Src/Tools/BigBestFitArenaDebugger.cpp b/Libs/Editor/Src/Tools/BigBestFitArenaDebugger.cpp index 7a738139..2f37619c 100644 --- a/Libs/Editor/Src/Tools/BigBestFitArenaDebugger.cpp +++ b/Libs/Editor/Src/Tools/BigBestFitArenaDebugger.cpp @@ -64,7 +64,7 @@ namespace rift::Editor { return -1; } - const bool hovered = UI::ItemHoverable(frameBox, id); + const bool hovered = UI::ItemHoverable(frameBox, id, ImGuiItemFlags_None); UI::RenderFrame(frameBox.Min, frameBox.Max, UI::GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding); @@ -196,13 +196,13 @@ namespace rift::Editor const String usedPctLabel = Strings::Format("{:.0f}%% used ({})", usedPct * 100.f, used); const float pctFontSize = (UI::GetFontSize() * usedPctLabel.size()) / 2.f; - UI::SameLine(UI::GetWindowContentRegionWidth() / 2 - pctFontSize / 2, + UI::SameLine(UI::GetContentRegionAvail().x / 2 - pctFontSize / 2, UI::GetStyle().ItemInnerSpacing.x / 2); UI::Text(usedPctLabel); UI::SetItemAllowOverlap(); const float usedFontSize = (UI::GetFontSize() * size.size()) / 2.f; - UI::SameLine(UI::GetWindowContentRegionWidth() - usedFontSize); + UI::SameLine(UI::GetContentRegionAvail().x - usedFontSize); UI::Text(size); UI::PopStyleColor(2); diff --git a/Libs/Editor/Src/Utils/DetailsPanel.cpp b/Libs/Editor/Src/Utils/DetailsPanel.cpp index 272e60cf..c32d98b4 100644 --- a/Libs/Editor/Src/Utils/DetailsPanel.cpp +++ b/Libs/Editor/Src/Utils/DetailsPanel.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -81,7 +80,7 @@ namespace rift::Editor if (hovered) { - if (UI::IsKeyReleased(GLFW_KEY_DELETE)) + if (UI::IsKeyReleased(ImGuiKey_Delete)) { removePin = true; } @@ -148,7 +147,7 @@ namespace rift::Editor } UI::PushStyleCompact(); UI::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.5f}); - UI::SetNextItemWidth(UI::GetContentRegionAvailWidth()); + UI::SetNextItemWidth(UI::GetContentRegionAvail().x); if (UI::Selectable(ICON_FA_PLUS "##AddInput")) { ScopedChange(ast, id); @@ -175,7 +174,7 @@ namespace rift::Editor } UI::PushStyleCompact(); UI::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f, 0.5f)); - UI::SetNextItemWidth(UI::GetContentRegionAvailWidth()); + UI::SetNextItemWidth(UI::GetContentRegionAvail().x); if (UI::Selectable(ICON_FA_PLUS "##AddOutput")) { ScopedChange(ast, id); diff --git a/Libs/Editor/Src/Utils/ElementsPanel.cpp b/Libs/Editor/Src/Utils/ElementsPanel.cpp index 0b864acc..9fd4944e 100644 --- a/Libs/Editor/Src/Utils/ElementsPanel.cpp +++ b/Libs/Editor/Src/Utils/ElementsPanel.cpp @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -61,7 +60,7 @@ namespace rift::Editor { editor.selectedPropertyId = variableId; - if (UI::IsKeyReleased(GLFW_KEY_DELETE)) + if (UI::IsKeyReleased(ImGuiKey_Delete)) { editor.pendingDeletePropertyId = variableId; } @@ -254,7 +253,7 @@ namespace rift::Editor const String windowName = Strings::Format("Elements##{}", typeId); if (UI::Begin(windowName.c_str(), &editor.showElements)) { - UI::SetNextItemWidth(UI::GetContentRegionAvailWidth()); + UI::SetNextItemWidth(UI::GetContentRegionAvail().x); editor.elementsFilter.Draw("##filter"); if (AST::HasVariables(ast, typeId)) diff --git a/Libs/Editor/Src/Utils/FunctionGraph.cpp b/Libs/Editor/Src/Utils/FunctionGraph.cpp index 139c8532..aefc603f 100644 --- a/Libs/Editor/Src/Utils/FunctionGraph.cpp +++ b/Libs/Editor/Src/Utils/FunctionGraph.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -872,7 +871,7 @@ namespace rift::Editor::Graph Nodes::DrawMiniMap(0.2f, Nodes::MiniMapCorner::TopRight); PopNodeStyle(); - if (UI::IsKeyReleased(GLFW_KEY_DELETE)) + if (UI::IsKeyReleased(ImGuiKey_Delete)) { AST::RemoveNodes(ast, Nodes::GetSelectedNodes()); } diff --git a/Libs/UI/Src/Inspection.cpp b/Libs/UI/Src/Inspection.cpp index 2e577300..d5ab1fa0 100644 --- a/Libs/UI/Src/Inspection.cpp +++ b/Libs/UI/Src/Inspection.cpp @@ -138,7 +138,7 @@ namespace rift::UI // Ignore indent on buttons const float widthAvailable = - ImGui::GetContentRegionAvailWidth() + UI::GetCurrentWindow()->DC.Indent.x; + ImGui::GetContentRegionAvail().x + UI::GetCurrentWindow()->DC.Indent.x; UI::SameLine(widthAvailable - 50.f); UI::PushStyleCompact(); if (UI::Button(ICON_FA_PLUS "##AddItem", v2(16.f, 18.f))) @@ -156,7 +156,7 @@ namespace rift::UI void DrawArrayItemButtons(const ArrayProperty& property, void* instance, i32 index) { const float widthAvailable = - ImGui::GetContentRegionAvailWidth() + UI::GetCurrentWindow()->DC.Indent.x; + ImGui::GetContentRegionAvail().x + UI::GetCurrentWindow()->DC.Indent.x; UI::SameLine(widthAvailable - 50.f); UI::PushStyleCompact(); static String label;