示例#1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();

            spriteBatch.Draw(_background, _rect, Color.White);
            Vector2 ballLogicalLocation = _ballSimulation.getPosition();
            var     ballVisualLocation  = _camera.convertToVisualCoords(ballLogicalLocation.X, ballLogicalLocation.Y);
            float   scale = _camera.ballScale(_ball.Width, _ballSimulation.getBallRadius());

            spriteBatch.Draw(_ball, ballVisualLocation, null, Color.White, 0, _ballCenter, scale, SpriteEffects.None, 0);

            spriteBatch.End();
        }
示例#2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            float ballScale = camera.getBallScale(ballSimulation.getBallRadius(), ballTexture.Bounds.Width);

            spriteBatch.Begin();

            spriteBatch.Draw(backGroundTexture, camera.getRectangle(), Color.White);
            spriteBatch.Draw(ballTexture, camera.convertToVisualCoords(ballSimulation.getBallPosition()),
                             ballTexture.Bounds, Color.White, 0, new Vector2(ballTexture.Bounds.Width / 2, ballTexture.Bounds.Height / 2),
                             ballScale, SpriteEffects.None, 0);

            spriteBatch.End();
        }