Beispiel #1
0
        /// <summary>
        /// MonoXEngine constructor
        /// </summary>
        /// <param name="MainSettingsFile"></param>
        public MonoXEngineGame(string MainSettingsFile)
        {
            // Static instance
            MonoXEngineGame.Instance = this;

            // Pass MainSettings
            Global.MainSettings = new DataSet();
            Global.MainSettings.FromXML(XDocument.Load(@MainSettingsFile));

            // Set Global.Game
            Global.Game = this;

            // GraphicsDeviceManager
            this.Graphics = new GraphicsDeviceManager(this);

            // Content RootDirectory
            Content.RootDirectory = Global.MainSettings.Get <string>(new string[] { "Directories", "Content" });

            // Window resizing
            if (Global.MainSettings.Get <string>("Viewport", "AllowResizing").ToLower() == "true")
            {
                Window.AllowUserResizing  = true;
                Window.ClientSizeChanged += delegate {
                    this.ViewportTexture.WindowSizeUpdate();
                };
            }

            // Full screen
            if (Global.MainSettings.Get <string>("Viewport", "FullScreen").ToLower() == "true")
            {
                Graphics.IsFullScreen = true;
            }
        }
Beispiel #2
0
 public void CaptureAndRender(MonoXEngineGame gameInstance, Action drawCalls)
 {
     this.BeginCapture();
     drawCalls();
     this.EndCapture();
     this.RenderToViewport();
 }
        /// <summary>
        /// MonoXEngine constructor
        /// </summary>
        /// <param name="MainSettingsFile"></param>
        public MonoXEngineGame(string MainSettingsFile)
        {
            // Static instance
            MonoXEngineGame.Instance = this;

            // Pass MainSettings
            Global.MainSettings = new DataSet();
            Global.MainSettings.FromXML(XDocument.Load(@MainSettingsFile));

            // Set Global.Game
            Global.Game = this;

            // GraphicsDeviceManager
            this.Graphics = new GraphicsDeviceManager(this);

            // Content RootDirectory
            Content.RootDirectory = Global.MainSettings.Get <string>(new string[] { "Directories", "Content" });

            // Window resizing
            if (Global.MainSettings.Get <string>("Viewport", "AllowResizing").ToLower() == "true")
            {
                Window.AllowUserResizing  = true;
                Window.ClientSizeChanged += delegate {
                    this.ViewportTexture.WindowSizeUpdate();
                };
            }

            // Presets
            IsFixedTimeStep = true;
            Graphics.SynchronizeWithVerticalRetrace = true;

            // Full screen
            if (Global.MainSettings.Get <string>("Viewport", "FullScreen").ToLower() == "true")
            {
                Graphics.IsFullScreen = true;
            }
            else
            {
                // PreferedBackBuffer (this messes up window resizing atm)
                Graphics.PreferredBackBufferWidth  = Global.MainSettings.Get <int>("Viewport", "WindowSizeX");
                Graphics.PreferredBackBufferHeight = Global.MainSettings.Get <int>("Viewport", "WindowSizeY");
            }
        }
Beispiel #4
0
 static void Main()
 {
     using (var game = new MonoXEngineGame("MyGame/MainSettings.xml"))
         game.Run();
 }