use of com.watabou.noosa.RenderedText in project shattered-pixel-dungeon-gdx by 00-Evan.
the class StartScene method create.
@Override
public void create() {
super.create();
Badges.loadGlobal();
Journal.loadGlobal();
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
Archs archs = new Archs();
archs.setSize(w, h);
add(archs);
ExitButton btnExit = new ExitButton();
btnExit.setPos(w - btnExit.width(), 0);
add(btnExit);
RenderedText title = PixelScene.renderText(Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2f;
title.y = (16 - title.baseLine()) / 2f;
align(title);
add(title);
ArrayList<GamesInProgress.Info> games = GamesInProgress.checkAll();
int slotGap = SPDSettings.landscape() ? 5 : 10;
int slotCount = Math.min(GamesInProgress.MAX_SLOTS, games.size() + 1);
int slotsHeight = slotCount * SLOT_HEIGHT + (slotCount - 1) * slotGap;
float yPos = (h - slotsHeight) / 2f;
if (SPDSettings.landscape())
yPos += 8;
for (GamesInProgress.Info game : games) {
SaveSlotButton existingGame = new SaveSlotButton();
existingGame.set(game.slot);
existingGame.setRect((w - SLOT_WIDTH) / 2f, yPos, SLOT_WIDTH, SLOT_HEIGHT);
yPos += SLOT_HEIGHT + slotGap;
align(existingGame);
add(existingGame);
}
if (games.size() < GamesInProgress.MAX_SLOTS) {
SaveSlotButton newGame = new SaveSlotButton();
newGame.set(GamesInProgress.firstEmpty());
newGame.setRect((w - SLOT_WIDTH) / 2f, yPos, SLOT_WIDTH, SLOT_HEIGHT);
yPos += SLOT_HEIGHT + slotGap;
align(newGame);
add(newGame);
}
GamesInProgress.curSlot = 0;
ActionIndicator.action = null;
fadeIn();
}
use of com.watabou.noosa.RenderedText in project shattered-pixel-dungeon-gdx by 00-Evan.
the class RankingsScene method create.
@Override
public void create() {
super.create();
Music.INSTANCE.play(Assets.THEME, true);
uiCamera.visible = false;
int w = Camera.main.width;
int h = Camera.main.height;
archs = new Archs();
archs.setSize(w, h);
add(archs);
Rankings.INSTANCE.load();
RenderedText title = PixelScene.renderText(Messages.get(this, "title"), 9);
title.hardlight(Window.TITLE_COLOR);
title.x = (w - title.width()) / 2f;
title.y = (16 - title.baseLine()) / 2f;
align(title);
add(title);
if (Rankings.INSTANCE.records.size() > 0) {
// attempts to give each record as much space as possible, ideally as much space as portrait mode
float rowHeight = GameMath.gate(ROW_HEIGHT_MIN, (uiCamera.height - 26) / Rankings.INSTANCE.records.size(), ROW_HEIGHT_MAX);
float left = (w - Math.min(MAX_ROW_WIDTH, w)) / 2 + GAP;
float top = (h - rowHeight * Rankings.INSTANCE.records.size()) / 2;
int pos = 0;
for (Rankings.Record rec : Rankings.INSTANCE.records) {
Record row = new Record(pos, pos == Rankings.INSTANCE.lastRecord, rec);
float offset = rowHeight <= 14 ? pos % 2 == 1 ? 5 : -5 : 0;
row.setRect(left + offset, top + pos * rowHeight, w - left * 2, rowHeight);
add(row);
pos++;
}
if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) {
RenderedText label = PixelScene.renderText(Messages.get(this, "total") + " ", 8);
label.hardlight(0xCCCCCC);
add(label);
RenderedText won = PixelScene.renderText(Integer.toString(Rankings.INSTANCE.wonNumber), 8);
won.hardlight(Window.SHPX_COLOR);
add(won);
RenderedText total = PixelScene.renderText("/" + Rankings.INSTANCE.totalNumber, 8);
total.hardlight(0xCCCCCC);
total.x = (w - total.width()) / 2;
total.y = top + pos * rowHeight + GAP;
add(total);
float tw = label.width() + won.width() + total.width();
label.x = (w - tw) / 2;
won.x = label.x + label.width();
total.x = won.x + won.width();
label.y = won.y = total.y = h - label.height() - GAP;
align(label);
align(total);
align(won);
}
} else {
RenderedText noRec = PixelScene.renderText(Messages.get(this, "no_games"), 8);
noRec.hardlight(0xCCCCCC);
noRec.x = (w - noRec.width()) / 2;
noRec.y = (h - noRec.height()) / 2;
align(noRec);
add(noRec);
}
ExitButton btnExit = new ExitButton();
btnExit.setPos(Camera.main.width - btnExit.width(), 0);
add(btnExit);
fadeIn();
}
use of com.watabou.noosa.RenderedText in project shattered-pixel-dungeon-gdx by 00-Evan.
the class WndGameInProgress method statSlot.
private void statSlot(String label, String value) {
RenderedText txt = PixelScene.renderText(label, 8);
txt.y = pos;
add(txt);
txt = PixelScene.renderText(value, 8);
txt.x = WIDTH * 0.6f;
txt.y = pos;
PixelScene.align(txt);
add(txt);
pos += GAP + txt.baseLine();
}
Aggregations