mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
5735fd09d9
This new API is built on top of std::variant. This allows us to store many different event types in a space-efficient way and access the active event type in a type-safe manner that eliminates the categories of UB that are possible with unions. Co-authored-by: kimci86 <kimci86@hotmail.fr>
1.5 KiB
1.5 KiB
Description
This PR is related to the issue #
Tasks
- Tested on Linux
- Tested on Windows
- Tested on macOS
- Tested on iOS
- Tested on Android
How to test this PR?
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode({1280, 720}), "Minimal, complete and verifiable example");
window.setFramerateLimit(60);
while (window.isOpen())
{
for (sf::Event event; window.pollEvent(event);)
{
if (event.is<sf::Event::Closed>())
window.close();
}
window.clear();
window.display();
}
}