本文整理汇总了Java中org.andengine.util.HorizontalAlign类的典型用法代码示例。如果您正苦于以下问题:Java HorizontalAlign类的具体用法?Java HorizontalAlign怎么用?Java HorizontalAlign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HorizontalAlign类属于org.andengine.util包,在下文中一共展示了HorizontalAlign类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initLayer
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
private void initLayer(KeyListenScene pBaseScene, String pText) {
// レイヤー作成
setColor(Color.BLACK);
setAlpha(0.7f);
setVisible(false);
setZIndex(LayerZIndexType.CUTIN_LAYER.getValue());
// フォント
Font titleFont = pBaseScene.createFont(Typeface.SANS_SERIF, 36, Color.WHITE);
// 表示テキスト
Text winConditionTitle = new Text(16, 16, titleFont,
pText,
new TextOptions(HorizontalAlign.CENTER),
pBaseScene.getBaseActivity().getVertexBufferObjectManager());
pBaseScene.placeToCenter(winConditionTitle);
winConditionTitle.setY(winConditionTitle.getY() - 40);
attachChild(winConditionTitle);
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:19,代码来源:TextCutInTouchLayer.java
示例2: initTalk
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public void initTalk(SparseArray<TiledSprite> faces, List<PlayerTalkDto> talks) {
// 初期化
this.talkIndex = 0;
this.textMaxLength = 0;
// 会話する顔を登録
this.faces = faces;
// 会話内容を登録
this.talks = talks;
// 設定された会話内容を元に最大テキストサイズで初期化してTextを用意する
textMaxLength = getMaxLength(talks);
talkText = new Text(16, 16, font,
getSizeToStr("-", textMaxLength),
new TextOptions(HorizontalAlign.LEFT),
baseScene.getBaseActivity().getVertexBufferObjectManager());
talkText.setAutoWrap(AutoWrap.WORDS);
nameText = new Text(16, 16, font,
getSizeToStr("-", textMaxLength),
new TextOptions(HorizontalAlign.LEFT),
baseScene.getBaseActivity().getVertexBufferObjectManager());
nameText.setColor(Color.GREEN);
nextTalk();
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:27,代码来源:TalkLayer.java
示例3: onLose
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public void onLose(int score, float posRatioX, float posRatioY) {
music.pause();
final IFont menuFont = getFont(FontAsset.name(ResMan.F_HUD_BIN, ResMan.F_HUD_BIN_SIZE, ResMan.F_HUD_BIN_COLOR, ResMan.F_HUD_BIN_ANTI));
gameOverText = new Text(0, 0, menuFont, getEndTextAndUpdateHighScore(false, score), 32, new TextOptions(HorizontalAlign.CENTER), getVBOM());
final Vector2 textPosition = spritePosition(gameOverText.getWidth(), gameOverText.getHeight(), posRatioX, posRatioY);
gameOverText.setPosition(textPosition.x, textPosition.y);
pauseScene.attachChild(gameOverText);
currentGame.logLevelEnd(score, false);
gameScene.setChildScene(pauseScene, false, true, true);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:11,代码来源:AbstractGameActivity.java
示例4: onWin
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public void onWin(int score, float posRatioX, float posRatioY) {
music.pause();
final IFont menuFont = getFont(FontAsset.name(ResMan.F_HUD_BIN, ResMan.F_HUD_BIN_SIZE, ResMan.F_HUD_BIN_COLOR, ResMan.F_HUD_BIN_ANTI));
winText = new Text(0, 0, menuFont, getEndTextAndUpdateHighScore(true, score), 32, new TextOptions(HorizontalAlign.CENTER), getVBOM());
final Vector2 textPosition = spritePosition(winText.getWidth(), winText.getHeight(), posRatioX, posRatioY);
winText.setPosition(textPosition.x, textPosition.y);
winScene.attachChild(winText);
updateNextGame();
currentGame.logLevelEnd(score, true);
gameScene.setChildScene(winScene, false, true, true);
}
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:12,代码来源:AbstractGameActivity.java
示例5: generatePowerUp
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
/**
* Generate a power up that can be collected by shooting it.
* @param x the x pos
* @param y the y pos
* @return the generated power up
*/
public Entity generatePowerUp(float centerX, float centerY, PowerUpTypeEnum type) {
final Sprite sPowerUp = new Sprite(0, 0, spriteLoader.getPowerUpTextureRegion(), this.vertextBufferObjectManager);
sPowerUp.setZIndex(9);
SpriteUtil.setCenter(sPowerUp, centerX, centerY);
Entity powerUp = this.em.createEntity();
this.em.addComponentToEntity(new SpriteComponent(sPowerUp, false), powerUp);
Text puText = new Text(0, 0, spriteLoader.getPowerUpFont(), "azertyuiop azertyuiop azertyuiop", new TextOptions(AutoWrap.WORDS, 74, HorizontalAlign.CENTER), this.vertextBufferObjectManager);
puText.setPosition(43 - puText.getWidth()/2f, 43 - puText.getHeight()/2f);
sPowerUp.attachChild(puText);
this.em.addComponentToEntity(new PowerUpComponent(type, 4, puText), powerUp);
return powerUp;
}
开发者ID:Callilf,项目名称:RotatingSentries,代码行数:21,代码来源:EntityFactory.java
示例6: initLayer
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
private void initLayer(KeyListenScene pBaseScene) {
Font defaultFont = pBaseScene.createFont(Typeface.SANS_SERIF, 16, Color.WHITE);
Font blueFont = pBaseScene.createFont(Typeface.SANS_SERIF, 36, Color.BLUE);
Font redFont = pBaseScene.createFont(Typeface.SANS_SERIF, 36, Color.RED);
setColor(Color.BLACK);
setAlpha(0.7f);
setVisible(false);
setZIndex(LayerZIndexType.CUTIN_LAYER.getValue());
// TODO: 文字ベタ書き
Text winConditionTitle = new Text(16, 16, blueFont, "- 勝利条件 -",
new TextOptions(HorizontalAlign.CENTER),
pBaseScene.getBaseActivity().getVertexBufferObjectManager());
pBaseScene.placeToCenterX(winConditionTitle, 20);
attachChild(winConditionTitle);
Text winConditionDetial = new Text(16, 16, defaultFont, "全ての敵を倒せ",
new TextOptions(HorizontalAlign.CENTER),
pBaseScene.getBaseActivity().getVertexBufferObjectManager());
pBaseScene.placeToCenterX(winConditionDetial, winConditionTitle.getY() + winConditionTitle.getHeight() + 20);
attachChild(winConditionDetial);
Text gameOverConditionTitle = new Text(16, 16, redFont, "- 敗北条件 -",
new TextOptions(HorizontalAlign.CENTER),
pBaseScene.getBaseActivity().getVertexBufferObjectManager());
pBaseScene.placeToCenterX(gameOverConditionTitle, winConditionDetial.getY() + winConditionDetial.getHeight() + 50);
attachChild(gameOverConditionTitle);
Text gameOverConditionDetial = new Text(16, 16, defaultFont, "プレイヤーキャラの全滅",
new TextOptions(HorizontalAlign.CENTER),
pBaseScene.getBaseActivity().getVertexBufferObjectManager());
pBaseScene.placeToCenterX(gameOverConditionDetial, gameOverConditionTitle.getY() + gameOverConditionTitle.getHeight() + 20);
attachChild(gameOverConditionDetial);
// TODO: あとでTAG管理
setTag(TAG);
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:38,代码来源:MapBattleClearConditionTouchLayer.java
示例7: initLayer
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
private void initLayer(KeyListenScene pBaseScene, SaveDataDto saveDataDto) {
// レイヤー作成
setColor(Color.BLACK);
setAlpha(0.7f);
setVisible(false);
setZIndex(LayerZIndexType.CUTIN_LAYER.getValue());
// フォント
Font defaultFont = pBaseScene.createFont(Typeface.SANS_SERIF, 16, Color.WHITE);
Font titleFont = pBaseScene.createFont(Typeface.SANS_SERIF, 36, Color.WHITE);
// 表示テキスト TODO: 文字ベタ書き
Text winConditionTitle = new Text(16, 16, titleFont,
"- 第" + saveDataDto.getScenarioNo() + "章 -",
new TextOptions(HorizontalAlign.CENTER),
pBaseScene.getBaseActivity().getVertexBufferObjectManager());
pBaseScene.placeToCenter(winConditionTitle);
winConditionTitle.setY(winConditionTitle.getY() - 40);
attachChild(winConditionTitle);
Text gameOverConditionDetial = new Text(16, 16, defaultFont,
saveDataDto.getScenarioTitle(),
new TextOptions(HorizontalAlign.CENTER),
pBaseScene.getBaseActivity().getVertexBufferObjectManager());
pBaseScene.placeToCenterX(gameOverConditionDetial, winConditionTitle.getY() + winConditionTitle.getHeight() + 20);
attachChild(gameOverConditionDetial);
setTag(ScenarioStartCutInTouchLayer.TAG);
}
开发者ID:kyokomi,项目名称:AndEngineSRPGQuest,代码行数:29,代码来源:ScenarioStartCutInTouchLayer.java
示例8: initViews
import org.andengine.util.HorizontalAlign; //导入依赖的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
示例9: DirectMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public DirectMenuAnimator(final HorizontalAlign pHorizontalAlign) {
super(pHorizontalAlign);
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:DirectMenuAnimator.java
示例10: AlphaMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public AlphaMenuAnimator(final HorizontalAlign pHorizontalAlign) {
super(pHorizontalAlign);
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:AlphaMenuAnimator.java
示例11: SlideMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public SlideMenuAnimator(final HorizontalAlign pHorizontalAlign) {
super(pHorizontalAlign);
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:SlideMenuAnimator.java
示例12: BaseMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public BaseMenuAnimator(final HorizontalAlign pHorizontalAlign) {
this(pHorizontalAlign, MENUITEMSPACING_DEFAULT);
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:BaseMenuAnimator.java
示例13: TextOptions
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public TextOptions() {
this(AutoWrap.NONE, 0, HorizontalAlign.LEFT, Text.LEADING_DEFAULT);
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:TextOptions.java
示例14: getHorizontalAlign
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public HorizontalAlign getHorizontalAlign() {
return this.mHorizontalAlign;
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:TextOptions.java
示例15: setHorizontalAlign
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public void setHorizontalAlign(final HorizontalAlign pHorizontalAlign) {
this.mHorizontalAlign = pHorizontalAlign;
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:TextOptions.java
示例16: TickerTextOptions
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public TickerTextOptions(final float pCharactersPerSecond, final boolean pReverse) {
this(HorizontalAlign.LEFT, pCharactersPerSecond, pReverse);
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:TickerText.java
示例17: getHorizontalAlign
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public HorizontalAlign getHorizontalAlign() {
return this.mTextOptions.mHorizontalAlign;
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:4,代码来源:Text.java
示例18: setHorizontalAlign
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public void setHorizontalAlign(final HorizontalAlign pHorizontalAlign) {
this.mTextOptions.mHorizontalAlign = pHorizontalAlign;
this.invalidateText();
}
开发者ID:peterchaula,项目名称:ClassicF1,代码行数:6,代码来源:Text.java
示例19: generateSentry
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
/**
* Generate a sentry at the middle of the screen.
* @param rotation the start rotation of the sentry
* @return The entity corresponding to the created sentry.
*/
public Entity generateSentry(int rotation) {
// Sprite compo
TiledTextureRegion sentryTexture = spriteLoader.getSentryTextureRegion();
final AnimatedSprite sSentry = new AnimatedSprite(gameArea.getWidth()/2 - sentryTexture.getWidth()/2, gameArea.getHeight()/2 - sentryTexture.getHeight()/2,
sentryTexture, this.vertextBufferObjectManager);
sSentry.setZIndex(11);
sSentry.setRotation(rotation);
sSentry.stopAnimation(0);
Entity sentry = this.em.createEntity();
SpriteComponent spriteComponent = new SpriteComponent(sSentry, true).defineRectangularHitbox(108, 10, 55, 70);
this.em.addComponentToEntity(spriteComponent, sentry);
this.em.addComponentToEntity(new SelfRotationComponent(3, 0.8f, 0.2f, rotation, true, true), sentry);
//Primary fire compo
Sprite primaryFireIcon = new Sprite(0, 0, spriteLoader.getFireIconPrimaryStandardTextureRegion(), this.vertextBufferObjectManager);
this.em.addComponentToEntity(new PrimaryShootingComponent(primaryFireIcon, ProjectileType.STANDARD, 0.5f,
SpriteAnimationEnum.SENTRY_STANDARD_SHOOT.getFrames(),
SpriteAnimationEnum.SENTRY_STANDARD_SHOOT.getFrameDurations()), sentry);
// //Secondary fire compo
// //Secondary shooting test :
// Sprite secondaryFireIcon = new Sprite(0, 0, spriteLoader.getFireIconSecondaryPiercingTextureRegion(), this.vertextBufferObjectManager);
// Text ammoText = new Text(0, 0, spriteLoader.getSecondaryAmmoFont(), "999", new TextOptions(HorizontalAlign.RIGHT), this.vertextBufferObjectManager);
// this.em.addComponentToEntity(new SecondaryShootingComponent(secondaryFireIcon, 50, ammoText, ProjectileType.PIERCING, 0.1f,
// SpriteAnimationEnum.SENTRY_STANDARD_SHOOT.getFrames(),
// SpriteAnimationEnum.SENTRY_STANDARD_SHOOT.getFrameDurations()), sentry);
//Secondary mine test :
Sprite secondaryMineIcon = new Sprite(0, 0, spriteLoader.getFireIconSecondaryMineTextureRegion(), this.vertextBufferObjectManager);
Sprite targetSprite = new Sprite(0, 0, spriteLoader.getTargetTextureRegion(), this.vertextBufferObjectManager);
Text ammoText = new Text(0, 0, spriteLoader.getSecondaryAmmoFont(), "999", new TextOptions(HorizontalAlign.RIGHT), this.vertextBufferObjectManager);
this.em.addComponentToEntity(new SecondaryMineComponent(secondaryMineIcon, 10, ammoText, targetSprite), sentry);
//AOE attack compo
Rectangle hitbox = (Rectangle)spriteComponent.getHitbox();
final AnimatedSprite sElectricAttack = new AnimatedSprite(0, 0, this.spriteLoader.getSentryElectricAttackTextureRegion(), this.vertextBufferObjectManager);
sElectricAttack.setX(hitbox.getX() + hitbox.getWidth()/2 - sElectricAttack.getWidth()/2);
sElectricAttack.setY(hitbox.getY() + hitbox.getHeight()/2 - sElectricAttack.getHeight()/2);
sElectricAttack.setVisible(false);
sSentry.attachChild(sElectricAttack);
final Sprite sElectricAttackIcon = new Sprite(0, 0, this.spriteLoader.getSkillElectricityTextureRegion(), this.vertextBufferObjectManager);
final Sprite sElectricAttackIconFrame = new Sprite(0, 0, this.spriteLoader.getSkillFrameTextureRegion(), this.vertextBufferObjectManager);
//Temp : placing the icon on the top right of the HUD
sElectricAttackIconFrame.setX(1508);
sElectricAttackIconFrame.setY(10);
sElectricAttackIcon.setX(1508);
sElectricAttackIcon.setY(10);
this.em.addComponentToEntity(new AOEAttackComponent(sElectricAttack, sElectricAttackIcon, sElectricAttackIconFrame, hitbox, 5, 2, this.vertextBufferObjectManager), sentry);
//Detectable compo
this.em.addComponentToEntity(new DetectableComponent(), sentry);
return sentry;
}
开发者ID:Callilf,项目名称:RotatingSentries,代码行数:60,代码来源:EntityFactory.java
注:本文中的org.andengine.util.HorizontalAlign类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论