Sdl_Enablekey Repeat For Joystick
#1
Posted 28 February 2012 - 09:24 PM
I've a problem , with my CAANOO stick.I will a function similar to SDL_EnableKey repeat for joystick, to disable event when stick is pushed.
#2
Posted 29 February 2012 - 03:01 PM
I've a problem , with my CAANOO stick.I will a function similar to SDL_EnableKey repeat for joystick, to disable event when stick is pushed.
Sorry but your question is very badly written. I think you want the same function for joystick events as SDL_EnableKey does for keyboard events. A quick look at the SDL api nothing like this exists.
I think the only option is to remember the last sent value and create your own timer to control how you use that value.
#3
Posted 29 February 2012 - 05:23 PM
did you have an exmple of timer to control joystick event ??
Thank's.
#4
Posted 29 February 2012 - 05:36 PM
Yes pickle , i know, my english is very bad
![]()
did you have an exmple of timer to control joystick event ??
Thank's.
well a simple way would something like this (in rough pseudo code):
IF sdl button pressed event detected THEN /* Should only occur once if the position is stable, if the stick changes then this will be triggered quite often */
button = pressed
timer = 0 /* This makes sure you act instantly on the first press */
ELSE IF sdl button released event detected THEN
button = released
timer = 0
ENDIF
IF button is pressed and timer is 0 THEN
do logic
set timer = 100 /* force 100 ticks until logic occurs again */
ENDIF
timer--
Som other info that may be useful
http://www.gp32x.com...-controls-info/
#5
Posted 02 March 2012 - 05:47 PM
Thank you for your reply.I see your post to control Info.it's possible to disable event repeating with
if(eventState.jaxis.axis == 0)
{
positionX[eventState.jaxis.which] = eventState.jaxis.value;
}
...
Thx
#6
Posted 02 March 2012 - 06:56 PM
Hi Pickle,
Thank you for your reply.I see your post to control Info.it's possible to disable event repeating with
if(eventState.jaxis.axis == 0)
{
positionX[eventState.jaxis.which] = eventState.jaxis.value;
}
...
Thx
Ok im a bit confused, i thought you wanted a way to enable a repeat of the joystick value not disable anything. I also dont see how that snippet of code you posted really has any effect on controlling how events are handled.
All that code says is that if a joystick event says it occured on the X-axis store in a array that is sorted by the joystick index. In no way does it control when or how often you store or act on a event.











