1
Window / Re: Using WindowHandle to get window input
« on: December 29, 2012, 02:23:27 am »
Thanks FRex, I just changed it to return a pointer to the sfml window. Works fine now
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
...
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;
}
}
}