public void onSurfaceCreated(GL10 gl, EGLConfig config) { GS2DJNI.start( apkPath, activity.getExternalStoragePath(), activity.getGlobalExternalStoragePath(), GL2JNIView.displayWidth, GL2JNIView.displayHeight); }
public GL2JNIView( GS2DActivity activity, String apkPath, AccelerometerListener accelerometerListener, KeyEventListener keyEventListener, ArrayList<NativeCommandListener> commandListeners) { super(activity.getApplication()); GL2JNIView.accelerometerListener = accelerometerListener; this.apkPath = apkPath; this.commandListeners = commandListeners; GL2JNIView.keyEventListener = keyEventListener; init(false, 1, 0, activity); retrieveScreenSize(activity); setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); frameHandler = new FrameHandler(this, 100); frameHandler.start(); }
public void onDrawFrame(GL10 gl) { final String commands = GS2DJNI.mainLoop( GL2JNIView.getTouchDataString() + GL2JNIView.getAccelerometerDataString() + GL2JNIView.keyEventListener.getCommands()); if (!commands.equals("")) { activity.runOnUiThread( new Runnable() { public void run() { for (Iterator<NativeCommandListener> i = commandListeners.iterator(); i.hasNext(); ) { NativeCommandListener current = i.next(); if (current != null) current.parseAndExecuteCommands(commands); } } }); Log.i("GS2D_Native_command", commands); } }