chore: cleaned up monogame references from desktop platform & shared project

This commit is contained in:
2026-01-26 12:21:30 +03:00
parent d71882c8e7
commit 9935805f06
6 changed files with 22 additions and 200 deletions

View File

@@ -1,16 +1,13 @@
using Microsoft.Xna.Framework.Graphics;
using System;
using Engine.Core;
using Engine.Core.Debug;
using Engine.Core.Serialization;
using Engine.Integration.MonoGame;
using Engine.Serializers.Yaml;
using Engine.Systems.Network;
using MyUniverse.Platforms.Desktop;
using Engine.Systems.Time;
Universe universe = new();
using MonoGameWindow monoGameWindow = new(universe);
ISerializer serializer = new YamlSerializer();
@@ -25,12 +22,8 @@ universe.InstantiateUniverseObject().SetUniverseObject("Logger")
IUniverseObject desktopParent = universe.InstantiateUniverseObject().SetUniverseObject("Desktop");
universe.InstantiateUniverseObject().SetUniverseObject("Desktop Inputs", desktopParent)
.BehaviourController.AddBehaviour<DesktopInputs>();
universe.InstantiateUniverseObject().SetUniverseObject("Visual Managers", desktopParent)
.BehaviourController.AddBehaviour<DrawManager>()
.BehaviourController.AddBehaviour<LoadContentManager>();
.BehaviourController.AddBehaviour<DrawManager>();
/* For Networking
LiteNetLibClient client = universe.InstantiateUniverseObject().SetUniverseObject("Client").BehaviourController.AddBehaviour<LiteNetLibClient>();
@@ -38,9 +31,24 @@ client.BehaviourController.AddBehaviour<NetworkManager>();
universe.OnPreUpdate.AddOneTimeListener((_, _) => client.Connect("localhost", 8888));
*/
MyUniverse.Shared.UniverseSource.ApplyClient(universe);
MyUniverse.Shared.UniverseSource.ApplyCore(universe);
MyUniverse.Shared.UniverseSource.ApplyUniverse(universe);
monoGameWindow.Graphics.GraphicsProfile = GraphicsProfile.HiDef;
desktopParent.AddChild(universe.InstantiateUniverseObject().SetUniverseObject("Triangle Batcher").BehaviourController.AddBehaviour<Engine.Systems.Graphics.TriangleBatcher>().UniverseObject);
monoGameWindow.Run();
universe.Initialize();
DateTime lastRun = DateTime.UtcNow;
TimeSpan timeSinceStart = new(0);
while (true)
{
DateTime now = DateTime.UtcNow;
TimeSpan updateTimeSpan = now - lastRun;
timeSinceStart += updateTimeSpan;
universe.Update(new(timeSinceStart, updateTimeSpan));
lastRun = now;
System.Threading.Thread.Sleep(1);
}