コード例 #1
0
    private void statSlot(String label, String value) {

      BitmapText txt = PixelScene.createText(label, 8);
      txt.y = pos;
      add(txt);

      txt = PixelScene.createText(value, 8);
      txt.measure();
      txt.x = PixelScene.align(WIDTH * 0.65f);
      txt.y = pos;
      add(txt);

      pos += GAP + txt.baseLine();
    }
コード例 #2
0
    private void buffSlot(Buff buff) {

      int index = buff.icon();

      if (index != BuffIndicator.NONE) {

        Image icon = new Image(icons);
        icon.frame(film.get(index));
        icon.y = pos;
        add(icon);

        BitmapText txt = PixelScene.createText(buff.toString(), 8);
        txt.x = icon.width + GAP;
        txt.y = pos + (int) (icon.height - txt.baseLine()) / 2;
        add(txt);

        pos += GAP + icon.height;
      }
    }
コード例 #3
0
    public StatsTab() {

      Hero hero = Dungeon.hero;

      BitmapText title =
          PixelScene.createText(
              Utils.format(TXT_TITLE, hero.lvl, hero.className()).toUpperCase(Locale.ENGLISH), 9);
      title.hardlight(TITLE_COLOR);
      title.measure();
      add(title);

      RedButton btnCatalogus =
          new RedButton(TXT_CATALOGUS) {
            @Override
            protected void onClick() {
              hide();
              GameScene.show(new WndCatalogus());
            }
          };
      btnCatalogus.setRect(
          0, title.y + title.height(), btnCatalogus.reqWidth() + 2, btnCatalogus.reqHeight() + 2);
      add(btnCatalogus);

      RedButton btnJournal =
          new RedButton(TXT_JOURNAL) {
            @Override
            protected void onClick() {
              hide();
              GameScene.show(new WndJournal());
            }
          };
      btnJournal.setRect(
          btnCatalogus.right() + 1,
          btnCatalogus.top(),
          btnJournal.reqWidth() + 2,
          btnJournal.reqHeight() + 2);
      add(btnJournal);

      // mod
      RedButton btnSkills =
          new RedButton(TXT_SKILLS) {
            @Override
            protected void onClick() {
              hide();
              GameScene.show(new WndSkills());
            }
          };
      btnSkills.setRect(
          btnJournal.right() + 1,
          btnJournal.top(),
          btnSkills.reqWidth() + 2,
          btnSkills.reqHeight() + 2);
      add(btnSkills);

      pos = btnCatalogus.bottom() + GAP;

      statSlot(TXT_STR, hero.STR());
      statSlot(TXT_HEALTH, hero.HP + "/" + hero.HT);
      statSlot(TXT_EXP, hero.exp + "/" + hero.maxExp());

      pos += GAP;

      statSlot(TXT_GOLD, Statistics.goldCollected);
      statSlot(TXT_DEPTH, Statistics.deepestFloor);

      pos += GAP;
    }