Example #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.Black);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            //GraphicsDevice.Viewport.Width - liveSize.
            if (!gameOver && player.Lives > 0)
            {
                spriteBatch.DrawString(font, score, Vector2.Zero, Color.White);
                spriteBatch.DrawString(font, lives, new Vector2(GraphicsDevice.Viewport.Width - liveSize.X, 0), Color.White);
                drawBricks();
                paddle.Draw(spriteBatch);
                ball.Draw(spriteBatch);
                //spriteBatch.Draw(pixel, levelBricks[0][0].Hitbox, new Color(Color.Blue, 100));
                //spriteBatch.Draw(pixel, ball.Hitbox, new Color(Color.Red, 100));
            }

            else
            {
                Vector2 location = new Vector2(GraphicsDevice.Viewport.Width / 2 - gameFontSize.X / 2, GraphicsDevice.Viewport.Height / 2 - gameFontSize.Y / 2);
                spriteBatch.DrawString(endGameFont, gameMessage, location, Color.White);
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }
Example #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);
            spriteBatch.Begin();
            foreach (var brick in bricks)
            {
                brick.Draw(spriteBatch);
            }
            ball.Draw(spriteBatch);
            paddle.Draw(spriteBatch);
            spriteBatch.End();
            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
Example #3
0
 /// <summary>
 /// draws all the objects on the canvas
 /// </summary>
 /// <param name="canvas">the canvas</param>
 private new void Draw(Canvas canvas)
 {
     base.OnDraw(canvas);                                                   //set the canvas to be drawn on
     canvas.DrawColor(ColorManager.Instance.GetColor(ColorKey.Background)); //draws the background color
     Score.Draw(canvas);                                                    //draws the score
     pause.Draw(canvas);                                                    //draws the pause
     BottomBat.Draw(canvas);                                                //draws the bottom bat
     TopBat.Draw(canvas);                                                   //draws the top bat
     bricks.Draw(canvas);
     //draw the ball
     ball.Draw(canvas);
     start.Draw(canvas);
     if (isPaused)
     {
         resume.IsVisible = true;
     }
     resume.Draw(canvas); //draw the resume button
 }