示例#1
0
  public void render() {
    ClientOverworldStage cs = (ClientOverworldStage) stage;
    Renderer.translate(-cs.camX, -cs.camY);
    Renderer.addClip(0, 0, 368, 240, true);

    if (FEResources.hasTexture(functionalClassName().toLowerCase() + "_map_idle")) {
      Transform t = new Transform();
      if (sprite.getAnimationName().equals("RIGHT")) {
        t.flipHorizontal();
        t.setTranslation(14, 0); // Why do we have to do this?
      }
      Color mod = new Color(1.0f, 1.0f, 1.0f, 1.0f);
      t.setColor(mod);
      if (moved) {
        sprite.render(x + 1 + rX, y + 1 + rY, renderDepth, t, new ShaderArgs("greyscale"));
      } else {
        ShaderArgs args = PaletteSwapper.setup(this);
        sprite.render(x + 1 + rX, y + 1 + rY, renderDepth, t, args);
      }
    } else {
      Color c = !moved ? new Color(getPartyColor()) : new Color(128, 128, 128);
      Renderer.drawRectangle(
          x + 1 + rX, y + 1 + rY, x + 14 + rX, y + 14 + rY, ClientOverworldStage.UNIT_DEPTH, c);
      Renderer.drawString(
          "default_med",
          name.charAt(0) + "" + name.charAt(1),
          x + 2 + rX,
          y + 1 + rY,
          ClientOverworldStage.UNIT_DEPTH);
    }
    if (rescuedUnit != null) {
      counter += Game.getDeltaSeconds();
      counter %= 1;
      if (counter > 0.5) {
        Renderer.render(rescue, 0, 0, 1, 1, x + 9, y + 7, x + 9 + 8, y + 7 + 8, renderDepth);
      }
    }

    Renderer.removeClip();
    Renderer.translate(cs.camX, cs.camY);
  }
  public void render() {
    int imageW = mug.getImageWidth();
    int imageH = mug.getImageHeight();
    int menuW = this.getWidth();

    Transform t = new Transform();
    if (flip) t.flipHorizontal();
    Renderer.render(
        mug,
        0,
        0,
        1,
        1,
        x + menuW / 2 - imageW / 2,
        y - imageH,
        x + menuW / 2 + imageW / 2,
        y,
        renderDepth,
        t);
    super.render();
  }