Hello everyone, i've just begun to learn SFML (couple days), my knowledge in c++ is average, i've read "C++ Primer", Lippman and already have some c++ code experience.
I have this simple code and my problem is, that it actually does't outputs characters to my console. It outputs everything i've typed AFTER i close the window. But, if i uncomment the << endl; statement, it outputs characters typed in real time. It seems i can't output my typed characters in real time, without having a new line after each character, which is super strange.
If anyone knows, please help)
P.S Sorry for my bad english sometimes, probably, i'm not a native speaker(
#include <SFML/Graphics.hpp>
#include <iostream>
#include <string>
int main() {
sf::RenderWindow window(sf::VideoMode(500, 500), "SFML works!");
std::string display = "";
window.setKeyRepeatEnabled(false);
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed) {
window.close();
}
else if (event.type == sf::Event::TextEntered) {
std::cout << (char)(event.text.unicode) /* Try to uncomment THIS << std::endl */;
}
}
window.display();
}
return 0;
}