Editor: Show name of open scene in window title

This commit is contained in:
Simon Lübeß
2024-01-12 15:41:56 +01:00
parent 827f3bb564
commit ba68eb7428
4 changed files with 32 additions and 3 deletions
+15 -1
View File
@@ -563,7 +563,19 @@ namespace GlitchyEditor
/// Updates the title of the window.
private void UpdateWindowTitle()
{
Application.Instance.Window.Title = scope $"Glitchy Engine - {_currentProject.Name}";
String title = scope String("Glitchy Engine");
if (_currentProject != null)
{
title.AppendF($" - {_currentProject.Name}");
}
if (_editorScene != null)
{
title.AppendF($" | {_editorScene.Name}");
}
Application.Instance.Window.Title = title;
}
#region Project Management
@@ -1047,6 +1059,8 @@ namespace GlitchyEditor
ScriptEngine.DeserializeScriptInstances(serializedObjects);
}
}
UpdateWindowTitle();
}
/// Creates a new default scene.
+2 -1
View File
@@ -107,11 +107,12 @@ namespace GlitchyEngine
delete _contentManager;
delete _layerStack;
delete _rendererApi;
delete _window;
delete _gameTime;
delete _layerStack;
ScriptEngine.Shutdown();
}
+12
View File
@@ -17,6 +17,8 @@ namespace GlitchyEngine.World
class Scene : RefCounter
{
private String _name = new String("New Scene") ~ delete _;
internal EcsWorld _ecsWorld = new .() ~ delete _;
internal b2World* _physicsWorld2D;
@@ -46,6 +48,16 @@ namespace GlitchyEngine.World
cameraEntity
};
/// Gets or sets the name of the scene.
public StringView Name
{
get => _name;
set
{
_name.Set(value);
}
}
public this()
{
_onComponentAddedHandlers.Add(typeof(CameraComponent), (e, t, c) => {
@@ -324,6 +324,8 @@ class SceneSerializer
Try!(reader.ObjectBlock());
_scene.Name = Path.GetFileName(filePath, .. scope .());
// TODO: Scene name goes here!
String testName;
Deserialize.Value(reader, "Name", out testName);