本文整理汇总了Java中org.andengine.util.Constants.VERTEX_INDEX_Y属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.VERTEX_INDEX_Y属性的具体用法?Java Constants.VERTEX_INDEX_Y怎么用?Java Constants.VERTEX_INDEX_Y使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.andengine.util.Constants
的用法示例。
在下文中一共展示了Constants.VERTEX_INDEX_Y属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onAreaTouched
@Override
public boolean onAreaTouched(TouchEvent touchEvent, float localTouchX, float localTouchY) {
final float sceneTouchX = touchEvent.getX();
final float sceneTouchY = touchEvent.getY();
for (ITouchArea area: this.touchAreas) {
if (area.contains(sceneTouchX, sceneTouchY)) {
final float[] areaTouchCoordinates = area.convertSceneCoordinatesToLocalCoordinates(sceneTouchX, sceneTouchY);
final float areaTouchX = areaTouchCoordinates[Constants.VERTEX_INDEX_X];
final float areaTouchY = areaTouchCoordinates[Constants.VERTEX_INDEX_Y];
final Boolean handled = area.onAreaTouched(touchEvent, areaTouchX, areaTouchY);
if (handled != null && handled) {
return true;
}
}
}
return true;
}
示例2: fillVertices
public static void fillVertices(final float pLocalX, final float pLocalY, final float pLocalWidth, final float pLocalHeight, final Transformation pLocalToSceneTransformation, final float[] pVertices) {
final float localXMin = pLocalX;
final float localXMax = pLocalX + pLocalWidth;
final float localYMin = pLocalY;
final float localYMax = pLocalY + pLocalHeight;
pVertices[0 + Constants.VERTEX_INDEX_X] = localXMin;
pVertices[0 + Constants.VERTEX_INDEX_Y] = localYMin;
pVertices[2 + Constants.VERTEX_INDEX_X] = localXMax;
pVertices[2 + Constants.VERTEX_INDEX_Y] = localYMin;
pVertices[4 + Constants.VERTEX_INDEX_X] = localXMax;
pVertices[4 + Constants.VERTEX_INDEX_Y] = localYMax;
pVertices[6 + Constants.VERTEX_INDEX_X] = localXMin;
pVertices[6 + Constants.VERTEX_INDEX_Y] = localYMax;
pLocalToSceneTransformation.transform(pVertices);
}
示例3: convertSceneTouchEventToSurfaceTouchEvent
public void convertSceneTouchEventToSurfaceTouchEvent(final TouchEvent pSceneTouchEvent, final int pSurfaceWidth, final int pSurfaceHeight) {
this.convertAxisAlignedSceneToSurfaceTouchEvent(pSceneTouchEvent, pSurfaceWidth, pSurfaceHeight);
final float rotation = this.mRotation;
if (rotation == 0) {
/* Nothing. */
} else if (rotation == 180) {
pSceneTouchEvent.setY(pSurfaceHeight - pSceneTouchEvent.getY());
pSceneTouchEvent.setX(pSurfaceWidth - pSceneTouchEvent.getX());
} else {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pSceneTouchEvent.getY();
MathUtils.revertRotateAroundCenter(Camera.VERTICES_TMP, -rotation, pSurfaceWidth >> 1, pSurfaceHeight >> 1); // TODO Use a Transformation object instead!?!
pSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例4: getSceneCoordinatesFromSurfaceCoordinates
public float[] getSceneCoordinatesFromSurfaceCoordinates(final float[] pSurfaceCoordinates, final int pSurfaceWidth, final int pSurfaceHeight) {
final float relativeX;
final float relativeY;
final float rotation = this.mRotation;
if (rotation == 0) {
relativeX = pSurfaceCoordinates[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
relativeY = 1 - (pSurfaceCoordinates[Constants.VERTEX_INDEX_Y] / pSurfaceHeight);
} else if (rotation == 180) {
relativeX = 1 - (pSurfaceCoordinates[Constants.VERTEX_INDEX_X] / pSurfaceWidth);
relativeY = pSurfaceCoordinates[Constants.VERTEX_INDEX_Y] / pSurfaceHeight;
} else {
MathUtils.rotateAroundCenter(pSurfaceCoordinates, rotation, pSurfaceWidth >> 1, pSurfaceHeight >> 1); // TODO Use a Transformation object instead!?!
relativeX = pSurfaceCoordinates[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
relativeY = 1 - (pSurfaceCoordinates[Constants.VERTEX_INDEX_Y] / pSurfaceHeight);
}
this.convertAxisAlignedSurfaceCoordinatesToSceneCoordinates(pSurfaceCoordinates, relativeX, relativeY);
return pSurfaceCoordinates;
}
示例5: convertSurfaceTouchEventToSceneTouchEvent
public void convertSurfaceTouchEventToSceneTouchEvent(final TouchEvent pSurfaceTouchEvent, final int pSurfaceWidth, final int pSurfaceHeight) {
final float relativeX;
final float relativeY;
final float surfaceTouchEventX = pSurfaceTouchEvent.getX();
final float surfaceTouchEventY = pSurfaceTouchEvent.getY();
final float rotation = this.mRotation;
if (rotation == 0) {
relativeX = surfaceTouchEventX / pSurfaceWidth;
relativeY = 1 - (surfaceTouchEventY / pSurfaceHeight);
} else if (rotation == 180) {
relativeX = 1 - (surfaceTouchEventX / pSurfaceWidth);
relativeY = surfaceTouchEventY / pSurfaceHeight;
} else {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = surfaceTouchEventX;
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = surfaceTouchEventY;
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, rotation, pSurfaceWidth >> 1, pSurfaceHeight >> 1); // TODO Use a Transformation object instead!?!
relativeX = Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
relativeY = 1 - (Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] / pSurfaceHeight);
}
this.convertAxisAlignedSurfaceTouchEventToSceneTouchEvent(pSurfaceTouchEvent, relativeX, relativeY);
}
示例6: onAreaTouched
@Override
public boolean onAreaTouched(final TouchEvent pTouchEvent, final float touchX, final float touchY) {
boolean handled = this.scrollDetector.onManagedTouchEvent(pTouchEvent);
//Debug.d("scrollDetector: "+handled);
if (this.touch_was_scroll || this.is_scrolling) {
//Debug.d("Touch was scroll ");
this.touch_was_scroll = false;
this.scroll_last = System.currentTimeMillis();
return true;
} else {
//Debug.d("Touch was not scroll ");
this.touch_was_scroll = false;
long delay = System.currentTimeMillis() - this.scroll_last;
if (delay < this.scroll_timeout) {
return false;
}
final float sceneTouchX = pTouchEvent.getX();
final float sceneTouchY = pTouchEvent.getY();
for (ITouchArea area: this.touchAreas) {
if (area.contains(sceneTouchX, sceneTouchY)) {
final float[] areaTouchCoordinates = area.convertSceneCoordinatesToLocalCoordinates(sceneTouchX, sceneTouchY);
final float areaTouchX = areaTouchCoordinates[Constants.VERTEX_INDEX_X];
final float areaTouchY = areaTouchCoordinates[Constants.VERTEX_INDEX_Y];
final Boolean ishandled = area.onAreaTouched(pTouchEvent, areaTouchX, areaTouchY);
if (ishandled != null && ishandled) {
return true;
}
}
}
return false;
}
}
示例7: convertParentCoordinatesToLocalCoordinates
@Override
public float[] convertParentCoordinatesToLocalCoordinates(final float pX, final float pY, final float[] pReuse) {
pReuse[Constants.VERTEX_INDEX_X] = pX;
pReuse[Constants.VERTEX_INDEX_Y] = pY;
this.getParentToLocalTransformation().transform(pReuse);
return pReuse;
}
示例8: convertLocalCoordinatesToParentCoordinates
@Override
public float[] convertLocalCoordinatesToParentCoordinates(final float pX, final float pY, final float[] pReuse) {
final Transformation localToParentTransformation = this.getLocalToParentTransformation();
pReuse[Constants.VERTEX_INDEX_X] = pX;
pReuse[Constants.VERTEX_INDEX_Y] = pY;
localToParentTransformation.transform(pReuse);
return pReuse;
}
示例9: unapplySceneToCameraSceneOffset
@Override
protected void unapplySceneToCameraSceneOffset(final TouchEvent pCameraSceneTouchEvent) {
super.unapplySceneToCameraSceneOffset(pCameraSceneTouchEvent);
final float zoomFactor = this.mZoomFactor;
if (zoomFactor != 1) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pCameraSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pCameraSceneTouchEvent.getY();
MathUtils.revertScaleAroundCenter(Camera.VERTICES_TMP, zoomFactor, zoomFactor, this.getCenterX(), this.getCenterY()); // TODO Use a Transformation object instead!?!
pCameraSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例10: unapplySceneToCameraSceneOffset
@Override
protected void unapplySceneToCameraSceneOffset(final TouchEvent pCameraSceneTouchEvent) {
super.unapplySceneToCameraSceneOffset(pCameraSceneTouchEvent);
final float zoomFactor = this.mZoomFactor;
if(zoomFactor != 1) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pCameraSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pCameraSceneTouchEvent.getY();
MathUtils.revertScaleAroundCenter(Camera.VERTICES_TMP, zoomFactor, zoomFactor, this.getCenterX(), this.getCenterY()); // TODO Use a Transformation object instead!?!
pCameraSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例11: convertAxisAlignedSceneCoordinatesToSurfaceCoordinates
private void convertAxisAlignedSceneCoordinatesToSurfaceCoordinates(final float[] pSceneCoordinates, final int pSurfaceWidth, final int pSurfaceHeight) {
final float xMin = this.getXMin();
final float xMax = this.getXMax();
final float yMin = this.getYMin();
final float yMax = this.getYMax();
final float relativeX = (pSceneCoordinates[Constants.VERTEX_INDEX_X] - xMin) / (xMax - xMin);
final float relativeY = 1 - (pSceneCoordinates[Constants.VERTEX_INDEX_Y] - yMin) / (yMax - yMin);
pSceneCoordinates[Constants.VERTEX_INDEX_X] = relativeX * pSurfaceWidth;
pSceneCoordinates[Constants.VERTEX_INDEX_Y] = relativeY * pSurfaceHeight;
}
示例12: applyCameraSceneRotation
private void applyCameraSceneRotation(final TouchEvent pSceneTouchEvent) {
final float cameraSceneRotation = -this.mCameraSceneRotation;
if(cameraSceneRotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pSceneTouchEvent.getY();
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, cameraSceneRotation, (this.mXMax - this.mXMin) * 0.5f, (this.mYMax - this.mYMin) * 0.5f);
pSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例13: applySceneRotation
private void applySceneRotation(final TouchEvent pCameraSceneTouchEvent) {
final float rotation = this.mRotation;
if (rotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pCameraSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pCameraSceneTouchEvent.getY();
MathUtils.rotateAroundCenter(Camera.VERTICES_TMP, rotation, this.getCenterX(), this.getCenterY()); // TODO Use a Transformation object instead!?!
pCameraSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
}
示例14: convertLocalToSceneCoordinates
@Override
public float[] convertLocalToSceneCoordinates(final float pX, final float pY, final float[] pReuse) {
final Transformation localToSceneTransformation = this.getLocalToSceneTransformation();
pReuse[Constants.VERTEX_INDEX_X] = pX;
pReuse[Constants.VERTEX_INDEX_Y] = pY;
localToSceneTransformation.transform(pReuse);
return pReuse;
}
示例15: applySceneToCameraSceneOffset
@Override
protected void applySceneToCameraSceneOffset(final TouchEvent pSceneTouchEvent) {
final float zoomFactor = this.mZoomFactor;
if(zoomFactor != 1) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pSceneTouchEvent.getY();
MathUtils.scaleAroundCenter(Camera.VERTICES_TMP, zoomFactor, zoomFactor, this.getCenterX(), this.getCenterY()); // TODO Use a Transformation object instead!?!
pSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
}
super.applySceneToCameraSceneOffset(pSceneTouchEvent);
}