SFML community forums
Help => General => Topic started 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);
}
-
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);
}
-
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.
-
thx! :)