SDL Controls

From Pandora Wiki
Revision as of 21:40, 9 August 2012 by Sebt3 (talk | contribs) (Created page with "== Gaming buttons == The pandora gaming buttons are mapped to certain keyboards keys. Here is the list : {|class="wikitable sortable" border="1" cellpadding="1" cellspacing="0" ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Gaming buttons

The pandora gaming buttons are mapped to certain keyboards keys. Here is the list :

Button SDLK key code
A SDLK_HOME
B SDLK_END
X SDLK_PAGEDOWN
Y SDLK_PAGEUP
START SDLK_LALT
SELECT SDLK_LCTRL
L SDLK_RSHIFT
R SDLK_RCTRL

Working with the nubs

The nubs can be used as mouse or as joystick and can be set independly one from the other. Here is the list of available mode :

Mode Description
mouse For mouse mouvements
mbuttons Mouse buttons
scroll like a 4d mouse wheel
absolute Joystick mode

for more informations see the Nubs.

Changing nub status in a start script

Here is the best way to set the nubs in joystick mode :

export NUB0MODE=`cat /proc/pandora/nub0/mode`
export NUB1MODE=`cat /proc/pandora/nub1/mode`
if [ -e /usr/pandora/scripts/op_nubchange.sh ]; then
    /usr/pandora/scripts/op_nubchange.sh absolute absolute
else
    echo absolute > /proc/pandora/nub0/mode
    echo absolute > /proc/pandora/nub1/mode
fi
# start your app here

# now revert them to the original state
if [ -e /usr/pandora/scripts/op_nubchange.sh ]; then
    /usr/pandora/scripts/op_nubchange.sh $NUB0MODE $NUB1MODE
else
    echo $NUB0MODE > /proc/pandora/nub0/mode
    echo $NUB1MODE > /proc/pandora/nub1/mode
fi

Finding the nub using SDL

// Joystick vars
#ifdef PANDORA
static SDL_Joystick *vid_sdlnub1 = NULL;
static SDL_Joystick *vid_sdlnub2 = NULL;
#endif


// Initialisation code
#ifdef PANDORA
                int i  = 0;
                for( i = 0; i < SDL_NumJoysticks(); i++) {
                        if (!strcmp(SDL_JoystickName(i), "nub0"))
                                vid_sdlnub1 = SDL_JoystickOpen(i);
                        else if (!strcmp(SDL_JoystickName(i), "nub1"))
                                vid_sdlnub2 = SDL_JoystickOpen(i);
                }
#endif