コード例 #1
0
ファイル: Game1.cs プロジェクト: easdale2010/GameMenu
        /// <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();
            background.drawme(ref spriteBatch);

            spriteBatch.End();

            switch (gamestate)
            {
            case -1:
                drawmenu();
                break;

            case 0:
                drawgame();
                break;

            case 1:
                drawoptions();
                break;

            case 2:
                drawhighscore();
                break;

            default:
                this.Exit();
                break;
            }

            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);

            spriteBatch.Begin();

            background.drawme(ref spriteBatch);

            if (gameover)
            {
                gameoverimage.drawme(ref spriteBatch);
            }

            spriteBatch.DrawString(mainfont, "Screen Resoloution" + displaywidth.ToString() + "  " + displayheight.ToString(), new Vector2(40, 40), Color.White, MathHelper.ToRadians(0), new Vector2(0, 0), 1.5f, SpriteEffects.None, 0);

            for (int i = 0; i < ballsinplay; i++)
            {
                balls[i].drawme(ref spriteBatch);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }
コード例 #3
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();

            Vector3 tempshippos = backgscroll.drawme(ref spriteBatch, spaceship[0].position, displaywidth, displayheight, out gameoffset);

            if (gameover)
            {
                gameoverimage.drawme(ref spriteBatch);
            }

            for (int i = 0; i < ballsinplay; i++)
            {
                balls[i].drawme(ref spriteBatch, balls[i].position - gameoffset);
            }

            spaceship[0].drawme(ref spriteBatch, tempshippos);
            spaceship[1].drawme(ref spriteBatch, spaceship[1].position - gameoffset);


            for (int i = 0; i < numberofships; i++)
            {
                bullet[i].drawme(ref spriteBatch, bullet[i].position - gameoffset);
            }

            if (spaceship[1].visible)
            {
                spriteBatch.DrawString(mainfont, "P2 Lives " + spaceship[1].lives.ToString("0"), new Vector2(displaywidth - 140, 40), Color.White,
                                       MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);
                spriteBatch.DrawString(mainfont, "P2 Score " + spaceship[1].score.ToString("0"), new Vector2(displaywidth - 140, 60), Color.White,
                                       MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);
            }


            spriteBatch.DrawString(mainfont, "P1 Lives " + spaceship[0].lives.ToString("0"), new Vector2(40, 40), Color.White,
                                   MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);

            spriteBatch.DrawString(mainfont, " P1 Score " + spaceship[0].score.ToString("0"), new Vector2(40, 60), Color.White,
                                   MathHelper.ToRadians(0), new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);



            //for (int i = 0; i < numberofships; i++)
            //    for (int b = 0; b < numberofbullets; b++)
            //        bullets5[i,b].drawme(ref spriteBatch);

            for (int i = 0; i < ballsinplay; i++)
            {
                explosion[i].drawme(ref spriteBatch, explosion[i].position - gameoffset);
            }
            for (int i = 0; i < numberofships; i++)
            {
                shiphit[i].drawme(ref spriteBatch, shiphit[i].position - gameoffset);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }