Welcome! Log In Create A New Profile

Advanced

SDL hat event

Posted by TheDrev 
SDL hat event
April 21, 2010 10:35PM
Hi !
for Hat event I use
    if( event->type == SDL_JOYHATMOTION){
        if ( event->jhat.hat & SDL_HAT_UP )
        {
            // GNA ! 
        }
        else if ( event->jhat.hat & SDL_HAT_RIGHTDOWN )
        {
            // MU ? 
        }
    }

I just need a little example that uses [SDL_JoystickGetHat] [www.libsdl.org] for some test.



Edited 1 time(s). Last edit at 04/21/2010 10:35PM by TheDrev.
Re: SDL hat event
April 22, 2010 07:16AM
I hate to break it to you, but I don't think that the Wii remote/nunchuck/any-combination has a HAT. I would suggest using the D-PAD. Like so:

if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_UP){
    // GNA !
}else if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_DOWN){
    // MU?
}
Re: SDL hat event
April 23, 2010 01:02AM
With the late version on the svn it's seems that it is possible (see the sdl page on wiki), but I only succeed with the analog pad of the classic controler. (event of type SDL_JOYAXISMOTION)
I wonder if anyone have made the wiimote or classic + pad works without the libogc wiimote interface (wich I'll use if sdl input don't works)



Edited 1 time(s). Last edit at 04/23/2010 01:03AM by TheDrev.
Re: SDL hat event
April 23, 2010 02:11AM
I used the SDL hat in a project a while ago. Browse through this :-

[cubeenginewii.svn.sourceforge.net]
Re: SDL hat event
April 23, 2010 11:03AM
Thanks that's what I was looking for.
I swear that if that works I'll post a working example on the SDL page :D
Sorry, only registered users may post in this forum.

Click here to login