本文整理汇总了Java中org.andengine.util.HorizontalAlign类的典型用法代码示例。如果您正苦于以下问题:Java HorizontalAlign类的具体用法?Java HorizontalAlign怎么用?Java HorizontalAlign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HorizontalAlign类属于org.andengine.util包,在下文中一共展示了HorizontalAlign类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
示例9: DirectMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public DirectMenuAnimator(final HorizontalAlign pHorizontalAlign) {
super(pHorizontalAlign);
}
示例10: AlphaMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public AlphaMenuAnimator(final HorizontalAlign pHorizontalAlign) {
super(pHorizontalAlign);
}
示例11: SlideMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public SlideMenuAnimator(final HorizontalAlign pHorizontalAlign) {
super(pHorizontalAlign);
}
示例12: BaseMenuAnimator
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public BaseMenuAnimator(final HorizontalAlign pHorizontalAlign) {
this(pHorizontalAlign, MENUITEMSPACING_DEFAULT);
}
示例13: TextOptions
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public TextOptions() {
this(AutoWrap.NONE, 0, HorizontalAlign.LEFT, Text.LEADING_DEFAULT);
}
示例14: getHorizontalAlign
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public HorizontalAlign getHorizontalAlign() {
return this.mHorizontalAlign;
}
示例15: setHorizontalAlign
import org.andengine.util.HorizontalAlign; //导入依赖的package包/类
public void setHorizontalAlign(final HorizontalAlign pHorizontalAlign) {
this.mHorizontalAlign = pHorizontalAlign;
}