Ejemplo n.º 1
0
  /**
   * Capture the current image with the size as it is displayed and retrieve it as Bitmap.
   *
   * @return current output as Bitmap
   * @throws InterruptedException
   */
  public Bitmap capture() throws InterruptedException {
    final Semaphore waiter = new Semaphore(0);

    final int width = mGLSurfaceView.getMeasuredWidth();
    final int height = mGLSurfaceView.getMeasuredHeight();

    // Take picture on OpenGL thread
    final int[] pixelMirroredArray = new int[width * height];
    mGPUImage.runOnGLThread(
        new Runnable() {
          @Override
          public void run() {
            final IntBuffer pixelBuffer = IntBuffer.allocate(width * height);
            GLES20.glReadPixels(
                0, 0, width, height, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pixelBuffer);
            int[] pixelArray = pixelBuffer.array();

            // Convert upside down mirror-reversed image to right-side up normal image.
            for (int i = 0; i < height; i++) {
              for (int j = 0; j < width; j++) {
                pixelMirroredArray[(height - i - 1) * width + j] = pixelArray[i * width + j];
              }
            }
            waiter.release();
          }
        });
    requestRender();
    waiter.acquire();

    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    bitmap.copyPixelsFromBuffer(IntBuffer.wrap(pixelMirroredArray));
    return bitmap;
  }
 private void initGLSurfaceView() {
   if (glView != null) {
     glView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
     glView.setRenderer(renderer);
     glView.setOnTouchListener(this);
   }
 }
Ejemplo n.º 3
0
 /**
  * Sets the GLSurfaceView which will display the preview.
  *
  * @param view the GLSurfaceView
  */
 public void setGLSurfaceView(final GLSurfaceView view) {
   mGlSurfaceView = view;
   mGlSurfaceView.setEGLContextClientVersion(2);
   mGlSurfaceView.setRenderer(mRenderer);
   mGlSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
   mGlSurfaceView.requestRender();
 }
Ejemplo n.º 4
0
  /**
   * initializing viewport set window properties (width, height, fullscreen, orientation based on
   * config) initialize touch listener if config.sensor initialize sound if config.sound initialize
   * music if config.music
   *
   * @param state
   */
  public void create(Bundle state) {
    super.onCreate(state);
    restore(getIntent().getExtras());
    if (config.fullscreen) {
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      getWindow()
          .setFlags(
              WindowManager.LayoutParams.FLAG_FULLSCREEN,
              WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    if (config.orientation == Config.LANDSCAPE) {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    } else {
      setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    view = new GLSurfaceView(this);
    view.setRenderer(this);
    setContentView(view);
    view.setOnTouchListener(this);
    this.resources = getResources();
    this.screen = new Size(config.width, config.height);
    // this.strech = config.strech;

    if (config.sound) {
      sound = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
      // volume = (AudioManager) getSystemService (AUDIO_SERVICE);
    }
    if (config.sensor) {
      sensor = (SensorManager) getSystemService(SENSOR_SERVICE);
      accelerometer = sensor.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    }
  }
Ejemplo n.º 5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    Logger.log("onCreate");
    if (master != null) {
      copy(master);
    }
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    mGLView = new GLSurfaceView(getApplication());
    mGLView.setEGLConfigChooser(
        new GLSurfaceView.EGLConfigChooser() {
          public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
            // Ensure that we get a 16bit framebuffer. Otherwise, we'll fall
            // back to Pixelflinger on some device (read: Samsung I7500)
            int[] attributes = new int[] {EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE};
            EGLConfig[] configs = new EGLConfig[1];
            int[] result = new int[1];
            egl.eglChooseConfig(display, attributes, configs, 1, result);
            return configs[0];
          }
        });
    mGLView.setLayoutParams(
        new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT));
    mGLView.setRenderer(new BRenderer());

    this.setContentView(mGLView);
    wakeLock = getWakeLock(this, TAG);
  }
  @Override
  public void onPause() {
    stopChoreographerThread();

    final CountDownLatch cdl;
    if (null != mSurfaceView) {
      mSurfaceView.onPause();
      cdl = new CountDownLatch(1);
      mSurfaceView.queueEvent(
          new Runnable() {
            @Override
            public void run() {
              // these two must happen on the gl thread
              nativeLeaveVrMode(mPtr);
              destroySurfaceForTimeWarp();
              cdl.countDown();
            }
          });
    } else {
      cdl = null;
    }

    if (mVrApiInitialized) {
      if (null != cdl) {
        try {
          cdl.await();
        } catch (final InterruptedException ignored) {
        }
      }
      nativeUninitializeVrApi(mPtr);
      mVrApiInitialized = false;
    }
  }
 public void onCreate(ViewGroup groupView) {
   log.pushTimer(this, "start");
   // Create OpenCV part:
   if (RUN_OPENCV) {
     opencv = new OpenCVInterface(this, this.mainActivity);
     JavaCameraView cameraView = new JavaCameraView(mainActivity, JavaCameraView.CAMERA_ID_ANY);
     cameraView.setLayoutParams(
         new FrameLayout.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
     cameraView.enableFpsMeter();
     cameraView.setVisibility(JavaCameraView.GONE);
     groupView.addView(cameraView);
     opencv.onCreate(cameraView);
   }
   // Create OpenGL render part:
   if (RUN_RENDERER) {
     render = new RenderInterface(this);
     GLSurfaceView renderView = new GLSurfaceView(mainActivity.getApplicationContext());
     renderView.setLayoutParams(
         new FrameLayout.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
     groupView.addView(renderView);
     render.onCreate(renderView);
   }
   // Set layout things:
   mainActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   log.log(TAG, "Framework created in " + log.popTimer(this).time + "ms.");
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_camera_capture);

    File outputFile = new File(Environment.getExternalStorageDirectory(), "camera-test.mp4");
    TextView fileText = (TextView) findViewById(R.id.cameraOutputFile_text);
    fileText.setText(outputFile.toString());

    Spinner spinner = (Spinner) findViewById(R.id.cameraFilter_spinner);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            this, R.array.cameraFilterNames, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner.
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(this);

    // Define a handler that receives camera-control messages from other threads.  All calls
    // to Camera must be made on the same thread.  Note we create this before the renderer
    // thread, so we know the fully-constructed object will be visible.
    mCameraHandler = new CameraHandler(this);

    mRecordingEnabled = sVideoEncoder.isRecording();

    // Configure the GLSurfaceView.  This will start the Renderer thread, with an
    // appropriate EGL context.
    mGLView = (GLSurfaceView) findViewById(R.id.cameraPreview_surfaceView);
    mGLView.setEGLContextClientVersion(2); // select GLES 2.0
    mRenderer = new CameraSurfaceRenderer(mCameraHandler, sVideoEncoder, outputFile);
    mGLView.setRenderer(mRenderer);
    mGLView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    Log.d(TAG, "onCreate complete: " + this);
  }
Ejemplo n.º 9
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   surfaceView = new GLSurfaceView(this);
   surfaceView.setEGLContextClientVersion(3);
   surfaceView.setRenderer(new GLRenderer(this));
   setContentView(surfaceView);
 }
 @Override
 protected void onResume() {
   super.onResume();
   if (mRajRenderer == null) return;
   mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
   mSurfaceView.onResume();
   mRajRenderer.onVisibilityChanged(true);
 }
Ejemplo n.º 11
0
 private void init(Context context, AttributeSet attrs) {
   mGLSurfaceView = new GPUImageGLSurfaceView(context, attrs);
   mGLSurfaceView.setZOrderOnTop(true);
   mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
   mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT);
   addView(mGLSurfaceView);
   mGPUImage = new GPUImage(getContext());
   mGPUImage.setGLSurfaceView(mGLSurfaceView);
 }
Ejemplo n.º 12
0
  public void update(GLSurfaceView surface, GameData gamedata) {
    // position based on accelerometer
    if (((shipPosition - (change * 5)) > 0)
        && (shipPosition - (change * 5)) < (surface.getWidth() - getWidth()))
      shipPosition -= change * 5;

    // change image based on tilt
    if (change > 1 || change < -1) {
      if (change > 0) {
        srcX = 0 * width;
        // srcY = 1 * height;
      } else if (change < 0) {
        srcX = 2 * width;
        // srcY = 1 * height;
      }
    } else {
      srcX = 1 * width;
      // srcY = 0 * height;
    }

    src = new Rect(srcX, srcY, width + srcX, height + srcY);

    // Log.d("Acceleromter Data", " " + change);

    setmY((surface.getHeight() / 4) * 3);
    setmX(((int) shipPosition));

    /*
    if (burrakBoss.isMoving())
    {
      for (int i = 0; i < burrakBoss.bullets.length; i++)
      {
        if (burrakBoss.bullets[i].isMoving())
        {
          if (hit(burrakBoss.bullets[i]))
          {
            damageShip(gamedata, burrakBoss.bullets[i].getDamage());
            burrakBoss.bullets[i].resetBullet();
          }
        }
      }
    }

    for (int i = 0; i < bullets.length; i++)
    {
      if (bullets[i].isMoving())
      {
        if (hit(bullets[i]))
        {
          damageShip(gamedata, bullets[i].getDamage());
          bullets[i].resetBullet();
        }
      }
    }
    */

  }
Ejemplo n.º 13
0
  public void onDestroy() {

    // it is too late to call graphics.destroy - it needs live gl GLThread and gl context, otherwise
    // it will cause of deadlock
    // if (graphics != null) {
    //	graphics.clearManagedCaches();
    //	graphics.destroy();
    // }

    // so we do what we can..
    if (graphics != null) {
      // not necessary - already called in AndroidLiveWallpaperService.onDeepPauseApplication
      // app.graphics.clearManagedCaches();

      // kill the GLThread managed by GLSurfaceView (only for GLSurfaceView because
      // GLSurffaceViewCupcake stops thread in onPause events - which is not as easy and safe for
      // GLSurfaceView)
      if (graphics.view != null && (graphics.view instanceof GLSurfaceView)) {
        GLSurfaceView glSurfaceView = (GLSurfaceView) graphics.view;
        try {
          Method method = null;
          for (Method m : glSurfaceView.getClass().getMethods()) {
            if (m.getName()
                .equals("onDestroy")) // implemented in AndroidGraphicsLiveWallpaper, redirects to
            // onDetachedFromWindow - which stops GLThread by calling
            // mGLThread.requestExitAndWait()
            {
              method = m;
              break;
            }
          }

          if (method != null) {
            method.invoke(glSurfaceView);
            if (AndroidLiveWallpaperService.DEBUG)
              Log.d(
                  AndroidLiveWallpaperService.TAG,
                  " > AndroidLiveWallpaper - onDestroy() stopped GLThread managed by GLSurfaceView");
          } else throw new Exception("method not found!");
        } catch (Throwable t) {
          // error while scheduling exit of GLThread, GLThread will remain live and wallpaper
          // service wouldn't be able to shutdown completely
          Log.e(
              AndroidLiveWallpaperService.TAG,
              "failed to destroy GLSurfaceView's thread! GLSurfaceView.onDetachedFromWindow impl changed since API lvl 16!");
          t.printStackTrace();
        }
      }
    }

    if (audio != null) {
      // dispose audio and free native resources, mandatory since graphics.pause is never called in
      // live wallpaper
      audio.dispose();
    }
  }
Ejemplo n.º 14
0
  private VideoRendererGui(GLSurfaceView surface) {
    this.surface = surface;
    // Create an OpenGL ES 2.0 context.
    surface.setPreserveEGLContextOnPause(true);
    surface.setEGLContextClientVersion(2);
    surface.setRenderer(this);
    surface.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    yuvImageRenderers = new ArrayList<YuvImageRenderer>();
  }
Ejemplo n.º 15
0
 @Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
   if (mForceSize != null) {
     super.onMeasure(
         MeasureSpec.makeMeasureSpec(mForceSize.width, MeasureSpec.EXACTLY),
         MeasureSpec.makeMeasureSpec(mForceSize.height, MeasureSpec.EXACTLY));
   } else {
     super.onMeasure(widthMeasureSpec, heightMeasureSpec);
   }
 }
Ejemplo n.º 16
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   this.requestWindowFeature(Window.FEATURE_NO_TITLE);
   getWindow()
       .setFlags(
           WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
   GLSurfaceView view = new GLSurfaceView(this);
   view.setRenderer(myRenderer);
   setContentView(view);
 }
Ejemplo n.º 17
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    view = new GLSurfaceView(this);
    view.setEGLContextClientVersion(2);
    view.setRenderer(new TriangleRenderer(view));
    setContentView(view);
  }
Ejemplo n.º 18
0
  @Override
  public void onSetScript() {
    mSurfaceView = new GLSurfaceView(mActivity);

    mSurfaceView.setPreserveEGLContextOnPause(true);
    mSurfaceView.setEGLContextClientVersion(3);
    mSurfaceView.setEGLContextFactory(mContextFactory);
    mSurfaceView.setEGLConfigChooser(mConfigChooser);
    mSurfaceView.setEGLWindowSurfaceFactory(mWindowSurfaceFactory);
    mSurfaceView.setRenderer(mRenderer);
    mSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

    mActivity.setContentView(mSurfaceView);

    final DisplayMetrics metrics = new DisplayMetrics();
    mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
    final VrAppSettings appSettings = mActivity.getAppSettings();
    final int screenWidthPixels = Math.max(metrics.widthPixels, metrics.heightPixels);
    final int screenHeightPixels = Math.min(metrics.widthPixels, metrics.heightPixels);
    final int frameBufferWidth = appSettings.getFramebufferPixelsWide();
    final int frameBufferHeight = appSettings.getFramebufferPixelsHigh();
    final SurfaceHolder holder = mSurfaceView.getHolder();
    holder.setFormat(PixelFormat.TRANSLUCENT);

    if ((-1 != frameBufferHeight) && (-1 != frameBufferWidth)) {
      if ((screenWidthPixels != frameBufferWidth) && (screenHeightPixels != frameBufferHeight)) {
        Log.v(TAG, "--- window configuration ---");
        Log.v(TAG, "--- width: %d", frameBufferWidth);
        Log.v(TAG, "--- height: %d", frameBufferHeight);
        // a different resolution of the native window requested
        holder.setFixedSize((int) frameBufferWidth, (int) frameBufferHeight);
        Log.v(TAG, "----------------------------");
      }
    }
  }
Ejemplo n.º 19
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // make FULLSCREEN, witout title and bar
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    surface = new GLSurfaceView(this);
    surface.setEGLContextClientVersion(2);
    surface.setRenderer(new GlRenderer(this));
    setContentView(surface);
  }
Ejemplo n.º 20
0
  /*--------- onDrawFrame ---------------------------------------------------------------*/
  public void onDrawFrame(GL10 gl) {

    Log.d(TAG + "class MyRenderer", "onDrawFrame");

    boolean result = MidasNative.render();
    if (result) {
      parentView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    } else {
      parentView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
    }

    while (mPreRenderRunnables.size() > 0) {
      mPreRenderRunnables.remove(0).run();
    }
  }
Ejemplo n.º 21
0
  private View createGLSurfaceView(
      Activity activity, boolean useGL2, final ResolutionStrategy resolutionStrategy) {
    EGLConfigChooser configChooser = getEglConfigChooser();
    if (useGL2 && checkGL20()) {
      //			GLSurfaceView20 view = new GLSurfaceView20(activity, resolutionStrategy);
      GLSurfaceView20 view = new GLSurfaceView20(activity, true, 16, 0, resolutionStrategy);
      Log.v("launcher", "create gl");
      //			view.setZOrderOnTop(true);
      if (configChooser != null) view.setEGLConfigChooser(configChooser);
      else
        view.setEGLConfigChooser(
            config.r, config.g, config.b, config.a, config.depth, config.stencil);
      // view.pauseEglHelper = config.pauseEglHelper;
      view.setRenderer(this);
      return view;
    } else {
      config.useGL20 = false;
      configChooser = getEglConfigChooser();
      int sdkVersion = Integer.parseInt(android.os.Build.VERSION.SDK);
      if (sdkVersion >= 11) {
        GLSurfaceView view =
            new GLSurfaceView(activity) {

              @Override
              protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                ResolutionStrategy.MeasuredDimension measures =
                    resolutionStrategy.calcMeasures(widthMeasureSpec, heightMeasureSpec);
                setMeasuredDimension(measures.width, measures.height);
              }
            };
        if (configChooser != null) view.setEGLConfigChooser(configChooser);
        else
          view.setEGLConfigChooser(
              config.r, config.g, config.b, config.a, config.depth, config.stencil);
        // view.pauseEglHelper = config.pauseEglHelper;
        view.setRenderer(this);
        return view;
      } else {
        GLSurfaceViewCupcake view = new GLSurfaceViewCupcake(activity, resolutionStrategy);
        if (configChooser != null) view.setEGLConfigChooser(configChooser);
        else
          view.setEGLConfigChooser(
              config.r, config.g, config.b, config.a, config.depth, config.stencil);
        view.setRenderer(this);
        return view;
      }
    }
  }
Ejemplo n.º 22
0
 @Override
 public void requestRendering() {
   if (view != null) {
     if (view instanceof GLSurfaceViewCupcake) ((GLSurfaceViewCupcake) view).requestRender();
     if (view instanceof GLSurfaceView) ((GLSurfaceView) view).requestRender();
   }
 }
 @Override
 protected void onPause() {
   Log.d(TAG, "onPause -- releasing camera");
   super.onPause();
   releaseCamera();
   mGLView.queueEvent(
       new Runnable() {
         @Override
         public void run() {
           // Tell the renderer that it's about to be paused so it can clean up.
           mRenderer.notifyPausing();
         }
       });
   mGLView.onPause();
   Log.d(TAG, "onPause complete");
 }
Ejemplo n.º 24
0
  /*----------------------onPause--------------------------------------------------------------------*/
  @Override
  public void onPause() {
    Log.d(TAG, "onPause()");

    stopRendering();
    super.onPause();
  }
Ejemplo n.º 25
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setBackgroundDrawable(null);
    created = true;
    Log.d(TAG, "onCreate");

    pipe = new DataPipe(this);
    cam = new Camera();
    engine = new Engine(pipe, cam);

    gameView = new GLSurfaceView(this);
    gameView.setEGLContextClientVersion(2);

    gameView.setOnTouchListener(this);
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    gestureDetector = new GestureDetector(this, new GlAppGestureListener(this));

    surface = new GLSurfaceView(this);
    renderer = new GlRenderer(this);

    Bundle extras = getIntent().getExtras();

    renderer.SetExampleNum(extras.getInt(EXAMPLE_NAME));

    if ((renderer.GetExampleNum() == 5)
        || (renderer.GetExampleNum() == 7)
        || (renderer.GetExampleNum() == 6)) {
      Context context = getApplicationContext();
      Toast toast = Toast.makeText(context, "Используйте двойной клик", Toast.LENGTH_LONG);
      toast.setGravity(Gravity.BOTTOM, 0, 50);
      toast.show();
    }

    if (renderer.GetExampleNum() == 4) {
      Context context = getApplicationContext();
      Toast toast = Toast.makeText(context, "Нажмите и проведите", Toast.LENGTH_LONG);
      toast.setGravity(Gravity.BOTTOM, 0, 50);
      toast.show();
    }

    surface.setRenderer(renderer);
    setContentView(surface);
  }
Ejemplo n.º 27
0
 @Override
 protected void onPause() {
   // Ideally a game should implement onResume() and onPause()
   // to take appropriate action when the activity looses focus
   super.onPause();
   mGLSurfaceView.onPause();
 }
Ejemplo n.º 28
0
 /**
  * Sets the up camera to be connected to GPUImage to get a filtered preview.
  *
  * @param camera the camera
  * @param degrees by how many degrees the image should be rotated
  * @param flipHorizontal if the image should be flipped horizontally
  * @param flipVertical if the image should be flipped vertically
  */
 public void setUpCamera(
     final Camera camera,
     final int degrees,
     final boolean flipHorizontal,
     final boolean flipVertical) {
   mGlSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
   if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
     setUpCameraGingerbread(camera);
   } else {
     camera.setPreviewCallback(mRenderer);
     camera.startPreview();
   }
   Rotation rotation = Rotation.NORMAL;
   switch (degrees) {
     case 90:
       rotation = Rotation.ROTATION_90;
       break;
     case 180:
       rotation = Rotation.ROTATION_180;
       break;
     case 270:
       rotation = Rotation.ROTATION_270;
       break;
   }
   mRenderer.setRotationCamera(rotation, flipHorizontal, flipVertical);
 }
Ejemplo n.º 29
0
 // part of SurfaceHolder.Callback
 @Override
 public void surfaceCreated(SurfaceHolder holder) {
   super.surfaceCreated(holder);
   if (PApplet.DEBUG) {
     System.out.println("surfaceCreated()");
   }
 }
Ejemplo n.º 30
0
 @Override
 public void onResume() {
   super.onResume();
   // the very first time we're resumed, our loop will still be null because we wait to create it
   // until after our UI has been laid out and we know the size of the game screen
   if (loop != null) loop.start();
 }