Exemple #1
0
  @Override
  public void render(float delta) {
    // scale from 1600x900 to whatever user screen is set to and clear graphics
    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

    // translate sprite batch like camera
    Point2F offsetPoint = Camera.getDefault().getTranslatedMatrix();
    engine.gameBatch.setProjectionMatrix(
        engine.gameBatch.getProjectionMatrix().translate(offsetPoint.x, offsetPoint.y, 0));

    //        engine.gameBatch.setShader(shader);

    engine.gameBatch.begin(); // start render
    //        shader.begin(); // Bind before the shader begins

    currentLevel.render(engine.gameBatch);

    //        shader.end();
    engine.gameBatch.end(); // end render

    engine.guiBatch.begin();
    fog.render(engine.guiBatch, 0, 0);
    GUI.render(engine.guiBatch);
    engine.guiBatch.end();
  }
Exemple #2
0
  public void render(SpriteBatch g) {
    if (onGround || thrown || dropped) {
      Point2F p = Globals.toIsoCoord(getX(), getY());
      if (dropped || thrown) {
        p.y += z;
      }

      g.setColor(drawColor);
      groundSprite.render(g, p.x, p.y);
      g.setColor(Color.WHITE);
    } else {
      System.out.println(
          "WARNING "
              + name
              + " is out of state! A inventory item is being drawn like a floor item.");
    }
  }