43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
#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;
|
|
} |