Exemplo n.º 1
0
        public static void drawTabuleiro(Tabuleiro tabuleiro, SpriteBatch sp,
                                         Texture2D textura, SpriteFont fonte)
        {
            Peca fakePeca = new Peca(corPeca.Branca);

            if (tabuleiro != null)
            {
                for (int lin = 0; lin < tabuleiro.Altura; lin++)
                {
                    for (int col = 0; col < tabuleiro.Largura; col++)
                    {
                        Peca peca = tabuleiro.GetPeca(lin, col);
                        if (peca != null)
                        {
                            DrawObjeto.drawPeca(peca, sp, textura);
                        }
                        else
                        {
                            fakePeca.Linha  = lin;
                            fakePeca.Coluna = col;
                            DrawObjeto.drawPeca(fakePeca, sp, textura);
                        }
                    }
                }
                String texto = "   0  |  1   |  2   |  3  |  4  |  5  |  6   |  7  |";
                sp.DrawString(fonte, texto, new Vector2(0, 8 * Peca.Tamanho), Color.Yellow);
            }
        }
Exemplo n.º 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);

            // TODO: Add your drawing code here
            spriteBatch.Begin();
            //DrawObjeto.drawPeca(peca, spriteBatch, texturaPeca);
            DrawObjeto.drawTabuleiro(tabuleiro, spriteBatch, texturaPeca, fonteArial);
            spriteBatch.DrawString(fonteArial, "Jogador Atual:" + jogador[jogadorAtual].ToString(),
                                   new Vector2(0, 9 * Peca.Tamanho), Color.Black);
            spriteBatch.End();
            base.Draw(gameTime);
        }