Ejemplo n.º 1
0
  @Override
  public void present(float deltaTime) {
    Graphics g = game.getGraphics();

    g.drawPixmap(Assets.background, 0, 0);
    g.drawPixmap(Assets.mainmenu, 64, 20, 0, 45, 196, 45);

    int y = 100;
    for (int i = 0; i < 5; i++) {
      drawText(g, lines[i], 20, y);
      y += 50;
    }

    g.drawPixmap(Assets.buttons, 0, 416, 64, 64, 64, 64);
  }
Ejemplo n.º 2
0
  public void drawText(Graphics g, String line, int x, int y) {
    int len = line.length();
    for (int i = 0; i < len; i++) {
      char character = line.charAt(i);

      if (character == ' ') {
        x += 20;
        continue;
      }

      int srcX = 0;
      int srcWidth = 0;
      if (character == '.') {
        srcX = 200;
        srcWidth = 10;
      } else {
        srcX = (character - '0') * 20;
        srcWidth = 20;
      }

      g.drawPixmap(Assets.numbers, x, y, srcX, 0, srcWidth, 32);
      x += srcWidth;
    }
  }