本文整理汇总了Java中org.andengine.util.Constants.VERTEX_INDEX_X属性的典型用法代码示例。如果您正苦于以下问题:Java Constants.VERTEX_INDEX_X属性的具体用法?Java Constants.VERTEX_INDEX_X怎么用?Java Constants.VERTEX_INDEX_X使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.andengine.util.Constants
的用法示例。
在下文中一共展示了Constants.VERTEX_INDEX_X属性的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: 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;
}
}
示例4: convertSceneToLocalCoordinates
@Override
public float[] convertSceneToLocalCoordinates(final float pX, final float pY, final float[] pReuse) {
pReuse[Constants.VERTEX_INDEX_X] = pX;
pReuse[Constants.VERTEX_INDEX_Y] = pY;
this.getSceneToLocalTransformation().transform(pReuse);
return pReuse;
}
示例5: convertLocalCoordinatesToSceneCoordinates
@Override
public float[] convertLocalCoordinatesToSceneCoordinates(final float[] pCoordinates, final float[] pReuse) {
final Transformation localToSceneTransformation = this.getLocalToSceneTransformation();
pReuse[Constants.VERTEX_INDEX_X] = pCoordinates[Constants.VERTEX_INDEX_X];
pReuse[Constants.VERTEX_INDEX_Y] = pCoordinates[Constants.VERTEX_INDEX_Y];
localToSceneTransformation.transform(pReuse);
return pReuse;
}
示例6: convertLocalCoordinatesToParentCoordinates
@Override
public float[] convertLocalCoordinatesToParentCoordinates(final float[] pCoordinates, final float[] pReuse) {
final Transformation localToParentTransformation = this.getLocalToParentTransformation();
pReuse[Constants.VERTEX_INDEX_X] = pCoordinates[Constants.VERTEX_INDEX_X];
pReuse[Constants.VERTEX_INDEX_Y] = pCoordinates[Constants.VERTEX_INDEX_Y];
localToParentTransformation.transform(pReuse);
return pReuse;
}
示例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: spawnParticle
private void spawnParticle() {
if (this.mParticlesAlive < this.mParticlesMaximum) {
Particle<T> particle = this.mParticles[this.mParticlesAlive];
/* New particle needs to be created. */
this.mParticleEmitter.getPositionOffset(ParticleSystem.POSITION_OFFSET_CONTAINER);
final float x = ParticleSystem.POSITION_OFFSET_CONTAINER[Constants.VERTEX_INDEX_X];
final float y = ParticleSystem.POSITION_OFFSET_CONTAINER[Constants.VERTEX_INDEX_Y];
if (particle == null) {
particle = new Particle<T>();
this.mParticles[this.mParticlesAlive] = particle;
particle.setEntity(this.mEntityFactory.create(x, y));
} else {
particle.reset();
particle.getEntity().setPosition(x, y);
}
/* Apply particle initializers. */
{
for (int i = this.mParticleInitializers.size() - 1; i >= 0; i--) {
this.mParticleInitializers.get(i).onInitializeParticle(particle);
}
for (int i = this.mParticleModifiers.size() - 1; i >= 0; i--) {
this.mParticleModifiers.get(i).onInitializeParticle(particle);
}
}
this.mParticlesAlive++;
}
}
示例9: convertAxisAlignedSurfaceCoordinatesToSceneCoordinates
private void convertAxisAlignedSurfaceCoordinatesToSceneCoordinates(final float[] pSurfaceCoordinates, final float pRelativeX, final float pRelativeY) {
final float xMin = this.getXMin();
final float xMax = this.getXMax();
final float yMin = this.getYMin();
final float yMax = this.getYMax();
final float x = xMin + pRelativeX * (xMax - xMin);
final float y = yMin + pRelativeY * (yMax - yMin);
pSurfaceCoordinates[Constants.VERTEX_INDEX_X] = x;
pSurfaceCoordinates[Constants.VERTEX_INDEX_Y] = y;
}
示例10: unapplyCameraSceneRotation
private void unapplyCameraSceneRotation(final TouchEvent pCameraSceneTouchEvent) {
final float cameraSceneRotation = this.mCameraSceneRotation;
if (cameraSceneRotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pCameraSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pCameraSceneTouchEvent.getY();
MathUtils.revertRotateAroundCenter(Camera.VERTICES_TMP, cameraSceneRotation, this.getCameraSceneWidth() * 0.5f, this.getCameraSceneHeight() * 0.5f); // 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: spawnParticle
private void spawnParticle() {
if(this.mParticlesAlive < this.mParticlesMaximum){
Particle<T> particle = this.mParticles[this.mParticlesAlive];
/* New particle needs to be created. */
this.mParticleEmitter.getPositionOffset(ParticleSystem.POSITION_OFFSET_CONTAINER);
final float x = ParticleSystem.POSITION_OFFSET_CONTAINER[Constants.VERTEX_INDEX_X];
final float y = ParticleSystem.POSITION_OFFSET_CONTAINER[Constants.VERTEX_INDEX_Y];
if(particle == null) {
particle = new Particle<T>();
this.mParticles[this.mParticlesAlive] = particle;
particle.setEntity(this.mEntityFactory.create(x, y));
} else {
particle.reset();
particle.getEntity().setPosition(x, y);
}
/* Apply particle initializers. */
{
for(int i = this.mParticleInitializers.size() - 1; i >= 0; i--) {
this.mParticleInitializers.get(i).onInitializeParticle(particle);
}
for(int i = this.mParticleModifiers.size() - 1; i >= 0; i--) {
this.mParticleModifiers.get(i).onInitializeParticle(particle);
}
}
this.mParticlesAlive++;
}
}
示例13: onAreaTouchEvent
private Boolean onAreaTouchEvent(final TouchEvent pSceneTouchEvent, final float sceneTouchEventX, final float sceneTouchEventY, final ITouchArea touchArea) {
final float[] touchAreaLocalCoordinates = touchArea.convertSceneCoordinatesToLocalCoordinates(sceneTouchEventX, sceneTouchEventY);
final float touchAreaLocalX = touchAreaLocalCoordinates[Constants.VERTEX_INDEX_X];
final float touchAreaLocalY = touchAreaLocalCoordinates[Constants.VERTEX_INDEX_Y];
final boolean handledSelf = touchArea.onAreaTouched(pSceneTouchEvent, touchAreaLocalX, touchAreaLocalY);
if (handledSelf) {
return Boolean.TRUE;
} else if (this.mOnAreaTouchListener != null) {
return this.mOnAreaTouchListener.onAreaTouched(pSceneTouchEvent, touchArea, touchAreaLocalX, touchAreaLocalY);
} else {
return null;
}
}
示例14: 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]);
}
}
示例15: unapplySceneRotation
private void unapplySceneRotation(final TouchEvent pSceneTouchEvent) {
final float rotation = this.mRotation;
if (rotation != 0) {
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] = pSceneTouchEvent.getX();
Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] = pSceneTouchEvent.getY();
MathUtils.revertRotateAroundCenter(Camera.VERTICES_TMP, rotation, 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]);
}
}