本文整理汇总了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));
}
示例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);
}