예제 #1
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);
    }
  }
예제 #2
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();
 }
예제 #3
0
  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);
  }
예제 #4
0
  /**
   * Finishes off rendering. Enables depth writes, disables blending and texturing. Must always be
   * called after a call to {@link #begin()}
   */
  public void end() {
    if (!drawing) throw new IllegalStateException("SpriteBatch.begin must be called before end.");
    if (idx > 0) renderMesh();
    lastTexture = null;
    idx = 0;
    drawing = false;

    GLCommon gl = Gdx.gl;
    gl.glDepthMask(true);
    if (isBlendingEnabled()) gl.glDisable(GL10.GL_BLEND);

    if (Gdx.graphics.isGL20Available()) {
      if (customShader != null) customShader.end();
      else shader.end();
    } else {
      gl.glDisable(GL10.GL_TEXTURE_2D);
    }
  }
  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);
  }
예제 #6
0
  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 logConfig(EGLConfig config) {
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    int r = getAttrib(egl, display, config, EGL10.EGL_RED_SIZE, 0);
    int g = getAttrib(egl, display, config, EGL10.EGL_GREEN_SIZE, 0);
    int b = getAttrib(egl, display, config, EGL10.EGL_BLUE_SIZE, 0);
    int a = getAttrib(egl, display, config, EGL10.EGL_ALPHA_SIZE, 0);
    int d = getAttrib(egl, display, config, EGL10.EGL_DEPTH_SIZE, 0);
    int s = getAttrib(egl, display, config, EGL10.EGL_STENCIL_SIZE, 0);
    int samples =
        Math.max(
            getAttrib(egl, display, config, EGL10.EGL_SAMPLES, 0),
            getAttrib(egl, display, config, GdxEglConfigChooser.EGL_COVERAGE_SAMPLES_NV, 0));
    boolean coverageSample =
        getAttrib(egl, display, config, GdxEglConfigChooser.EGL_COVERAGE_SAMPLES_NV, 0) != 0;

    // print configuration just one time (on some devices gl context is recreated every time when
    // device is locked / unlocked - every time when screen turns on and off)
    if (!configLogged) {

      if (gl != null) {
        Gdx.app.log("AndroidGraphics", "OGL renderer: " + gl.glGetString(GL10.GL_RENDERER));
        Gdx.app.log("AndroidGraphics", "OGL vendor: " + gl.glGetString(GL10.GL_VENDOR));
        Gdx.app.log("AndroidGraphics", "OGL version: " + gl.glGetString(GL10.GL_VERSION));
        Gdx.app.log("AndroidGraphics", "OGL extensions: " + gl.glGetString(GL10.GL_EXTENSIONS));
        configLogged = true;
      }

      Gdx.app.log("AndroidGraphics", "framebuffer: (" + r + ", " + g + ", " + b + ", " + a + ")");
      Gdx.app.log("AndroidGraphics", "depthbuffer: (" + d + ")");
      Gdx.app.log("AndroidGraphics", "stencilbuffer: (" + s + ")");
      Gdx.app.log("AndroidGraphics", "samples: (" + samples + ")");
      Gdx.app.log("AndroidGraphics", "coverage sampling: (" + coverageSample + ")");
    }

    bufferFormat = new BufferFormat(r, g, b, a, d, s, samples, coverageSample);
  }
예제 #9
0
  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();
  }