diff --git a/CLEditor.Core/CLEditor.Core.csproj b/CLEditor.Core/CLEditor.Core.csproj index e8f02ab769616c32c51501e0d9eebfb57690f2fb..35a5a7164e9c7518353bfbb173dd66040fd02f21 100644 --- a/CLEditor.Core/CLEditor.Core.csproj +++ b/CLEditor.Core/CLEditor.Core.csproj @@ -68,7 +68,6 @@ - @@ -84,6 +83,7 @@ + diff --git a/CLEditor.Core/Debug.cs b/CLEditor.Core/Debug.cs deleted file mode 100644 index 625393a96218868742086cb1645be5423e454f76..0000000000000000000000000000000000000000 --- a/CLEditor.Core/Debug.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.ObjectModel; - -namespace CLEditor.Core -{ - public static class Debug - { - public static ObservableCollection Messages { get; set; } - public static void Warning(string message) - { - var log = new Log - { - Type = LogType.Warn, - Message = message, - }; - Messages.Add(log); - } - - public static void Error(string message) - { - var log = new Log - { - Type = LogType.Error, - Message = message, - }; - Messages.Add(log); - } - - public static void Error(Exception exception) - { - var log = new Log - { - Type = LogType.Error, - Message = exception.Message, - File = exception.Source, - Status = exception.TargetSite.Name - }; - Messages.Add(log); - } - - public static void WriteLine(string message) - { - } - - static Debug() - { - Messages = new ObservableCollection(); - } - } -} \ No newline at end of file diff --git a/CLEditor.Core/Diagnostics/ConsoleLogListener.cs b/CLEditor.Core/Diagnostics/ConsoleLogListener.cs index fa60e4c55ebbb4f609f5eebc3ab707e885e00996..fc3071f5dbc572fd3d1db91409e69bb845b6bb2b 100644 --- a/CLEditor.Core/Diagnostics/ConsoleLogListener.cs +++ b/CLEditor.Core/Diagnostics/ConsoleLogListener.cs @@ -71,7 +71,60 @@ namespace CLEditor.Core.Diagnostics { return; } + + EnsureConsole(); + +#if C_PLATFORM_ANDROID + return; +#else + var exceptionMsg = GetExceptionText(logMessage); +#if C_PLATFORM_WINDOWS_DESKTOP || C_PLATFORM_UNIX + var initialColor = Console.ForegroundColor; + + switch (logMessage.Type) + { + case LogMessageType.Debug: + Console.ForegroundColor = (ConsoleColor.DarkGray); + break; + case LogMessageType.Verbose: + Console.ForegroundColor = (ConsoleColor.Gray); + break; + case LogMessageType.Info: + Console.ForegroundColor = (ConsoleColor.Green); + break; + case LogMessageType.Warning: + Console.ForegroundColor = (ConsoleColor.Yellow); + break; + case LogMessageType.Error: + case LogMessageType.Fatal: + Console.ForegroundColor = (ConsoleColor.Red); + break; + } +#endif + + if (Debugger.IsAttached) + { + Debug.WriteLine(GetDefaultText(logMessage)); + if (!string.IsNullOrEmpty(exceptionMsg)) + { + Debug.WriteLine(logMessage); + } + } + +#if !C_PLATFORM_UWP + Console.WriteLine(GetDefaultText(logMessage)); + if (!string.IsNullOrEmpty(exceptionMsg)) + { + Console.WriteLine(exceptionMsg); + } +#endif + +#if C_PLATFORM_WINDOWS_DESKTOP || C_PLATFORM_UNIX + Console.ForegroundColor = initialColor; +#endif +#endif } + #if C_PLATFORM_WINDOWS_DESKTOP private const int StdOutConsoleHandle = -11; diff --git a/CLEditor.Core/Diagnostics/LogListener.cs b/CLEditor.Core/Diagnostics/LogListener.cs index 544c232d13ca70c0241a571e2c370b530da335ac..86ff73bbcf354d0f943f694b803b16268aceb551 100644 --- a/CLEditor.Core/Diagnostics/LogListener.cs +++ b/CLEditor.Core/Diagnostics/LogListener.cs @@ -8,6 +8,7 @@ namespace CLEditor.Core.Diagnostics /// public abstract class LogListener : IDisposable { + private int logCountFlushLimit; /// /// 获取日志消息计数 /// @@ -26,7 +27,7 @@ namespace CLEditor.Core.Diagnostics /// public int LogCountFlushLimit { - get { return LogCountFlushLimit; } + get { return logCountFlushLimit; } set { if (value <= 0) @@ -34,7 +35,7 @@ namespace CLEditor.Core.Diagnostics throw new ArgumentException("值必须大于0"); } - LogCountFlushLimit = value; + logCountFlushLimit = value; } } @@ -74,6 +75,37 @@ namespace CLEditor.Core.Diagnostics return (logMessage.Type > LogMessageType.Info) || (LogMessageCount % LogCountFlushLimit) == 0; } + /// + /// 获取特定日志消息的默认文本 + /// + /// + /// + protected virtual string GetDefaultText(ILogMessage logMessage) + { + return TextFormatter(logMessage); + } + + /// + /// 获取描述与特定日志消息关联的异常的文本 + /// + /// + /// + [NotNull] + protected virtual string GetExceptionText([NotNull] ILogMessage message) + { + var serializableLogMessage = message as SerializableLogMessage; + if (serializableLogMessage != null) + { + return serializableLogMessage.ExceptionInfo?.ToString() ?? string.Empty; + } + var logMessage = message as LogMessage; + if (logMessage != null) + { + return logMessage.Exception?.ToString() ?? string.Empty; + } + throw new ArgumentException("不支持的日志消息."); + } + private void OnLogInternal([NotNull] ILogMessage logMessage) { OnLog(logMessage); diff --git a/CLEditor.Core/Diagnostics/SerializableLogMessage.cs b/CLEditor.Core/Diagnostics/SerializableLogMessage.cs new file mode 100644 index 0000000000000000000000000000000000000000..09958fbbbd8081ad1b2046168b968eee5bb6c50d --- /dev/null +++ b/CLEditor.Core/Diagnostics/SerializableLogMessage.cs @@ -0,0 +1,27 @@ +using CLEditor.Core.Annotations; + +namespace CLEditor.Core.Diagnostics +{ + [DataContract] + public class SerializableLogMessage : ILogMessage + { + public string Module { get; set; } + public LogMessageType Type { get; set; } + public string Text { get; set; } + public ExceptionInfo ExceptionInfo { get; } + + public SerializableLogMessage([NotNull] LogMessage message) + { + Module = message.Module; + Type = message.Type; + Text = message.Text; + ExceptionInfo = message.Exception != null ? new ExceptionInfo(message.Exception) : null; + } + + public override string ToString() + { + return + $"{(Module != null ? $"[{Module}]: " : string.Empty)}{Type}: {Text}{(ExceptionInfo != null ? $". {ExceptionInfo.Message}" : string.Empty)}"; + } + } +} \ No newline at end of file diff --git a/CLEditor.Core/PropertyContainer.cs b/CLEditor.Core/PropertyContainer.cs index 3c4bc1c965b69c3a58081361145c7c25e186e414..80ea740ecc8fb577a35ca60682583a3eea3736be 100644 --- a/CLEditor.Core/PropertyContainer.cs +++ b/CLEditor.Core/PropertyContainer.cs @@ -15,12 +15,6 @@ namespace CLEditor.Core [DataContract] public struct PropertyContainer : IDictionary, IReadOnlyDictionary { - private int _count; - private ICollection _keys; - private ICollection _values; - private int _count1; - private IEnumerable _keys1; - private IEnumerable _values1; private Dictionary properties; @@ -209,7 +203,7 @@ namespace CLEditor.Core return Remove(item.Key); } - int ICollection>.Count => _count; + int ICollection>.Count => Count; public bool IsReadOnly => false; private static readonly Dictionary> AccessorProperties = new Dictionary>(); diff --git a/CLEditor.sln b/CLEditor.sln index d4c7d16237bb8d0923a23c745d9d677a961c8a64..fd3e8c4165ae0e8c8aa21a57ce9e7f62edea9f05 100644 --- a/CLEditor.sln +++ b/CLEditor.sln @@ -23,6 +23,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CLEditor.AssetEngine", "CLE EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CLEngine", "CLEngine\CLEngine.csproj", "{64882F3D-F201-43FC-9C9B-F92D7A37F846}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Game", "Game", "{8C812676-F827-4094-853C-ABB9FA80BE38}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Game.Windows", "Game.Windows\Game.Windows.csproj", "{A809253D-AA0F-4856-987F-E1C4CECF6B6F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Game.Desktop", "Game.Desktop\Game.Desktop.csproj", "{4961F01A-591A-457C-9485-2935A428287A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -125,6 +131,26 @@ Global {64882F3D-F201-43FC-9C9B-F92D7A37F846}.Release|x64.Build.0 = Release|Any CPU {64882F3D-F201-43FC-9C9B-F92D7A37F846}.Release|x86.ActiveCfg = Release|Any CPU {64882F3D-F201-43FC-9C9B-F92D7A37F846}.Release|x86.Build.0 = Release|Any CPU + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Debug|Any CPU.ActiveCfg = Debug|x86 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Debug|x64.ActiveCfg = Debug|x86 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Debug|x86.ActiveCfg = Debug|x86 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Debug|x86.Build.0 = Debug|x86 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Release|Any CPU.ActiveCfg = Release|x86 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Release|x64.ActiveCfg = Release|x86 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Release|x86.ActiveCfg = Release|x86 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F}.Release|x86.Build.0 = Release|x86 + {4961F01A-591A-457C-9485-2935A428287A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Debug|x64.ActiveCfg = Debug|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Debug|x64.Build.0 = Debug|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Debug|x86.ActiveCfg = Debug|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Debug|x86.Build.0 = Debug|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Release|Any CPU.Build.0 = Release|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Release|x64.ActiveCfg = Release|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Release|x64.Build.0 = Release|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Release|x86.ActiveCfg = Release|Any CPU + {4961F01A-591A-457C-9485-2935A428287A}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -133,6 +159,8 @@ Global {F49C4C69-3A15-4201-8AA2-29E115A17311} = {C2329FBC-8B03-4A1F-9873-3688D3A0F679} {14E96242-DA07-4408-BFD5-CEB6D2FE9CCE} = {C2329FBC-8B03-4A1F-9873-3688D3A0F679} {FE171BF2-9210-4A24-BCE4-BDB95E6202F5} = {CD40EE54-68B9-47F9-9B40-0D2DD2B18A96} + {A809253D-AA0F-4856-987F-E1C4CECF6B6F} = {8C812676-F827-4094-853C-ABB9FA80BE38} + {4961F01A-591A-457C-9485-2935A428287A} = {8C812676-F827-4094-853C-ABB9FA80BE38} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {09D24DF9-151B-4065-8E04-AA89C79159C9} diff --git a/CLEngine/CGame.cs b/CLEngine/CGame.cs index 61d934e59ddf68aae7274ac68690f33aa5a18ed5..bf708b7e09d9e1ad92a298378271ffcadca324fc 100644 --- a/CLEngine/CGame.cs +++ b/CLEngine/CGame.cs @@ -1,5 +1,12 @@ -using CLEditor.Core.Diagnostics; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using CLEditor.Core.Diagnostics; +using CLEngine.Properties; using Microsoft.Xna.Framework; +using NLua; +using Lua = NLua.Lua; namespace CLEngine { @@ -9,6 +16,10 @@ namespace CLEngine public class CGame : Game { private readonly LogListener logListener; + private readonly Lua Lua; + private readonly object[] MainObject; + private readonly LuaTable MainTable; + private const string MainCoreLuaFile = "core.lua"; public CGame() { @@ -18,6 +29,58 @@ namespace CLEngine { GlobalLogger.GlobalMessageLogged += logListener; } + + Lua = new Lua(); + Lua.LoadCLRPackage(); + if (!File.Exists(MainCoreLuaFile)) + { + using (var coreLuaStream = File.Create(MainCoreLuaFile)) + using (var streamWriter = new StreamWriter(coreLuaStream, Encoding.UTF8)) + { + streamWriter.Write(Encoding.UTF8.GetString(Resources.core)); + } + } + MainObject = Lua.DoFile(MainCoreLuaFile); + + MainTable = MainObject[0] as LuaTable ?? throw new ArgumentException("脚本发生严重错误!"); + } + + protected override void Initialize() + { + base.Initialize(); + + var index = FindKeyIndex("init"); + CallValueIndex(index); + } + + private int FindKeyIndex(string functionName) + { + var index = -1; + var keyCollection = MainTable.Keys as Dictionary.KeyCollection; + foreach (var key in keyCollection) + { + index++; + if (key.ToString().Equals(functionName)) + { + return index; + } + } + + return index; + } + + private void CallValueIndex(int index) + { + var step = 0; + var valueCollection = MainTable.Values as Dictionary.ValueCollection; + foreach (var value in valueCollection) + { + if (step == index) + { + (value as LuaFunction)?.Call(); + } + step++; + } } protected virtual LogListener GetLogListener() diff --git a/CLEngine/CLEngine.csproj b/CLEngine/CLEngine.csproj index e81297fb348e3aa0387dce82f90e81d0a20df589..93044964fe0cf9f6c7e0de1fd6b70a1449b6dd44 100644 --- a/CLEngine/CLEngine.csproj +++ b/CLEngine/CLEngine.csproj @@ -30,9 +30,15 @@ 4 + + ..\packages\NLua.1.3.2.1\lib\net45\KeraLua.dll + ..\packages\MonoGame.Framework.Portable.3.6.0.1625\lib\portable-net45+win8+wpa81\MonoGame.Framework.dll + + ..\packages\NLua.1.3.2.1\lib\net45\NLua.dll + @@ -45,8 +51,14 @@ + + True + True + Resources.resx + + @@ -55,5 +67,23 @@ CLEditor.Core + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + PreserveNewest + + + PreserveNewest + + + + +xcopy /s /y "D:\CLEngine\packages\NLua.1.3.2.1\lib\native\*.*" "$(TargetDir)" + \ No newline at end of file diff --git a/CLEngine/Properties/Resources.Designer.cs b/CLEngine/Properties/Resources.Designer.cs new file mode 100644 index 0000000000000000000000000000000000000000..ac5f18581437196eeb378954a1717cc4c1b75f2a --- /dev/null +++ b/CLEngine/Properties/Resources.Designer.cs @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// +// 此代码由工具生成。 +// 运行时版本:4.0.30319.42000 +// +// 对此文件的更改可能会导致不正确的行为,并且如果 +// 重新生成代码,这些更改将会丢失。 +// +//------------------------------------------------------------------------------ + +namespace CLEngine.Properties { + using System; + + + /// + /// 一个强类型的资源类,用于查找本地化的字符串等。 + /// + // 此类是由 StronglyTypedResourceBuilder + // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 + // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen + // (以 /str 作为命令选项),或重新生成 VS 项目。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 返回此类使用的缓存的 ResourceManager 实例。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CLEngine.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 使用此强类型资源类,为所有资源查找 + /// 重写当前线程的 CurrentUICulture 属性。 + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// 查找 System.Byte[] 类型的本地化资源。 + /// + internal static byte[] core { + get { + object obj = ResourceManager.GetObject("core", resourceCulture); + return ((byte[])(obj)); + } + } + } +} diff --git a/CLEngine/Properties/Resources.resx b/CLEngine/Properties/Resources.resx new file mode 100644 index 0000000000000000000000000000000000000000..05a58e144645ab019da12c953e45539b4e80d61b --- /dev/null +++ b/CLEngine/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Templates\core.lua;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CLEngine/Templates/core.lua b/CLEngine/Templates/core.lua new file mode 100644 index 0000000000000000000000000000000000000000..565356d8f99f62d0e950fca697dab68934bdb976 --- /dev/null +++ b/CLEngine/Templates/core.lua @@ -0,0 +1,14 @@ +local self = {} + +--[[ + 游戏初始化 +]] +function self:init() + +end + +function self:update() + +end + +return self \ No newline at end of file diff --git a/CLEngine/packages.config b/CLEngine/packages.config index 78caa928a1c8138e43a88dcab5573b235287cf76..2c530683ea0a794e46ea84a39ab9a563a9ed64e6 100644 --- a/CLEngine/packages.config +++ b/CLEngine/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/CLPipleline/bin/Debug/CLPipleline.dll b/CLPipleline/bin/Debug/CLPipleline.dll index 34b97114455404351c8ee82e03047915c0b58994..6a9d04985538663e46479fb6667074778174d39c 100644 Binary files a/CLPipleline/bin/Debug/CLPipleline.dll and b/CLPipleline/bin/Debug/CLPipleline.dll differ diff --git a/CLPipleline/bin/Debug/CLPipleline.pdb b/CLPipleline/bin/Debug/CLPipleline.pdb index 68c17f8915a2aa46564ac0cb4799a9ab0d0e7ac6..47ce248333ea31163335849dae3c8b02bdc58a68 100644 Binary files a/CLPipleline/bin/Debug/CLPipleline.pdb and b/CLPipleline/bin/Debug/CLPipleline.pdb differ diff --git a/Game.Desktop/Content/Content.mgcb b/Game.Desktop/Content/Content.mgcb new file mode 100644 index 0000000000000000000000000000000000000000..ddc4c367975c6fc7fd2aa93ee38beb48c46baf5b --- /dev/null +++ b/Game.Desktop/Content/Content.mgcb @@ -0,0 +1,15 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/platform:DesktopGL +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# + diff --git a/Game.Desktop/Game.Desktop.csproj b/Game.Desktop/Game.Desktop.csproj new file mode 100644 index 0000000000000000000000000000000000000000..eeadfb3fca11575bde15b56efd01758ffca08701 --- /dev/null +++ b/Game.Desktop/Game.Desktop.csproj @@ -0,0 +1,123 @@ + + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {4961F01A-591A-457C-9485-2935A428287A} + WinExe + Properties + Game.Desktop + Game.Desktop + 512 + DesktopGL + v4.5 + + + true + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + DEBUG;TRACE;LINUX + full + AnyCPU + prompt + false + 4 + + + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + TRACE;LINUX + true + pdbonly + AnyCPU + prompt + false + 4 + + + Icon.ico + + + app.manifest + + + + + + + + + $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll + + + + + + + + + + + + x86\SDL2.dll + PreserveNewest + + + x64\SDL2.dll + PreserveNewest + + + x86\soft_oal.dll + PreserveNewest + + + x64\soft_oal.dll + PreserveNewest + + + x86\libSDL2-2.0.so.0 + PreserveNewest + + + x64\libSDL2-2.0.so.0 + PreserveNewest + + + x86\libopenal.so.1 + PreserveNewest + + + x64\libopenal.so.1 + PreserveNewest + + + libSDL2-2.0.0.dylib + PreserveNewest + + + libopenal.1.dylib + PreserveNewest + + + MonoGame.Framework.dll.config + PreserveNewest + + + + + + {64882f3d-f201-43fc-9c9b-f92d7a37f846} + CLEngine + + + + + + \ No newline at end of file diff --git a/Game.Desktop/Game1.cs b/Game.Desktop/Game1.cs new file mode 100644 index 0000000000000000000000000000000000000000..47b3031d962ef60e112be8ef4ea5222c86c1dcc0 --- /dev/null +++ b/Game.Desktop/Game1.cs @@ -0,0 +1,84 @@ +using CLEngine; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace Game.Desktop +{ + /// + /// This is the main type for your game. + /// + public class Game1 : CGame + { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + public Game1() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + // TODO: use this.Content to load your game content here + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// game-specific content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); + + // TODO: Add your update logic here + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.CornflowerBlue); + + // TODO: Add your drawing code here + + base.Draw(gameTime); + } + } +} diff --git a/Game.Desktop/Icon.bmp b/Game.Desktop/Icon.bmp new file mode 100644 index 0000000000000000000000000000000000000000..2b481653e241818d2894e4ef33234eaff9aad701 Binary files /dev/null and b/Game.Desktop/Icon.bmp differ diff --git a/Game.Desktop/Icon.ico b/Game.Desktop/Icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7d9dec18704053ee43cd7c956022ddbdb34d8de1 Binary files /dev/null and b/Game.Desktop/Icon.ico differ diff --git a/Game.Desktop/Program.cs b/Game.Desktop/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..25eacbd2ef903cf983612dec9702d09386ed18ef --- /dev/null +++ b/Game.Desktop/Program.cs @@ -0,0 +1,20 @@ +using System; + +namespace Game.Desktop +{ + /// + /// The main class. + /// + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + using (var game = new Game1()) + game.Run(); + } + } +} diff --git a/Game.Desktop/Properties/AssemblyInfo.cs b/Game.Desktop/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..79977773505ff19ece954042da1828fdb6d6b695 --- /dev/null +++ b/Game.Desktop/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Game.Desktop")] +[assembly: AssemblyProduct("Game.Desktop")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b7fa13a1-6df3-404f-844c-28d34bb101a5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Game.Desktop/app.manifest b/Game.Desktop/app.manifest new file mode 100644 index 0000000000000000000000000000000000000000..f6123db318c7dd999dcfddd85ccd64dc718b341e --- /dev/null +++ b/Game.Desktop/app.manifest @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + + + + diff --git a/Game.Windows/Content/Content.mgcb b/Game.Windows/Content/Content.mgcb new file mode 100644 index 0000000000000000000000000000000000000000..3c4260651901709dd0d8f6213e8710c0814915fd --- /dev/null +++ b/Game.Windows/Content/Content.mgcb @@ -0,0 +1,15 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/platform:Windows +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# + diff --git a/Game.Windows/Game.Windows.csproj b/Game.Windows/Game.Windows.csproj new file mode 100644 index 0000000000000000000000000000000000000000..86e7811d123be69a9849787bf496681b6cc1299e --- /dev/null +++ b/Game.Windows/Game.Windows.csproj @@ -0,0 +1,77 @@ + + + + + Debug + x86 + 8.0.30703 + 2.0 + {A809253D-AA0F-4856-987F-E1C4CECF6B6F} + WinExe + Properties + Game.Windows + Game.Windows + 512 + Windows + v4.5 + + + x86 + true + full + false + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + DEBUG;TRACE;WINDOWS + prompt + 4 + + + x86 + pdbonly + true + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + TRACE;WINDOWS + prompt + 4 + + + Icon.ico + + + app.manifest + + + + + + + + + $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll + + + + + + + + + + + + + + {64882f3d-f201-43fc-9c9b-f92d7a37f846} + CLEngine + + + + + + \ No newline at end of file diff --git a/Game.Windows/Game1.cs b/Game.Windows/Game1.cs new file mode 100644 index 0000000000000000000000000000000000000000..5be600c84f4825b650860d8489ffb9810b1243a4 --- /dev/null +++ b/Game.Windows/Game1.cs @@ -0,0 +1,84 @@ +using CLEngine; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace Game.Windows +{ + /// + /// This is the main type for your game. + /// + public class Game1 : CGame + { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + + public Game1() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + + // TODO: use this.Content to load your game content here + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// game-specific content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); + + // TODO: Add your update logic here + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.CornflowerBlue); + + // TODO: Add your drawing code here + + base.Draw(gameTime); + } + } +} diff --git a/Game.Windows/Icon.ico b/Game.Windows/Icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..7d9dec18704053ee43cd7c956022ddbdb34d8de1 Binary files /dev/null and b/Game.Windows/Icon.ico differ diff --git a/Game.Windows/Program.cs b/Game.Windows/Program.cs new file mode 100644 index 0000000000000000000000000000000000000000..a523876c57d71fbdf4a4d4cb1d6430b104282f52 --- /dev/null +++ b/Game.Windows/Program.cs @@ -0,0 +1,22 @@ +using System; + +namespace Game.Windows +{ +#if WINDOWS || LINUX + /// + /// The main class. + /// + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + using (var game = new Game1()) + game.Run(); + } + } +#endif +} diff --git a/Game.Windows/Properties/AssemblyInfo.cs b/Game.Windows/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000000000000000000000000000000..ec6174f510fd54e2880c9defe0542f5d1d7dfba0 --- /dev/null +++ b/Game.Windows/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Game.Windows")] +[assembly: AssemblyProduct("Game.Windows")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("574d61c1-0c1d-45be-bb55-abecc7cc2c69")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Game.Windows/app.manifest b/Game.Windows/app.manifest new file mode 100644 index 0000000000000000000000000000000000000000..73922b4ff78a98bae0c177466f2f9bbd7b1341d4 --- /dev/null +++ b/Game.Windows/app.manifest @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + + + +