SDL Controls?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
bronxbomber92
Posts: 36
Joined: Fri Jul 21, 2006 11:00 am

SDL Controls?

Post by bronxbomber92 »

What are the controls in SDL?
For exmaple what is pad.Buttons&PSP_CTRL_CROSS in SDL? I know its sumtin todo with joystick....
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

README.PSP
bronxbomber92
Posts: 36
Joined: Fri Jul 21, 2006 11:00 am

Post by bronxbomber92 »

I saw that but I'm still confused. Can anyone provide an example?
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

The PSP buttons show up as joystick buttons. For SDL documentation on joysticks, see http://psp.jim.sh/sdl-doc/guideinput.html
FreePlay
Posts: 71
Joined: Wed Jan 04, 2006 6:53 pm
Location: Schenectady, New York, USA

Post by FreePlay »

My port of LPairs uses the D pad and buttons in SDL. If you want to check out the source, it's included with the release here.

Specifically, in pairs.c, in run_game, you'll see an example of using buttons to simulate a mouse click at a specific location. You could use it to do pretty much anything else, too.

The definitions for the keys I use (X_CROSS, X_SELECT, etc.) are in psp.h.

Porting an SDL game is an excellent way to familiarize yourself with the API. I knew nothing of SDL before I did LPairs, and I still managed to do rather well.
bronxbomber92
Posts: 36
Joined: Fri Jul 21, 2006 11:00 am

Post by bronxbomber92 »

Thanks, but I think there's a password on the zip?
FreePlay
Posts: 71
Joined: Wed Jan 04, 2006 6:53 pm
Location: Schenectady, New York, USA

Post by FreePlay »

There shouldn't be. I don't put passwords on my release files. In case you can't get to it:
pairs.h
pairs.c
psp.h
psp.c

Also, I've got this for my init_sdl call:

Code: Select all

init_sdl( SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK);
bronxbomber92
Posts: 36
Joined: Fri Jul 21, 2006 11:00 am

Post by bronxbomber92 »

:) Thanks, I'll take a look at these
Post Reply