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


Java ITextureAtlasSource.getTextureWidth方法代码示例

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


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

示例1: createChildren

import org.andengine.opengl.texture.atlas.source.ITextureAtlasSource; //导入方法依赖的package包/类
private Node createChildren(final ITextureAtlasSource pTextureAtlasSource, final int pTextureWidth, final int pTextureHeight, final int pTextureAtlasSourceSpacing, final int pTextureAtlasSourcePadding, final int pDeltaWidth, final int pDeltaHeight) {
	final Rect rect = this.mRect;

	if (pDeltaWidth >= pDeltaHeight) {
		/* Split using a vertical axis. */
		this.mChildA = new Node(
				rect.getLeft(),
				rect.getTop(),
				pTextureAtlasSource.getTextureWidth() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding,
				rect.getHeight()
		);

		this.mChildB = new Node(
				rect.getLeft() + (pTextureAtlasSource.getTextureWidth() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding),
				rect.getTop(),
				rect.getWidth() - (pTextureAtlasSource.getTextureWidth() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding),
				rect.getHeight()
		);
	} else {
		/* Split using a horizontal axis. */
		this.mChildA = new Node(
				rect.getLeft(),
				rect.getTop(),
				rect.getWidth(),
				pTextureAtlasSource.getTextureHeight() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding
		);

		this.mChildB = new Node(
				rect.getLeft(),
				rect.getTop() + (pTextureAtlasSource.getTextureHeight() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding),
				rect.getWidth(),
				rect.getHeight() - (pTextureAtlasSource.getTextureHeight() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding)
		);
	}

	return this.mChildA.insert(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:38,代码来源:BlackPawnTextureAtlasBuilder.java

示例2: createChildren

import org.andengine.opengl.texture.atlas.source.ITextureAtlasSource; //导入方法依赖的package包/类
private Node createChildren(final ITextureAtlasSource pTextureAtlasSource, final int pTextureWidth, final int pTextureHeight, final int pTextureAtlasSourceSpacing, final int pTextureAtlasSourcePadding, final int pDeltaWidth, final int pDeltaHeight) {
	final Rect rect = this.mRect;

	if(pDeltaWidth >= pDeltaHeight) {
		/* Split using a vertical axis. */
		this.mChildA = new Node(
				rect.getLeft(),
				rect.getTop(),
				pTextureAtlasSource.getTextureWidth() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding,
				rect.getHeight()
		);

		this.mChildB = new Node(
				rect.getLeft() + (pTextureAtlasSource.getTextureWidth() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding),
				rect.getTop(),
				rect.getWidth() - (pTextureAtlasSource.getTextureWidth() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding),
				rect.getHeight()
		);
	} else {
		/* Split using a horizontal axis. */
		this.mChildA = new Node(
				rect.getLeft(),
				rect.getTop(),
				rect.getWidth(),
				pTextureAtlasSource.getTextureHeight() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding
		);

		this.mChildB = new Node(
				rect.getLeft(),
				rect.getTop() + (pTextureAtlasSource.getTextureHeight() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding),
				rect.getWidth(),
				rect.getHeight() - (pTextureAtlasSource.getTextureHeight() + pTextureAtlasSourceSpacing + 2 * pTextureAtlasSourcePadding)
		);
	}

	return this.mChildA.insert(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding);
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:38,代码来源:BlackPawnTextureAtlasBuilder.java

示例3: insert

import org.andengine.opengl.texture.atlas.source.ITextureAtlasSource; //导入方法依赖的package包/类
public Node insert(final ITextureAtlasSource pTextureAtlasSource, final int pTextureWidth, final int pTextureHeight, final int pTextureAtlasSourceSpacing, final int pTextureAtlasSourcePadding) throws IllegalArgumentException {
	if (this.mChildA != null && this.mChildB != null) {
		final Node newNode = this.mChildA.insert(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding);
		if (newNode != null) {
			return newNode;
		} else {
			return this.mChildB.insert(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding);
		}
	} else {
		if (this.mTextureAtlasSource != null) {
			return null;
		}

		final int textureSourceWidth = pTextureAtlasSource.getTextureWidth() + 2 * pTextureAtlasSourcePadding;
		final int textureSourceHeight = pTextureAtlasSource.getTextureHeight() + 2 * pTextureAtlasSourcePadding;

		final int rectWidth = this.mRect.getWidth();
		final int rectHeight = this.mRect.getHeight();

		if (textureSourceWidth > rectWidth || textureSourceHeight > rectHeight) {
			return null;
		}

		final int textureSourceWidthWithSpacing = textureSourceWidth + pTextureAtlasSourceSpacing;
		final int textureSourceHeightWithSpacing = textureSourceHeight + pTextureAtlasSourceSpacing;

		final int rectLeft = this.mRect.getLeft();
		final int rectTop = this.mRect.getTop();

		final boolean fitToBottomWithoutSpacing = textureSourceHeight == rectHeight && rectTop + textureSourceHeight == pTextureHeight;
		final boolean fitToRightWithoutSpacing = textureSourceWidth == rectWidth && rectLeft + textureSourceWidth == pTextureWidth;

		if (textureSourceWidthWithSpacing == rectWidth) {
			if (textureSourceHeightWithSpacing == rectHeight) { /* Normal case with padding. */
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if (fitToBottomWithoutSpacing) { /* Bottom edge of the BitmapTexture. */
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			}
		}

		if (fitToRightWithoutSpacing) { /* Right edge of the BitmapTexture. */
			if (textureSourceHeightWithSpacing == rectHeight) {
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if (fitToBottomWithoutSpacing) { /* Bottom edge of the BitmapTexture. */
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if (textureSourceHeightWithSpacing > rectHeight) {
				return null;
			} else {
				return this.createChildren(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding, rectWidth - textureSourceWidth, rectHeight - textureSourceHeightWithSpacing);
			}
		}

		if (fitToBottomWithoutSpacing) {
			if (textureSourceWidthWithSpacing == rectWidth) {
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if (textureSourceWidthWithSpacing > rectWidth) {
				return null;
			} else {
				return this.createChildren(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding, rectWidth - textureSourceWidthWithSpacing, rectHeight - textureSourceHeight);
			}
		} else if (textureSourceWidthWithSpacing > rectWidth || textureSourceHeightWithSpacing > rectHeight) {
			return null;
		} else {
			return this.createChildren(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding, rectWidth - textureSourceWidthWithSpacing, rectHeight - textureSourceHeightWithSpacing);
		}
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:73,代码来源:BlackPawnTextureAtlasBuilder.java

示例4: insert

import org.andengine.opengl.texture.atlas.source.ITextureAtlasSource; //导入方法依赖的package包/类
public Node insert(final ITextureAtlasSource pTextureAtlasSource, final int pTextureWidth, final int pTextureHeight, final int pTextureAtlasSourceSpacing, final int pTextureAtlasSourcePadding) throws IllegalArgumentException {
	if(this.mChildA != null && this.mChildB != null) {
		final Node newNode = this.mChildA.insert(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding);
		if(newNode != null){
			return newNode;
		} else {
			return this.mChildB.insert(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding);
		}
	} else {
		if(this.mTextureAtlasSource != null) {
			return null;
		}

		final int textureSourceWidth = pTextureAtlasSource.getTextureWidth() + 2 * pTextureAtlasSourcePadding;
		final int textureSourceHeight = pTextureAtlasSource.getTextureHeight() + 2 * pTextureAtlasSourcePadding;

		final int rectWidth = this.mRect.getWidth();
		final int rectHeight = this.mRect.getHeight();

		if(textureSourceWidth > rectWidth || textureSourceHeight > rectHeight) {
			return null;
		}

		final int textureSourceWidthWithSpacing = textureSourceWidth + pTextureAtlasSourceSpacing;
		final int textureSourceHeightWithSpacing = textureSourceHeight + pTextureAtlasSourceSpacing;

		final int rectLeft = this.mRect.getLeft();
		final int rectTop = this.mRect.getTop();

		final boolean fitToBottomWithoutSpacing = textureSourceHeight == rectHeight && rectTop + textureSourceHeight == pTextureHeight;
		final boolean fitToRightWithoutSpacing = textureSourceWidth == rectWidth && rectLeft + textureSourceWidth == pTextureWidth;

		if(textureSourceWidthWithSpacing == rectWidth){
			if(textureSourceHeightWithSpacing == rectHeight) { /* Normal case with padding. */
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if(fitToBottomWithoutSpacing) { /* Bottom edge of the BitmapTexture. */
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			}
		}

		if(fitToRightWithoutSpacing) { /* Right edge of the BitmapTexture. */
			if(textureSourceHeightWithSpacing == rectHeight) {
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if(fitToBottomWithoutSpacing) { /* Bottom edge of the BitmapTexture. */
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if(textureSourceHeightWithSpacing > rectHeight) {
				return null;
			} else {
				return this.createChildren(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding, rectWidth - textureSourceWidth, rectHeight - textureSourceHeightWithSpacing);
			}
		}

		if(fitToBottomWithoutSpacing) {
			if(textureSourceWidthWithSpacing == rectWidth) {
				this.mTextureAtlasSource = pTextureAtlasSource;
				return this;
			} else if(textureSourceWidthWithSpacing > rectWidth) {
				return null;
			} else {
				return this.createChildren(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding, rectWidth - textureSourceWidthWithSpacing, rectHeight - textureSourceHeight);
			}
		} else if(textureSourceWidthWithSpacing > rectWidth || textureSourceHeightWithSpacing > rectHeight) {
			return null;
		} else {
			return this.createChildren(pTextureAtlasSource, pTextureWidth, pTextureHeight, pTextureAtlasSourceSpacing, pTextureAtlasSourcePadding, rectWidth - textureSourceWidthWithSpacing, rectHeight - textureSourceHeightWithSpacing);
		}
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:73,代码来源:BlackPawnTextureAtlasBuilder.java


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