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

Author Topic: [solved] Stuck in event loop with JoyButtonReleased  (Read 2047 times)

0 Members and 1 Guest are viewing this topic.

kurokaze

  • Newbie
  • *
  • Posts: 1
    • View Profile
[solved] Stuck in event loop with JoyButtonReleased
« on: August 25, 2008, 12:24:27 am »
Whenever I use an event loop as presented in the tutorials onsite, my program gets stuck in the loop. App.GetEvent(Event) never returns FALSE. This is reproduced in e.g. the exact source of the OpenGL tutorial.

Based on a switch I threw in, the offending repeating event is of type JoyButtonReleased.

Removing my joystick had no effect. Rebooting with it removed did solve the issue. However, it returned as soon as the joystick was reinserted.

I'm rather uninterested in developing a program that requires a reboot to work, so I really need to work around this problem somehow.

I'm using the latest MinGW with the precompiled DLL version of SFML. I'll try static and compiling it myself, and the SVN, but I thought I'd see if anyone has experienced anything similar.

One obvious possibility is that my joystick driver really is sending constant button release messages, but I'd think I'd have run into trouble with other programs if that were the case. Something wrong on the SFML side seems more likely. Or PEBKAC.

I thought about working around it via a simple "if(Event.Type == sf::Event::JoyButtonReleased) break;" since I don't actually need the joystick for my program, but that could easily cause other events to be missed if they got stacked under the JoyButtonReleased event.

Edit: This appears to be due to the fact that my joystick has 13 buttons plus an 8-way hat, and SFML 1.3 uses a 16-element array to track button states. Changing the array size to 32 fixes the problem and I see this has been done in SVN along with a check to prevent similar data corruption in the future. Good work. :)

On the minus side my joystick produces no events after the fix (before the fix it didn't produce any events other than the Release spam either), but again, it is unnecessary to my program so this is by no means a deal-breaker.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
[solved] Stuck in event loop with JoyButtonReleased
« Reply #1 on: August 25, 2008, 09:13:26 am »
I'll try to find my old joystick and check that :)

In the meantime, if anyone has some feedback regarding joystick events, it would help a lot.
Laurent Gomila - SFML developer

 

anything