コード例 #1
0
        static void Main()
        {
            // Checks for updates and applies them if found, otherwises launches the game.
#if !DEBUG
            Updater.CheckForUpdates();
#endif

            using (var game = new Pulsarc())
            {
                game.Run();
            }
        }
コード例 #2
0
        static void Main()
        {
            /* //Checks for updates and applies them if found, otherwises launches the game.
             #if !DEBUG
             * Updater.CheckForUpdates();
             #endif
             * Commented out as CheckForUpdates with release 1.4.4-alpha as it serves little purpose in
             * Pulsarc's current state and may cause issues when the server goes down.*/

            using (var game = new Pulsarc())
            {
                game.Run();
            }
        }
コード例 #3
0
        public Pulsarc()
        {
            pulsarc = this;

            // Set up stored Data access
            DataManager.Initialize();

            // Load user config
            Config.Initialize();

            // Set default resolution if not set, and fullscreen when at least one isn't set.
            if (Config.GetInt("Graphics", "ResolutionWidth") <= 0)
            {
                Config.SetInt("Graphics", "ResolutionWidth", GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width);
                Config.SetInt("Graphics", "FullScreen", 2);
            }

            if (Config.GetInt("Graphics", "ResolutionHeight") <= 0)
            {
                Config.SetInt("Graphics", "ResolutionHeight", GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);
                Config.SetInt("Graphics", "FullScreen", 2);
            }

            // Set Graphics preferences according to config.ini
            Graphics.PreferredBackBufferWidth  = Config.GetInt("Graphics", "ResolutionWidth");
            Graphics.PreferredBackBufferHeight = Config.GetInt("Graphics", "ResolutionHeight");

            Graphics.IsFullScreen = Config.GetInt("Graphics", "FullScreen") >= 1;
            Window.IsBorderless   = Config.GetInt("Graphics", "FullScreen") >= 2;

            Graphics.SynchronizeWithVerticalRetrace = Config.GetInt("Graphics", "VSync") == 1;

            // Don't use FPSLimit if Vsync is on
            if (!Graphics.SynchronizeWithVerticalRetrace)
            {
                // Force the game to update at fixed time intervals
                IsFixedTimeStep = Config.GetInt("Graphics", "FPSLimit") != 0;

                // Set the time interval to match the FPSLimit
                if (IsFixedTimeStep)
                {
                    TargetElapsedTime =
                        TimeSpan.FromSeconds(1 / (float)Config.GetInt("Graphics", "FPSLimit"));
                }
            }

            Content.RootDirectory = "Content";
        }