- Fixed bug in builder when no content files exist
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using ImGuiNET;
|
||||
using Nerfed.Runtime;
|
||||
using Nerfed.Runtime.Graphics;
|
||||
using Nerfed.Runtime.Gui;
|
||||
|
||||
namespace Nerfed.Editor
|
||||
{
|
||||
internal static class EditorGui
|
||||
{
|
||||
private static GuiController guiController;
|
||||
|
||||
internal static void Initialize()
|
||||
{
|
||||
// Create GuiController.
|
||||
guiController = new GuiController(Engine.GraphicsDevice, Engine.MainWindow, Color.DimGray);
|
||||
// Subscribe to GUI update.
|
||||
// GuiController.OnGui call => UpdateDock;
|
||||
// GuiController.OnGui call => UpdateEditorWindows;
|
||||
// GuiController.OnGui call => ...;
|
||||
guiController.OnGui += HandleOnGui;
|
||||
}
|
||||
|
||||
internal static void Update()
|
||||
{
|
||||
// Update GuiController.
|
||||
guiController.Update(Engine.Timestep.TotalSeconds);
|
||||
}
|
||||
|
||||
internal static void Render()
|
||||
{
|
||||
// Reneder GuiController.
|
||||
guiController.Render();
|
||||
}
|
||||
|
||||
internal static void Quit()
|
||||
{
|
||||
guiController.Dispose();
|
||||
}
|
||||
|
||||
private static void UpdateDock()
|
||||
{
|
||||
// Setup default dockspace for the main window.
|
||||
uint id = ImGui.GetID("MainDockSpace");
|
||||
ImGui.DockSpaceOverViewport(id, ImGui.GetMainViewport(), ImGuiDockNodeFlags.None);
|
||||
}
|
||||
|
||||
private static void UpdateMainMenu()
|
||||
{
|
||||
if (ImGui.BeginMainMenuBar())
|
||||
{
|
||||
if (ImGui.BeginMenu("File"))
|
||||
{
|
||||
if (ImGui.MenuItem("Exit"))
|
||||
{
|
||||
Engine.Quit();
|
||||
}
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
ImGui.EndMainMenuBar();
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleOnGui()
|
||||
{
|
||||
UpdateMainMenu();
|
||||
UpdateDock();
|
||||
|
||||
ImGui.ShowDemoWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Nerfed.Runtime\Nerfed.Runtime.csproj"/>
|
||||
<ProjectReference Include="..\Nerfed.Runtime\Nerfed.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project=".\CopyLibs.targets"/>
|
||||
@@ -31,4 +31,4 @@
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command=""$(ProjectDir)../Tools/Nerfed.Builder/Nerfed.Builder" -build -projectPath $(ProjectDir) -platform Desktop" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -6,6 +6,37 @@ internal class Program
|
||||
{
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
Engine.OnInitialize += HandleOnInitialize;
|
||||
Engine.OnUpdate += HandleOnUpdate;
|
||||
Engine.OnRender += HandleOnRender;
|
||||
Engine.OnQuit += HandleOnQuit;
|
||||
|
||||
Engine.Run(args);
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleOnInitialize()
|
||||
{
|
||||
// Open project.
|
||||
// Setip EditorGui.
|
||||
EditorGui.Initialize();
|
||||
}
|
||||
|
||||
private static void HandleOnUpdate()
|
||||
{
|
||||
// Editor Update.
|
||||
EditorGui.Update();
|
||||
|
||||
|
||||
// Try Catch UserCode Update.
|
||||
}
|
||||
|
||||
private static void HandleOnRender()
|
||||
{
|
||||
EditorGui.Render();
|
||||
}
|
||||
|
||||
private static void HandleOnQuit()
|
||||
{
|
||||
EditorGui.Quit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user