示例#1
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.CornflowerBlue);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            spriteBatch.Draw(leftWheel.Texture, leftWheel.getRectangle(), null, Color.White, leftWheel.Rotation,
                             leftWheel.getCenter(), SpriteEffects.None, 0);
            spriteBatch.Draw(rightWheel.Texture, rightWheel.getRectangle(), null, Color.White, rightWheel.Rotation,
                             rightWheel.getCenter(), SpriteEffects.None, 0);
            spriteBatch.Draw(oven.Texture, oven.getRectangle(), Color.White);
            drawText();

            foreach (Actor cupcake in cupcakes)
            {
                //spriteBatch.Draw(cupcake.Texture, cupcake.getRectangle(), null, Color.White, cupcake.Rotation, cupcake.getCenter(), SpriteEffects.None, 0);
                spriteBatch.Draw(cupcake.Texture, cupcake.getRectangle(), Color.White);
            }

            drawCupcakesOnWheels();

            drawCupcakesOnOven();

            spriteBatch.End();

            base.Draw(gameTime);
        }
示例#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.CornflowerBlue); //The background color will be set to whatever color is set here.


            spriteBatch.Begin(); //Begin a new spriteBatch, then draw the left and right wheels, and the oven, followed by any text.
            spriteBatch.Draw(leftWheel.Texture, leftWheel.getRectangle(), null, Color.White, leftWheel.Rotation,
                             leftWheel.getCenter(), SpriteEffects.None, 0);
            spriteBatch.Draw(rightWheel.Texture, rightWheel.getRectangle(), null, Color.White, rightWheel.Rotation,
                             rightWheel.getCenter(), SpriteEffects.None, 0);
            spriteBatch.Draw(oven.Texture, oven.getRectangle(), Color.White);
            drawText();

            foreach (Actor cupcake in cupcakes)//Draw each cupcake in the cupcakes list.
            {
                //spriteBatch.Draw(cupcake.Texture, cupcake.getRectangle(), null, Color.White, cupcake.Rotation, cupcake.getCenter(), SpriteEffects.None, 0);
                spriteBatch.Draw(cupcake.Texture, cupcake.getRectangle(), Color.White);
            }

            drawCupcakesOnWheels();

            drawCupcakesOnOven();

            spriteBatch.End();

            base.Draw(gameTime);
        }