コード例 #1
0
ファイル: GameScreen.java プロジェクト: TeamSweepy/Greywater
  @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();
  }
コード例 #2
0
ファイル: Item.java プロジェクト: TeamSweepy/Greywater
 /**
  * Finds if given point is within current image's bounding box, meant for Ziga to override for
  * items
  */
 @Override
 protected boolean didPointHitImage(Point2F point) {
   Point2F p = Globals.toIsoCoord(getX(), getY());
   return groundSprite
       .getImageRectangleAtOrigin(
           p.x + mainCamera.xOffsetAggregate, p.y + mainCamera.yOffsetAggregate)
       .contains(point.x, point.y);
 }
コード例 #3
0
ファイル: Item.java プロジェクト: TeamSweepy/Greywater
  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.");
    }
  }