45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Linq;
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
using Pong;
|
|
|
|
using Syntriax.Engine.Core;
|
|
using Syntriax.Engine.Core.Debug;
|
|
using Syntriax.Engine.Core.Serialization;
|
|
using Syntriax.Engine.Integration.MonoGame;
|
|
using Syntriax.Engine.Serializers.Yaml;
|
|
|
|
Universe universe = new();
|
|
|
|
ISerializer serializer = new YamlSerializer();
|
|
|
|
ILogger logger = new FileLogger($"logs/{DateTime.UtcNow:yyyy-MM-dd_HH-mm-ss}.log");
|
|
|
|
#if DEBUG
|
|
logger = new LoggerWrapper(logger, new ConsoleLogger());
|
|
#endif
|
|
|
|
universe.InstantiateUniverseObject().SetUniverseObject("Logger").BehaviourController.AddBehaviour<LoggerContainer>().Logger = logger;
|
|
|
|
bool isServerEnabled = Environment.GetCommandLineArgs().FirstOrDefault(x => x.CompareTo("--server") == 0) is not null;
|
|
|
|
if (isServerEnabled)
|
|
PongUniverse.ApplyPongServer(universe, 8888);
|
|
|
|
PongUniverse.ApplyPongClient(universe, "localhost", 8888);
|
|
PongUniverse.ApplyPongUniverse(universe);
|
|
|
|
universe.InstantiateUniverseObject().SetUniverseObject("Desktop HO")
|
|
.BehaviourController.AddBehaviour<KeyboardInputsBehaviour>();
|
|
|
|
using MonoGameWindow monoGameWindow = new(universe);
|
|
|
|
monoGameWindow.Graphics.PreferredBackBufferWidth = 1024;
|
|
monoGameWindow.Graphics.PreferredBackBufferHeight = 576;
|
|
monoGameWindow.Graphics.GraphicsProfile = GraphicsProfile.HiDef;
|
|
|
|
monoGameWindow.Run();
|