mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
fixed Settings-File not being created and start of Recent-Projects-Menu
This commit is contained in:
@@ -7,3 +7,4 @@ vendor/directx
|
|||||||
imgui.ini
|
imgui.ini
|
||||||
GlitchyEditor/resources/scripts/ScriptCore.dll
|
GlitchyEditor/resources/scripts/ScriptCore.dll
|
||||||
GlitchyEditor/resources/scripts/ScriptCore.pdb
|
GlitchyEditor/resources/scripts/ScriptCore.pdb
|
||||||
|
GlitchyEditor/settings.bon
|
||||||
|
|||||||
@@ -70,6 +70,14 @@ namespace GlitchyEditor
|
|||||||
SceneState _sceneState = .Edit;
|
SceneState _sceneState = .Edit;
|
||||||
bool _isPaused = false;
|
bool _isPaused = false;
|
||||||
|
|
||||||
|
append List<(String Name, String Path)> _recentProjectPaths = .() ~ {
|
||||||
|
for (var item in _)
|
||||||
|
{
|
||||||
|
delete item.Name;
|
||||||
|
delete item.Path;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// Gets or sets the path of the current scene.
|
/// Gets or sets the path of the current scene.
|
||||||
public StringView SceneFilePath
|
public StringView SceneFilePath
|
||||||
{
|
{
|
||||||
@@ -623,6 +631,23 @@ namespace GlitchyEditor
|
|||||||
SetReference!(_activeScene, _editorScene);
|
SetReference!(_activeScene, _editorScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawOpenRecentProjectMenu()
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
for (let (name, path) in _recentProjectPaths)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (i >= 10)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (ImGui.MenuItem(scope $"{i}: {name} ({path})"))
|
||||||
|
{
|
||||||
|
LoadSceneFile(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawMainMenuBar()
|
private void DrawMainMenuBar()
|
||||||
{
|
{
|
||||||
ImGui.BeginMainMenuBar();
|
ImGui.BeginMainMenuBar();
|
||||||
@@ -635,12 +660,19 @@ namespace GlitchyEditor
|
|||||||
if (ImGui.MenuItem("Save", "Ctrl+S"))
|
if (ImGui.MenuItem("Save", "Ctrl+S"))
|
||||||
SaveScene();
|
SaveScene();
|
||||||
|
|
||||||
if (ImGui.MenuItem("Save as...", "Ctrl+Shift+N"))
|
if (ImGui.MenuItem("Save as...", "Ctrl+Shift+S"))
|
||||||
SaveSceneAs();
|
SaveSceneAs();
|
||||||
|
|
||||||
if (ImGui.MenuItem("Open...", "Ctrl+O"))
|
if (ImGui.MenuItem("Open...", "Ctrl+O"))
|
||||||
OpenScene();
|
OpenScene();
|
||||||
|
|
||||||
|
if (ImGui.BeginMenu("Open Recent"))
|
||||||
|
{
|
||||||
|
DrawOpenRecentProjectMenu();
|
||||||
|
|
||||||
|
ImGui.EndMenu();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
|
|
||||||
if (ImGui.MenuItem("Settings"))
|
if (ImGui.MenuItem("Settings"))
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ namespace GlitchyEngine
|
|||||||
{
|
{
|
||||||
Settings settings = Application.Get().Settings;
|
Settings settings = Application.Get().Settings;
|
||||||
|
|
||||||
|
if (!File.Exists("./settings.bon"))
|
||||||
|
{
|
||||||
|
settings.Save();
|
||||||
|
}
|
||||||
|
|
||||||
var result = Bon.DeserializeFromFile(ref settings, "./settings.bon");
|
var result = Bon.DeserializeFromFile(ref settings, "./settings.bon");
|
||||||
|
|
||||||
if (result case .Err)
|
if (result case .Err)
|
||||||
|
|||||||
Reference in New Issue
Block a user