コード例 #1
0
        public void Draw(float totalSeconds, SpriteBatch spriteBatch)
        {
            timeElapsed += totalSeconds;
            spriteBatch.Draw(cursorImage,
                             cursorPos,
                             null, Color.White,
                             0f,
                             new Vector2(cursorImage.Width / 2, cursorImage.Height / 2),//denna sätter ut cirkeln!
                             camera.scaleSizeTo(cursorImage.Width, radius * 2),
                             SpriteEffects.None,
                             0f);//denna håller koll på muspekarbilden!

            foreach (ParticleSystem Particle in particleSpark)
            {
                Particle.Draw(spriteBatch, camera, particle);
            }//280
            foreach (SmokeSystem smokeSystem in smokes)
            {
                smokeSystem.Draw(spriteBatch);
            }
            foreach (ExplosionManager explosion in explosions)
            {
                explosion.Draw(totalSeconds);
            }

            //explosionManager.Draw(totalSeconds);
        }
コード例 #2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(box,
                             //Vector2.One * 5,
                             //null, Color.White,
                             //0f,
                             //Vector2.Zero,
                             camera.GetGameWindow(), Color.Black);
            //SpriteEffects.None,
            //0f);/// ritar ut boxen eller snarare kvadraten!

            foreach (Ball ball in ballSimulation.getBalls())
            {
                if (ball.isBallDead == false)
                {
                    spriteBatch.Draw(ballTexture,
                                     camera.returnPositionOfField(ball.position.X, ball.position.Y),
                                     null, Color.White,
                                     0f,
                                     new Vector2(ballTexture.Width, ballTexture.Height) / 2,
                                     camera.scaleSizeTo(ballTexture.Width, ball.getRadius * 2), //, ballSimulation.ball.getRadius*2
                                     SpriteEffects.None,
                                     0f);                                                       // denna skalar om bollen så att den passar i min skärm
                }
                else
                {
                    spriteBatch.Draw(deadBall,
                                     camera.returnPositionOfField(ball.position.X, ball.position.Y),
                                     null, Color.White,
                                     0f,
                                     new Vector2(deadBall.Width, deadBall.Height) / 2,
                                     camera.scaleSizeTo(deadBall.Width, ball.getRadius * 2), //, ballSimulation.ball.getRadius*2
                                     SpriteEffects.None,
                                     0f);                                                    // denna skalar om bollen så att den passar i min skärm
                }
            }
        }