[Gambas-devel] Wait statement changes in recent revision

Kevin Fishburne kevinfishburne at ...590...
Wed Apr 20 21:51:42 CEST 2011


On 04/18/2011 04:31 AM, Benoît Minisini wrote:
>> Alright Benoît, what changed in the recent revision? ;)
>>
>> I noticed before that supposedly recursive Wait statements were
>> not-so-recursive, and that I had to call them multiple times to allow
>> various events to trigger. If I had two events that had queued, for
>> example, I'd have to call Wait twice per frame for each to execute. Now
>> calling Wait several times seems to trigger the first event over and
>> over without triggering the second. I even had a stack overflow early
>> on, which I hadn't seen since my earliest days of programming. I can
>> adapt to the new way of things, but I'm not sure exactly what is
>> happening now. All I could think of was a GOSUB without a RETURN, haha.
>>
>> ...
>
> Now WAIT should behave as specified in the documentation :
>
> 1) With no argument, it will process only (one?) refresh event. Input events
> (mouse, keyboard, joystick) are queued.
>
> 2) With a time argument, it will process all events during the specified time.
>
> Normally, joystick events are queud by SDL. Why do you need to ignore them
> from time to time?

Thanks for the clarification Laurent and Benoît. What's funny is I had 
thought there was a problem with Wait from the beginning, but it had 
been "wrong" for so long I thought it was "right". I've adjusted the 
code so that it works properly now.

I still need to try out the new SDL joystick support, as I'm still using 
the old /dev/input/js0 device (which also queues input). The reason I 
need to flush or ignore some gamepad input is because the controls are 
dual-analog (Playstation-style). The analog sticks create a rapid flood 
of events when they're moved, which by far exceeds the frame rate of the 
game. Since these stick movement events are queued, any movement of an 
analog stick results in those events being spread out over dozens of 
frames, taking several seconds to finish. If you move, the player just 
keeps on moving. If you rotate, the player just keeps on rotating.

I'll figure it out...no worries. :)

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...590...
phone: (770) 853-6271





More information about the Devel mailing list