Add Godot project shell
This commit is contained in:
43
godot/scripts/debug/DebugOverlay.cs
Normal file
43
godot/scripts/debug/DebugOverlay.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
#nullable enable
|
||||
|
||||
using Godot;
|
||||
|
||||
namespace SideScrollerGame.Debug;
|
||||
|
||||
public partial class DebugOverlay : CanvasLayer
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
Layer = 100;
|
||||
ProcessMode = ProcessModeEnum.Always;
|
||||
EnsureLabel();
|
||||
}
|
||||
|
||||
public void SetStatus(DebugSettings settings, string loadedSceneId)
|
||||
{
|
||||
Label label = EnsureLabel();
|
||||
label.Text = $"Debug boot: {settings.BootMode}\nSeed: {settings.Seed}\nScene: {loadedSceneId}\nDebug: {OS.IsDebugBuild()}";
|
||||
}
|
||||
|
||||
private Label EnsureLabel()
|
||||
{
|
||||
if (m_StatusLabel is not null)
|
||||
{
|
||||
return m_StatusLabel;
|
||||
}
|
||||
|
||||
m_StatusLabel = GetNodeOrNull<Label>("StatusLabel");
|
||||
if (m_StatusLabel is null)
|
||||
{
|
||||
m_StatusLabel = new Label { Name = "StatusLabel" };
|
||||
AddChild(m_StatusLabel);
|
||||
}
|
||||
|
||||
m_StatusLabel.MouseFilter = Control.MouseFilterEnum.Ignore;
|
||||
m_StatusLabel.Position = new Vector2(8.0f, 8.0f);
|
||||
m_StatusLabel.AutowrapMode = TextServer.AutowrapMode.Off;
|
||||
return m_StatusLabel;
|
||||
}
|
||||
|
||||
private Label? m_StatusLabel;
|
||||
}
|
||||
Reference in New Issue
Block a user