Browse Source

add FNA build

main
Colin McMillen 3 months ago
parent
commit
a0030dcf0d
  1. 6
      FNA/App.config
  2. 71
      FNA/FNA.csproj
  3. 20
      FNA/FnaExtensionMethods.cs
  4. 48
      FNA/FnaProgram.cs
  5. 36
      FNA/Properties/AssemblyInfo.cs

6
FNA/App.config

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>

71
FNA/FNA.csproj

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A39F01F6-3124-4AFB-A7B1-AC822DFB4541}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>SemiColinGames</RootNamespace>
<AssemblyName>Sneak</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FnaExtensionMethods.cs" />
<Compile Include="FnaProgram.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\FNA\FNA.csproj">
<Project>{35253ce1-c864-4cd3-8249-4d1319748e8f}</Project>
<Name>FNA</Name>
</ProjectReference>
<ProjectReference Include="..\..\Newtonsoft.Json\Src\Newtonsoft.Json\Newtonsoft.Json.csproj">
<Project>{60ba5cb8-55db-467a-8d9b-342bd4b50c23}</Project>
<Name>Newtonsoft.Json</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\Shared\Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

20
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);
}
}
}

48
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();
}
}
}
}

36
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")]
Loading…
Cancel
Save