Now, I'd like to work on other keys. Also I would not like to keep this part in the same place (it's uncomfortable for me) Should I do it like above (just adding else ifs, or with second event:
As I tried to explain above, you cannot do it with a second event loop. That is not how pollEvent works.
The other point I tried to make is that after the pollEvent loop, you're free to do whatever you want, so it's not really a problem. For instance, you could do this:
while(okno.open()) {
...
std::queue<sf::Keyboard::Key> specialKeys;
std::queue<sf::Keyboard::Key> normalKeys;
sf::Event event;
while (okno.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
okno.close();
} else if (event.type == sf::Event::KeyPressed) {
if(event.key.code == sf::Keyboard::LAlt ||
event.key.code == sf::Keyboard::RAlt ||
...) {
specialKeys.push_back(event.key.code);
} else {
normalKeys.push_back(event.key.code);
}
} // other event types
}
// code to process specialKeys
// code to process normalKeys
// rendering and stuff
}
Now the only thing the pollEvent loop has to know about is your definition of a "special key". Is this what you were trying to achieve?