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


Java Camera.getYMin方法代码示例

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


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

示例1: drawOrthogonal

import org.andengine.engine.camera.Camera; //导入方法依赖的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

示例2: drawIsometricCullingLoop

import org.andengine.engine.camera.Camera; //导入方法依赖的package包/类
/**
 * This loops through all the tiles and checks if the centre location of the
 * tile is within the screen space. <br>
 * It doesn't loop through the TMXTile Arrays, instead it calculates the
 * tile centre using maths. This is not the most efficient way to draw, but
 * FPS is okish. <br>
 * This calculates the tile location
 * 
 * @param pGLState
 * @param pCamera
 */
public void drawIsometricCullingLoop(final GLState pGLState, final Camera pCamera) {
	final float cameraMinX = pCamera.getXMin();
	final float cameraMinY = pCamera.getYMin();
	final float cameraWidth = pCamera.getWidth();
	final float cameraHeight = pCamera.getHeight();
	final int tileColumns = this.mTileColumns;
	final int tileRows = this.mTileRows;

	final int yWholeMax = (int) (cameraMinY + cameraHeight);
	final int yWholeMin = (int) cameraMinY;
	final int xWholeMax = (int) (cameraMinX + cameraWidth);
	final int xWholeMin = (int) cameraMinX;

	for (int j = 0; j < tileRows; j++) {
		for (int i = 0; i < tileColumns; i++) {
			float[] isoCen = this.getIsoTileCentreAt(i, j);
			if (isoCen[1] < yWholeMax && isoCen[1] > yWholeMin) {
				if (isoCen[0] < xWholeMax && isoCen[0] > xWholeMin) {
					this.mSpriteBatchVertexBufferObject.draw(GLES20.GL_TRIANGLE_STRIP,
							this.getSpriteBatchIndex(i, j) * SpriteBatch.VERTICES_PER_SPRITE,
							SpriteBatch.VERTICES_PER_SPRITE);
				}
			}
		}
	}
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:38,代码来源:TMXLayer.java

示例3: drawIsometricCullingLoopExtra

import org.andengine.engine.camera.Camera; //导入方法依赖的package包/类
/**
 * This loops through all the tiles and checks if the centre location of the
 * tile is within or partly in the screen space. <br>
 * It doesn't loop through the TMXTile Arrays, instead it calculates the
 * tile centre using maths. <br>
 * This is not the most efficient way to draw, but FPS is okish.
 * 
 * @param pGLState
 * @param pCamera
 */
public void drawIsometricCullingLoopExtra(final GLState pGLState, final Camera pCamera) {
	final float cameraMinX = pCamera.getXMin();
	final float cameraMinY = pCamera.getYMin();
	final float cameraWidth = pCamera.getWidth();
	final float cameraHeight = pCamera.getHeight();
	final int tileColumns = this.mTileColumns;
	final int tileRows = this.mTileRows;
	final float tileHeight = this.mTMXTiledMap.getTileHeight();
	final float tileWidth = this.mTMXTiledMap.getTileWidth();

	final int yWholeMax = (int) (cameraMinY + cameraHeight);
	final int yWholeMin = (int) cameraMinY;
	final int yPartialMax = (int) (yWholeMax + tileHeight);
	final int yPartialMin = (int) (yWholeMin - tileHeight);

	final int xWholeMax = (int) (cameraMinX + cameraWidth);
	final int xWholeMin = (int) cameraMinX;
	final int xPartialMax = (int) (xWholeMax + tileWidth);
	final int xPartialMin = (int) (xWholeMin - tileWidth);

	final float[] cullingVertices = this.mCullingVertices;
	for (int j = 0; j < tileRows; j++) {
		for (int i = 0; i < tileColumns; i++) {
			float[] isoCen = this.getIsoTileCentreAt(i, j);
			if (isoCen[1] < yWholeMax && isoCen[1] > yWholeMin || isoCen[1] < yPartialMax
					&& isoCen[1] > yPartialMin) {
				if (isoCen[0] < xWholeMax && isoCen[0] > xWholeMin || isoCen[0] < xPartialMax
						&& isoCen[0] > xPartialMin) {
					this.mSpriteBatchVertexBufferObject.draw(GLES20.GL_TRIANGLE_STRIP,
							this.getSpriteBatchIndex(i, j) * SpriteBatch.VERTICES_PER_SPRITE,
							SpriteBatch.VERTICES_PER_SPRITE);
				}
			}
		}
	}
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:47,代码来源:TMXLayer.java

示例4: fillVertices

import org.andengine.engine.camera.Camera; //导入方法依赖的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

示例5: drawIsometricCullingTiledSource

import org.andengine.engine.camera.Camera; //导入方法依赖的package包/类
/**
 * Culling method taken from method paintLayer in IsoMapView.java from Tiled
 * 0.7.2 source code. <br>
 * Not to dissimilar to the function drawTileLayer in isometricrenderer.cpp
 * from Tiled 0.8.0 source code. <br>
 * Slight performance gain and draws tiles in a different order than the
 * others, this does not appear to cause any problems. The tiles original Z
 * order are unaffected. <br>
 * Copyright 2009-2011, Thorbjorn Lindeijer <[email protected]>
 * 
 * @param pGLState
 * @param pCamera
 */
public void drawIsometricCullingTiledSource(final GLState pGLState, final Camera pCamera) {
	/*
	 * Copyright 2009-2011, Thorbjorn Lindeijer <[email protected]>
	 * <br><a href="http://sourceforge.net/projects/tiled/files/Tiled/0.7.2/tiled-0.7.2-src.zip/">Tiled 0.7.2 source code zip</a>
	 * <br><a href="https://github.com/bjorn/tiled/blob/master/src/libtiled/isometricrenderer.cpp">Tiled 0.8.0 source code - isometricrenderer.cpp on Github</a>
	 * Copied across and changed slightly by Paul Robinson.
	 * Changes being using an int array rather than Point object, 
	 * The original Tiled Java source code used Point objects.
	 */
	final int tileWidth = this.mTMXTiledMap.getTileWidth();
	final int tileHeight = this.mTMXTiledMap.getTileHeight();
	/*
	 *  Since using AnchorCenter camera Y min is bottom left, so add the camera height
	 */
	final float cameraMinX = pCamera.getXMin();
	final float cameraMinY = pCamera.getYMin() + pCamera.getHeight();
	final float cameraWidth = pCamera.getWidth();
	final float cameraHeight = pCamera.getHeight();
	
	final float pY = cameraMinY < 0 ? Math.abs(cameraMinY) : 0 - cameraMinY;
	int[] rowItr = this.screenToTileCoords(cameraMinX, pY);
	rowItr[0]--;
	
	/*
	 *  Determine area to draw from clipping rectangle
	 *  Row calculation has changed
	 */
	int columns = (int) (cameraWidth / tileWidth + 3);
	int rows = (int) (cameraHeight / (tileHeight/2) + 4);
	// Draw this map layer
	for (int y = 0; y < rows; y++) {
		int[] columnItr = { rowItr[0], rowItr[1] };
		for (int x = 0; x < columns; x++) {
			if (columnItr[0] >= 0 && columnItr[0] < this.mTileColumns) {
				if (columnItr[1] >= 0 && columnItr[1] < this.mTileRows) {
					this.mSpriteBatchVertexBufferObject.draw(GLES20.GL_TRIANGLE_STRIP,
							this.getSpriteBatchIndex(columnItr[0], columnItr[1]) * SpriteBatch.VERTICES_PER_SPRITE,
							SpriteBatch.VERTICES_PER_SPRITE);
				}
			}
			// Advance to the next tile
			columnItr[0]++;
			columnItr[1]--;
		}
		if ((y & 1) > 0) {
			rowItr[0]++;
		} else {
			rowItr[1]++;
		}
	}
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:65,代码来源:TMXLayer.java


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