• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MathUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ETC1Texture

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
public ETC1Texture(final TextureManager pTextureManager, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener) throws IOException {
	super(pTextureManager, PixelFormat.RGB_565, pTextureOptions, pTextureStateListener);

	InputStream inputStream = null;
	try {
		inputStream = this.getInputStream();

		this.mETC1TextureHeader = new ETC1TextureHeader(StreamUtils.streamToBytes(inputStream, ETC1.ETC_PKM_HEADER_SIZE));

		if (BuildConfig.DEBUG) {
			if (!(MathUtils.isPowerOfTwo(this.mETC1TextureHeader.mWidth) && MathUtils.isPowerOfTwo(this.mETC1TextureHeader.mHeight))) {
				Debug.w("ETC1 textures with NPOT sizes can cause a crash on PowerVR GPUs!");
			}
		}
	} finally {
		StreamUtils.close(inputStream);
	}
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:19,代码来源:ETC1Texture.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: convertSceneTouchEventToSurfaceTouchEvent

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
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:ArturVasilov,项目名称:AndroidCourses,代码行数:19,代码来源:Camera.java


示例4: getBezierCurveLength

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
/**
 * Calculates the length of a Bézier curve by taking <code>pSamples</code> samples.
 *
 * @param pXs x-coordinates of the control points of the Bézier curve.
 * @param pYs y-coordinates of the control points of the Bézier curve.
 * @param pSamples the number of samples to take. The higher the more accurate.
 * @return
 */
public static final float getBezierCurveLength(final float[] pXs, final float[] pYs, final int pSamples) {
	float length = 0;
	final int n = pXs.length - 1;

	float lastX = pXs[0];
	float lastY = pYs[0];
	for (int k = 1; k <= LENGTH_SAMPLES_DEFAULT; k++) {
		final float t = (1f * k) / LENGTH_SAMPLES_DEFAULT;

		float x = 0;
		float y = 0;
		for (int i = 0; i <= n; i++) {
			final float bernstein = BezierCurveUtils.getBernsteinPolynomial(t, i, n);
			x += pXs[i] * bernstein;
			y += pYs[i] * bernstein;
		}

		length += MathUtils.distance(lastX, lastY, x, y);

		lastX = x;
		lastY = y;
	}

	return length;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:34,代码来源:BezierCurveUtils.java


示例5: LongMap

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
/**
 * Creates a new map with the specified initial capacity and load factor. This map will hold initialCapacity * loadFactor items
 * before growing the backing table.
 */
public LongMap (int initialCapacity, float loadFactor) {
	if (initialCapacity < 0) throw new IllegalArgumentException("initialCapacity must be >= 0: " + initialCapacity);
	if (capacity > 1 << 30) throw new IllegalArgumentException("initialCapacity is too large: " + initialCapacity);
	capacity = MathUtils.nextPowerOfTwo(initialCapacity);

	if (loadFactor <= 0) throw new IllegalArgumentException("loadFactor must be > 0: " + loadFactor);
	this.loadFactor = loadFactor;

	threshold = (int)(capacity * loadFactor);
	mask = capacity - 1;
	hashShift = 31 - Integer.numberOfTrailingZeros(capacity);
	stashCapacity = Math.max(3, (int)Math.ceil(Math.log(capacity)) + 1);
	pushIterations = Math.max(Math.min(capacity, 32), (int)Math.sqrt(capacity) / 4);

	keyTable = new long[capacity + stashCapacity];
	valueTable = (V[])new Object[keyTable.length];
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:22,代码来源:LongMap.java


示例6: 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


示例7: drawOrthogonal

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
/**
 * Call if this if the map is Orthogonal <br>
 * This is the original unmodified orthogonal render.
 * 
 * @param pGLState
 * @param pCamera
 */
private void drawOrthogonal(final GLState pGLState, final Camera pCamera) {
	final int tileColumns = this.mTileColumns;
	final int tileRows = this.mTileRows;
	final int tileWidth = this.mTMXTiledMap.getTileWidth();
	final int tileHeight = this.mTMXTiledMap.getTileHeight();

	final float scaledTileWidth = tileWidth * this.mScaleX;
	final float scaledTileHeight = tileHeight * this.mScaleY;

	final float[] cullingVertices = this.mCullingVertices;

	final float layerMinX = cullingVertices[SpriteBatch.VERTEX_INDEX_X];
	final float layerMinY = cullingVertices[SpriteBatch.VERTEX_INDEX_Y];

	final float cameraMinX = pCamera.getXMin();
	final float cameraMinY = pCamera.getYMin();
	final float cameraWidth = pCamera.getWidth();
	final float cameraHeight = pCamera.getHeight();

	/* Determine the area that is visible in the camera. */
	final float firstColumnRaw = (cameraMinX - layerMinX) / scaledTileWidth;
	final int firstColumn = MathUtils.bringToBounds(0, tileColumns - 1, (int) Math.floor(firstColumnRaw));
	final int lastColumn = MathUtils.bringToBounds(0, tileColumns - 1,
			(int) Math.ceil(firstColumnRaw + cameraWidth / scaledTileWidth));

	final float firstRowRaw = (cameraMinY - layerMinY) / scaledTileHeight;
	final int firstRow = MathUtils.bringToBounds(0, tileRows - 1, (int) Math.floor(firstRowRaw));
	final int lastRow = MathUtils.bringToBounds(0, tileRows - 1,
			(int) Math.floor(firstRowRaw + cameraHeight / scaledTileHeight));

	for (int row = firstRow; row <= lastRow; row++) {
		for (int column = firstColumn; column <= lastColumn; column++) {
			this.mSpriteBatchVertexBufferObject.draw(GLES20.GL_TRIANGLE_STRIP,
					this.getSpriteBatchIndex(column, row) * SpriteBatch.VERTICES_PER_SPRITE,
					SpriteBatch.VERTICES_PER_SPRITE);
		}
	}
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:46,代码来源:TMXLayer.java


示例8: clipForCamera

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
/**
  * Perform clipping using normal Scene coordinate transformations
  * @param pGLState
  * @param pCamera
  */
 private void clipForCamera(GLState pGLState, Camera pCamera) {
     final int surfaceHeight = pCamera.getSurfaceHeight();

/* In order to apply clipping, we need to determine the the axis aligned bounds in OpenGL coordinates. */

/* Determine clipping coordinates of each corner in surface coordinates. */
     final float[] lowerLeftSurfaceCoordinates = pCamera.getSurfaceCoordinatesFromSceneCoordinates(this.convertLocalCoordinatesToSceneCoordinates(0, 0, new float[2]));
     final int lowerLeftX = (int)Math.round(lowerLeftSurfaceCoordinates[Constants.VERTEX_INDEX_X]);
     final int lowerLeftY = surfaceHeight - (int)Math.round(lowerLeftSurfaceCoordinates[Constants.VERTEX_INDEX_Y]);

     final float[] upperLeftSurfaceCoordinates = pCamera.getSurfaceCoordinatesFromSceneCoordinates(this.convertLocalCoordinatesToSceneCoordinates(0, this.mHeight, new float[2]));
     final int upperLeftX = (int)Math.round(upperLeftSurfaceCoordinates[Constants.VERTEX_INDEX_X]);
     final int upperLeftY = surfaceHeight - (int)Math.round(upperLeftSurfaceCoordinates[Constants.VERTEX_INDEX_Y]);

     final float[] upperRightSurfaceCoordinates = pCamera.getSurfaceCoordinatesFromSceneCoordinates(this.convertLocalCoordinatesToSceneCoordinates(this.mWidth, this.mHeight, new float[2]));
     final int upperRightX = (int)Math.round(upperRightSurfaceCoordinates[Constants.VERTEX_INDEX_X]);
     final int upperRightY = surfaceHeight - (int)Math.round(upperRightSurfaceCoordinates[Constants.VERTEX_INDEX_Y]);

     final float[] lowerRightSurfaceCoordinates = pCamera.getSurfaceCoordinatesFromSceneCoordinates(this.convertLocalCoordinatesToSceneCoordinates(this.mWidth, 0, new float[2]));
     final int lowerRightX = (int)Math.round(lowerRightSurfaceCoordinates[Constants.VERTEX_INDEX_X]);
     final int lowerRightY = surfaceHeight - (int)Math.round(lowerRightSurfaceCoordinates[Constants.VERTEX_INDEX_Y]);

/* Determine minimum and maximum x clipping coordinates. */
     final int minClippingX = MathUtils.min(lowerLeftX, upperLeftX, upperRightX, lowerRightX);
     final int maxClippingX = MathUtils.max(lowerLeftX, upperLeftX, upperRightX, lowerRightX);

/* Determine minimum and maximum y clipping coordinates. */
     final int minClippingY = MathUtils.min(lowerLeftY, upperLeftY, upperRightY, lowerRightY);
     final int maxClippingY = MathUtils.max(lowerLeftY, upperLeftY, upperRightY, lowerRightY);

/* Determine clipping width and height. */
     final int clippingWidth = maxClippingX - minClippingX;
     final int clippingHeight = maxClippingY - minClippingY;
     //Debug.d("ClippingY: min="+minClippingY+", max="+maxClippingY);
     //Debug.d("clipForCamera: GLES20.glScissor("+minClippingX+", "+minClippingY+", "+clippingWidth+", "+clippingHeight+")");
     GLES20.glScissor(minClippingX, minClippingY, clippingWidth, clippingHeight);
 }
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:43,代码来源:Scrollable.java


示例9: applySceneToCameraSceneOffset

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
@Override
protected void applySceneToCameraSceneOffset(final float[] pSceneCoordinates) {
	final float zoomFactor = this.mZoomFactor;
	if(zoomFactor != 1) {
		MathUtils.scaleAroundCenter(pSceneCoordinates, zoomFactor, zoomFactor, this.getCenterX(), this.getCenterY()); // TODO Use a Transformation object instead!?!
	}

	super.applySceneToCameraSceneOffset(pSceneCoordinates);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:10,代码来源:ZoomCamera.java


示例10: LevelStatsDBConnector

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
public LevelStatsDBConnector(final Context pContext, final String pSecret, final String pSubmitURL) {
	this.mSecret = pSecret;
	this.mSubmitURL = pSubmitURL;

	final SharedPreferences simplePreferences = SimplePreferences.getInstance(pContext);
	final int playerID = simplePreferences.getInt(PREFERENCES_LEVELSTATSDBCONNECTOR_PLAYERID_ID, -1);
	if(playerID != -1) {
		this.mPlayerID = playerID;
	} else {
		this.mPlayerID = MathUtils.random(1000000000, Integer.MAX_VALUE);
		SimplePreferences.getEditorInstance(pContext).putInt(PREFERENCES_LEVELSTATSDBCONNECTOR_PLAYERID_ID, this.mPlayerID).commit();
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:14,代码来源:LevelStatsDBConnector.java


示例11: 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:mediamonks,项目名称:tilt-game-android,代码行数:13,代码来源:Camera.java


示例12: getRandomValueC

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
protected float getRandomValueC() {
	if (this.mMinValueC == this.mMaxValueC) {
		return this.mMaxValueC;
	} else {
		return MathUtils.random(this.mMinValueC, this.mMaxValueC);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:8,代码来源:BaseTripleValueParticleInitializer.java


示例13: updateControlKnob

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
private void updateControlKnob(final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
	final Sprite controlBase = this.mControlBase;

	final float relativeX = (MathUtils.bringToBounds(0, controlBase.getWidth(), pTouchAreaLocalX) / controlBase.getWidth()) - 0.5f;
	final float relativeY = (MathUtils.bringToBounds(0, controlBase.getHeight(), pTouchAreaLocalY) / controlBase.getHeight()) - 0.5f;

	this.onUpdateControlKnob(relativeX, relativeY);
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:9,代码来源:BaseOnScreenControl.java


示例14: updateControlKnob

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
private void updateControlKnob(final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
	final Sprite controlBase = this.mControlBase;

	final float relativeX = MathUtils.bringToBounds(0, controlBase.getWidth(), pTouchAreaLocalX) / controlBase.getWidth() - 0.5f;
	final float relativeY = MathUtils.bringToBounds(0, controlBase.getHeight(), pTouchAreaLocalY) / controlBase.getHeight() - 0.5f;

	this.onUpdateControlKnob(relativeX, relativeY);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:9,代码来源:BaseOnScreenControl.java


示例15: applySceneToCameraSceneOffset

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
@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:ArturVasilov,项目名称:AndroidCourses,代码行数:15,代码来源:ZoomCamera.java


示例16: unapplySceneToCameraSceneOffset

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


示例17: writeTextureToHardware

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
@Override
protected void writeTextureToHardware(final GLState pGLState) throws IOException {
	final Config bitmapConfig = this.mBitmapTextureFormat.getBitmapConfig();
	final Bitmap bitmap = this.onGetBitmap(bitmapConfig);

	if (bitmap == null) {
		throw new NullBitmapException("Caused by: '" + this.toString() + "'.");
	}

	final boolean useDefaultAlignment = MathUtils.isPowerOfTwo(bitmap.getWidth()) && MathUtils.isPowerOfTwo(bitmap.getHeight()) && (this.mPixelFormat == PixelFormat.RGBA_8888);
	if (!useDefaultAlignment) {
		/* Adjust unpack alignment. */
		GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
	}

	final boolean preMultipyAlpha = this.mTextureOptions.mPreMultiplyAlpha;
	if (preMultipyAlpha) {
		GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
	} else {
		pGLState.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0, this.mPixelFormat);
	}

	if (!useDefaultAlignment) {
		/* Restore default unpack alignment. */
		GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, GLState.GL_UNPACK_ALIGNMENT_DEFAULT);
	}

	bitmap.recycle();
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:30,代码来源:BitmapTexture.java


示例18: unapplyCameraSceneRotation

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
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]);
	}
}
 
开发者ID:mediamonks,项目名称:tilt-game-android,代码行数:13,代码来源:Camera.java


示例19: unapplySceneRotation

import org.andengine.util.math.MathUtils; //导入依赖的package包/类
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]);
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:13,代码来源:Camera.java


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AfterScenario类代码示例发布时间:2022-05-22
下一篇:
Java SqlMapGenerator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap