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

Author Topic: Event Polling not working  (Read 8018 times)

0 Members and 1 Guest are viewing this topic.

Yelnats

  • Newbie
  • *
  • Posts: 27
    • View Profile
Event Polling not working
« Reply #15 on: December 08, 2010, 04:54:05 am »
In the 700s.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Event Polling not working
« Reply #16 on: December 08, 2010, 08:47:01 am »
700 frames per second? That's your problem, you are running at full throttle with the main-loop. Because you do that it will starve the thread processing events in the background resulting in a huge delay in the events getting registered since the event thread don't get any opportunity to run since your main thread is busy working it's ass off trying to pull events that will never be registered.

Like I said before, easy fix is setting a framerate or just simply calling sf::Sleep.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Event Polling not working
« Reply #17 on: December 08, 2010, 08:51:17 am »
Quote
That's your problem, you are running at full throttle with the main-loop. Because you do that it will starve the thread processing events in the background resulting in a huge delay in the events getting registered since the event thread don't get any opportunity to run since your main thread is busy working it's ass off trying to pull events that will never be registered.

There's no event thread running in parallel/background, events are processed when calling GetEvent.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Event Polling not working
« Reply #18 on: December 08, 2010, 10:52:50 am »
Quote from: "Laurent"
Quote
That's your problem, you are running at full throttle with the main-loop. Because you do that it will starve the thread processing events in the background resulting in a huge delay in the events getting registered since the event thread don't get any opportunity to run since your main thread is busy working it's ass off trying to pull events that will never be registered.

There's no event thread running in parallel/background, events are processed when calling GetEvent.


You might not have a thread for it but the OS has. I get the same problem if my main-thread never sleeps.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Event Polling not working
« Reply #19 on: December 08, 2010, 11:06:58 am »
Quote
You might not have a thread for it but the OS has. I get the same problem if my main-thread never sleeps.

Hmm, never seen this problem before (and I've already seen apps running at thousands of FPS). I don't think the OS runs an event thread inside your process. Maybe it has a global process for that but then it's probably smart enough to handle priorities, otherwise any application that runs at 100% CPU would totally block the whole OS.
Laurent Gomila - SFML developer

Yelnats

  • Newbie
  • *
  • Posts: 27
    • View Profile
Event Polling not working
« Reply #20 on: December 08, 2010, 03:44:14 pm »
Ok I guess I'll just use sf::Input with a bool check to see if key was unpressed.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Event Polling not working
« Reply #21 on: December 08, 2010, 04:05:08 pm »
Quote from: "Yelnats"
Ok I guess I'll just use sf::Input with a bool check to see if key was unpressed.

Is it different? sf::Input uses events internally.
Laurent Gomila - SFML developer

Yelnats

  • Newbie
  • *
  • Posts: 27
    • View Profile
Event Polling not working
« Reply #22 on: December 08, 2010, 10:36:14 pm »
Well sf::Input is and has been working for me since I started, for WSAD controls and such.