Esempio n. 1
0
 public void onSurfaceCreated(GL10 gl, EGLConfig config) {
   GS2DJNI.start(
       apkPath,
       activity.getExternalStoragePath(),
       activity.getGlobalExternalStoragePath(),
       GL2JNIView.displayWidth,
       GL2JNIView.displayHeight);
 }
Esempio n. 2
0
 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();
 }
Esempio n. 3
0
 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);
   }
 }