integer for joy_raw.x

Posted By: Nicholas

integer for joy_raw.x - 10/04/11 17:23

I am trying to get the solid integer for the analog stick, but when I do something like below it stops at 140ish then jumps to 255 a second later when the stick is pushed all the way.

var stickv;

while(1){
stickv=integer(joy_raw.x);
wait(1);
}

I have this displayed in a panel along with the actual joy_raw.x.
the joy updates super fast and the integer shows pretty fast when below 100 (or above -100) but much past that and it freezes.
any ideas?
Posted By: MrGuest

Re: integer for joy_raw.x - 10/04/11 17:46

try
Code:
#include <acknex.h>
#include <default.c>

var var_joyForceX;
PANEL* pnl = {
	digits(20, 20, "joy_raw.x = %.2f", *, 1, joy_raw.x);
	digits(20, 50, "joy_force.x = %.2f", *, 1, joy_force.x);
	digits(20, 80, "var_joyForceX = %.2f", *, 1, var_joyForceX);
	flags = SHOW;
}

void main(){
	
	while(1){
		
		var_joyForceX = integer(joy_raw.x);
		wait(1);
	}
}

I'm guessing you have something else in your code or you have a dodgy joypad causing the issue. Hopefully this code should highlight it.
Posted By: Nicholas

Re: integer for joy_raw.x - 10/04/11 18:40

I'll give that a try when I get home. I haven't been checking the joy_force.x
I do have some other code in my while loop, but nothing that should give me trouble past a cetain threshold, but work fine below that.
I'll check it out tonight.
© 2024 lite-C Forums