Example #1
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    camera.update();
    batch.setProjectionMatrix(camera.combined);
    batch.begin();

    backgroundImage.draw(batch, 1);
    preUIrender(delta);

    batch.end();

    // Update FPS-Counter
    fpsLabel.setText("FPS: " + String.valueOf(Gdx.graphics.getFramesPerSecond()));
    fpsLabel.setPosition(
        uiStage.getWidth() - fpsLabel.getPrefWidth(),
        uiStage.getHeight() - fpsLabel.getPrefHeight() / 2);

    uiStage.act(delta);
    uiStage.draw();
  }
Example #2
0
  public void pintar(SpriteBatch batch, float parentAlpha, ScreenViewport vista) {

    if (estado_juego == ESTADO_NORMAL) {

      time += Gdx.graphics.getDeltaTime();

      estado.draw();
      batch2.begin();
      fuente.draw(batch2, "" + (int) time, 220, 480);
      batch2.end();

    } else if (estado_juego == ESTADO_GANA) {

      final int tiempo = (int) time;

      batch.begin();
      //	fuente.draw(batch2, "Ganaste", 320/2,480/2);
      gana.draw(batch, 1);
      replay.draw(batch, 1);
      menu.draw(batch, 1);
      next.draw(batch, 1);

      if (tiempo >= 0 && tiempo <= 10) {
        batch.draw(
            Recursos.getRecursos().getCuadroColor("amarrillo"),
            (qbox.Pantalla.ANCHO / 2) - 128,
            (qbox.Pantalla.ALTO / 2) - 180);
        batch.draw(
            Recursos.getRecursos().getCuadroColor("azul"),
            (qbox.Pantalla.ANCHO / 2) - 52,
            (qbox.Pantalla.ALTO / 2) - 180);
        batch.draw(
            Recursos.getRecursos().getCuadroColor("rojo"),
            (qbox.Pantalla.ANCHO / 2) + 25,
            (qbox.Pantalla.ALTO / 2) - 180);
      } else if (tiempo > 10 && tiempo <= 20) {

        batch.draw(
            Recursos.getRecursos().getCuadroColor("amarrillo"),
            (qbox.Pantalla.ANCHO / 2) - 128,
            (qbox.Pantalla.ALTO / 2) - 180);
        batch.draw(
            Recursos.getRecursos().getCuadroColor("azul"),
            (qbox.Pantalla.ANCHO / 2) - 52,
            (qbox.Pantalla.ALTO / 2) - 180);

      } else if (tiempo > 20 && tiempo <= 30) {
        batch.draw(
            Recursos.getRecursos().getCuadroColor("amarrillo"),
            (qbox.Pantalla.ANCHO / 2) - 52,
            (qbox.Pantalla.ALTO / 2) - 180);
      }

      batch.end();
    } else if (estado_juego == ESTADO_PIERDE) {
      batch.begin();

      pierde.draw(batch, 1);
      replay.draw(batch, 1);
      menu.draw(batch, 1);

      batch.end();
    }
  }