...
sf::WindowHandle winHdl = window_->getWindowHandle(); // this gets and returns the sf::WindowHandle from my graphics engine
sf::Window sfmlWindow_(winHdl); // send the window handle to a new sfml window
...
void Game::handleEvents() {
sf::Event event;
if (sfmlWindow_.isOpen() == true)
std::cout << "IS OPEN: " << (sfmlWindow_.isOpen() == true) << std::endl;
// while there are pending events...
while (sfmlWindow_.pollEvent(event)) {
std::cout << "event type: " << event.type << std::endl;
// 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:
receiveKeyboardEvent(event);
receiveMouseEvent(event);
break;
}
}
}