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