Sorry if I posted this already. It seems to have disappeared, probably
because of size or copyright violations, so now I'm just posting a
stripped-down example.
If the Renderer is in a separate file how do I access
getCurrentPosition from the onDrawFrame? For example:
public class Run extends Activity {
MediaPlayer mp;
private GLSurfaceView glSurface;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mp = MediaPlayer.create(this, R.raw.yang13bs);
glSurface = new GLSurfaceView(this);
glSurface.setRenderer(new Test(this,mp));
setContentView(glSurface);
}
@Override
protected void onResume() {
super.onResume();
glSurface.onResume();
}
@Override
protected void onPause() {
super.onPause();
mp.stop();
glSurface.onPause();
}
}
----------------------------------------------------------------------
public class Test implements Renderer {
private Context context;
public Test(Context context, MediaPlayer mp) {
this.context = context;
cube = new Cube();
mp.start();
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
...
}
public void onDrawFrame(GL10 gl) {
...
mPos = mp.getCurrentPosition();
}
public void onSurfaceChanged(GL10 gl, int width, int height) {
...
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en