예제 #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            //_graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
            //_graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            //_graphics.IsFullScreen = true;
            //_graphics.ApplyChanges();

            InputManager.Initialize();
            _screenManager = new ScreenManager();
            _screenManager.AddScreen(new PenetratorScreen(GraphicsDevice));
            _screenManager.AddScreen(new TestScreen(GraphicsDevice));
            _screenManager.GotoScreen("Penetrator");
            _screenManager.Initialize();
            _screenManager.GotoScreen("TestScreen");
            _screenManager.Initialize();

            base.Initialize();
        }
예제 #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // TODO: Add your update logic here
            InputManager.Update();
            if (InputManager.IsKeyTriggered(Keys.D1))
            {
                _screenManager.GotoScreen("Penetrator");
            }
            if (InputManager.IsKeyTriggered(Keys.D2))
            {
                _screenManager.GotoScreen("TestScreen");
            }

            _screenManager.Update(gameTime);

            base.Update(gameTime);
        }