コード例 #1
0
ファイル: GameScreen.java プロジェクト: idkgi/NerdShooter
  public void render(float delta) {
    gameTicks++;

    long seconds = (long) ((gameTicks / 60D) * 10L);

    Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(Gdx.gl.GL_COLOR_BUFFER_BIT);

    controller.update(delta);
    updateEntities(delta);
    renderer.render();

    button.begin(ShapeRenderer.ShapeType.Filled);
    {
      if (Gdx.app.getType().equals(Application.ApplicationType.Android)) {
        Gdx.gl.glEnable(Gdx.gl20.GL_BLEND);
        Gdx.gl.glBlendFunc(Gdx.gl20.GL_SRC_ALPHA, Gdx.gl20.GL_ONE_MINUS_SRC_ALPHA);

        button.setColor(0.0F, 0.5F, 0.5F, 0.5F);
        button.rect(left.x, left.y, left.width, left.height);
        button.rect(right.x, right.y, right.width, right.height);

        button.setColor(1.0F, 1.0F, 1.0F, 0.5F);
        button.rect(jump.x, jump.y, jump.width, jump.height);
      }

      world.getJaxon().inventory.renderGUI(button, width, height, buttonSize * 0.75F);
    }
    button.end();

    batch.begin();
    {
      if (Gdx.app.getType().equals(Application.ApplicationType.Android)) {
        batch.draw(controlLeft, left.x, left.y, left.width, left.height);
        batch.draw(controlRight, right.x, right.y, right.width, right.height);
        batch.draw(controlUp, jump.x, jump.y, jump.width, jump.height);
      }

      world.getJaxon().inventory.renderItems(batch, width, height, buttonSize * 0.75F);
      font.draw(
          batch,
          "Time: " + (seconds / 10D) + " ticks, FPS: " + Gdx.graphics.getFramesPerSecond(),
          0,
          height - 10);
    }
    batch.end();
  }
コード例 #2
0
 public void draw(
     TextureRegion tr,
     float width,
     float height,
     float origX,
     float origY,
     float x,
     float y,
     float rot,
     Color tint) {
   setTint(tint);
   if (tr instanceof TextureAtlas.AtlasRegion) {
     myTextureChecker.onReg((TextureAtlas.AtlasRegion) tr);
   } else {
     throw new AssertionError("Unexpected texture class");
   }
   mySpriteBatch.draw(tr, x - origX, y - origY, origX, origY, width, height, 1, 1, rot);
 }
コード例 #3
0
 private void setTint(Color tint) {
   mySpriteBatch.setColor(tint);
 }
コード例 #4
0
 public void end() {
   myTextureChecker.onEnd();
   mySpriteBatch.end();
 }
コード例 #5
0
 public void begin() {
   mySpriteBatch.begin();
 }
コード例 #6
0
 public void setMtx(Matrix4 mtx) {
   mySpriteBatch.setProjectionMatrix(mtx);
 }
コード例 #7
0
 public void setAdditive(boolean additive) {
   int dstFunc = additive ? GL20.GL_ONE : GL20.GL_ONE_MINUS_SRC_ALPHA;
   mySpriteBatch.setBlendFunction(GL20.GL_SRC_ALPHA, dstFunc);
 }
コード例 #8
0
 public void dispose() {
   mySpriteBatch.dispose();
   myFont.dispose();
 }