Ejemplo n.º 1
0
        protected Game2D(int defaultScreenWidth = 800, int defaultScreenHeight = 600, bool fullscreen = false, bool useGamePad = false, DepthFormat depthFormat = DepthFormat.None, string configFileName = null)
        {
            _configFileName = string.IsNullOrEmpty(configFileName) ? DefaultConfigFileName : configFileName;
            LoadGameProperties();

            var width  = GetScreenSizeComponent(defaultScreenWidth, GameProperty.GameResolutionXProperty, 800);
            var height = GetScreenSizeComponent(defaultScreenHeight, GameProperty.GameResolutionYProperty, 600);

            GraphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth    = width,
                PreferredBackBufferHeight   = height,
                PreferredDepthStencilFormat = depthFormat,
                IsFullScreen = fullscreen
            };
            Content.RootDirectory = "Content";

            Keyboard      = new KeyboardEx();
            Mouse         = new MouseEx();
            GuiSystem     = new GuiSystem(this);
            DepthRenderer = new DepthRenderer();
            Cursor        = new Cursor(this);
            if (useGamePad)
            {
                GamePad = new GamePadEx();
            }

            _clearOptions = ClearOptions.Target;
            if (depthFormat != DepthFormat.None)
            {
                _clearOptions |= ClearOptions.DepthBuffer;
            }

            _registeredGlobals = new Dictionary <string, GameObject>();
        }
Ejemplo n.º 2
0
        protected Game2D(int screenWidth, int screenHeight, bool fullscreen, bool useGamePad = false, DepthFormat depthFormat = DepthFormat.None)
        {
            GraphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth    = screenWidth,
                PreferredBackBufferHeight   = screenHeight,
                PreferredDepthStencilFormat = depthFormat,
                IsFullScreen = fullscreen
            };
            Content.RootDirectory = "Content";

            Keyboard      = new KeyboardEx();
            Mouse         = new MouseEx();
            DepthRenderer = new DepthRenderer();
            ScriptRunner  = new ScriptRunner(this);
            if (useGamePad)
            {
                GamePad = new GamePadEx();
            }

            _clearOptions = ClearOptions.Target;
            if (depthFormat != DepthFormat.None)
            {
                _clearOptions |= ClearOptions.DepthBuffer;
            }

            _registeredGlobals = new Dictionary <string, GameObject>();
        }
Ejemplo n.º 3
0
 public override void Initialize(ContentManager content)
 {
     base.Initialize(content);
     RebuildRenderTargets();
     _depthRenderer = new DepthRenderer();
 }