SFML community forums

Help => General => Topic started by: og_the_trog on March 05, 2014, 07:03:14 am

Title: event delay on linux
Post by: og_the_trog on March 05, 2014, 07:03:14 am
hello everybody
So I'm using:
linux mint 16 - 64 bit.
sfml2.0
code::blocks
GNU GCC compiler

so I will press a button then about one second after it will register I pressed the button, then about one second after I stop pressing the button it will register that the button has stopped being pressed, this also happens for mouse events.

this is an examaple of what I use:
    if (event.type == sf::Event::MouseButtonPressed)
    {
        if (event.key.code == sf::Mouse::Left)
        {
            //do stuff
        }
    }
 

oh and the lag gets longer the longer the program is running.

I compiled it on window 8 using code blocks and mingw and this problem was not present.

Thankyou for any help.
Title: Re: event delay on linux
Post by: AlexxanderX on March 05, 2014, 07:33:16 am
What you exactly do in the //do stuff ?
Title: Re: event delay on linux
Post by: og_the_trog on March 05, 2014, 07:55:18 am
I have an std::vector of sprites, and I add a sprite to the vector.
I figured it wasn't a coding problem because it worked fine on windows...
Title: Re: event delay on linux
Post by: eXpl0it3r on March 05, 2014, 08:38:26 am
Make a minimal and complete example and post it here.

Although I can't find my crystal ball, I "feel" like you might not be using a while loop for polling the events.
Title: Re: event delay on linux
Post by: og_the_trog on March 05, 2014, 09:33:19 am
Yes, thankyou, you were right, I was using:
if (window.pollEvent(event))
 
instead of:
while (window.pollEvent(event))
 
Title: Re: event delay on linux
Post by: Tank on March 05, 2014, 10:31:03 am
Magic eXpl0it3r strikes again.
Title: Re: event delay on linux
Post by: select_this on March 05, 2014, 12:05:46 pm
Can you pick my lottery numbers for me, eXpl0it3r  :P
Title: Re: event delay on linux
Post by: eXpl0it3r on March 05, 2014, 12:45:08 pm
Can you pick my lottery numbers for me, eXpl0it3r  :P
Sure, but all magic comes with a price. You buy the lottery tickets, I'll tell you which numbers to set and when you win, I'll get 40%. ;D