-19
src/Debug/Debug.cs
-19
src/Debug/Debug.cs
···
89
.SetRelativeWindowSize(0.1f, 0.1f, 0.4f, 0.6f)
90
.SetAlwaysRebuildTexture(true));
91
92
-
SceneHandler.Register(new NotificationScene((int)(Game.Window.Width * 0.2), (int)(Game.Window.Height), "Notification")
93
-
.SetRelativeWindowSize(0f, 0f, 0.2f, 1f)
94
-
.SetAlwaysRebuildTexture(true)
95
-
.SetAlwaysAtFront(true));
96
-
97
SceneHandler.Register(new PerformanceScene((int)(Game.Window.Width * 0.2), (int)(Game.Window.Height * 0.4), "Performance")
98
.SetRelativeWindowSize(0f, 0.89f, 0.10f, 1.001f)
99
.SetAlwaysRebuildTexture(true));
100
101
-
SceneHandler.Load("Notification");
102
//SceneHandler.Load("Performance");
103
// SceneHandler.Load("Console");
104
// SceneHandler.Load("Inspector");
···
153
h = 0f
154
};
155
156
-
public static void SendNotification(string message)
157
-
{
158
-
SceneHandler.Get<NotificationScene>().Notifications.Add(new Notification() {
159
-
Life = 50f,
160
-
Message = message
161
-
});
162
-
}
163
-
164
public static void Log(object message)
165
{
166
Log(LogLevel.Message, message);
···
209
}
210
}
211
}
212
-
}
213
-
214
-
if(level == LogLevel.Error)
215
-
{
216
-
SendNotification(String.Join(" ", lines));
217
}
218
}
219
···
89
.SetRelativeWindowSize(0.1f, 0.1f, 0.4f, 0.6f)
90
.SetAlwaysRebuildTexture(true));
91
92
SceneHandler.Register(new PerformanceScene((int)(Game.Window.Width * 0.2), (int)(Game.Window.Height * 0.4), "Performance")
93
.SetRelativeWindowSize(0f, 0.89f, 0.10f, 1.001f)
94
.SetAlwaysRebuildTexture(true));
95
96
//SceneHandler.Load("Performance");
97
// SceneHandler.Load("Console");
98
// SceneHandler.Load("Inspector");
···
147
h = 0f
148
};
149
150
public static void Log(object message)
151
{
152
Log(LogLevel.Message, message);
···
195
}
196
}
197
}
198
}
199
}
200
-42
src/Debug/NotificationScene.cs
-42
src/Debug/NotificationScene.cs
···
1
-
using Fjord.Scenes;
2
-
using Fjord.Ui;
3
-
using Fjord.Graphics;
4
-
5
-
internal class Notification
6
-
{
7
-
public float Life = 0;
8
-
public string Message = "";
9
-
}
10
-
11
-
class NotificationScene : Scene
12
-
{
13
-
internal List<Notification> Notifications = new();
14
-
15
-
public NotificationScene(int width, int height, string id) : base(width, height, id)
16
-
{
17
-
}
18
-
19
-
public override void Awake()
20
-
{
21
-
SetCaptureMouse(false);
22
-
SetClearColor(0, 0, 0, 0);
23
-
}
24
-
25
-
public override void Render()
26
-
{
27
-
float yOffset = 10;
28
-
foreach(Notification notif in Notifications)
29
-
{
30
-
new Rectangle(new(10f, yOffset, WindowSize.X - 10, 100))
31
-
.Color(UiColors.Background)
32
-
.Fill(true)
33
-
.Render();
34
-
new Text(Font.DefaultFont, notif.Message)
35
-
.Color(UiColors.TextColor)
36
-
.Size(16)
37
-
.Position(new(15f, yOffset + 5f))
38
-
.Render();
39
-
yOffset += 110;
40
-
}
41
-
}
42
-
}
···