当前位置: 首页>>代码示例>>Java>>正文


Java Constants.VERTEX_INDEX_Y属性代码示例

本文整理汇总了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;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:17,代码来源:Dialog.java

示例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);
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:20,代码来源:EntityCollisionChecker.java

示例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]);
	}
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:18,代码来源:Camera.java

示例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;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:22,代码来源:Camera.java

示例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);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:26,代码来源:Camera.java

示例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;
    }
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:32,代码来源:Scrollable.java

示例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;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:9,代码来源:Entity.java

示例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;
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:11,代码来源:Entity.java

示例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]);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:14,代码来源:ZoomCamera.java

示例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]);
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:14,代码来源:ZoomCamera.java

示例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;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:Camera.java

示例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]);
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:12,代码来源:Camera.java

示例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]);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:Camera.java

示例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;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:11,代码来源:Entity.java

示例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);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:14,代码来源:ZoomCamera.java


注:本文中的org.andengine.util.Constants.VERTEX_INDEX_Y属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。