diff --git a/FNA/App.config b/FNA/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/FNA/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/FNA/FNA.csproj b/FNA/FNA.csproj new file mode 100644 index 0000000..442de2b --- /dev/null +++ b/FNA/FNA.csproj @@ -0,0 +1,71 @@ + + + + + Debug + AnyCPU + {A39F01F6-3124-4AFB-A7B1-AC822DFB4541} + WinExe + SemiColinGames + Sneak + v4.8 + 512 + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + 8.0 + + + + + + + + + + + + + + + + + + + + + + + + + {35253ce1-c864-4cd3-8249-4d1319748e8f} + FNA + + + {60ba5cb8-55db-467a-8d9b-342bd4b50c23} + Newtonsoft.Json + + + + + diff --git a/FNA/FnaExtensionMethods.cs b/FNA/FnaExtensionMethods.cs new file mode 100644 index 0000000..4095980 --- /dev/null +++ b/FNA/FnaExtensionMethods.cs @@ -0,0 +1,20 @@ +using Microsoft.Xna.Framework; + +namespace SemiColinGames { + public static class FnaExtensionMethods { + // Point + public static Vector2 ToVector2(this Point p) { + return new Vector2(p.X, p.Y); + } + + // Rectangle + public static Point Size(this Rectangle r) { + return new Point(r.Width, r.Height); + } + + // Vector2 + public static Point ToPoint(this Vector2 v) { + return new Point((int) v.X, (int) v.Y); + } + } +} diff --git a/FNA/FnaProgram.cs b/FNA/FnaProgram.cs new file mode 100644 index 0000000..6cbaa2b --- /dev/null +++ b/FNA/FnaProgram.cs @@ -0,0 +1,48 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; + +namespace SemiColinGames { + + public class DesktopGLDisplay : IDisplay { + private GameWindow window; + private GraphicsDeviceManager graphics; + + public void Initialize(GameWindow window, GraphicsDeviceManager graphics) { + this.window = window; + this.graphics = graphics; + window.Title = "Sneak"; + } + + public void SetFullScreen(bool fullScreen) { + if (fullScreen) { + // In DesktopGL, we misappropriate "fullscreen" to be "the settings good for recording + // gameplay GIFs". + // window.IsBorderless = true; + // graphics.PreferredBackBufferWidth = 720; + // graphics.PreferredBackBufferHeight = 405; + graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width; + graphics.PreferredBackBufferHeight = graphics.GraphicsDevice.DisplayMode.Height; + } else { + // window.IsBorderless = false; + graphics.PreferredBackBufferWidth = 1280; + graphics.PreferredBackBufferHeight = 720; + } + Debug.WriteLine("display: {0}x{1}, fullscreen={2}", + graphics.PreferredBackBufferWidth, + graphics.PreferredBackBufferHeight, + fullScreen); + graphics.ApplyChanges(); + } + } + + public static class DesktopGLProgram { + [STAThread] + static void Main() { + using (var game = new SneakGame()) { + game.Services.AddService(typeof(IDisplay), new DesktopGLDisplay()); + game.Run(); + } + } + } +} \ No newline at end of file diff --git a/FNA/Properties/AssemblyInfo.cs b/FNA/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ee42924 --- /dev/null +++ b/FNA/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("sneak-fna")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("sneak-fna")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[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("a39f01f6-3124-4afb-a7b1-ac822dfb4541")] + +// 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")]