예제 #1
0
  @Override
  public void render() {
    Gdx.gl.glClearColor(
        background.rgb.getRed() / 255f,
        background.rgb.getGreen() / 255f,
        background.rgb.getBlue() / 255f,
        background.rgb.getAlpha() / 255f);

    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    boolean hasUserInput = false;
    if (input.getText() != null && input.getText().length() != 0) hasUserInput = true;
    final String text =
        hasUserInput ? input.getText() : "The quick brown fox jumps over the lazy dog";

    float scale = scaleSlider.getValue();

    cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    batch.setProjectionMatrix(cam.combined);

    batch.getProjectionMatrix().scale(scale, scale, 0.0f);

    //		batch.getTransformMatrix().scale(scale, scale, 0.0f);

    if (fonts != null) {
      batch.begin();

      int x = 5;
      int y = 0;

      for (FontElement e : fonts) {
        y += e.font.getLineHeight() + 5;
        String str = hasUserInput ? text : e.name + " " + e.size + ": " + text;
        e.font.draw(batch, str, x, y);
      }

      batch.end();
    }

    input.setY(Gdx.graphics.getHeight() - input.getHeight() - 5);
    labelInput.setY(Gdx.graphics.getHeight() - input.getHeight() - 5);

    labelScale.setY(labelInput.getY() - labelInput.getHeight() - 5);
    scaleSlider.setY(input.getY() - input.getHeight() - 5);
    scaleAmt.setY(scaleSlider.getY());

    linearFiltering.setY(scaleSlider.getY() - scaleSlider.getHeight() - 10);

    stage.act();
    stage.draw();
  }