本文整理汇总了Java中org.andengine.entity.scene.menu.item.IMenuItem.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java IMenuItem.getHeight方法的具体用法?Java IMenuItem.getHeight怎么用?Java IMenuItem.getHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.scene.menu.item.IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.getHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFromY
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
protected float getFromY(final MenuScene pMenuScene, final IMenuItem pMenuItem, final float pY) {
switch (this.mDirection) {
case DOWN_LEFT:
case DOWN:
case DOWN_RIGHT:
return pMenuScene.getHeight() + (pMenuItem.getHeight() * 0.5f);
case LEFT:
case RIGHT:
return pY;
case UP_LEFT:
case UP:
case UP_RIGHT:
return -(pMenuItem.getHeight() * 0.5f);
default:
throw new IllegalArgumentException();
}
}
示例2: prepareAnimations
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
public void prepareAnimations(final ArrayList<IMenuItem> pMenuItems, final float pCameraWidth, final float pCameraHeight) {
final float maximumWidth = this.getMaximumWidth(pMenuItems);
final float overallHeight = this.getOverallHeight(pMenuItems);
final float baseY = (pCameraHeight - overallHeight) * 0.5f;
final float menuItemSpacing = this.mMenuItemSpacing;
float offsetY = 0;
final int menuItemCount = pMenuItems.size();
for(int i = 0; i < menuItemCount; i++) {
final IMenuItem menuItem = pMenuItems.get(i);
menuItem.setPosition(-maximumWidth, baseY + offsetY);
offsetY += menuItem.getHeight() + menuItemSpacing;
}
}
示例3: getMenuItemY
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
protected float getMenuItemY(final MenuScene pMenuScene, final int pIndex) {
final float menuSceneHeight = pMenuScene.getHeight();
final IMenuItem menuItem = pMenuScene.getMenuItem(pIndex);
/* Prepare vertical position. */
float baseY;
switch (this.mVerticalAlign) {
case TOP:
baseY = menuSceneHeight;
break;
case CENTER:
baseY = (0.5f * menuSceneHeight) + (this.mOverallHeight * 0.5f);
break;
case BOTTOM:
baseY = this.mOverallHeight;
break;
default:
throw new IllegalArgumentException("Unexpected " + VerticalAlign.class.getSimpleName() + " with value: '" + this.mVerticalAlign + "'.");
}
final float menuItemHeight = menuItem.getHeight();
/* Determine vertical position. */
final float y = baseY - (menuItemHeight * 0.5f) - (pIndex * (menuItemHeight + this.mMenuItemSpacing));
return y + this.mOffsetY;
}
示例4: updateOverallHeight
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
private void updateOverallHeight(final MenuScene pMenuScene) {
final int menuItemCount = pMenuScene.getMenuItemCount();
float overallHeight = 0;
for (int i = menuItemCount - 1; i >= 0; i--) {
final IMenuItem menuItem = pMenuScene.getMenuItem(i);
overallHeight += menuItem.getHeight();
}
this.mOverallHeight = overallHeight + ((menuItemCount - 1) * this.mMenuItemSpacing);
}
示例5: prepareAnimations
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
public void prepareAnimations(final ArrayList<IMenuItem> pMenuItems, final float pCameraWidth, final float pCameraHeight) {
final float maximumWidth = this.getMaximumWidth(pMenuItems);
final float overallHeight = this.getOverallHeight(pMenuItems);
final float baseX = (pCameraWidth - maximumWidth) * 0.5f;
final float baseY = (pCameraHeight - overallHeight) * 0.5f;
final float menuItemSpacing = this.mMenuItemSpacing;
float offsetY = 0;
final int menuItemCount = pMenuItems.size();
for(int i = 0; i < menuItemCount; i++) {
final IMenuItem menuItem = pMenuItems.get(i);
final float offsetX;
switch(this.mHorizontalAlign) {
case LEFT:
offsetX = 0;
break;
case RIGHT:
offsetX = maximumWidth - menuItem.getWidthScaled();
break;
case CENTER:
default:
offsetX = (maximumWidth - menuItem.getWidthScaled()) * 0.5f;
break;
}
menuItem.setPosition(baseX + offsetX , baseY + offsetY);
offsetY += menuItem.getHeight() + menuItemSpacing;
}
}
示例6: prepareAnimations
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
public void prepareAnimations(final ArrayList<IMenuItem> pMenuItems, final float pCameraWidth, final float pCameraHeight) {
final float maximumWidth = this.getMaximumWidth(pMenuItems);
final float overallHeight = this.getOverallHeight(pMenuItems);
final float baseX = (pCameraWidth - maximumWidth) * 0.5f;
final float baseY = (pCameraHeight - overallHeight) * 0.5f;
final float menuItemSpacing = this.mMenuItemSpacing;
float offsetY = 0;
final int menuItemCount = pMenuItems.size();
for(int i = 0; i < menuItemCount; i++) {
final IMenuItem menuItem = pMenuItems.get(i);
final float offsetX;
switch(this.mHorizontalAlign) {
case LEFT:
offsetX = 0;
break;
case RIGHT:
offsetX = maximumWidth - menuItem.getWidthScaled();
break;
case CENTER:
default:
offsetX = (maximumWidth - menuItem.getWidthScaled()) * 0.5f;
break;
}
menuItem.setPosition(baseX + offsetX , baseY + offsetY);
menuItem.setAlpha(ALPHA_FROM);
offsetY += menuItem.getHeight() + menuItemSpacing;
}
}
示例7: buildAnimations
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
public void buildAnimations(final ArrayList<IMenuItem> pMenuItems, final float pCameraWidth, final float pCameraHeight) {
final IEaseFunction easeFunction = this.mEaseFunction;
final float maximumWidth = this.getMaximumWidth(pMenuItems);
final float overallHeight = this.getOverallHeight(pMenuItems);
final float baseX = (pCameraWidth - maximumWidth) * 0.5f;
final float baseY = (pCameraHeight - overallHeight) * 0.5f;
float offsetY = 0;
final int menuItemCount = pMenuItems.size();
for(int i = 0; i < menuItemCount; i++) {
final IMenuItem menuItem = pMenuItems.get(i);
final float offsetX;
switch(this.mHorizontalAlign) {
case LEFT:
offsetX = 0;
break;
case RIGHT:
offsetX = maximumWidth - menuItem.getWidthScaled();
break;
case CENTER:
default:
offsetX = (maximumWidth - menuItem.getWidthScaled()) * 0.5f;
break;
}
final MoveModifier moveModifier = new MoveModifier(DURATION, -maximumWidth, baseX + offsetX, baseY + offsetY, baseY + offsetY, easeFunction);
moveModifier.setAutoUnregisterWhenFinished(false);
menuItem.registerEntityModifier(moveModifier);
offsetY += menuItem.getHeight() + this.mMenuItemSpacing;
}
}
示例8: getOverallHeight
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
protected float getOverallHeight(final ArrayList<IMenuItem> pMenuItems) {
float overallHeight = 0;
for(int i = pMenuItems.size() - 1; i >= 0; i--) {
final IMenuItem menuItem = pMenuItems.get(i);
overallHeight += menuItem.getHeight();
}
overallHeight += (pMenuItems.size() - 1) * this.mMenuItemSpacing;
return overallHeight;
}