示例#1
0
文件: Game1.cs 项目: Asketil/1Pixor
        /// <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.White);

            // TODO: Add your drawing code here
            spriteBatch.Begin();

            Terrain.terrainDraw(t, lvl, nbrCaseWidth, nbrCaseHeight, spriteBatch, GraphicsDevice);
            for (int i = 0; i < nbrCaseWidth; i++)
            {
                for (int j = 0; j < nbrCaseHeight; j++)
                {
                    t[lvl, i, j].Draw(spriteBatch);
                }
            }
            player.Draw(spriteBatch);
            spriteBatch.DrawString(sf, lvl.ToString(), new Vector2(5, 0), Color.Black);
            spriteBatch.DrawString(sf, player.nbrblock.ToString(), new Vector2(nbrCaseWidth * tailleCase - 25, 0), Color.Black);

            if (help)
            {
                spriteBatch.DrawString(sf, "Fleche directionnelle: se deplacer\nPave numerique: creuser\nEspace: descendre/monter\nZ,D,X,Q: poser", new Vector2(5, nbrCaseHeight * tailleCase - 28 * 4), Color.Black);
            }
            if (debug)
            {
                spriteBatch.DrawString(sf, player.rec.ToString() + "\n" + t[lvl, player.widthCase, player.heightCase].getType, new Vector2(5, 25), Color.Black);
            }

            spriteBatch.End();

            base.Draw(gameTime);
        }