iam trying to make a menu
i need to check if the user pressed a button to move throw the menu
when i tried doing this function then calling it in main
if (Keyboard::isKeyPressed(Keyboard::S))
{
selectedText[selectedNum].setFillColor(Color::White);
selectedNum++;
selectedText[selectedNum].setFillColor(Color::Blue);
}
the it goes throw all menu then the program crash
else if i use
if (event.type == Event::KeyPressed && event.key.code == Keyboard::S)
menu.moveDown();
it works fine
so what is the difference between these two ways what did ido wrong