📜  在 csfml 中使用事件 - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:56.494000             🧑  作者: Mango

代码示例1
sf::Event event;

// while there are pending events...
while (window.pollEvent(event))
{
    // check the type of the event...
    switch (event.type)
    {
        // window closed
        case sf::Event::Closed:
            window.close();
            break;

        // key pressed
        case sf::Event::KeyPressed:
            ...
            break;

        // we don't process other types of events
        default:
            break;
    }
}