use of com.watabou.noosa.BitmapTextMultiline in project pixel-dungeon by watabou.
the class AmuletScene method create.
@Override
public void create() {
super.create();
BitmapTextMultiline text = null;
if (!noText) {
text = createMultiline(TXT, 8);
text.maxWidth = WIDTH;
text.measure();
add(text);
}
amulet = new Image(Assets.AMULET);
add(amulet);
RedButton btnExit = new RedButton(TXT_EXIT) {
@Override
protected void onClick() {
Dungeon.win(ResultDescriptions.WIN);
Dungeon.deleteGame(Dungeon.hero.heroClass, true);
Game.switchScene(noText ? TitleScene.class : RankingsScene.class);
}
};
btnExit.setSize(WIDTH, BTN_HEIGHT);
add(btnExit);
RedButton btnStay = new RedButton(TXT_STAY) {
@Override
protected void onClick() {
onBackPressed();
}
};
btnStay.setSize(WIDTH, BTN_HEIGHT);
add(btnStay);
float height;
if (noText) {
height = amulet.height + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align((Camera.main.width - amulet.width) / 2);
amulet.y = align((Camera.main.height - height) / 2);
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
} else {
height = amulet.height + LARGE_GAP + text.height() + LARGE_GAP + btnExit.height() + SMALL_GAP + btnStay.height();
amulet.x = align((Camera.main.width - amulet.width) / 2);
amulet.y = align((Camera.main.height - height) / 2);
text.x = align((Camera.main.width - text.width()) / 2);
text.y = amulet.y + amulet.height + LARGE_GAP;
btnExit.setPos((Camera.main.width - btnExit.width()) / 2, text.y + text.height() + LARGE_GAP);
btnStay.setPos(btnExit.left(), btnExit.bottom() + SMALL_GAP);
}
new Flare(8, 48).color(0xFFDDBB, true).show(amulet, 0).angularSpeed = +30;
fadeIn();
}
use of com.watabou.noosa.BitmapTextMultiline in project pixel-dungeon by watabou.
the class GameLog method layout.
@Override
protected void layout() {
float pos = y;
for (int i = length - 1; i >= 0; i--) {
BitmapTextMultiline entry = (BitmapTextMultiline) members.get(i);
entry.maxWidth = (int) width;
entry.measure();
entry.x = x;
entry.y = pos - entry.height();
pos -= entry.height();
}
}
Aggregations