为什么在我关闭使用SFML创建的窗口之前,控制台不会显示输入的文本?

时间:2019-01-03 17:08:45

标签: c++ sfml

当我关闭SFML窗口或退出时,输入将显示在终端上。

#include <SFML/Graphics.hpp>
#include <iostream>

int main() {

sf::RenderWindow window(sf::VideoMode(640,480), "SFML", sf::Style::Close | sf::Style::Titlebar | sf::Style::Resize); while(window.isOpen()) { sf::Event event; while(window.pollEvent(event)) { switch(event.type) { case sf::Event::Closed: window.close(); break; case sf::Event::Resized: printf("New window width: %i New window height: %i\n",event.size.width,event.size.height); break; case sf::Event::TextEntered: if(event.text.unicode < 128) { printf("%c", event.text.unicode); } } window.clear(sf::Color::Black); window.display(); } } return 0;}

0 个答案:

没有答案