Hi there,
I'm now trying to mastering OpenGL for mobile gaming, so I'll need to ask a boxes of question about it. Here's my current problem now.
Specification :
- android SDK API 6 (android 2.1)
- using command line to create new project, build, and install
- using emulator (AVD) to run program
- Windows 7 Pro SP 1 32x
I'm trying to rotate triangle in my android on touch (onTouchEvent).
Here's my code snippet :
package .....;
import android.app.Activity;
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
public class segitiga extends Activity{
..
..
..
..
}
class HelloOpenGLES10SurfaceView extends GLSurfaceView {
...
...
...
public HelloOpenGLES10SurfaceView(Context context){
...
...
@Override
public boolean onTouchEvent(MotionEvent e) {
float x = e.getX();
float y = e.getY();
switch (e.getAction()) {
case MotionEvent.ACTION_MOVE:
float dx = x - mPreviousX;
float dy = y - mPreviousY;
if (y > getHeight() / 2) {
dx = dx * -1 ;
}
if (x < getWidth() / 2) {
dy = dy * -1 ;
}
mRenderer.mAngle += (dx + dy) * TOUCH_SCALE_FACTOR;
requestRender();
}
mPreviousX = x;
mPreviousY = y;
return true;
}
}
}
The porblem is when I tried to compile (install debug / adb installd ) to my emulator it's throw me error like this on the line of :
public boolean onTouchEvent(MotionEvent e)
It need ";" after onTouchEvent and after "e". So it should be this like according to the compiler :
public boolean onTouchEvent;(MotionEvent e;)
And that's wrong things.
How should I fixe it?
Thanks in advances