From e6749c51c4a2212f9671f69fe0a37eae4901ac52 Mon Sep 17 00:00:00 2001 From: chrisbell Date: Fri, 6 Feb 2026 23:22:48 -0600 Subject: [PATCH] Adding SzGui project --- .gitignore | 4 ++- SessionZero.sln | 6 ++++ SzCore/SzDataHandler.cs | 4 ++- SzCore/SzEvaluator.cs | 2 +- SzGui/Program.cs | 6 ++++ SzGui/SzApp.cs | 46 ++++++++++++++++++++++++ SzGui/SzGui.csproj | 20 +++++++++++ SzGui/imgui.ini | 79 +++++++++++++++++++++++++++++++++++++++++ flake.nix | 20 ++++++++++- 9 files changed, 183 insertions(+), 4 deletions(-) create mode 100644 SzGui/Program.cs create mode 100644 SzGui/SzApp.cs create mode 100644 SzGui/SzGui.csproj create mode 100644 SzGui/imgui.ini diff --git a/.gitignore b/.gitignore index 55b082d..c2742eb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ SzCli/bin/ SzCli/obj/ SzCore/bin/ -SzCore/obj/ \ No newline at end of file +SzCore/obj/ +SzGui/obj/ +SzGui/bin/ diff --git a/SessionZero.sln b/SessionZero.sln index 68f749e..1d52211 100644 --- a/SessionZero.sln +++ b/SessionZero.sln @@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SzCore", "SzCore\SzCore.csp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SzCli", "SzCli\SzCli.csproj", "{F598E3F7-5CE7-4713-9AED-9BCFDC872974}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SzGui", "SzGui\SzGui.csproj", "{3347AFA3-823F-4F40-9B9A-7C277164622E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -24,5 +26,9 @@ Global {F598E3F7-5CE7-4713-9AED-9BCFDC872974}.Debug|Any CPU.Build.0 = Debug|Any CPU {F598E3F7-5CE7-4713-9AED-9BCFDC872974}.Release|Any CPU.ActiveCfg = Release|Any CPU {F598E3F7-5CE7-4713-9AED-9BCFDC872974}.Release|Any CPU.Build.0 = Release|Any CPU + {3347AFA3-823F-4F40-9B9A-7C277164622E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3347AFA3-823F-4F40-9B9A-7C277164622E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3347AFA3-823F-4F40-9B9A-7C277164622E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3347AFA3-823F-4F40-9B9A-7C277164622E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/SzCore/SzDataHandler.cs b/SzCore/SzDataHandler.cs index 50bc11c..9a3f962 100644 --- a/SzCore/SzDataHandler.cs +++ b/SzCore/SzDataHandler.cs @@ -22,6 +22,8 @@ public class SzDataHandler try { var json = SZ.Parser.SerializeDatasetToJson(dataset); + var evalResult = await SZ.Evaluator.EvaluateDatasetAsync(dataset); + if (!evalResult.IsSuccess) return SzResult.Failure($"Could not save dataset, evaluation failed: {evalResult.Error!}"); var success = await SZ.LocalFileManager.SaveFileAsync(datasetPath, json, ct); return success ? SzResult.Success(true) : SzResult.Failure("Failed to write dataset file."); } @@ -246,4 +248,4 @@ public class SzDataHandler } } #endregion -} \ No newline at end of file +} diff --git a/SzCore/SzEvaluator.cs b/SzCore/SzEvaluator.cs index 7493e2b..dd53bef 100644 --- a/SzCore/SzEvaluator.cs +++ b/SzCore/SzEvaluator.cs @@ -109,4 +109,4 @@ public class SzEvaluator var errString = errors.ToString().Trim(); return string.IsNullOrEmpty(errString) ? SzResult.Success(true) : SzResult.Failure(errString); } -} \ No newline at end of file +} diff --git a/SzGui/Program.cs b/SzGui/Program.cs new file mode 100644 index 0000000..3b76925 --- /dev/null +++ b/SzGui/Program.cs @@ -0,0 +1,6 @@ +// See https://aka.ms/new-console-template for more information + +using SzGui; + +var app = new SzApp(); +app.Init(); \ No newline at end of file diff --git a/SzGui/SzApp.cs b/SzGui/SzApp.cs new file mode 100644 index 0000000..d1bfc47 --- /dev/null +++ b/SzGui/SzApp.cs @@ -0,0 +1,46 @@ +using System.Numerics; +using ImGuiNET; +using Raylib_cs; +using rlImGui_cs; + +namespace SzGui; + +public class SzApp +{ + public void Init() + { + Raylib.SetConfigFlags(ConfigFlags.Msaa4xHint | ConfigFlags.VSyncHint | ConfigFlags.ResizableWindow); + Raylib.InitWindow(1280, 800, "SessionZero"); + + rlImGui.Setup(true, true); + ImGui.GetIO().ConfigWindowsMoveFromTitleBarOnly = true; + + while (!Raylib.WindowShouldClose()) + { + Raylib.BeginDrawing(); + Raylib.ClearBackground(new Color(0, 20, 50)); + rlImGui.Begin(); + + ImGui.DockSpaceOverViewport(0); + + // ImGui.ShowDemoWindow(); + ImGui.ShowStyleEditor(); + DrawImGui(); + + rlImGui.End(); + Raylib.EndDrawing(); + } + + rlImGui.Shutdown(); + Raylib.CloseWindow(); + } + + private void DrawImGui() + { + if(ImGui.Begin("SessionZero")) + { + ImGui.TextUnformatted("Test: " + IconFonts.FontAwesome6.House); + } + ImGui.End(); + } +} diff --git a/SzGui/SzGui.csproj b/SzGui/SzGui.csproj new file mode 100644 index 0000000..16c9b9c --- /dev/null +++ b/SzGui/SzGui.csproj @@ -0,0 +1,20 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + + + diff --git a/SzGui/imgui.ini b/SzGui/imgui.ini new file mode 100644 index 0000000..09d83fd --- /dev/null +++ b/SzGui/imgui.ini @@ -0,0 +1,79 @@ +[Window][Debug##Default] +Pos=1006,402 +Size=762,814 +Collapsed=0 + +[Window][SessionZero] +Pos=0,0 +Size=3792,2067 +Collapsed=0 +DockId=0x08BD597D,0 + +[Window][Dear ImGui Demo] +Size=1894,2067 +Collapsed=0 +DockId=0x08BD597D,0 + +[Window][Dear ImGui Style Editor] +Pos=96,60 +Size=692,1365 +Collapsed=0 + +[Window][Example: Assets Browser] +Pos=60,60 +Size=800,480 +Collapsed=0 + +[Window][Dear ImGui Debug Log] +Pos=60,60 +Size=343,428 +Collapsed=0 + +[Window][About Dear ImGui] +Pos=1113,633 +Size=568,155 +Collapsed=0 + +[Window][Example: Auto-resizing window] +Pos=1131,778 +Size=652,464 +Collapsed=0 + +[Window][DockSpace Demo] +Pos=0,19 +Size=3840,2141 +Collapsed=0 + +[Window][Example: Console] +Pos=798,38 +Size=2086,2122 +Collapsed=0 +DockId=0xC0DFADC4,0 + +[Window][Example: Property editor] +Pos=60,60 +Size=430,450 +Collapsed=0 + +[Window][Example: Property editor/##tree_37EC733C] +IsChild=1 +Size=300,409 + +[Window][WindowOverViewport_11111111] +Pos=0,0 +Size=3792,2067 +Collapsed=0 + +[Table][0xB6880529,2] +RefScale=13 +Column 0 Sort=0v + +[Table][0x2048C668,2] +RefScale=13 +Column 0 Width=4 +Column 1 Weight=2.0000 + +[Docking][Data] +DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,0 Size=3792,2067 CentralNode=1 Selected=0x3C0097EB +DockSpace ID=0xC0DFADC4 Pos=0,38 Size=3840,2122 CentralNode=1 + diff --git a/flake.nix b/flake.nix index 8452abd..b3a393a 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,6 @@ outputs = { self, nixpkgs }: let supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f { pkgs = import nixpkgs { inherit system; }; }); @@ -19,10 +18,29 @@ nativeBuildInputs = with pkgs; [ dotnet-sdk omnisharp-roslyn + pkg-config + ]; + + buildInputs = with pkgs; [ + libGL + # X11 dependencies for Raylib + xorg.libX11 + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXrandr ]; shellHook = '' echo "// SESSION ZERO DEV SHELL //" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${with pkgs; lib.makeLibraryPath [ + libGL + xorg.libX11 + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXrandr + ]}" ''; }; });