if (event.type == Event::Closed || event.key.code == Keyboard::Escape)
And this is wrong, you need to ensure the event is a keyboard event before checking the key.
Thanks! You've found my main bug. Didn't know why the window crash, when cursor was near left side of screen.
And yep, I meant polling events with a for loop. Thought I can make my code little more beautiful w/o making event for all almost the same options.
edit: If it's still incomprehensible, I wanted to do something like this (I know it won't work):
while (window.pollEvent(event))
{
if (event.type == Event::Closed || event.key.code == Keyboard::Escape)
{
window.close();
}
for (int i=0; i<6; i++)
{
else if (option[i].getGlobalBounds().contains(mouse) &&
eventtype == Event::MouseButtonPressed && event.key.code == Mouse::Left)
{
//many functions based on matrix used in option[]
}
}
}