A simple .NET Framework to make 2D games quick and easy.

Removed Notifications

Changed files
-61
src
-19
src/Debug/Debug.cs
··· 89 89 .SetRelativeWindowSize(0.1f, 0.1f, 0.4f, 0.6f) 90 90 .SetAlwaysRebuildTexture(true)); 91 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 92 SceneHandler.Register(new PerformanceScene((int)(Game.Window.Width * 0.2), (int)(Game.Window.Height * 0.4), "Performance") 98 93 .SetRelativeWindowSize(0f, 0.89f, 0.10f, 1.001f) 99 94 .SetAlwaysRebuildTexture(true)); 100 95 101 - SceneHandler.Load("Notification"); 102 96 //SceneHandler.Load("Performance"); 103 97 // SceneHandler.Load("Console"); 104 98 // SceneHandler.Load("Inspector"); ··· 153 147 h = 0f 154 148 }; 155 149 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 150 public static void Log(object message) 165 151 { 166 152 Log(LogLevel.Message, message); ··· 209 195 } 210 196 } 211 197 } 212 - } 213 - 214 - if(level == LogLevel.Error) 215 - { 216 - SendNotification(String.Join(" ", lines)); 217 198 } 218 199 } 219 200
-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 - }