本文整理汇总了Java中org.andengine.entity.scene.menu.item.IMenuItem.setPosition方法的典型用法代码示例。如果您正苦于以下问题:Java IMenuItem.setPosition方法的具体用法?Java IMenuItem.setPosition怎么用?Java IMenuItem.setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.scene.menu.item.IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.setPosition方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: onMenuItemPositionReset
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
protected void onMenuItemPositionReset(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
pMenuItem.setPosition(pX, pY);
pMenuItem.resetEntityModifiers();
pMenuItem.setAlpha(AlphaMenuSceneAnimator.ALPHA_FROM);
}
示例3: onMenuItemPositionReset
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
protected void onMenuItemPositionReset(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
final float fromX = getFromX(pMenuScene, pMenuItem, pX);
final float fromY = getFromY(pMenuScene, pMenuItem, pY);
pMenuItem.setPosition(fromX, fromY);
pMenuItem.resetEntityModifiers();
}
示例4: onMenuItemPositionBuilt
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
protected void onMenuItemPositionBuilt(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
pMenuItem.setPosition(pX, pY);
final AlphaModifier alphaModifier = new AlphaModifier(AlphaMenuSceneAnimator.DURATION, AlphaMenuSceneAnimator.ALPHA_FROM, AlphaMenuSceneAnimator.ALPHA_TO, this.mEaseFunction);
alphaModifier.setAutoUnregisterWhenFinished(false);
pMenuItem.registerEntityModifier(alphaModifier);
}
示例5: onMenuItemPositionBuilt
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
protected void onMenuItemPositionBuilt(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
final float fromX = getFromX(pMenuScene, pMenuItem, pX);
final float fromY = getFromY(pMenuScene, pMenuItem, pY);
pMenuItem.setPosition(fromX, fromY);
final MoveModifier moveModifier = new MoveModifier(SlideMenuSceneAnimator.DURATION, fromX, fromY, pX, pY, this.mEaseFunction);
moveModifier.setAutoUnregisterWhenFinished(false);
pMenuItem.registerEntityModifier(moveModifier);
}
示例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);
offsetY += menuItem.getHeight() + menuItemSpacing;
}
}
示例7: 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;
}
}
示例8: onMenuItemPositionBuilt
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
protected void onMenuItemPositionBuilt(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
pMenuItem.setPosition(pX, pY);
}
示例9: onMenuItemPositionReset
import org.andengine.entity.scene.menu.item.IMenuItem; //导入方法依赖的package包/类
@Override
protected void onMenuItemPositionReset(final MenuScene pMenuScene, final int pIndex, final IMenuItem pMenuItem, final float pX, final float pY) {
pMenuItem.setPosition(pX, pY);
}