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
|
||||
GlitchyEditor/resources/scripts/ScriptCore.dll
|
||||
GlitchyEditor/resources/scripts/ScriptCore.pdb
|
||||
GlitchyEditor/settings.bon
|
||||
|
||||
@@ -70,6 +70,14 @@ namespace GlitchyEditor
|
||||
SceneState _sceneState = .Edit;
|
||||
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.
|
||||
public StringView SceneFilePath
|
||||
{
|
||||
@@ -623,6 +631,23 @@ namespace GlitchyEditor
|
||||
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()
|
||||
{
|
||||
ImGui.BeginMainMenuBar();
|
||||
@@ -635,11 +660,18 @@ namespace GlitchyEditor
|
||||
if (ImGui.MenuItem("Save", "Ctrl+S"))
|
||||
SaveScene();
|
||||
|
||||
if (ImGui.MenuItem("Save as...", "Ctrl+Shift+N"))
|
||||
if (ImGui.MenuItem("Save as...", "Ctrl+Shift+S"))
|
||||
SaveSceneAs();
|
||||
|
||||
if (ImGui.MenuItem("Open...", "Ctrl+O"))
|
||||
OpenScene();
|
||||
|
||||
if (ImGui.BeginMenu("Open Recent"))
|
||||
{
|
||||
DrawOpenRecentProjectMenu();
|
||||
|
||||
ImGui.EndMenu();
|
||||
}
|
||||
|
||||
ImGui.Separator();
|
||||
|
||||
|
||||
@@ -67,6 +67,11 @@ namespace GlitchyEngine
|
||||
{
|
||||
Settings settings = Application.Get().Settings;
|
||||
|
||||
if (!File.Exists("./settings.bon"))
|
||||
{
|
||||
settings.Save();
|
||||
}
|
||||
|
||||
var result = Bon.DeserializeFromFile(ref settings, "./settings.bon");
|
||||
|
||||
if (result case .Err)
|
||||
|
||||
Reference in New Issue
Block a user