On 03/29/2011 06:13 PM, Laurent Carlier wrote:
> Le mardi 29 mars 2011 04:33:21, Kevin Fishburne a écrit :
>> I'm reading input from a gamepad by using code such as:
>>
>> pad_device = Exec ["cat", "/dev/input/js0"] For Read As "Gamepad"
>>
>> Public Sub Gamepad_READ()
>>     ' Process the gamepad input.
>> End
>>
>> The problem is that analog stick movements create a LOT of read events
>> which are generated far faster than the frame rate of the application.
>> How can I clear the events queued by the Gamepad stream?
>>
>> Also, how can I continuously read events from the stream until it is
>> empty? I might want to clear it like that so I can ignore some events
>> and process others. Thanks!
>
> Did you try to use a gamepad with sdl component ? because i'm currently
> designing such api for gambas3, i guess it will not be too long before i can
> commit the code.

That is very cool... I'm looking forward to seeing it, and yes I'm 
currently using the SDL component. I switched the game over a couple of 
months ago.

What I did to relieve the problem for now was to call the WAIT statement 
a bunch of times using a FOR...NEXT loop. That way even if my frame rate 
is low, the gamepad's READ event is allowed to trigger multiple times 
per frame.

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


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to