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

Author Topic: issue with pollEvent in SFML 2.0  (Read 2560 times)

0 Members and 1 Guest are viewing this topic.

rincewind

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
issue with pollEvent in SFML 2.0
« on: August 25, 2012, 05:00:14 pm »
Hello. I'm having an issue with pollEvent.

please check out my code

#include <SFML/Graphics.hpp>

int main()
{

    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");
    sf::Text text("bla bla ");
    text.setPosition(100,100);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }
        window.clear();
        window.draw(text);
        text.rotate(15);
        window.display();
    }

    return 0;
}
 

what it should be doing is just rotate some text really really fast, but when I move my mouse around the window, the text stops and nothing happens (also the text is rotating really laggy if the mouse is on the window). If I comment out the while loop, everything works as it should.

Also I noticed the same lags and slowdowns in the sample opengl.exe (included with sfml 2.0)

Does anyone know how to fix this?

(this is run on windows 7)
« Last Edit: August 25, 2012, 05:03:07 pm by rincewind »

Perde

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: issue with pollEvent in SFML 2.0
« Reply #1 on: August 25, 2012, 05:24:26 pm »
Nevermind. I don't exactly know what happened. It was working properly after doing the change I suggested, but after resetting to your code again it continued to do so.

[edit]
Btw, when I thought that I could reproduce your problem, I was actually witnessing this:
http://en.sfml-dev.org/forums/index.php?topic=8971.msg60381#new
« Last Edit: August 25, 2012, 05:51:35 pm by Perde »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: issue with pollEvent in SFML 2.0
« Reply #2 on: August 25, 2012, 06:03:30 pm »
Well I do not have a problem with your code (also on Windows 7).
What graphics card do you use? Is it uptodate?
Do you have any application installed that could manipulate inputs or send messages to other applications?

Afaik we had already quite a few complaints where the event loop stalled the application, but I'm not sure if there ever was a solution... You could search the forum for it. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

rincewind

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: issue with pollEvent in SFML 2.0
« Reply #3 on: August 26, 2012, 09:56:03 am »
Looking through the forums I figured out that the problem is the joystick :\

I have a bluetooth joystick installed - I connect the ps3 joystick to the computer, and I think this causes the problem. If I change this

const sf::Time connectionRefreshDelay = sf::milliseconds(500);

to this

const sf::Time connectionRefreshDelay = sf::milliseconds(50000);

in the source, then everything works smoothly.

 

anything