當前位置: 首頁>>代碼示例>>Java>>正文


Java ZoomCamera類代碼示例

本文整理匯總了Java中org.andengine.engine.camera.ZoomCamera的典型用法代碼示例。如果您正苦於以下問題:Java ZoomCamera類的具體用法?Java ZoomCamera怎麽用?Java ZoomCamera使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ZoomCamera類屬於org.andengine.engine.camera包,在下文中一共展示了ZoomCamera類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: clipForHUD

import org.andengine.engine.camera.ZoomCamera; //導入依賴的package包/類
/**
 * Perform clipping using HUD coordinate transformations
 * @param pGLState
 * @param pCamera
 */
private void clipForHUD(GLState pGLState, Camera pCamera) {
    float[] coordinates = this.getParent().convertLocalCoordinatesToSceneCoordinates(this.mX, this.mY, new float[2]);
    float[] size = this.getParent().convertLocalCoordinatesToSceneCoordinates(this.mWidth, this.mHeight, new float[2]);
    final float zoom = ((ZoomCamera)pCamera).getZoomFactor();
    final float screenRatioX = pCamera.getSurfaceWidth()/pCamera.getWidth();
    final float screenRatioY = pCamera.getSurfaceHeight()/pCamera.getHeight();
    final float left = (this.mX - (this.mWidth/2)) * screenRatioX / zoom;
    final float bottom = (this.mY - (this.mHeight/2)) * screenRatioY / zoom;
    final float width = this.mWidth * screenRatioX / zoom;
    final float height = this.mHeight * screenRatioY / zoom;
    if (print_debug) {
        Debug.d("Scrollable X: " + this.mX);
        Debug.d("Scrollable Y: " + this.mY);
        Debug.d("Scrollable W: " + this.mWidth);
        Debug.d("Scrollable H: " + this.mHeight);
        Debug.d("Scrollable x,y: "+coordinates[Constants.VERTEX_INDEX_X]+","+coordinates[Constants.VERTEX_INDEX_Y]);
        Debug.d("Scrollable w,h: " + size[Constants.VERTEX_INDEX_X]+","+size[Constants.VERTEX_INDEX_Y]);
        Debug.d("clipForHUD: GLES20.glScissor("+left+", "+bottom+", "+width+", "+height+")");
        Debug.d("Scrollable camera zoom: " + zoom);
        Debug.d("Scrollable screenRatioX: " + pCamera.getSurfaceWidth()/pCamera.getWidth());
        Debug.d("Scrollable screenRatioY: " + pCamera.getSurfaceHeight()/pCamera.getHeight());
        print_debug = false;
    }
    GLES20.glScissor((int)left, (int)bottom, (int)width, (int)height);
    //        Math.round(((clipX + point.x)) * screenRatioX),
    //        Math.round((cameraH - ((clipY + point.y) + clipH)) * screenRatioY),
    //        Math.round(clipW * screenRatioX),
    //        Math.round(clipH * screenRatioY));

}
 
開發者ID:Linguaculturalists,項目名稱:Phoenicia,代碼行數:36,代碼來源:Scrollable.java

示例2: clipToProgress

import org.andengine.engine.camera.ZoomCamera; //導入依賴的package包/類
private void clipToProgress(GLState pGLState, Camera pCamera) {
    final float zoom = ((ZoomCamera)pCamera).getZoomFactor();
    final float screenRatioX = pCamera.getSurfaceWidth()/pCamera.getWidth();
    final float screenRatioY = pCamera.getSurfaceHeight()/pCamera.getHeight();
    final float left = (this.mX - (this.mWidth/2)) * screenRatioX / zoom;
    final float bottom = (this.mY - (this.mHeight/2)) * screenRatioY / zoom;
    final float width = (this.mWidth * screenRatioX / zoom) * this.progress;
    final float height = this.mHeight * screenRatioY / zoom;
    GLES20.glScissor((int) left, (int) bottom, (int) width, (int) height);
}
 
開發者ID:Linguaculturalists,項目名稱:Phoenicia,代碼行數:11,代碼來源:ProgressBar.java


注:本文中的org.andengine.engine.camera.ZoomCamera類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。