//while (pWindow->pollEvent(Event))
while (const std::optional Event = pWindow->pollEvent())
{
//if (Event.type == sf::Event::Closed)
if (Event->is<sf::Event::Closed>())
{
pWindow->close(); //> Und raus ..:
}
//if (Event.type == sf::Event::GainedFocus)
if (Event->is<sf::Event::GainedFocus>()) //> a) ???:
{ .. }
//if (Event.type == sf::Event::LostFocus)
if (Event->is<sf::Event::LostFocus>()) //> b) ???:
{ .. }
//if (Event.type == sf::Event::MouseWheelScrolled)
if (Event->is<sf::Event::MouseWheelScrolled>())
{
#ifdef ZWIANER_VERSION_K
pMaus->SetlMausMoveZpp((long)Event.mouseWheelScroll.delta); //> c) ???:
#endif
}
..
}
.. what must I do by a) b) c) .. ???
I recommend to check the updated tutorial for event handling (https://www.sfml-dev.org/tutorials/3.0/window/events/#sfeventgetift), since it comes with example code for each event type (e.g. MouseWheelScrolled (https://www.sfml-dev.org/tutorials/3.0/window/events/#the-mousewheelscrolled-event)).
You can use event->is<T>() if you're not interested in any of the event data or the event doesn't have any data, otherwise you can use event->getIf<T>() to get the event data.
You may also want to use else if so you don't have to check all the event types.
//while (pWindow->pollEvent(Event))
while (const std::optional Event = pWindow->pollEvent())
{
//if (Event.type == sf::Event::Closed)
if (Event->is<sf::Event::Closed>())
{
pWindow->close(); //> Und raus ..:
}
//if (Event.type == sf::Event::GainedFocus)
else if (Event->is<sf::Event::GainedFocus>()) //> a) ???:
{ .. }
//if (Event.type == sf::Event::LostFocus)
else if (Event->is<sf::Event::LostFocus>()) //> b) ???:
{ .. }
//if (Event.type == sf::Event::MouseWheelScrolled)
else if (const auto* mouseWheelScrolled = Event->getIf<sf::Event::MouseWheelScrolled>())
{
#ifdef ZWIANER_VERSION_K
pMaus->SetlMausMoveZpp((long)mouseWheelScrolled->delta); //> c) ???:
#endif
}
..
}