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


Java Text.setZIndex方法代码示例

本文整理汇总了Java中org.andengine.entity.text.Text.setZIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Text.setZIndex方法的具体用法?Java Text.setZIndex怎么用?Java Text.setZIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.andengine.entity.text.Text的用法示例。


在下文中一共展示了Text.setZIndex方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: PriceSign

import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public PriceSign(float x, float y, float price, VertexBufferObjectManager pVertexBufferObjectManager) {
	
	// superconstructor
	super((int) x - TEXTURE.getWidth() / 2, (int) y - TEXTURE.getHeight() / 2, TEXTURE, pVertexBufferObjectManager);
	
	// set variables
	setZIndex(TowerDefense.ZINDEX_HUD);
	mPrice = price;
	mCenterX = (int) x;
	mCenterY = (int) y;
	
	//create text field with price
	mPriceText = new Text(mCenterX, mCenterY - 5, TowerDefense.FONT_SMALL, "" + (int) mPrice, 3, getVertexBufferObjectManager());
	mPriceText.setZIndex(TowerDefense.ZINDEX_HUD + 1);
	mPriceText.setPosition(mCenterX - mPriceText.getWidth() / 2, mCenterY - 5);
	if (TowerDefense.mSceneManager.getCurrentLevel().mCoins < mPrice) mPriceText.setColor(0.8f, 0.2f, 0.2f);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mPriceText);
	
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:20,代码来源:PriceSign.java

示例2: initFps

import org.andengine.entity.text.Text; //导入方法依赖的package包/类
/**
 * FPSの画面表示.
 */
protected void initFps(float x, float y, Font font) {
	mFpsText= new Text(x, y, font, "FPS:0.000000000000000000000000", 
			getBaseActivity().getVertexBufferObjectManager());
	mFpsText.setZIndex(999);
	mFpsText.setTag(FPS_TAG);
	attachChild(mFpsText);

	mFpsCounter = new AverageFPSCounter(1) {
		
		@Override
		protected void onHandleAverageDurationElapsed(float pFPS) {
			mFpsText.setText("FPS:" + pFPS);
		}
	};
	registerUpdateHandler(mFpsCounter);
	
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:21,代码来源:KeyListenScene.java

示例3: initDamageText

import org.andengine.entity.text.Text; //导入方法依赖的package包/类
/**
 * ダメージテキスト初期化
 */
private void initDamageText(IEntity entity) {
	Text damageText = new Text(0, 0, getBaseScene().getFont(), "00000", 
			getBaseScene().getBaseActivity().getVertexBufferObjectManager());
	damageText.setColor(Color.TRANSPARENT);
	damageText.setZIndex(LayerZIndexType.TEXT_LAYER.getValue());
	damageText.setTag(DAMAGE_TEXT_TAG);
	entity.attachChild(damageText);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:12,代码来源:BattlePart.java

示例4: initDamageText

import org.andengine.entity.text.Text; //导入方法依赖的package包/类
/**
 * ダメージテキスト初期化
 */
private void initDamageText(IEntity entity) {
	Text damageText = new Text(0, 0, getBaseScene().getFont(), "00000", 
			getBaseScene().getBaseActivity().getVertexBufferObjectManager());
	damageText.setColor(Color.TRANSPARENT);
	damageText.setZIndex(LayerZIndexType.TEXT_LAYER.getValue());
	damageText.setTag(DAMAGE_TEXT_TAG); //TODO: TAG管理
	entity.attachChild(damageText);
}
 
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:12,代码来源:SRPGPart.java

示例5: HUD

import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public HUD(VertexBufferObjectManager pVertexBufferObjectManager) {
	
	// set up main hud
	mMainHUD = new Sprite(20, 20, TowerDefense.TEXTURE_HUD_MAIN, pVertexBufferObjectManager);
	mHealthText = new Text(65, 31, TowerDefense.FONT_NORMAL, "" + TowerDefense.mSceneManager.getCurrentLevel().mHealth, 32, pVertexBufferObjectManager);
	mCoinsText = new Text(122, 31, TowerDefense.FONT_NORMAL, "" + TowerDefense.mSceneManager.getCurrentLevel().mCoins, 32, pVertexBufferObjectManager);
	mWavesText = new Text(76, 54, TowerDefense.FONT_NORMAL, "WAVE " + TowerDefense.mSceneManager.getCurrentLevel().mWaveCurrent + "/" + TowerDefense.mSceneManager.getCurrentLevel().mWavesTotal, 32, pVertexBufferObjectManager);
	mMainHUD.setZIndex(TowerDefense.ZINDEX_HUD);
	mHealthText.setZIndex(TowerDefense.ZINDEX_HUD);
	mCoinsText.setZIndex(TowerDefense.ZINDEX_HUD);
	mWavesText.setZIndex(TowerDefense.ZINDEX_HUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mMainHUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mHealthText);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mCoinsText);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mWavesText);
	
	// set up bottom hud
	mBottomHUD = new Sprite(0, TowerDefense.CAMERA_HEIGHT - TowerDefense.TEXTURE_HUD_BOTTOM.getHeight(), TowerDefense.TEXTURE_HUD_BOTTOM, pVertexBufferObjectManager);
	mBottomHUD.setZIndex(TowerDefense.ZINDEX_HUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mBottomHUD);
	mStartButton = new StartButton(TowerDefense.CAMERA_WIDTH - 10, TowerDefense.CAMERA_HEIGHT, pVertexBufferObjectManager);
	
	// set up info hud
	float centerAlign = 10 + TowerDefense.TEXTURE_HUD_SKILLS.getWidth() + 10 + (TowerDefense.CAMERA_WIDTH - (10 + TowerDefense.TEXTURE_HUD_SKILLS.getWidth() + 10 + 10 + TowerDefense.TEXTURE_HUD_START.getWidth() + 10)) / 2 - TowerDefense.TEXTURE_HUD_INFO.getWidth() / 2;
	mInfoHUD = new Sprite((int) centerAlign, TowerDefense.CAMERA_HEIGHT - TowerDefense.TEXTURE_HUD_INFO.getHeight(), TowerDefense.TEXTURE_HUD_INFO, pVertexBufferObjectManager);
	mTowerIcon = new Sprite((int) (mInfoHUD.getX() + 18 - TowerDefense.TEXTURE_ICON_TEST.getWidth() / 2), (int) (mInfoHUD.getY() + 18 - TowerDefense.TEXTURE_ICON_TEST.getHeight() / 2), TowerDefense.TEXTURE_ICON_TEST, pVertexBufferObjectManager);
	mTowerNameText = new Text(mInfoHUD.getX() + 45, mInfoHUD.getY() + 12, TowerDefense.FONT_NORMAL, "", 32, pVertexBufferObjectManager);
	mTowerDamageText = new Text(mInfoHUD.getX() + 190, mInfoHUD.getY() + 12, TowerDefense.FONT_NORMAL, "", 32, pVertexBufferObjectManager);
	mTowerDelayText = new Text(mInfoHUD.getX() + 265, mInfoHUD.getY() + 12, TowerDefense.FONT_NORMAL, "", 32, pVertexBufferObjectManager);
	mTowerRangeText = new Text(mInfoHUD.getX() + 360, mInfoHUD.getY() + 12, TowerDefense.FONT_NORMAL, "", 32, pVertexBufferObjectManager);
	mInfoHUD.setZIndex(TowerDefense.ZINDEX_HUD);
	mTowerIcon.setZIndex(TowerDefense.ZINDEX_HUD);
	mTowerNameText.setZIndex(TowerDefense.ZINDEX_HUD);
	mTowerDamageText.setZIndex(TowerDefense.ZINDEX_HUD);
	mTowerDelayText.setZIndex(TowerDefense.ZINDEX_HUD);
	mTowerRangeText.setZIndex(TowerDefense.ZINDEX_HUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mInfoHUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mTowerIcon);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mTowerNameText);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mTowerDamageText);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mTowerDelayText);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mTowerRangeText);
	hideInfo();
	
	// set up skills hud
	mSkillsHUD = new Sprite(10, TowerDefense.CAMERA_HEIGHT - TowerDefense.TEXTURE_HUD_SKILLS.getHeight(), TowerDefense.TEXTURE_HUD_SKILLS, pVertexBufferObjectManager);
	mSkill1 = new Sprite(mSkillsHUD.getX() + 33, TowerDefense.CAMERA_HEIGHT - 15 - TowerDefense.TEXTURE_HUD_SKILL.getHeight(), TowerDefense.TEXTURE_HUD_SKILL, pVertexBufferObjectManager);
	mSkill2 = new Sprite(mSkillsHUD.getX() + 108, TowerDefense.CAMERA_HEIGHT - 15 - TowerDefense.TEXTURE_HUD_SKILL.getHeight(), TowerDefense.TEXTURE_HUD_SKILL, pVertexBufferObjectManager);
	mSkillsHUD.setZIndex(TowerDefense.ZINDEX_HUD);
	mSkill1.setZIndex(TowerDefense.ZINDEX_HUD);
	mSkill2.setZIndex(TowerDefense.ZINDEX_HUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mSkillsHUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mSkill1);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mSkill2);
	
	// set up the options hud //TODO make OptionsButton and PauseButton classes
	mOptionsButton = new Sprite(TowerDefense.CAMERA_WIDTH - 20 - TowerDefense.TEXTURE_BUTTON_OPTIONS.getWidth(), 20, TowerDefense.TEXTURE_BUTTON_OPTIONS, pVertexBufferObjectManager);
	mOptionsButton.setZIndex(TowerDefense.ZINDEX_HUD);
	TowerDefense.mSceneManager.getCurrentLevel().attachChild(mOptionsButton);
	mPauseButton = new PauseButton(TowerDefense.CAMERA_WIDTH - 86, 38, pVertexBufferObjectManager);
	
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:63,代码来源:HUD.java

示例6: initViews

import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public void initViews(final ResourceManager pResourceManager, final Camera pCamera) {

		final float cameraHeight = pCamera.getHeight();
		final float cameraWidth = pCamera.getWidth();

		mRacer = new Racer(GameActivity.NUM_OF_LIVES, cameraWidth, cameraHeight, pResourceManager.mRaceCarRegion, mContext.getVertexBufferObjectManager());
		mRacer.setY(cameraHeight - mRacer.getHeight() - 15f);

		final int textOffsetX = (int) (cameraWidth * RACE_TRACK_WIDTH) + 20;
		// scores
		mHighScore = new Text(textOffsetX, 100, pResourceManager.mGameFont, "High Score\n 0123456789", new TextOptions(HorizontalAlign.LEFT), mContext.getVertexBufferObjectManager());
		mHighScore.setText("High Score \n " + Persistance.getHighScore(mContext));
		mScore = new Text(textOffsetX, 180, pResourceManager.mGameFont, "Score \n0123456789", mContext.getVertexBufferObjectManager());
		mLives = new Text(textOffsetX, 260, pResourceManager.mGameFont, "Lives \n01234556789", mContext.getVertexBufferObjectManager());
		mLives.setText("Lives \n " + mRacer.mLivesLeft);
		mLevel = new Text(textOffsetX, 340, pResourceManager.mGameFont, "Level\n 0123456789", mContext.getVertexBufferObjectManager());

		mScore.setText("Score \n 0");

		// menus
		mPlayText = new Text(cameraWidth / 2, cameraHeight / 3, pResourceManager.mGamePlayFont, "Play", 5, new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mLevelText = new Text(cameraWidth / 2, cameraHeight / 3 + mPlayText.getHeight() + 40f, pResourceManager.mGamePlayFont, "Level", 5, new TextOptions(HorizontalAlign.CENTER),
				mContext.getVertexBufferObjectManager());
		mHelpText = new Text(cameraWidth / 2, cameraHeight / 3 + mLevelText.getHeight() + mPlayText.getHeight() + 80f, pResourceManager.mGamePlayFont, "Help", 4, new TextOptions(
				HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());

		// game over
		mExplosionSprite = new Sprite(-500f, mRacer.getY(), pResourceManager.mExplosionRegion, mContext.getVertexBufferObjectManager());
		mGameOverText = new Text(cameraWidth / 2, cameraHeight / 3, pResourceManager.mGamePlayFont, "Score", 5, new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mGameOverScoreText = new Text(cameraWidth / 2, cameraHeight / 3 + mGameOverText.getHeight() + 40, pResourceManager.mGamePlayFont, " 0123456789", 12, new TextOptions(HorizontalAlign.CENTER),
				mContext.getVertexBufferObjectManager());
		mExplosionSprite.setCullingEnabled(true);
		mExplosionSprite.setZIndex(3);

		mPlayText.setAlpha(0.7f);
		mHelpText.setAlpha(0.7f);
		mLevelText.setAlpha(0.7f);
		mGameOverText.setAlpha(0.7f);
		mGameOverScoreText.setAlpha(0.7f);
		mGameOverText.setColor(mGameOverTextColor);
		mGameOverScoreText.setColor(mGameOverTextColor);

		mPlayText.setZIndex(6);
		mLevelText.setZIndex(6);
		mHelpText.setZIndex(6);
		mGameOverText.setZIndex(7);
		mGameOverScoreText.setZIndex(7);

		placeCenter(mPlayText, pCamera);
		placeCenter(mHelpText, pCamera);
		placeCenter(mLevelText, pCamera);
		placeCenter(mGameOverText, pCamera);
		placeCenter(mGameOverScoreText, pCamera);

		registerTouchArea(mHelpText);
		registerTouchArea(mPlayText);
		registerTouchArea(mLevelText);
		attachChild(mHelpText);
		attachChild(mPlayText);
		attachChild(mLevelText);
		attachChild(mHighScore);
		attachChild(mScore);
		attachChild(mLives);
		attachChild(mLevel);
		attachChild(mRacer);
		attachChild(mExplosionSprite);
		sortChildren();

	}
 
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:70,代码来源:GameScene.java

示例7: createScene

import org.andengine.entity.text.Text; //导入方法依赖的package包/类
public Scene createScene(){

		Scene mScene = new Scene();
		VertexBufferObjectManager vbo = mContext.getVertexBufferObjectManager();

		Sprite backgroundSprite = new Sprite(0, 0 , mResourceManager.mBackgroundTextureRegion, vbo);	
		mParallaxBackground.attachParallaxEntity(new ParallaxEntity(1, backgroundSprite));

		mScene.setBackground(mParallaxBackground);
		mScene.setBackgroundEnabled(true);


		// bird		
		float birdStartXOffset = (MainActivity.CAMERA_WIDTH / 4) - (Bird.BIRD_WIDTH / 4);
		float birdYOffset = (MainActivity.CAMERA_HEIGHT / 2) - (Bird.BIRD_HEIGHT / 4);
		mBird = new Bird(birdStartXOffset, birdYOffset, mContext.getVertexBufferObjectManager(), mScene);

		//score
		mScoreText = new Text(0, 60, mResourceManager.mScoreFont, "        ", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mScoreText.setZIndex(3);
		mScene.attachChild(mScoreText);		

		// get ready text
		mGetReadyText = new Text(0, 220, mResourceManager.mGetReadyFont, "Get Ready!", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mGetReadyText.setZIndex(3);
		mScene.attachChild(mGetReadyText);
		centerText(mGetReadyText);

		// instructions image
		mInstructionsSprite = new Sprite(0, 0, 200, 172, mResourceManager.mInstructionsTexture, mContext.getVertexBufferObjectManager());
		mInstructionsSprite.setZIndex(3);
		mScene.attachChild(mInstructionsSprite);
		centerSprite(mInstructionsSprite);
		mInstructionsSprite.setY(mInstructionsSprite.getY() + 20);

		// copy text
		mCopyText = new Text(0, 750, mResourceManager.mCopyFont, "(c) Dean Wild 2014", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mCopyText.setZIndex(3);
		mScene.attachChild(mCopyText);
		centerText(mCopyText);


		// you suck text		
		mYouSuckText = new Text(0, MainActivity.CAMERA_HEIGHT / 2 - 100, mResourceManager.mYouSuckFont, "You Suck!", new TextOptions(HorizontalAlign.CENTER), mContext.getVertexBufferObjectManager());
		mYouSuckText.setZIndex(3);		
		centerText(mYouSuckText);

		return mScene;
	}
 
开发者ID:deano2390,项目名称:OpenFlappyBird,代码行数:50,代码来源:SceneManager.java


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