SFML community forums

Help => General => Topic started by: codingHere on October 09, 2021, 02:42:17 am

Title: why does this not work i read multiple posts still doesnt work
Post by: codingHere on October 09, 2021, 02:42:17 am
why does this not work???

   if (Keyboard::isKeyPressed(Keyboard::Enter))
                {
                    gameNotStarted = false;
                }
        // set the color
        text.setFillColor(Color::White);
       
        //position the text
        FloatRect textRect = text.getLocalBounds();

        text.setOrigin(textRect.width / 2.0f, textRect.top + textRect.height / 2.0f);
        text.setPosition(7200 / 3.4f, 1000 / 2.0f);

       


       


        window.clear();
        //draw here
        if (gameNotStarted = true)
        {
            window.draw(text);
        }
Title: Re: why does this not work i read multiple posts still doesnt work
Post by: codingHere on October 09, 2021, 02:54:36 am
nevermind i figured this out   :P i realized that this part is wrong:

if (gameNotStarted = true)
        {
            window.draw(text);
        }

its suppose to be like this:

if (gameNotStarted)
        {
            window.draw(text);
        }
Title: Re: why does this not work i read multiple posts still doesnt work
Post by: fallahn on October 09, 2021, 10:46:19 am
As a side note a comparison should be

    gameNotStarted == true

not

    gameNotStarted = true

 otherwise you're just assigning the value of true to the variable.
Title: Re: why does this not work i read multiple posts still doesnt work
Post by: codingHere on October 14, 2021, 04:48:05 am
thx!  :)