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


Java IMenuItem.getHeight方法代码示例

本文整理汇总了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();
	}
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:18,代码来源:SlideMenuSceneAnimator.java

示例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;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:20,代码来源:SlideMenuAnimator.java

示例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;
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:29,代码来源:MenuSceneAnimator.java

示例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);
}
 
开发者ID:ArturVasilov,项目名称:AndroidCourses,代码行数:12,代码来源:MenuSceneAnimator.java

示例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;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:34,代码来源:DirectMenuAnimator.java

示例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;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:36,代码来源:AlphaMenuAnimator.java

示例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;
	}
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:36,代码来源:SlideMenuAnimator.java

示例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;
}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:11,代码来源:BaseMenuAnimator.java


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