mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Almost entirely moved ImGui dependency (and settings) from Engine to Editor
This commit is contained in:
@@ -4,13 +4,16 @@ FileVersion = 1
|
|||||||
Name = "GlitchyEditor"
|
Name = "GlitchyEditor"
|
||||||
TargetType = "BeefGUIApplication"
|
TargetType = "BeefGUIApplication"
|
||||||
StartupObject = "GlitchyEngine.Program"
|
StartupObject = "GlitchyEngine.Program"
|
||||||
ProcessorMacros = ["GE_EDITOR_IMGUI_DEMO"]
|
ProcessorMacros = ["GE_EDITOR_IMGUI_DEMO", "GE_GRAPHICS_DX11"]
|
||||||
|
|
||||||
[Dependencies]
|
[Dependencies]
|
||||||
corlib = "*"
|
corlib = "*"
|
||||||
GlitchLog = "*"
|
GlitchLog = "*"
|
||||||
GlitchyEngine = "*"
|
GlitchyEngine = "*"
|
||||||
Xml-Beef = "*"
|
Xml-Beef = "*"
|
||||||
|
ImGuiImplDX11 = "*"
|
||||||
|
ImGuiImplWin32 = "*"
|
||||||
|
ImGuizmo = "*"
|
||||||
|
|
||||||
[Platform.Windows]
|
[Platform.Windows]
|
||||||
IconFile = "$(ProjectDir)/Resources/Textures/GlitchyEngineIcon.ico"
|
IconFile = "$(ProjectDir)/Resources/Textures/GlitchyEngineIcon.ico"
|
||||||
@@ -18,9 +21,13 @@ IconFile = "$(ProjectDir)/Resources/Textures/GlitchyEngineIcon.ico"
|
|||||||
[Configs.Debug.Win64]
|
[Configs.Debug.Win64]
|
||||||
PostBuildCmds = ["CopyFilesIfNewer(\"$(WorkspaceDir)/bin/vswhere.exe\", \"$(TargetDir)\")"]
|
PostBuildCmds = ["CopyFilesIfNewer(\"$(WorkspaceDir)/bin/vswhere.exe\", \"$(TargetDir)\")"]
|
||||||
DebugCommandArguments = "\"D:\\Development\\Git\\SingleStateToOrbit\""
|
DebugCommandArguments = "\"D:\\Development\\Git\\SingleStateToOrbit\""
|
||||||
|
PreprocessorMacros = ["DEBUG", "IMGUI"]
|
||||||
|
|
||||||
[Configs.Release.Win64]
|
[Configs.Release.Win64]
|
||||||
|
TargetDirectory = "$(BuildDir)/dist"
|
||||||
PostBuildCmds = ["CopyFilesIfNewer(\"$(WorkspaceDir)/bin/vswhere.exe\", \"$(TargetDir)\")"]
|
PostBuildCmds = ["CopyFilesIfNewer(\"$(WorkspaceDir)/bin/vswhere.exe\", \"$(TargetDir)\")"]
|
||||||
|
DebugCommandArguments = "\"D:\\Development\\Git\\SingleStateToOrbit\""
|
||||||
|
PreprocessorMacros = ["RELEASE", "IMGUI"]
|
||||||
|
|
||||||
[Configs.Paranoid.Win64]
|
[Configs.Paranoid.Win64]
|
||||||
PostBuildCmds = ["CopyFilesIfNewer(\"$(WorkspaceDir)/bin/vswhere.exe\", \"$(TargetDir)\")"]
|
PostBuildCmds = ["CopyFilesIfNewer(\"$(WorkspaceDir)/bin/vswhere.exe\", \"$(TargetDir)\")"]
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class RiderIdeAdapter : IIdeAdapter
|
|||||||
Editor.Instance.CurrentProject.GetPathToScriptSolutionFile(solutionPath);
|
Editor.Instance.CurrentProject.GetPathToScriptSolutionFile(solutionPath);
|
||||||
|
|
||||||
ProcessStartInfo startInfo = scope .();
|
ProcessStartInfo startInfo = scope .();
|
||||||
startInfo.SetFileName(Application.Instance.Settings.ScriptSettings.RiderPath);
|
startInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.RiderPath);
|
||||||
startInfo.SetArguments(scope $"{solutionPath} --line {lineNumber} {fileName}");
|
startInfo.SetArguments(scope $"{solutionPath} --line {lineNumber} {fileName}");
|
||||||
|
|
||||||
scope SpawnedProcess().Start(startInfo);
|
scope SpawnedProcess().Start(startInfo);
|
||||||
@@ -39,7 +39,7 @@ class RiderIdeAdapter : IIdeAdapter
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!File.Exists(Application.Instance.Settings.ScriptSettings.RiderPath))
|
if (!File.Exists(EditorApp.Instance.Settings.ScriptSettings.RiderPath))
|
||||||
{
|
{
|
||||||
Editor.Instance.ShowSettings();
|
Editor.Instance.ShowSettings();
|
||||||
Editor.Instance.SettingsWindow.HighlightSetting("Tools", "Rider path");
|
Editor.Instance.SettingsWindow.HighlightSetting("Tools", "Rider path");
|
||||||
@@ -51,7 +51,7 @@ class RiderIdeAdapter : IIdeAdapter
|
|||||||
}
|
}
|
||||||
|
|
||||||
ProcessStartInfo startInfo = scope .();
|
ProcessStartInfo startInfo = scope .();
|
||||||
startInfo.SetFileName(Application.Instance.Settings.ScriptSettings.RiderPath);
|
startInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.RiderPath);
|
||||||
startInfo.SetArguments(solutionPath);
|
startInfo.SetArguments(solutionPath);
|
||||||
|
|
||||||
scope SpawnedProcess().Start(startInfo);
|
scope SpawnedProcess().Start(startInfo);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class VisualStudioIdeAdapter : IIdeAdapter
|
|||||||
if (IsRunning())
|
if (IsRunning())
|
||||||
{
|
{
|
||||||
ProcessStartInfo startInfo = scope .();
|
ProcessStartInfo startInfo = scope .();
|
||||||
startInfo.SetFileName(Application.Instance.Settings.ScriptSettings.VisualStudioPath);
|
startInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.VisualStudioPath);
|
||||||
startInfo.SetArguments(scope $"/Edit {fileName}");
|
startInfo.SetArguments(scope $"/Edit {fileName}");
|
||||||
|
|
||||||
scope SpawnedProcess().Start(startInfo);
|
scope SpawnedProcess().Start(startInfo);
|
||||||
@@ -39,7 +39,7 @@ class VisualStudioIdeAdapter : IIdeAdapter
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessStartInfo startInfo = scope .();
|
ProcessStartInfo startInfo = scope .();
|
||||||
startInfo.SetFileName(Application.Instance.Settings.ScriptSettings.VisualStudioPath);
|
startInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.VisualStudioPath);
|
||||||
startInfo.SetArguments(scope $"/Edit {fileName}");
|
startInfo.SetArguments(scope $"/Edit {fileName}");
|
||||||
|
|
||||||
scope SpawnedProcess().Start(startInfo);
|
scope SpawnedProcess().Start(startInfo);
|
||||||
|
|||||||
@@ -604,7 +604,7 @@ namespace GlitchyEditor.EditWindows
|
|||||||
|
|
||||||
if (ImGui.MenuItem("Open C# Project..."))
|
if (ImGui.MenuItem("Open C# Project..."))
|
||||||
{
|
{
|
||||||
switch (Application.Instance.Settings.ScriptSettings.SelectedIde)
|
switch (EditorApp.Instance.Settings.ScriptSettings.SelectedIde)
|
||||||
{
|
{
|
||||||
case .VisualStudio:
|
case .VisualStudio:
|
||||||
VisualStudioIdeAdapter.OpenScriptProject();
|
VisualStudioIdeAdapter.OpenScriptProject();
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ using GlitchyEditor.Multithreading;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using GlitchyEditor.Platform;
|
using GlitchyEditor.Platform;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using GlitchyEditor.ImGui;
|
||||||
|
using GlitchyEngine.Events;
|
||||||
|
|
||||||
namespace GlitchyEditor
|
namespace GlitchyEditor
|
||||||
{
|
{
|
||||||
@@ -24,6 +26,14 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
public BackgroundTaskManager BackgroundTaskManager => _backgroundTaskManager;
|
public BackgroundTaskManager BackgroundTaskManager => _backgroundTaskManager;
|
||||||
|
|
||||||
|
#if IMGUI
|
||||||
|
private ImGuiLayer _imGuiLayer;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
private EditorLayer _editorLayer;
|
||||||
|
|
||||||
|
public Settings Settings { get; private set; } = new .() ~ delete _;
|
||||||
|
|
||||||
public this(String[] args)
|
public this(String[] args)
|
||||||
{
|
{
|
||||||
/*while(!Debug.IsDebuggerPresent)
|
/*while(!Debug.IsDebuggerPresent)
|
||||||
@@ -38,11 +48,28 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
DragDropManager.Init();
|
DragDropManager.Init();
|
||||||
|
|
||||||
PushLayer(new EditorLayer(args, _contentManager));
|
#if IMGUI
|
||||||
|
_imGuiLayer = new ImGuiLayer();
|
||||||
|
PushOverlay(_imGuiLayer);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_editorLayer = new EditorLayer(args, _contentManager);
|
||||||
|
PushLayer(_editorLayer);
|
||||||
|
|
||||||
|
GlitchyEditor.Settings.Load();
|
||||||
|
Settings.OnApplySettings.Add(new (s, e) => {
|
||||||
|
OnEvent(scope SettingsAppliedEvent());
|
||||||
|
});
|
||||||
|
Settings.Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ~this()
|
public ~this()
|
||||||
{
|
{
|
||||||
|
// TODO: We should clear the queue of _backgroundTaskManager
|
||||||
|
// TODO: We should maybe also notify the user that that would happen!
|
||||||
|
|
||||||
|
PopLayer(_editorLayer);
|
||||||
|
|
||||||
DragDropManager.Deinit();
|
DragDropManager.Deinit();
|
||||||
|
|
||||||
_backgroundTaskManager.Deinit();
|
_backgroundTaskManager.Deinit();
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using ImGui;
|
|||||||
using GlitchyEngine;
|
using GlitchyEngine;
|
||||||
using GlitchyEditor.EditWindows;
|
using GlitchyEditor.EditWindows;
|
||||||
using GlitchyEngine.Events;
|
using GlitchyEngine.Events;
|
||||||
using GlitchyEngine.ImGui;
|
|
||||||
using GlitchyEngine.Math;
|
using GlitchyEngine.Math;
|
||||||
using GlitchyEngine.Renderer;
|
using GlitchyEngine.Renderer;
|
||||||
using GlitchyEngine.World;
|
using GlitchyEngine.World;
|
||||||
@@ -17,6 +16,7 @@ using GlitchyEngine.Core;
|
|||||||
using GlitchyEditor.Assets;
|
using GlitchyEditor.Assets;
|
||||||
using GlitchyEngine.Scripting;
|
using GlitchyEngine.Scripting;
|
||||||
using GlitchyEditor.Platform.Windows;
|
using GlitchyEditor.Platform.Windows;
|
||||||
|
using GlitchyEditor.ImGui;
|
||||||
|
|
||||||
namespace GlitchyEditor
|
namespace GlitchyEditor
|
||||||
{
|
{
|
||||||
@@ -777,8 +777,8 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
if (Directory.Exists(project.WorkspacePath))
|
if (Directory.Exists(project.WorkspacePath))
|
||||||
{
|
{
|
||||||
Application.Instance.Settings.EditorSettings.LastOpenedProject = project.WorkspacePath;
|
EditorApp.Instance.Settings.EditorSettings.LastOpenedProject = project.WorkspacePath;
|
||||||
Application.Instance.Settings.Save();
|
EditorApp.Instance.Settings.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
return .Ok;
|
return .Ok;
|
||||||
@@ -811,7 +811,7 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
Log.EngineLogger.AssertDebug(_scriptSerializer.SerializedObjectCount == 0, "Somehow some entities are serialized.");
|
Log.EngineLogger.AssertDebug(_scriptSerializer.SerializedObjectCount == 0, "Somehow some entities are serialized.");
|
||||||
|
|
||||||
if (Application.Instance.Settings.EditorSettings.ClearLogOnPlay)
|
if (EditorApp.Instance.Settings.EditorSettings.ClearLogOnPlay)
|
||||||
Editor.Instance.LogWindow.ClearLog();
|
Editor.Instance.LogWindow.ClearLog();
|
||||||
|
|
||||||
_scriptSerializer.SerializeScriptInstances();
|
_scriptSerializer.SerializeScriptInstances();
|
||||||
@@ -830,7 +830,7 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
_editor.CurrentScene = _activeScene;
|
_editor.CurrentScene = _activeScene;
|
||||||
|
|
||||||
if (Application.Instance.Settings.EditorSettings.SwitchToPlayerOnPlay)
|
if (EditorApp.Instance.Settings.EditorSettings.SwitchToPlayerOnPlay)
|
||||||
SwitchToPlayWindow();
|
SwitchToPlayWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -887,7 +887,7 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
_editor.CurrentScene = _activeScene;
|
_editor.CurrentScene = _activeScene;
|
||||||
|
|
||||||
if (Application.Instance.Settings.EditorSettings.SwitchToPlayerOnSimulate)
|
if (EditorApp.Instance.Settings.EditorSettings.SwitchToPlayerOnSimulate)
|
||||||
SwitchToPlayWindow();
|
SwitchToPlayWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,7 +896,7 @@ namespace GlitchyEditor
|
|||||||
{
|
{
|
||||||
_isPaused = true;
|
_isPaused = true;
|
||||||
|
|
||||||
if (Application.Instance.Settings.EditorSettings.SwitchToEditorOnPause)
|
if (EditorApp.Instance.Settings.EditorSettings.SwitchToEditorOnPause)
|
||||||
SwitchToEditorWindow();
|
SwitchToEditorWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -905,7 +905,7 @@ namespace GlitchyEditor
|
|||||||
{
|
{
|
||||||
_isPaused = false;
|
_isPaused = false;
|
||||||
|
|
||||||
if (Application.Instance.Settings.EditorSettings.SwitchToPlayerOnResume)
|
if (EditorApp.Instance.Settings.EditorSettings.SwitchToPlayerOnResume)
|
||||||
SwitchToPlayWindow();
|
SwitchToPlayWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,6 +918,9 @@ namespace GlitchyEditor
|
|||||||
/// Stops the simulation or game and returns to edit mode.
|
/// Stops the simulation or game and returns to edit mode.
|
||||||
private void OnSceneStop()
|
private void OnSceneStop()
|
||||||
{
|
{
|
||||||
|
if (_activeScene == null)
|
||||||
|
return;
|
||||||
|
|
||||||
SetActiveScene(_editorScene, startRuntime: true, startSimulation: false, newPlayMode: .Editor);
|
SetActiveScene(_editorScene, startRuntime: true, startSimulation: false, newPlayMode: .Editor);
|
||||||
|
|
||||||
// TODO: _editorScene.DeserializeScripts(scriptData);
|
// TODO: _editorScene.DeserializeScripts(scriptData);
|
||||||
@@ -939,7 +942,7 @@ namespace GlitchyEditor
|
|||||||
GameViewportSizeChanged(null, _editor.GameViewportWindow.RenderedViewportSize);
|
GameViewportSizeChanged(null, _editor.GameViewportWindow.RenderedViewportSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Application.Instance.Settings.EditorSettings.SwitchToEditorOnStop)
|
if (EditorApp.Instance.Settings.EditorSettings.SwitchToEditorOnStop)
|
||||||
SwitchToEditorWindow();
|
SwitchToEditorWindow();
|
||||||
|
|
||||||
// Reconstruct state before play
|
// Reconstruct state before play
|
||||||
@@ -1394,7 +1397,7 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
private void ShowOpenRecentProjectMenu()
|
private void ShowOpenRecentProjectMenu()
|
||||||
{
|
{
|
||||||
let recentProjects = Application.Instance.Settings.EditorSettings.RecentProjects;
|
let recentProjects = EditorApp.Instance.Settings.EditorSettings.RecentProjects;
|
||||||
|
|
||||||
if (recentProjects == null)
|
if (recentProjects == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using System.IO;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace GlitchyEngine
|
namespace GlitchyEditor
|
||||||
{
|
{
|
||||||
extension Settings
|
extension Settings
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using ImGui;
|
using ImGui;
|
||||||
|
using GlitchyEngine;
|
||||||
using GlitchyEngine.Events;
|
using GlitchyEngine.Events;
|
||||||
using ImGuizmo;
|
|
||||||
using GlitchyEngine.Renderer;
|
using GlitchyEngine.Renderer;
|
||||||
|
using ImGuizmo;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using internal ImGui;
|
using internal ImGui;
|
||||||
@@ -17,7 +18,7 @@ using internal GlitchyEngine.Platform.DX11;
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace GlitchyEngine.ImGui
|
namespace GlitchyEditor.ImGui
|
||||||
{
|
{
|
||||||
public class ImGuiLayer : Layer
|
public class ImGuiLayer : Layer
|
||||||
{
|
{
|
||||||
@@ -91,7 +92,7 @@ namespace GlitchyEngine.ImGui
|
|||||||
|
|
||||||
private void LoadFont()
|
private void LoadFont()
|
||||||
{
|
{
|
||||||
var settings = Application.Instance.Settings.ImGuiSettings;
|
var settings = EditorApp.Instance.Settings.ImGuiSettings;
|
||||||
|
|
||||||
ImGui.GetIO().Fonts.Clear();
|
ImGui.GetIO().Fonts.Clear();
|
||||||
|
|
||||||
@@ -256,6 +257,11 @@ namespace GlitchyEngine.ImGui
|
|||||||
ImGui.RenderPlatformWindowsDefault();
|
ImGui.RenderPlatformWindowsDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
ImGuiRender();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+1
-1
@@ -8,7 +8,7 @@ namespace GlitchyEngine.Events
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace GlitchyEngine.ImGui
|
namespace GlitchyEditor.ImGui
|
||||||
{
|
{
|
||||||
public class ImGuiRenderEvent : Event, IEvent
|
public class ImGuiRenderEvent : Event, IEvent
|
||||||
{
|
{
|
||||||
@@ -461,7 +461,7 @@ class Project
|
|||||||
bool referenceScriptCoreProject = false;
|
bool referenceScriptCoreProject = false;
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
Settings settings = Application.Instance.Settings;
|
Settings settings = EditorApp.Instance.Settings;
|
||||||
referenceScriptCoreProject = settings.DevSettings.UseScriptCoreDll;
|
referenceScriptCoreProject = settings.DevSettings.UseScriptCoreDll;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ using ImGui;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Bon;
|
using Bon;
|
||||||
|
using GlitchyEngine;
|
||||||
|
|
||||||
namespace GlitchyEngine
|
namespace GlitchyEditor
|
||||||
{
|
{
|
||||||
interface ISettings
|
interface ISettings
|
||||||
{
|
{
|
||||||
@@ -84,7 +85,7 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
public static void Load()
|
public static void Load()
|
||||||
{
|
{
|
||||||
Settings settings = Application.Get().Settings;
|
Settings settings = EditorApp.Instance.Settings;
|
||||||
|
|
||||||
if (!File.Exists("./settings.bon"))
|
if (!File.Exists("./settings.bon"))
|
||||||
{
|
{
|
||||||
@@ -96,7 +97,7 @@ namespace GlitchyEngine
|
|||||||
if (result case .Err)
|
if (result case .Err)
|
||||||
Log.EngineLogger.Error("Failed to deserialze settings.");
|
Log.EngineLogger.Error("Failed to deserialze settings.");
|
||||||
|
|
||||||
Application.Get().Settings.Apply();
|
settings.Apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
@@ -138,7 +139,7 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
public void Apply()
|
public void Apply()
|
||||||
{
|
{
|
||||||
Application.Instance.[Friend]_imGuiLayer.SettingsInvalid = true;
|
EditorApp.Instance.[Friend]_imGuiLayer.SettingsInvalid = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -59,7 +59,7 @@ namespace GlitchyEditor
|
|||||||
{
|
{
|
||||||
_open = false;
|
_open = false;
|
||||||
|
|
||||||
_settings = Application.Instance.Settings;
|
_settings = EditorApp.Instance.Settings;
|
||||||
|
|
||||||
Create();
|
Create();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ DirectX = "*"
|
|||||||
FreeType = "*"
|
FreeType = "*"
|
||||||
cgltf-beef = "*"
|
cgltf-beef = "*"
|
||||||
msdfgen-beef = "*"
|
msdfgen-beef = "*"
|
||||||
ImGui = "*"
|
|
||||||
ImGuiImplDX11 = "*"
|
|
||||||
ImGuiImplWin32 = "*"
|
|
||||||
ImGuizmo = "*"
|
|
||||||
Beefy2D = "*"
|
Beefy2D = "*"
|
||||||
LodePng = "*"
|
LodePng = "*"
|
||||||
GlitchyEngineHelper = "*"
|
GlitchyEngineHelper = "*"
|
||||||
@@ -22,6 +18,7 @@ bon = "*"
|
|||||||
box2d-beef = "*"
|
box2d-beef = "*"
|
||||||
"Beef.Linq" = "*"
|
"Beef.Linq" = "*"
|
||||||
NetHostBeef = "*"
|
NetHostBeef = "*"
|
||||||
|
ImGuiImplWin32 = "*"
|
||||||
|
|
||||||
[Configs.Paranoid.Win32]
|
[Configs.Paranoid.Win32]
|
||||||
PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
|
PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
|
||||||
@@ -33,7 +30,7 @@ PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
|
|||||||
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
|
PreprocessorMacros = ["RELEASE", "GE_WINDOWS"]
|
||||||
|
|
||||||
[Configs.Release.Win64]
|
[Configs.Release.Win64]
|
||||||
PreprocessorMacros = ["IMGUI", "RELEASE", "GE_PROFILE"]
|
PreprocessorMacros = ["RELEASE", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES", "GE_RESOURCE_DEBUG_NAMES"]
|
||||||
|
|
||||||
[Configs.Test.Win32]
|
[Configs.Test.Win32]
|
||||||
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
||||||
@@ -42,4 +39,4 @@ PreprocessorMacros = ["TEST", "GE_WINDOWS"]
|
|||||||
PreprocessorMacros = ["TEST", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES", "IMGUI", "GE_RESOURCE_DEBUG_NAMES"]
|
PreprocessorMacros = ["TEST", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES", "IMGUI", "GE_RESOURCE_DEBUG_NAMES"]
|
||||||
|
|
||||||
[Configs.Debug.Win64]
|
[Configs.Debug.Win64]
|
||||||
PreprocessorMacros = ["DEBUG", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES", "IMGUI", "GE_RESOURCE_DEBUG_NAMES"]
|
PreprocessorMacros = ["DEBUG", "GE_PROFILE", "GE_PROFILE_RENDERER", "GE_PROFILE_RESOURCES", "GE_RESOURCE_DEBUG_NAMES"]
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using GlitchyEngine.Events;
|
using GlitchyEngine.Events;
|
||||||
using GlitchyEngine.ImGui;
|
|
||||||
using GlitchyEngine.Renderer;
|
using GlitchyEngine.Renderer;
|
||||||
using GlitchyEngine.Debug;
|
using GlitchyEngine.Debug;
|
||||||
using GlitchyEngine.Content;
|
using GlitchyEngine.Content;
|
||||||
@@ -22,9 +21,6 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
private append LayerStack _layerStack = .();
|
private append LayerStack _layerStack = .();
|
||||||
|
|
||||||
#if IMGUI
|
|
||||||
private ImGuiLayer _imGuiLayer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private append GameTime _gameTime = .();
|
private append GameTime _gameTime = .();
|
||||||
|
|
||||||
@@ -47,8 +43,6 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
public static Application Instance => s_Instance;
|
public static Application Instance => s_Instance;
|
||||||
|
|
||||||
public Settings Settings {get; private set;} = new .() ~ delete _;
|
|
||||||
|
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
Profiler.ProfileFunction!();
|
Profiler.ProfileFunction!();
|
||||||
@@ -77,17 +71,6 @@ namespace GlitchyEngine
|
|||||||
|
|
||||||
Renderer.Init();
|
Renderer.Init();
|
||||||
ScriptEngine.Init();
|
ScriptEngine.Init();
|
||||||
|
|
||||||
#if IMGUI
|
|
||||||
_imGuiLayer = new ImGuiLayer();
|
|
||||||
PushOverlay(_imGuiLayer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GlitchyEngine.Settings.Load();
|
|
||||||
Settings.OnApplySettings.Add(new (s, e) => {
|
|
||||||
OnEvent(scope SettingsAppliedEvent());
|
|
||||||
});
|
|
||||||
Settings.Apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initializes the content manager.
|
/// Initializes the content manager.
|
||||||
@@ -184,7 +167,7 @@ namespace GlitchyEngine
|
|||||||
if(allowFrame)
|
if(allowFrame)
|
||||||
{
|
{
|
||||||
#if IMGUI
|
#if IMGUI
|
||||||
_imGuiLayer.ImGuiRender();
|
//_imGuiLayer.ImGuiRender();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_window.Context.SwapChain.Present();
|
_window.Context.SwapChain.Present();
|
||||||
@@ -214,6 +197,20 @@ namespace GlitchyEngine
|
|||||||
ownOverlay.OnAttach();
|
ownOverlay.OnAttach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void PopLayer(Layer layer)
|
||||||
|
{
|
||||||
|
Profiler.ProfileFunction!();
|
||||||
|
|
||||||
|
_layerStack.PopLayer(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PopOverlay(Layer layer)
|
||||||
|
{
|
||||||
|
Profiler.ProfileFunction!();
|
||||||
|
|
||||||
|
_layerStack.PopOverlay(layer);
|
||||||
|
}
|
||||||
|
|
||||||
public bool OnWindowClose(WindowCloseEvent e)
|
public bool OnWindowClose(WindowCloseEvent e)
|
||||||
{
|
{
|
||||||
_running = false;
|
_running = false;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace GlitchyEngine
|
|||||||
public static extern void Impl_NewFrame();
|
public static extern void Impl_NewFrame();
|
||||||
public static extern void Impl_EndFrame();
|
public static extern void Impl_EndFrame();
|
||||||
|
|
||||||
public static void ImGuiDebugDraw()
|
/*public static void ImGuiDebugDraw()
|
||||||
{
|
{
|
||||||
if (ImGui.Begin("Input"))
|
if (ImGui.Begin("Input"))
|
||||||
{
|
{
|
||||||
@@ -116,7 +116,7 @@ namespace GlitchyEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui.End();
|
ImGui.End();
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Mouse
|
public static class Mouse
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ namespace GlitchyEngine
|
|||||||
{
|
{
|
||||||
_insertIndex--;
|
_insertIndex--;
|
||||||
layer.OnDetach();
|
layer.OnDetach();
|
||||||
|
delete layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +71,7 @@ namespace GlitchyEngine
|
|||||||
if(_layers.Remove(overlay))
|
if(_layers.Remove(overlay))
|
||||||
{
|
{
|
||||||
overlay.OnDetach();
|
overlay.OnDetach();
|
||||||
|
delete overlay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -275,7 +275,10 @@ namespace GlitchyEngine
|
|||||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This line is the reason why GlitchyEngine depends on ImGui...
|
||||||
|
#if IMGUI
|
||||||
ImGui.ImGuiImplWin32.WndProcHandler(hwnd, uMsg, wParam, lParam);
|
ImGui.ImGuiImplWin32.WndProcHandler(hwnd, uMsg, wParam, lParam);
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user