Beispiel #1
0
 public void draw(float deltaTime) {
   GLCommon gl = Gdx.gl;
   gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
   renderer.render();
   guiCam.update();
   batcher.setProjectionMatrix(guiCam.combined);
   batcher.enableBlending();
   batcher.begin();
   switch (state) {
     case GAME_READY:
       presentReady();
       break;
     case GAME_RUNNING:
       presentRunning();
       break;
     case GAME_PAUSED:
       presentPaused();
       break;
     case GAME_LEVEL_END:
       presentLevelEnd();
       break;
     case GAME_OVER:
       presentGameOver();
       break;
   }
   batcher.end();
 }
Beispiel #2
0
  @Override
  public void present(float deltaTime) {
    GLCommon gl = Gdx.gl;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    camera.update();

    worldRender.render(deltaTime);
    if (isTreasure) {
      batcher.begin();
      renderTreasure(treasureType);
      if (isTreasureSound) {
        Assets.playSound(Assets.treasureSound, game.soundState);
        isTreasureSound = false;
      }
      batcher.end();
    } else if (isFinal) {
      batcher.begin();
      renderFinal();
      batcher.end();
    } else {
      if (isPause && !isDialog) {
        batcher.begin();
        renderGamePause();
        batcher.end();
      }
    }
    if ((isPause || !game.soundState) && bgMusic.isPlaying()) {
      bgMusic.pause();
    } else if (!isPause && !bgMusic.isPlaying() && game.soundState) {
      Assets.playMusic(bgMusic, game.soundState);
    }
  }
  public void draw(float deltaTime) {
    GLCommon gl = Gdx.gl;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    guiCam.update();

    batcher.disableBlending();
    batcher.begin();
    batcher.draw(helpRegion, 0, 0, 320, 480);
    batcher.end();

    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.arrow, 320, 0, -64, 64);
    batcher.end();

    gl.glDisable(GL10.GL_BLEND);
  }
  public void draw() {
    GLCommon gl = Gdx.gl;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    guiCam.update();

    batcher.setProjectionMatrix(guiCam.combined);
    batcher.disableBlending();
    batcher.begin();
    batcher.draw(helpRegion, 0, 0, 320, 480);
    batcher.end();

    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.arrow, 320, 0, -64, 64);
    batcher.end();

    gl.glDisable(GL10.GL_BLEND);
  }
  public void draw(float deltaTime) {
    GLCommon gl = Gdx.gl;
    gl.glClearColor(1, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    guiCam.update();
    batcher.setProjectionMatrix(guiCam.combined);

    batcher.disableBlending();
    batcher.begin();
    batcher.draw(Assets.backgroundRegion, 0, 0, 320, 480);
    batcher.end();

    batcher.enableBlending();
    batcher.begin();
    batcher.draw(Assets.logo, 160 - 274 / 2, 480 - 10 - 142, 274, 142);
    batcher.draw(Assets.mainMenu, 10, 200 - 110 / 2, 300, 110);
    batcher.draw(Settings.soundEnabled ? Assets.soundOn : Assets.soundOff, 0, 0, 64, 64);
    batcher.end();
  }
  public void render() {
    tweenManager.update(Gdx.graphics.getDeltaTime());

    if (gdx.getRotation() > 360 * 15 - 20) gdx.setRegion(gdxTex);

    GLCommon gl = Gdx.gl;
    gl.glClearColor(0, 0, 0, 1);
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    gl.glEnable(GL10.GL_BLEND);
    gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

    batch.setProjectionMatrix(camera.combined);
    batch.begin();
    strip.draw(batch);
    universal.draw(batch);
    tween.draw(batch);
    engine.draw(batch);
    logo.draw(batch);
    powered.draw(batch);
    gdx.draw(batch);
    if (veil.getColor().a > 0.1f) veil.draw(batch);
    batch.end();
  }
  private void draw(float delta) {

    GLCommon gl = Gdx.gl;
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    renderer.render();

    guiCam.update();
    batch.setProjectionMatrix(guiCam.combined);
    batch.enableBlending();
    batch.begin();

    if (state == GameScreen.GAME_PAUSED) batch.draw(Assets.play, 320 - 64, 480 - 64, 50, 50);
    else batch.draw(Assets.pause, 320 - 64, 480 - 64, 50, 50);
    batch.draw(Assets.left, 320 - 51, 0, 50, 50);
    batch.draw(Assets.right, 320 - 51, 70, 50, 50);
    batch.draw(Assets.up, 320 - 51, 120, 50, 50);
    // batch.draw(Assets.potEmpty, 20, 50);
    // batch.draw(new Texture(Gdx.files.internal("data/swordrangeattack.png")), 20, 50);
    Texture slot1Texture = Assets.skillSlotEmpty;
    Texture slot2Texture = Assets.skillSlotEmpty;
    Texture slot3Texture = Assets.skillSlotEmpty;
    boolean slot1cooldown = false;
    boolean slot2cooldown = false;
    boolean slot3cooldown = false;

    int count = 0;
    for (int key : world.skillsOnBar.keySet()) {

      Skill s = world.skillsOnBar.get(key);
      switch (count) {
        case 0:
          slot1Texture = new Texture(Gdx.files.internal("data/" + s.projectile_image));
          if (s.coolDown.isOnCooldown) slot1cooldown = true;
          break;

        case 1:
          slot2Texture = new Texture(Gdx.files.internal("data/" + s.projectile_image));
          if (s.coolDown.isOnCooldown) slot2cooldown = true;
          break;

        case 2:
          slot3Texture = new Texture(Gdx.files.internal("data/" + s.projectile_image));
          if (s.coolDown.isOnCooldown) slot3cooldown = true;
          break;
      }
      count++;
    }
    int x = 115;
    for (int i = 0; i < 3; i++) {

      batch.draw(Assets.skillSlotFrame, x, 5);
      x += 30;
    }
    batch.draw(slot1Texture, 113, 5);
    batch.draw(slot2Texture, 145, 5);
    batch.draw(slot3Texture, 175, 5);
    if (slot1cooldown) batch.draw(Assets.skillSlotOverlay, 115, 5);
    if (slot2cooldown) batch.draw(Assets.skillSlotOverlay, 145, 5);
    if (slot3cooldown) batch.draw(Assets.skillSlotOverlay, 175, 5);
    batch.end();
    renderHP();
  }