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

Author Topic: event delay on linux  (Read 2222 times)

0 Members and 1 Guest are viewing this topic.

og_the_trog

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
event delay on linux
« 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.

AlexxanderX

  • Full Member
  • ***
  • Posts: 128
    • View Profile
    • AlexanderX
Re: event delay on linux
« Reply #1 on: March 05, 2014, 07:33:16 am »
What you exactly do in the //do stuff ?
Here you can find my blog and tutorials about SFML - http://alexanderx.net/ (died...) - http://web.archive.org/web/20160110002847/http://alexanderx.net/

og_the_trog

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: event delay on linux
« Reply #2 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...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: event delay on linux
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

og_the_trog

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: event delay on linux
« Reply #4 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))
 

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: event delay on linux
« Reply #5 on: March 05, 2014, 10:31:03 am »
Magic eXpl0it3r strikes again.

select_this

  • Full Member
  • ***
  • Posts: 130
  • Current mood: just ate a pinecone
    • View Profile
    • darrenferrie.com
Re: event delay on linux
« Reply #6 on: March 05, 2014, 12:05:46 pm »
Can you pick my lottery numbers for me, eXpl0it3r  :P
Follow me on Twitter, why don'tcha? @select_this

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10819
    • View Profile
    • development blog
    • Email
Re: event delay on linux
« Reply #7 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
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/