Repeat for joybutton?

Hi List,

I’m new to the list and to SDL.
I’ve been experimenting with it on Linux, Mac, Windows and GP2x (my main
interest with SDL).

I have a question (searched the archives first, but couldn’t find an
answer) and would appreciate any help.

When a program is reacting to keyboard input, I can use
SDL_EnableKeyRepeat
and as long as the key that I’m polling for is held down, do something.

How is this done with a joystick?
For example, with SDL_JOYBUTTONDOWN - so that the user doesn’t have to
repeatedly press?

Thanks!
Paris

Hi List,

I’m new to the list and to SDL.
I’ve been experimenting with it on Linux, Mac, Windows and GP2x (my
main
interest with SDL).

I have a question (searched the archives first, but couldn’t find an
answer) and would appreciate any help.

When a program is reacting to keyboard input, I can use
SDL_EnableKeyRepeat
and as long as the key that I’m polling for is held down, do
something.

How is this done with a joystick?
For example, with SDL_JOYBUTTONDOWN - so that the user doesn’t have
to
repeatedly press?

Probably due to the way the OS handles joystick buttons as opposed to
keyboards. I’d figure you’re going to have to design your own handling
on this. I’d envision a code that sets a boolean like JButtonStillDown
that gets set to true when the system detects the button down and false
when it detects the button up. In between you’d have to keep track of
the ticks and maybe every 100 ticks, if it’s still down, fire a shot.>>> On 8/6/2007 at 7:37 PM, wrote:


Lilith

Hi Lilith,

Thanks for the reply - yes, that makes perfect sense.

Best,
p> ----- Original Message -----

Subject: Re: [SDL] repeat for joybutton?
From: lilith@dcccd.edu (Lilith Calbridge)
Date: Mon, August 06, 2007 10:48 pm
To:

On 8/6/2007 at 7:37 PM, <@paris_at_parisgraphi> wrote:
Hi List,

I’m new to the list and to SDL.
I’ve been experimenting with it on Linux, Mac, Windows and GP2x (my
main
interest with SDL).

I have a question (searched the archives first, but couldn’t find an
answer) and would appreciate any help.

When a program is reacting to keyboard input, I can use
SDL_EnableKeyRepeat
and as long as the key that I’m polling for is held down, do
something.

How is this done with a joystick?
For example, with SDL_JOYBUTTONDOWN - so that the user doesn’t have
to
repeatedly press?

Probably due to the way the OS handles joystick buttons as opposed to
keyboards. I’d figure you’re going to have to design your own handling
on this. I’d envision a code that sets a boolean like JButtonStillDown
that gets set to true when the system detects the button down and false
when it detects the button up. In between you’d have to keep track of
the ticks and maybe every 100 ticks, if it’s still down, fire a shot.


Lilith


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello !

When a program is reacting to keyboard input, I can use
SDL_EnableKeyRepeat
and as long as the key that I’m polling for is held down, do something.

How is this done with a joystick?
For example, with SDL_JOYBUTTONDOWN - so that the user doesn’t have to
repeatedly press?

Better than using SDL_KeyRepeat is implementing it
in your software, as to my knowledge there is no
such function as Joystick Repeat.

It is a little bit hard to explain,
i hope somebody can post a short example
code.

CU

Actually… I was stupid and although I searched the archives I didn’t
RTFM :wink:

Example 3-12 in the PDF of the SDL Doc - deals with this issue when
dealing with keypresses without using KeyRepeat. So I think the same
type of code will work with joystick buttons.

Best,
p> ----- Original Message -----

Subject: Re: [SDL] repeat for joybutton?
From: wizard@syntheticsw.com (Torsten Giebl)
Date: Tue, August 07, 2007 8:43 am
To: “A list for developers using the SDL library. (includes
SDL-announce)”

Hello !

When a program is reacting to keyboard input, I can use
SDL_EnableKeyRepeat
and as long as the key that I’m polling for is held down, do something.

How is this done with a joystick?
For example, with SDL_JOYBUTTONDOWN - so that the user doesn’t have to
repeatedly press?

Better than using SDL_KeyRepeat is implementing it
in your software, as to my knowledge there is no
such function as Joystick Repeat.

It is a little bit hard to explain,
i hope somebody can post a short example
code.

CU


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hey,

If you just want the joy button to repeat each frame instead of having a delay like the key repeat has, you can check the joy button state with:Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button);

Jonny D> Date: Mon, 6 Aug 2007 19:55:33 -0700> From: paris at parisgraphics.com> To: sdl at lists.libsdl.org> Subject: Re: [SDL] repeat for joybutton?> > Hi Lilith,> > > Thanks for the reply - yes, that makes perfect sense.> > > Best,> p> > > -------- Original Message --------> Subject: Re: [SDL] repeat for joybutton?> From: “Lilith Calbridge” > Date: Mon, August 06, 2007 10:48 pm> To: > > > > >>> On 8/6/2007 at 7:37 PM, wrote:> > Hi List,> > > I’m new to the list and to SDL.> > I’ve been experimenting with it on Linux, Mac, Windows and GP2x (my> main> > interest with SDL).> > > I have a question (searched the archives first, but couldn’t find an> > answer) and would appreciate any help.> > > When a program is reacting to keyboard input, I can use> > SDL_EnableKeyRepeat> > and as long as the key that I’m polling for is held down, do> something.> > > How is this done with a joystick?> > For example, with SDL_JOYBUTTONDOWN - so that the user doesn’t have> to> > repeatedly press?> > Probably due to the way the OS handles joystick buttons as opposed to> keyboards. I’d figure you’re going to have to design your own handling> on this. I’d envision a code that sets a boolean like JButtonStillDown> that gets set to true when the system detects the button down and false> when it detects the button up. In between you’d have to keep track of> the ticks and maybe every 100 ticks, if it’s still down, fire a shot.> > – > Lilith> _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org> > > > _______________________________________________> SDL mailing list> SDL at lists.libsdl.org> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


See what you?re getting into?before you go there
http://newlivehotmail.com/?ocid=TXT_TAGHM_migration_HM_viral_preview_0507