Пример #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            var viewMatrix       = _camera.GetViewMatrix();
            var projectionMatrix = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width,
                                                                      GraphicsDevice.Viewport.Height, 0, 0f, -1f);

            _mapRenderer.Draw(_map, ref viewMatrix, ref projectionMatrix);

            _spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix());
            _zombie.Draw(_spriteBatch);
            _spriteBatch.Draw(_fireballSprite);
            _spriteBatch.End();

            _spriteBatch.Begin(samplerState: SamplerState.PointClamp, transformMatrix: _camera.GetViewMatrix());

            _spriteBatch.Draw(_motwSprite);
            _spriteBatch.End();


            //_spriteBatch.Begin();
            //_spriteBatch.DrawString(_bitmapFont, string.Format("FPS: {0} Zoom: {1}", _fpsCounter.AverageFramesPerSecond, _camera.Zoom), new Vector2(5, 5), new Color(0.5f, 0.5f, 0.5f));
            //_spriteBatch.End();

            base.Draw(gameTime);
        }
Пример #2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            _spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix());
            _tiledMap.Draw(_spriteBatch, _camera);
            _spriteBatch.End();

            _spriteBatch.Begin(transformMatrix: _camera.GetViewMatrix());
            _zombie.Draw(_spriteBatch);
            _spriteBatch.End();

            //_spriteBatch.Begin();
            //_spriteBatch.DrawString(_bitmapFont, string.Format("FPS: {0} Zoom: {1}", _fpsCounter.AverageFramesPerSecond, _camera.Zoom), new Vector2(5, 5), new Color(0.5f, 0.5f, 0.5f));
            //_spriteBatch.End();

            base.Draw(gameTime);
        }