Skip to content

Commit

Permalink
Updated Imgui to 1.90
Browse files Browse the repository at this point in the history
  • Loading branch information
muit committed Dec 8, 2023
1 parent 45a44ed commit bbb3a4f
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Extern/imgui
Submodule imgui updated 192 files
38 changes: 19 additions & 19 deletions Libs/AST/Src/Compiler/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<NativeBindingModule>().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<NativeBindingModule>().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");
Expand Down
4 changes: 4 additions & 0 deletions Libs/Backends/MIR/Compiler/Src/C2MIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ namespace rift::MIR

void CToMIR(Compiler& compiler, MIR_context* ctx)
{
c2mir_init(ctx);

c2mir_options options;
InitCToMIROptions(options);

Expand All @@ -35,6 +37,8 @@ namespace rift::MIR
auto& mirModule = compiler.ast.Get<CMIRModule>(moduleId);
CToMIRModule(compiler, ctx, options, name, mirModule);
}

c2mir_finish(ctx);
}

void CToMIRModule(Compiler& compiler, MIR_context* ctx, c2mir_options& options, p::Tag name,
Expand Down
2 changes: 1 addition & 1 deletion Libs/Backends/MIR/Compiler/Src/IRGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

namespace rift::MIR
{
void Generate(Compiler& compiler)
void GenerateC(Compiler& compiler)
{
MIRAccess access{compiler.ast};
CGenerator cGen{compiler, access};
Expand Down
2 changes: 1 addition & 1 deletion Libs/Backends/MIR/Compiler/Src/IRGeneration.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace rift::MIR
CDeclCStruct, CDeclCStatic, p::TWrite<CMIRType>, p::TWrite<CMIRFunctionSignature>,
p::TWrite<CMIRLiteral>>;

void Generate(Compiler& compiler);
void GenerateC(Compiler& compiler);


struct CGenerator
Expand Down
14 changes: 1 addition & 13 deletions Libs/Backends/MIR/Compiler/Src/MIRBackendModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

extern "C"
{
#include <c2mir/c2mir.h>
#include <mir-gen.h>
#include <mir.h>
}
Expand All @@ -41,15 +40,6 @@ namespace rift
void* handler = nullptr;
};

struct Input
{
const char* name = nullptr;
p::u8* currentChar = nullptr;
p::TArray<p::u8> code;
struct c2mir_options options;
};


// clang-format off
static Lib gStdLibs[] {
#if defined(_WIN32)
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -307,7 +296,6 @@ namespace rift
}

CloseSTDLibs();
c2mir_finish(ctx);
MIR_finish(ctx);
}
} // namespace rift
4 changes: 2 additions & 2 deletions Libs/Editor/Src/Panels/FileExplorerPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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();
}
Expand Down
6 changes: 3 additions & 3 deletions Libs/Editor/Src/Tools/BigBestFitArenaDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 3 additions & 4 deletions Libs/Editor/Src/Utils/DetailsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <AST/Utils/Expressions.h>
#include <AST/Utils/TypeUtils.h>
#include <GLFW/glfw3.h>
#include <IconsFontAwesome5.h>
#include <Pipe/Core/EnumFlags.h>
#include <PipeECS.h>
Expand Down Expand Up @@ -81,7 +80,7 @@ namespace rift::Editor

if (hovered)
{
if (UI::IsKeyReleased(GLFW_KEY_DELETE))
if (UI::IsKeyReleased(ImGuiKey_Delete))
{
removePin = true;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions Libs/Editor/Src/Utils/ElementsPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

#include <AST/Utils/Expressions.h>
#include <AST/Utils/TypeUtils.h>
#include <GLFW/glfw3.h>
#include <IconsFontAwesome5.h>
#include <Pipe/Core/EnumFlags.h>
#include <PipeECS.h>
Expand Down Expand Up @@ -61,7 +60,7 @@ namespace rift::Editor
{
editor.selectedPropertyId = variableId;

if (UI::IsKeyReleased(GLFW_KEY_DELETE))
if (UI::IsKeyReleased(ImGuiKey_Delete))
{
editor.pendingDeletePropertyId = variableId;
}
Expand Down Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions Libs/Editor/Src/Utils/FunctionGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include <AST/Utils/Expressions.h>
#include <AST/Utils/Statements.h>
#include <AST/Utils/TransactionUtils.h>
#include <GLFW/glfw3.h>
#include <PipeECS.h>
#include <UI/Style.h>
#include <Utils/Nodes.h>
Expand Down Expand Up @@ -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());
}
Expand Down
4 changes: 2 additions & 2 deletions Libs/UI/Src/Inspection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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;
Expand Down

0 comments on commit bbb3a4f

Please sign in to comment.