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


Java MathUtils.rotateAroundCenter方法代码示例

本文整理汇总了Java中org.andengine.util.math.MathUtils.rotateAroundCenter方法的典型用法代码示例。如果您正苦于以下问题:Java MathUtils.rotateAroundCenter方法的具体用法?Java MathUtils.rotateAroundCenter怎么用?Java MathUtils.rotateAroundCenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.andengine.util.math.MathUtils的用法示例。


在下文中一共展示了MathUtils.rotateAroundCenter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSceneCoordinatesFromSurfaceCoordinates

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
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:mediamonks,项目名称:tilt-game-android,代码行数:23,代码来源:Camera.java

示例2: convertSurfaceTouchEventToSceneTouchEvent

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
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,代码行数:27,代码来源:Camera.java

示例3: convertSurfaceToSceneTouchEvent

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
public void convertSurfaceToSceneTouchEvent(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 = surfaceTouchEventY / pSurfaceHeight;
	} else if(rotation == 180) {
		relativeX = 1 - (surfaceTouchEventX / pSurfaceWidth);
		relativeY = 1 - (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);

		relativeX = Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X] / pSurfaceWidth;
		relativeY = Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y] / pSurfaceHeight;
	}

	this.convertAxisAlignedSurfaceToSceneTouchEvent(pSurfaceTouchEvent, relativeX, relativeY);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:27,代码来源:Camera.java

示例4: applyCameraSceneRotation

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
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.getCameraSceneWidth() * 0.5f, this.getCameraSceneHeight() * 0.5f); // 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,代码行数:13,代码来源:Camera.java

示例5: applySceneRotation

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
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,代码行数:13,代码来源:Camera.java

示例6: fillVertices

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private static void fillVertices(final Camera pCamera, final float[] pVertices) {
	pVertices[0 + Constants.VERTEX_INDEX_X] = pCamera.getXMin();
	pVertices[0 + Constants.VERTEX_INDEX_Y] = pCamera.getYMin();

	pVertices[2 + Constants.VERTEX_INDEX_X] = pCamera.getXMax();
	pVertices[2 + Constants.VERTEX_INDEX_Y] = pCamera.getYMin();

	pVertices[4 + Constants.VERTEX_INDEX_X] = pCamera.getXMax();
	pVertices[4 + Constants.VERTEX_INDEX_Y] = pCamera.getYMax();

	pVertices[6 + Constants.VERTEX_INDEX_X] = pCamera.getXMin();
	pVertices[6 + Constants.VERTEX_INDEX_Y] = pCamera.getYMax();

	MathUtils.rotateAroundCenter(pVertices, pCamera.getRotation(), pCamera.getCenterX(), pCamera.getCenterY());
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:16,代码来源:EntityCollisionChecker.java

示例7: applyCameraSceneRotation

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
private void applyCameraSceneRotation(final float[] pSceneCoordinates) {
	final float cameraSceneRotation = this.mCameraSceneRotation;

	if (cameraSceneRotation != 0) {
		MathUtils.rotateAroundCenter(pSceneCoordinates, cameraSceneRotation, this.getCameraSceneWidth() * 0.5f, this.getCameraSceneHeight() * 0.5f); // TODO Use a Transformation object instead!?!
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:8,代码来源:Camera.java

示例8: applySceneRotation

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
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());

		pCameraSceneTouchEvent.set(Camera.VERTICES_TMP[Constants.VERTEX_INDEX_X], Camera.VERTICES_TMP[Constants.VERTEX_INDEX_Y]);
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:12,代码来源:Camera.java

示例9: applyCameraSceneRotation

import org.andengine.util.math.MathUtils; //导入方法依赖的package包/类
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,代码行数:13,代码来源:Camera.java


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