Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Focus on Window?  (Read 2271 times)

0 Members and 1 Guest are viewing this topic.

HardCoded

  • Newbie
  • *
  • Posts: 23
    • View Profile
Focus on Window?
« on: November 07, 2011, 12:17:32 am »
I'm using SFML2.0 and VC++2010 and when I compile and run this:
Code: [Select]

int main () {
sf::RenderWindow App(sf::VideoMode(X_RATIO, Y_RATIO, 32), WINDOW_TITLE);
App.SetFramerateLimit(32);
while (true) {
App.Display();
}
return 0;
}

I can't seem to 'click' on the window it creates or move it about or do anything with it.
However, I can interact with the console window that opens up with it.

Am I missing something?

Felheart

  • Newbie
  • *
  • Posts: 23
    • View Profile
Focus on Window?
« Reply #1 on: November 07, 2011, 12:40:24 am »
pumping the message queue?

In C# it's App.DispatchEvents();
There should be something similar in the original c++ version

HardCoded

  • Newbie
  • *
  • Posts: 23
    • View Profile
Focus on Window?
« Reply #2 on: November 07, 2011, 02:22:33 am »
Ahh..
Got it working now.
I just added this to the loop: App.PollEvent(sf::Event());
I used a temporary sf::Event because I don't need the Events for now.

Thanks.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Focus on Window?
« Reply #3 on: November 07, 2011, 07:54:50 am »
Quote
I just added this to the loop: App.PollEvent(sf::Event());

This is not valid C++ (passing a temporary as a non-const reference), I suggest that you configure your compiler so that it doesn't silently skip this kind of error ;)
Laurent Gomila - SFML developer