The above video goes away if you are a member and logged in, so log in now!
|
| |
Would you like to get all the new info from PSX-Scene in your email each day?
| |
|
-
#1
Controller Pad
Controller Pad –
08-17-2010,10:36 PM
I was reading over the example pad.c program that came with the ps2sdk provided by ps2dev.org. I confused at the part where it is reading the actual button values. Why can't you just do a comparison such as if(buttons.btns == PAD_LEFT). Why is it first being exclusive OR'ed with 0xffff and then bit ANDed with the old value of btns? Why should it even matter what the previous value of btns is? Thanks for clearing this up?
-
08-17-2010,11:15 PM
Nevermind. I looked at the code some more and I got was going on. It looks like that bit-wise AND is just so the code doesn't print a million times if you hold down a button. Also the value is XOR'd with all 1's because btns contains a single zero in a particular bit position whereas the values such as PAD_LEFT have a 1 in a particular bit position.
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|