Example #1
0
 /**
  * To be called by game or event thread to request rendering thread to perform one of the defined
  * actions.
  *
  * @param reason One of the reason constants above
  * @param block Whether to block until the request has been serviced.
  */
 public synchronized void requestRender(int reason, boolean block) {
   if (mRenderBlocking) Log.f(TAG, "requestRender called while already blocking");
   mRenderBlocking = block;
   mRenderReason = reason;
   implementRenderRequest();
   if (block) {
     try {
       wait();
     } catch (InterruptedException e) {
       Log.w(
           TAG,
           "Interrupted while waiting for "
               + mRenderer.getDescription()
               + " to service "
               + " render request "
               + reason,
           e);
     }
   }
 }
Example #2
0
 /** Convenience function to request a screen refresh. */
 public synchronized void requestRender() {
   if (mRenderBlocking) Log.f(TAG, "requestRender called while already blocking");
   mRenderBlocking = false;
   mRenderReason = REASON_RENDER;
   implementRenderRequest();
 }
Example #3
0
 /**
  * Like requestRender but doesn't actually request the render. This is so that it can be used in
  * situations such as in conjunction with Android's GLSurfaceView.onPause(). It is anticipated
  * that the system will handle blocking in that situation.
  *
  * @param reason
  * @see requestRender(int, boolean)
  */
 public synchronized void preRequestRender(int reason) {
   if (mRenderBlocking) Log.f(TAG, "requestRender called while already blocking");
   mRenderBlocking = false;
   mRenderReason = reason;
 }