Press two buttons?

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

Moderators: cheriff, TyRaNiD

Post Reply
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Press two buttons?

Post by nikocronaldo »

if i want press two buttons to make a function,what do I put?
i saw this but it only works a button,i want the two buttons.

Code: Select all

if ((pad.Buttons & PSP_CTRL_START && pad.Buttons & PSP_CTRL_CROSS))
what do I do?
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

if (pad.Buttons &(PSP_CTRL_START| PSP_CTRL_CROSS) )
--pspZorba--
NO to K1.5 !
nikocronaldo
Posts: 31
Joined: Sun Feb 24, 2008 7:19 am

Post by nikocronaldo »

it doesn't work,or work START,or work CROSS.
thanks you.
crazyc
Posts: 408
Joined: Fri Jun 17, 2005 10:13 am

Post by crazyc »

if ((pad.Buttons & (PSP_CTRL_START|PSP_CTRL_CROSS)) == (PSP_CTRL_START|PSP_CTRL_CROSS))
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

oups, I do always the same mistake ;-)

if ((currentPad.Buttons &PSP_CTRL_START)&&(currentPad.Buttons& PSP_CTRL_CROSS) )
--pspZorba--
NO to K1.5 !
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

or:

Code: Select all

if (currentPad.Buttons &PSP_CTRL_START) {
// start is pressed
if (currentPad.Buttons &PSP_CTRL_CROSS) {
// start and cross are pressed
}
}
not the sort of thing that belongs here really.
If not actually, then potentially.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Yeah. All you're doing here is testing if two bits in an unsigned integer are both set. If you can't already do that, you probably need some remedial C lessons, which we don't do here.
Post Reply