mirror of
https://github.com/prime31/FNA-VSCode-Template.git
synced 2026-02-01 19:10:16 +07:00
Building projects and effects
This commit is contained in:
51
project_name/Program.cs
Normal file
51
project_name/Program.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace project_name
|
||||
{
|
||||
class Program
|
||||
{
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool SetDefaultDllDirectories(int directoryFlags);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
static extern void AddDllDirectory(string lpPathName);
|
||||
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
static extern bool SetDllDirectory(string lpPathName);
|
||||
|
||||
const int LOAD_LIBRARY_SEARCH_DEFAULT_DIRS = 0x00001000;
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
|
||||
AddDllDirectory(Path.Combine(
|
||||
AppDomain.CurrentDomain.BaseDirectory,
|
||||
Environment.Is64BitProcess ? "x64" : "x86"
|
||||
));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Pre-Windows 7, KB2533623
|
||||
SetDllDirectory(Path.Combine(
|
||||
AppDomain.CurrentDomain.BaseDirectory,
|
||||
Environment.Is64BitProcess ? "x64" : "x86"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
using (Game1 game = new Game1())
|
||||
{
|
||||
game.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user