diff --git a/.vscode/launch.json b/.vscode/launch.json
index 2eb044b..3c7c2a0 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -33,17 +33,6 @@
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"console": "internalConsole"
- },
- {
- "name": ".NET Launch (Host)",
- "type": "coreclr",
- "request": "launch",
- "preLaunchTask": "build",
- "program": "${workspaceFolder}/Platforms/Desktop/bin/Debug/net9.0/Desktop.exe",
- "args": ["--server"],
- "cwd": "${workspaceFolder}",
- "stopAtEntry": false,
- "console": "internalConsole"
}
],
"compounds": [
diff --git a/Engine b/Engine
index c3be8f6..767fc28 160000
--- a/Engine
+++ b/Engine
@@ -1 +1 @@
-Subproject commit c3be8f60b7e78984bb73501dc4d273a05b1331d2
+Subproject commit 767fc28488fbbea9d1125f91934f4b882275890c
diff --git a/Platforms/Desktop/ClientConfiguration.cs b/Platforms/Desktop/ClientConfiguration.cs
new file mode 100644
index 0000000..b390f4c
--- /dev/null
+++ b/Platforms/Desktop/ClientConfiguration.cs
@@ -0,0 +1,11 @@
+public class ClientConfiguration
+{
+ public bool Host = false;
+ public int HostPort = 8888;
+
+ public string ServerAddress = "localhost";
+ public int ServerPort = 8888;
+
+ public int windowWidth = 1024;
+ public int windowHeight = 576;
+}
diff --git a/Platforms/Desktop/Desktop.csproj b/Platforms/Desktop/Desktop.csproj
index 8981cd7..ebd3a07 100644
--- a/Platforms/Desktop/Desktop.csproj
+++ b/Platforms/Desktop/Desktop.csproj
@@ -39,6 +39,7 @@
+
diff --git a/Platforms/Desktop/Program.cs b/Platforms/Desktop/Program.cs
index 4292788..4dbe571 100644
--- a/Platforms/Desktop/Program.cs
+++ b/Platforms/Desktop/Program.cs
@@ -1,11 +1,8 @@
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;
@@ -24,21 +21,34 @@ logger = new LoggerWrapper(logger, new ConsoleLogger());
universe.InstantiateUniverseObject().SetUniverseObject("Logger").BehaviourController.AddBehaviour().Logger = logger;
-bool isServerEnabled = Environment.GetCommandLineArgs().FirstOrDefault(x => x.CompareTo("--server") == 0) is not null;
+string settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "settings.yaml");
+ClientConfiguration clientConfiguration;
+try
+{
+ clientConfiguration = serializer.Deserialize(File.ReadAllText(settingsPath));
+ logger.Log(clientConfiguration, $"{settingsPath} read");
+}
+catch (Exception exception)
+{
+ clientConfiguration = new();
+ logger.LogError(serializer, $"Error loading {settingsPath}. Creating new settings file");
+ logger.LogException(serializer, exception);
+ File.WriteAllText(settingsPath, serializer.Serialize(clientConfiguration));
+}
-if (isServerEnabled)
- PongUniverse.ApplyPongServer(universe, 8888);
+if (clientConfiguration.Host)
+ Pong.PongUniverse.ApplyPongServer(universe, clientConfiguration.HostPort);
-PongUniverse.ApplyPongClient(universe, "localhost", 8888);
-PongUniverse.ApplyPongUniverse(universe);
+Pong.PongUniverse.ApplyPongClient(universe, clientConfiguration.ServerAddress, clientConfiguration.ServerPort);
+Pong.PongUniverse.ApplyPongUniverse(universe);
universe.InstantiateUniverseObject().SetUniverseObject("Desktop HO")
.BehaviourController.AddBehaviour();
using MonoGameWindow monoGameWindow = new(universe);
-monoGameWindow.Graphics.PreferredBackBufferWidth = 1024;
-monoGameWindow.Graphics.PreferredBackBufferHeight = 576;
+monoGameWindow.Graphics.PreferredBackBufferWidth = clientConfiguration.windowWidth;
+monoGameWindow.Graphics.PreferredBackBufferHeight = clientConfiguration.windowHeight;
monoGameWindow.Graphics.GraphicsProfile = GraphicsProfile.HiDef;
monoGameWindow.Run();
diff --git a/Pong.sln b/Pong.sln
index c07d765..ddfb00f 100644
--- a/Pong.sln
+++ b/Pong.sln
@@ -25,6 +25,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Engine.Integration.MonoGame
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Platforms\Server\Server.csproj", "{A15263DB-DF65-4A07-8CA1-33A2919501A0}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Engine.Serializers", "Engine.Serializers", "{F1257AE1-A8BC-DE44-CB86-406F1335A1D0}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Engine.Serializers.Yaml", "Engine\Engine.Serializers\Engine.Serializers.Yaml\Engine.Serializers.Yaml.csproj", "{79F870AB-249E-4CA0-9DF0-F265514581DF}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -131,6 +135,18 @@ Global
{A15263DB-DF65-4A07-8CA1-33A2919501A0}.Release|x64.Build.0 = Release|Any CPU
{A15263DB-DF65-4A07-8CA1-33A2919501A0}.Release|x86.ActiveCfg = Release|Any CPU
{A15263DB-DF65-4A07-8CA1-33A2919501A0}.Release|x86.Build.0 = Release|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Debug|x64.Build.0 = Debug|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Debug|x86.Build.0 = Debug|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Release|x64.ActiveCfg = Release|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Release|x64.Build.0 = Release|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Release|x86.ActiveCfg = Release|Any CPU
+ {79F870AB-249E-4CA0-9DF0-F265514581DF}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -144,5 +160,7 @@ Global
{9059393F-4073-9273-0EEC-2B1BA61B620B} = {F7F62670-237A-4C93-A30E-CE661C6FC401}
{7CC31BC4-38EE-40F4-BBBA-9FC2F4CF6283} = {9059393F-4073-9273-0EEC-2B1BA61B620B}
{A15263DB-DF65-4A07-8CA1-33A2919501A0} = {FECFFD54-338F-4060-9161-1E5770D1DC33}
+ {F1257AE1-A8BC-DE44-CB86-406F1335A1D0} = {F7F62670-237A-4C93-A30E-CE661C6FC401}
+ {79F870AB-249E-4CA0-9DF0-F265514581DF} = {F1257AE1-A8BC-DE44-CB86-406F1335A1D0}
EndGlobalSection
EndGlobal