For some reason I cannot recreate the code, so there probably is a problem before there. Another question, why does the game crash when you close the render window? This is the code. I exist with code -1073741819. Using Visual Studio 2010 debug.
#include <SFML/Graphics.hpp>
#include <iostream>
int main(){
sf::Event events;
sf::RenderWindow App(sf::VideoMode(640, 800, 32), "test");
while(App.IsOpened()){
while (App.GetEvent(events)){
if(events.Type == sf::Event::KeyPressed){
if (events.Key.Code == sf::Key::S) std::cout << "sssSSSsss";
else if (events.Key.Code == sf::Key::Escape) App.Close();
}
}
}
return 0;
}
Oh I found out that my code DOES work, but the event detection takes a few seconds to kick in, and then it doesn't repeated for a few seconds more. Why is that? As in if the even is for sf::Key::Q it will wait for a few seconds before detecting it, then again before detecting it again.