Пример #1
0
        public void resetTable( )
        {
            m_vecBlackPieces = new List<Piece>( );
            m_vecDeadBlackPieces = new List<Piece>( );
            m_vecWhitePieces = new List<Piece>( );
            m_vecDeadWhitePieces = new List<Piece>( );

            //m_bCheck = false;
            m_bCheckMate = false;
            m_bVerifyCheck = true;

            int nRow = 0;
            int nCol = 0;
            Piece piece;

            // Team pieces.
            // First row - Black - Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook
            piece = new Rook( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Queen( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new King( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Rook( nRow, nCol, BLACK, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecBlackPieces.Add( piece );

            // Second row - Black - Pawns
            ++nRow;
            for( nCol = 0; nCol < TABLE_SIZE; ++nCol )
            {
                piece = new Pawn( nRow, nCol, BLACK, this );
                m_table[ nRow, nCol ].Piece = piece;
                m_vecBlackPieces.Add( piece );
            }

            // Third to sixth rows - Empty
            piece = null;
            for( nRow = 2; nRow < 6; nRow++ )
            {
                for( nCol = 0; nCol < TABLE_SIZE; ++nCol )
                {
                    m_table[ nRow, nCol ].Piece = null;
                }
            }

            // Seventh row - White - Pawns
            for( nCol = 0; nCol < TABLE_SIZE; ++nCol )
            {
                piece = new Pawn( nRow, nCol, WHITE, this );
                m_table[ nRow, nCol ].Piece = piece;
                m_vecWhitePieces.Add( piece );
            }

            nRow++;
            nCol = 0;

            // Last row - White - Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook
            piece = new Rook( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Queen( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new King( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Rook( nRow, nCol, WHITE, this );
            m_table[ nRow, nCol ].Piece = piece;
            m_vecWhitePieces.Add( piece );
        }
Пример #2
0
        private void initTable( )
        {
            int nRow = 0;
            int nCol = 0;
            Piece piece;
            Rectangle boundingBox;

            // Team pieces.
            // First row - Black - Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook
            piece = new Rook( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Queen( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new King( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );
            ++nCol;
            piece = new Rook( nRow, nCol, BLACK, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecBlackPieces.Add( piece );

            // Second row - Black - Pawns
            ++nRow;
            for (nCol = 0; nCol < TABLE_SIZE; ++nCol)
            {
                piece = new Pawn( nRow, nCol, BLACK, this );
                boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
                m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
                m_vecBlackPieces.Add( piece );
            }

            // Third to sixth rows - Empty
            piece = null;
            for( nRow = 2; nRow < 6; nRow++ )
            {
                for( nCol = 0; nCol < TABLE_SIZE; ++nCol )
                {
                    boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
                    m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
                }
            }

            // Seventh row - White - Pawns
            for( nCol = 0; nCol < TABLE_SIZE; ++nCol )
            {
                piece = new Pawn( nRow, nCol, WHITE, this );
                boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
                m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
                m_vecWhitePieces.Add( piece );
            }

            nRow++;
            nCol = 0;
            //bBlack = !bBlack;

            // Last row - White - Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook
            piece = new Rook( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Queen( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new King( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Bishop( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Knight( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
            ++nCol;
            piece = new Rook( nRow, nCol, WHITE, this );
            boundingBox = new Rectangle( ( 36 + ( nCol * 71 ) ), ( 35 + ( nRow * 71 ) ), 71, 71 );
            m_table[ nRow, nCol ] = new TableSquare( piece, boundingBox );
            m_vecWhitePieces.Add( piece );
        }
Пример #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            m_spriteBatch = new SpriteBatch(GraphicsDevice);

            //Loading table
            //Table.SetSelfImage(Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/table.png"));

            //Loading black and white pieces (on temporary instances - but the images are static)
            //Pawn pawn = new Pawn(0,0,false,null);
            //pawn.SelfImageWhite = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/white pawn.png");
            //pawn.SelfImageBlack = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/light_brown pawn.png");

            //Knight knight = new Knight(0,0,false,null);
            //knight.SelfImageWhite = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/white knight.png");
            //knight.SelfImageBlack = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/light_brown knight.png");

            //Bishop bishop = new Bishop(0,0,false,null);
            //bishop.SelfImageWhite = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/white bishop.png");
            //bishop.SelfImageBlack = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/light_brown bishop.png");

            //Rook rook = new Rook(0,0,false,null);
            //rook.SelfImageWhite = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/white rook.png");
            //rook.SelfImageBlack = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/light_brown rook.png");

            //King king = new King(0,0,false,null);
            //king.SelfImageWhite = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/white king.png");
            //king.SelfImageBlack = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/light_brown king.png");

            //Queen queen = new Queen(0,0,false,null);
            //queen.SelfImageWhite = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/white queen.png");
            //queen.SelfImageBlack = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/light_brown queen.png");

            //m_maskSelection = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/selection3.png");
            //m_maskSelectionTarget = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/targetSelections.png");

            //m_imgPlayNow = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/PlayerNow.png");

            //m_imgWhiteButton = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/BotãoBranco.png");
            //m_imgBlackButton = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/BotãoMarrom.png");

            //m_imgOpenGame = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/Abertura.png");
            //m_imgBlackWinner = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/Winner Brown.png");
            //m_imgWhiteWinner = Texture2D.FromFile(m_graphics.GraphicsDevice, "../../../Content/Textures/Winner White.png");

            Table.SetSelfImage(Content.Load<Texture2D>("Textures//table"));

            //Loading black and white pieces (on temporary instances - but the images are static)
            Pawn pawn = new Pawn(0,0,false,null);
            pawn.SelfImageWhite = Content.Load<Texture2D>("Textures//white pawn");
            pawn.SelfImageBlack = Content.Load<Texture2D>("Textures//light_brown pawn");

            Knight knight = new Knight(0,0,false,null);
            knight.SelfImageWhite = Content.Load<Texture2D>("Textures//white knight");
            knight.SelfImageBlack = Content.Load<Texture2D>("Textures//light_brown knight");

            Bishop bishop = new Bishop(0,0,false,null);
            bishop.SelfImageWhite = Content.Load<Texture2D>("Textures//white bishop");
            bishop.SelfImageBlack = Content.Load<Texture2D>("Textures//light_brown bishop");

            Rook rook = new Rook(0,0,false,null);
            rook.SelfImageWhite = Content.Load<Texture2D>("Textures//white rook");
            rook.SelfImageBlack = Content.Load<Texture2D>("Textures//light_brown rook");

            King king = new King(0,0,false,null);
            king.SelfImageWhite = Content.Load<Texture2D>("Textures//white king");
            king.SelfImageBlack = Content.Load<Texture2D>("Textures//light_brown king");

            Queen queen = new Queen(0,0,false,null);
            queen.SelfImageWhite = Content.Load<Texture2D>("Textures//white queen");
            queen.SelfImageBlack = Content.Load<Texture2D>("Textures//light_brown queen");

            m_maskSelection = Content.Load<Texture2D>("Textures//selection3");
            m_maskSelectionTarget = Content.Load<Texture2D>("Textures//targetSelections");

            m_imgPlayNow = Content.Load<Texture2D>("Textures//PlayerNow");

            m_imgWhiteButton = Content.Load<Texture2D>("Textures//BotãoBranco");
            m_imgBlackButton = Content.Load<Texture2D>("Textures//BotãoMarrom");

            m_imgOpenGame = Content.Load<Texture2D>("Textures//Abertura");
            m_imgBlackWinner = Content.Load<Texture2D>("Textures//Winner Brown");
            m_imgWhiteWinner = Content.Load<Texture2D>("Textures//Winner White");

            m_soundKlik = Content.Load<SoundEffect>( "Sounds\\KLICK" );
            m_soundKill = Content.Load<SoundEffect>( "Sounds\\BEEP_FM" );

            // TODO: use this.Content to load your game content here
        }