You may have seen me post earlier about the accelerometer, well after getting it working, i have set it up this way:
Init the accelerometer
Get the data
use data to define if someone is swinging the phone and play a sound.
Paint the screen.
I can paint the screen, i've gotten the data, and i've inited the accelerometer. The problem I'm having though is when i start to do this:
The application laggs horribly.
double force = Math.abs(x_int + y_int + z_int - x_pre - y_pre - z_pre)/2;
if(force > accThresh)
This is what I'm using to draw. So the coordinates go across the screen, and when open is false, it all runs very smooth. If it's not false, it goes horribly slow. Can anyone help me? Could it be the floating point number?
sx -= (x_int/3);
sy += (y_int/3);
g.setColor(255, 255, 255);
g.drawString("x = " + x_int, sx, sy+20, Graphics.TOP|Graphics.LEFT);
g.drawString("y = " + y_int, sx, sy+40, Graphics.TOP|Graphics.LEFT);
g.drawString("z = " + z_int, sx, sy+60, Graphics.TOP|Graphics.LEFT);
And with the sounds, it shouldn't make it lag too much am i correct?