Joy released button

SGDK only sub forum

Moderator: Stef

Post Reply
orlanrod
Very interested
Posts: 99
Joined: Fri Sep 25, 2015 7:46 pm

Joy released button

Post by orlanrod » Thu Oct 01, 2015 8:18 pm

How can i check if a joy button was released from a pressed state?

Thanks

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Re: Joy released button

Post by Stef » Thu Oct 01, 2015 9:10 pm

You need to use the JOY event handler for that :

Code: Select all

JOY_setEventHandler(joyEvent);
then :

Code: Select all

void joyEvent(u16 joy, u16 changed, u16 state)
{
    // START button state changed
    if (changed & BUTTON_START)
    {
        // START pressed ?
    	if (state & BUTTON_START) doSomething();
        // START released ?
    	else doSomethingElse();
    }

    // one of the A, B or C button has just been pressed ?
    if (changed & state & (BUTTON_A | BUTTON_B | BUTTON_C))
    {
       //
    }
}

Post Reply