コード例 #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    = graphics.GraphicsDevice;
            GameContent = Content;
            ControllerManager.Initialize();
            GameDebugger.Initialize();
            TextureHelper.Init();
            GameSpriteBatch = new SpriteBatch(graphics.GraphicsDevice);
            TileHighlight.Initialize();
            roamState  = new TestFreeRoamState();
            fightState = new TestFightState();
            StateManager.QueueState(fightState);
            this.IsMouseVisible = true;
            base.Initialize();
        }
コード例 #2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            //GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;

            //GraphicsDevice.BlendState = BlendState.NonPremultiplied;
            StateManager.Draw(gameTime);

            GameSpriteBatch.Begin();

            GameDebugger.Draw();
            GameCamera.Draw();
            StateManager.DrawSprite(gameTime);
            //GamePlayer.Draw(gameTime);
            GameSpriteBatch.End();

            // TODO: Add your drawing code here


            base.Draw(gameTime);
        }
コード例 #3
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)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.F))
            {
                World.TimeOfDay -= 0.5f;
                World.UpdateDayLight();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.G))
            {
                World.TimeOfDay += 0.5f;
                World.UpdateDayLight();
            }


            // TODO: Add your update logic here
            ControllerManager.Update();
            GameDebugger.Update(gameTime);

            GameCamera.Update(gameTime);
            StateManager.Update(gameTime);
            //GamePlayer.Update(gameTime);

            base.Update(gameTime);
        }