Well, I've a problem with the analog stick. I have a ship and it move in 8 directions. All directions work fine , except South-West and North-West :S
Here is the code:
Code: Select all
#ifdef _PSP_
float moveH, moveV;
sceCtrlPeekBufferPositive(&pad, 1);
moveH = (float)(pad.Lx)-128.0f;
moveV = (float)(pad.Ly)-128.0f;
// North-West
if((moveH < -16.0f) && (moveV < -16.0f)) {
Ship.dstrect.y += -VEL;
Ship.dstrect.x += -VEL;
}
// North-East
else if((moveV < -16.0f) && (moveH > 16.0f)) {
Ship.dstrect.y += -VEL;
Ship.dstrect.x += VEL;
}
// South-East
else if((moveH > 16.0f) && (moveV > 16.0f)) {
Ship.dstrect.y += VEL;
Ship.dstrect.x += VEL;
}
// South-West
else if((moveV > 16.0f) && (moveH < -16.0f)) {
Ship.dstrect.y += VEL;
Ship.dstrect.x += -VEL;
}
// North
else if(moveV < -16.0f) {
Ship.dstrect.y += -VEL;
}
// East
else if(moveH > 16.0f) {
Ship.dstrect.x += VEL;
}
// West
else if(moveH < -16.0f) {
Ship.dstrect.x += -VEL;
}
// South
else if(moveV > 16.0f) {
Ship.dstrect.y += VEL;
}
#endif
EDIT: The problem was in the main loop, but truely I don't know how I've solved xD
Cheers!!