Project

General

Profile

Changer de Couleur lors d'un clique souris. WT

Added by Thomas Furgol almost 5 years ago

Hello,

hello, I come to you because I do not know how to change color. In fact I have a table with boxes, I fill it with white and black pawns. Only I want to change the color as soon as a pawn is put. I want the color to change alternately. How to do ?

I do a method when the mouse clicks it displays a pawn but I can not manage the color for which change each time.

With that the problem is that all the pieces change color every time while I have to keep the colors.

if(_board.getJoueurCourant() == PLAYER_WHITE)
        {

            painter.setBrush(Wt::WBrush(Wt::StandardColor::White));

            painter.fillPath(circlePath, Wt::WBrush(Wt::WColor(Wt::StandardColor::White)));
            painter.drawPath(circlePath);



        }

    if(_board.getJoueurCourant() == PLAYER_BLACK)
    {

        painter.setBrush(Wt::WBrush(Wt::StandardColor::Black));
        painter.fillPath(circlePath, Wt::WBrush(Wt::WColor(Wt::StandardColor::Black)));
        painter.drawPath(circlePath);





    }