Example #1
0
        static void Main(string[] args)
        {
#if NETCOREAPP
            DllMap.Initialise(false);
#endif

            // https://github.com/FNA-XNA/FNA/wiki/4:-FNA-and-Windows-API#64-bit-support
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                SetDllDirectory(Path.Combine(
                                    AppDomain.CurrentDomain.BaseDirectory,
                                    Environment.Is64BitProcess ? "x64" : "x86"
                                    ));
            }

            // https://github.com/FNA-XNA/FNA/wiki/7:-FNA-Environment-Variables#fna_graphics_enable_highdpi
            // NOTE: from documentation:
            //       Lastly, when packaging for macOS, be sure this is in your app bundle's Info.plist:
            //           <key>NSHighResolutionCapable</key>
            //           <string>True</string>
            Environment.SetEnvironmentVariable("FNA_GRAPHICS_ENABLE_HIGHDPI", "1");

            using (AnathemaGame game = new AnathemaGame())
            {
                bool isHighDPI = Environment.GetEnvironmentVariable("FNA_GRAPHICS_ENABLE_HIGHDPI") == "1";
                if (isHighDPI)
                {
                    Debug.WriteLine("HiDPI Enabled");
                }

                game.Run();
            }
        }
Example #2
0
        /// <summary>
        /// The main entry point for the application.  This instantiates and runs our game (within XAGE.Engine.Core.dll)
        /// </summary>
        static void Main(string[] args)
        {
            // Settings that get injected into the engine
            RunSettings runSettings = new RunSettings
                                      (
                release: Release,
                allowDebugging: AllowDebugging,
                logLevel: LogLevel,
                logAsync: LogAsync,
                onNotImplemented: OnNotImplemented,
                catchScriptExceptions: CatchScriptExceptions,
                loader: Awakener.CSharpScript.Load,
                serializer: Awakener.CSharpScript.Serialize,
                deserializer: Awakener.CSharpScript.Deserialize,
                type: typeof(Awakener.CSharpScript)
                                      );

            // Initialise DLL mapping and other pre-game items
            DllMap.Initialise();

            // Run the game - any unhandled exceptions will be caught in Release mode only
            // In Debug mode it will stop in place, which is generally more useful for debugging
            try
            {
                using (XNAGame game = new XNAGame(runSettings))
                {
                    game.Run();
                }
            }
            catch (Exception exc) when(CatchEngineExceptions)
            {
                Logger.Fatal("Unhandled exception: " + exc.Message);
                Logger.Fatal("StackTrace: " + exc.StackTrace);
            }
            finally
            {
                Logger.Reset();
            }
        }
Example #3
0
        /// <summary>
        /// The main entry point for the application.  This instantiates and runs our game (within XAGE.Engine.Core.dll)
        /// </summary>
        static void Main(string[] args)
        {
            // Must do this before anything else
            DllMap.Initialise();

            // Create Script Delegates that get injected into the engine
            RunSettings runSettings = new RunSettings(
                Release,
                AllowDebugging,
                LogLevel,
                LogAsync,
                OnNotImplemented,
                LastnFurious.CSharpScript.Load,
                LastnFurious.CSharpScript.Serialize,
                LastnFurious.CSharpScript.Deserialize,
                typeof(LastnFurious.CSharpScript));

            // Run the game - any unhandled exceptions will be caught in Release mode only
            // In Debug mode it will stop in place, which is generally more useful for debugging
            try
            {
                using (XNAGame game = new XNAGame(runSettings))
                {
                    game.Run();
                }
            }
            catch (Exception exc) when(CatchFatalExceptions)
            {
                Logger.Fatal("Unhandled exception: " + exc.Message);
                Logger.Fatal("StackTrace: " + exc.StackTrace);
            }
            finally
            {
                Logger.Reset();
            }
        }