本文整理汇总了Java中org.andengine.entity.scene.menu.item.IMenuItem.setAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java IMenuItem.setAlpha方法的具体用法?Java IMenuItem.setAlpha怎么用?Java IMenuItem.setAlpha使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.entity.scene.menu.item.IMenuItem
的用法示例。
在下文中一共展示了IMenuItem.setAlpha方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例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 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;
}
}