Joystick/analog stick in PSPGL----Cant get it right... Help?

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

Moderators: cheriff, TyRaNiD

Post Reply
sg57
Posts: 144
Joined: Fri Oct 14, 2005 2:26 pm

Joystick/analog stick in PSPGL----Cant get it right... Help?

Post by sg57 »

I have 4 variables, per say, I want them to individually to be manipulated for each direction the analog is pointing...

Directions being down/backward, left, right nad forward/up... The original function supplied by the port of nehe tutorials on lesson 10 uses the analog stick, so ive looked there many times... Ive tried this approach, but it just goes everywhere with the slightest tap on the stick:

Code: Select all

void joystickMoved (unsigned int buttonMask, int x, int y, int z)
{
	if &#40;abs&#40;x&#41; > 200&#41; // dead zone LEFT         <------------
	&#123;	
              variablex--;
	&#125;

	if &#40;abs&#40;y&#41; > 200&#41; // dead zone UP          +++++++++++++++
	&#123;	
               variabley--;
	&#125;
	if &#40;abs&#40;x&#41; < 55&#41; // dead zone RIGHT         ------------->
	&#123;	
              variablex++;
	&#125;

     if &#40;abs&#40;y&#41; < 55&#41; // dead zone DOWN          _______________
	&#123;
              variabley++;
	&#125;	
&#125;
Could someone please enlighten me on exactly how to use the analog stick - PSPGL's function for the joystick, since I cant seem to get it right....

Thanks!
Post Reply