示例#1
0
  /**
   * Get the intepolated colour at the given location on the gradient
   *
   * @param p The point of the gradient (0 >= n >= 1)
   * @return The interpolated colour at the given location
   */
  public Color getColorAt(float p) {
    if (p <= 0) return steps.get(0).col;
    if (p > 1) return steps.get(steps.size() - 1).col;

    for (int i = 1; i < steps.size(); i++) {
      Step prev = (steps.get(i - 1));
      Step current = (steps.get(i));

      if (p <= current.location) {
        float dis = current.location - prev.location;
        p -= prev.location;
        float v = p / dis;

        Color c = new Color(1, 1, 1, 1);
        c.a = (prev.col.a * (1 - v)) + (current.col.a * (v));
        c.r = (prev.col.r * (1 - v)) + (current.col.r * (v));
        c.g = (prev.col.g * (1 - v)) + (current.col.g * (v));
        c.b = (prev.col.b * (1 - v)) + (current.col.b * (v));

        return c;
      }
    }

    // shouldn't ever happen
    return Color.black;
  }
示例#2
0
 private Color ret(Color dst, int r, int g, int b, int a) {
   dst.r = r / 255.0f;
   dst.g = g / 255.0f;
   dst.b = b / 255.0f;
   dst.a = a / 255.0f;
   return dst;
 }
 /** @see org.newdawn.slick.BasicGame#update(org.newdawn.slick.GameContainer, int) */
 public void update(GameContainer container, int delta) {
   int mx = container.getInput().getMouseX();
   int my = container.getInput().getMouseY();
   try {
     Color c = image.getColor(mx, my);
     System.out.println(c.getRed() + " " + c.getBlue() + " " + c.getGreen());
   } catch (Exception e) {
   }
 }
示例#4
0
 public static void visualSeekColors(
     Color currentColor,
     float targetR,
     float targetG,
     float targetB,
     float currentStep,
     float stepCount) {
   currentColor.r += ((targetR - currentColor.r) * currentStep) / stepCount;
   currentColor.g += ((targetG - currentColor.g) * currentStep) / stepCount;
   currentColor.b += ((targetB - currentColor.b) * currentStep) / stepCount;
 }
示例#5
0
 /** Generate the image used for texturing the gradient across shapes */
 public void genImage() {
   if (image == null) {
     ImageBuffer buffer = new ImageBuffer(128, 16);
     for (int i = 0; i < 128; i++) {
       Color col = getColorAt(i / 128.0f);
       for (int j = 0; j < 16; j++)
         buffer.setRGBA(
             i, j, col.getRedByte(), col.getGreenByte(), col.getBlueByte(), col.getAlphaByte());
     }
     image = buffer.getImage();
   }
 }
示例#6
0
  public void update(final GameContainer c, final int delta) {
    if (!active) {
      return;
    }

    final int centerX = c.getWidth() >> 1;
    final int centerY = c.getHeight() >> 1;

    final int offX = (centerX - origin.getDcX()) + dX;
    final int offY = (centerY - origin.getDcY()) + dY;

    final Avatar av = World.getAvatar();
    if (av != null) {
      glueAvatarToOrigin(av);
      corridor.setCorridor(av);
    }

    Camera.getInstance().setViewport(-offX, -offY, c.getWidth(), c.getHeight());
    Camera.getInstance().clearDirtyAreas();

    if (legacyRendering) {
      Camera.getInstance().markEverythingDirty();
    }

    synchronized (display) {
      for (final Rectangle rect : removedAreaList) {
        Camera.getInstance().markAreaDirty(rect);
      }
      synchronized (GameMap.LIGHT_LOCK) {
        while (true) {
          final MapInteractionEvent event = eventQueue.poll();
          if (event == null) {
            break;
          }

          for (int i = display.size() - 1; i >= 0; i--) {
            if (display.get(i).processEvent(c, delta, event)) {
              break;
            }
          }
        }

        // update the items
        for (int i = 0, displaySize = display.size(); i < displaySize; i++) {
          display.get(i).update(c, delta);
        }
      }
    }

    if (fadeOutColor.getAlpha() > 0) {
      fadeOutColor.a = AnimationUtility.approach(fadeOutColor.getAlpha(), 0, 0, 255, delta) / 255.f;
    }
  }
示例#7
0
    public void Render(Coord dc) {
      double t = (float) (System.currentTimeMillis() - start_time) / (float) LIFE_TIME;
      int a = FlyParam.GetAlpha(t);
      int dy = FlyParam.GetY(t);
      Color c = getColor();

      Render2D.Text(
          "default",
          dc.x - Render2D.GetTextWidth("default", msg) / 2,
          dc.y - dy - 85,
          msg,
          new Color(c.getRed(), c.getGreen(), c.getBlue(), a));
    }
示例#8
0
  /** @see AbstractComponent#render(GUIContext, org.newdawn.slick.Graphics) */
  public void render(GUIContext container, Graphics g) {
    if (lastKey != -1) {
      if (input.isKeyDown(lastKey)) {
        if (repeatTimer < System.currentTimeMillis()) {
          repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL;
          keyPressed(lastKey, lastChar);
        }
      } else {
        lastKey = -1;
      }
    }
    Rectangle oldClip = g.getClip();
    g.setWorldClip(x, y, width, height);

    // Someone could have set a color for me to blend...
    Color clr = g.getColor();

    if (background != null) {
      g.setColor(background.multiply(clr));
      g.fillRect(x, y, width, height);
    }
    g.setColor(text.multiply(clr));
    Font temp = g.getFont();

    int cpos = font.getWidth(value.substring(0, cursorPos));
    int tx = 0;
    if (cpos > width) {
      tx = width - cpos - font.getWidth("_");
    }

    g.translate(tx + 2, 0);
    g.setFont(font);
    g.drawString(value, x + 1, y + 1);

    if (hasFocus() && visibleCursor) {
      g.drawString("_", x + 1 + cpos + 2, y + 1);
    }

    g.translate(-tx - 2, 0);

    if (border != null) {
      g.setColor(border.multiply(clr));
      g.drawRect(x, y, width, height);
    }
    g.setColor(clr);
    g.setFont(temp);
    g.clearWorldClip();
    g.setClip(oldClip);
  }
示例#9
0
 public Pause(Font font, int widht, int height) {
   this.height = height;
   this.widht = widht;
   this.font = font;
   colorB = Color.black;
   colorB.a = 0.6f;
   x = widht / 2 - font.getWidth(pause) / 2;
   y = height / 2 - font.getHeight(pause) / 2;
   colorF = Color.white;
 }
示例#10
0
  public void select() {
    text = "" + StaticManager.getScore();
    System.out.println("selecting: " + getId());
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Color c = new Color(getId(), 255, 255, 255);
    c.bind();
    int xoff = 0;
    for (int i = 0; i < text.length(); i++) {
      String subs = text.substring(i, i + 1);
      GL11.glBegin(GL11.GL_QUADS);
      GL11.glVertex2i(getX() + xoff, getY());

      GL11.glVertex2i(getX() + xoff + font[getIndex(subs)].getImageWidth(), getY());

      GL11.glVertex2i(
          getX() + xoff + font[getIndex(subs)].getImageWidth(),
          getY() + font[getIndex(subs)].getImageHeight());

      GL11.glVertex2i(getX() + xoff, getY() + font[getIndex(subs)].getImageHeight());
      GL11.glEnd();
      xoff += font[getIndex(subs)].getImageWidth();
    }
    GL11.glEnable(GL11.GL_TEXTURE_2D);
  }
示例#11
0
 public void bind() {
   color.bind();
 }
示例#12
0
  @Override
  public void draw(Graphics g, int trackPosition) {
    int timeDiff = hitObject.getTime() - trackPosition;
    float scale = timeDiff / (float) game.getApproachTime();
    float fadeinScale = (timeDiff - game.getApproachTime() + FADE_IN_TIME) / (float) FADE_IN_TIME;
    float approachScale = 1 + scale * 3;
    float alpha = Utils.clamp(1 - fadeinScale, 0, 1);
    boolean overlayAboveNumber = Options.getSkin().isHitCircleOverlayAboveNumber();

    float oldAlpha = Utils.COLOR_WHITE_FADE.a;
    Utils.COLOR_WHITE_FADE.a = color.a = alpha;
    Image hitCircleOverlay = GameImage.HITCIRCLE_OVERLAY.getImage();
    Image hitCircle = GameImage.HITCIRCLE.getImage();
    float[] endPos = curve.pointAt(1);

    curve.draw(color);
    color.a = alpha;

    // end circle
    hitCircle.drawCentered(endPos[0], endPos[1], color);
    hitCircleOverlay.drawCentered(endPos[0], endPos[1], Utils.COLOR_WHITE_FADE);

    // start circle
    hitCircle.drawCentered(x, y, color);
    if (!overlayAboveNumber) hitCircleOverlay.drawCentered(x, y, Utils.COLOR_WHITE_FADE);

    // ticks
    if (ticksT != null) {
      Image tick = GameImage.SLIDER_TICK.getImage();
      for (int i = 0; i < ticksT.length; i++) {
        float[] c = curve.pointAt(ticksT[i]);
        tick.drawCentered(c[0], c[1], Utils.COLOR_WHITE_FADE);
      }
    }
    if (sliderClickedInitial) ; // don't draw current combo number if already clicked
    else
      data.drawSymbolNumber(
          hitObject.getComboNumber(),
          x,
          y,
          hitCircle.getWidth() * 0.40f / data.getDefaultSymbolImage(0).getHeight(),
          alpha);
    if (overlayAboveNumber) hitCircleOverlay.drawCentered(x, y, Utils.COLOR_WHITE_FADE);

    // repeats
    for (int tcurRepeat = currentRepeats; tcurRepeat <= currentRepeats + 1; tcurRepeat++) {
      if (hitObject.getRepeatCount() - 1 > tcurRepeat) {
        Image arrow = GameImage.REVERSEARROW.getImage();
        if (tcurRepeat != currentRepeats) {
          if (sliderTime == 0) continue;
          float t = Math.max(getT(trackPosition, true), 0);
          arrow.setAlpha((float) (t - Math.floor(t)));
        } else arrow.setAlpha(1f);
        if (tcurRepeat % 2 == 0) {
          // last circle
          arrow.setRotation(curve.getEndAngle());
          arrow.drawCentered(endPos[0], endPos[1]);
        } else {
          // first circle
          arrow.setRotation(curve.getStartAngle());
          arrow.drawCentered(x, y);
        }
      }
    }

    if (timeDiff >= 0) {
      // approach circle
      GameImage.APPROACHCIRCLE.getImage().getScaledCopy(approachScale).drawCentered(x, y, color);
    } else {
      // Since update() might not have run before drawing during a replay, the
      // slider time may not have been calculated, which causes NAN numbers and flicker.
      if (sliderTime == 0) return;

      float[] c = curve.pointAt(getT(trackPosition, false));
      float[] c2 = curve.pointAt(getT(trackPosition, false) + 0.01f);

      float t = getT(trackPosition, false);
      //			float dis = hitObject.getPixelLength() * HitObject.getXMultiplier() * (t - (int) t);
      //			Image sliderBallFrame = sliderBallImages[(int) (dis / (diameter * Math.PI) * 30) %
      // sliderBallImages.length];
      Image sliderBallFrame =
          sliderBallImages[(int) (t * sliderTime * 60 / 1000) % sliderBallImages.length];
      float angle = (float) (Math.atan2(c2[1] - c[1], c2[0] - c[0]) * 180 / Math.PI);
      sliderBallFrame.setRotation(angle);
      sliderBallFrame.drawCentered(c[0], c[1]);

      // follow circle
      if (followCircleActive) {
        GameImage.SLIDER_FOLLOWCIRCLE.getImage().drawCentered(c[0], c[1]);

        // "flashlight" mod: dim the screen
        if (GameMod.FLASHLIGHT.isActive()) {
          float oldAlphaBlack = Utils.COLOR_BLACK_ALPHA.a;
          Utils.COLOR_BLACK_ALPHA.a = 0.75f;
          g.setColor(Utils.COLOR_BLACK_ALPHA);
          g.fillRect(0, 0, containerWidth, containerHeight);
          Utils.COLOR_BLACK_ALPHA.a = oldAlphaBlack;
        }
      }
    }

    Utils.COLOR_WHITE_FADE.a = oldAlpha;
  }
示例#13
0
 public static void visualSeekAlpha(Color currentColor, float targetAlpha, float animationSpeed) {
   currentColor.a += (targetAlpha - currentColor.a) * animationSpeed;
   if (currentColor.a < 0.01f) {
     currentColor.a = 0f;
   }
 }
示例#14
0
  /**
   * @see org.newdawn.slick.svg.inkscape.ElementProcessor#process(org.newdawn.slick.svg.Loader,
   *     org.w3c.dom.Element, org.newdawn.slick.svg.Diagram, org.newdawn.slick.geom.Transform)
   */
  public void process(Loader loader, Element element, Diagram diagram, Transform transform)
      throws ParsingException {
    NodeList patterns = element.getElementsByTagName("pattern");

    for (int i = 0; i < patterns.getLength(); i++) {
      Element pattern = (Element) patterns.item(i);
      NodeList list = pattern.getElementsByTagName("image");
      if (list.getLength() == 0) {
        Log.warn("Pattern 1981 does not specify an image. Only image patterns are supported.");
        continue;
      }
      Element image = (Element) list.item(0);

      String patternName = pattern.getAttribute("id");
      String ref = image.getAttributeNS(Util.XLINK, "href");
      diagram.addPatternDef(patternName, ref);
    }

    NodeList linear = element.getElementsByTagName("linearGradient");
    ArrayList toResolve = new ArrayList();

    for (int i = 0; i < linear.getLength(); i++) {
      Element lin = (Element) linear.item(i);
      String name = lin.getAttribute("id");
      Gradient gradient = new Gradient(name, false);

      gradient.setTransform(Util.getTransform(lin, "gradientTransform"));

      if (stringLength(lin.getAttribute("x1")) > 0) {
        gradient.setX1(Float.parseFloat(lin.getAttribute("x1")));
      }
      if (stringLength(lin.getAttribute("x2")) > 0) {
        gradient.setX2(Float.parseFloat(lin.getAttribute("x2")));
      }
      if (stringLength(lin.getAttribute("y1")) > 0) {
        gradient.setY1(Float.parseFloat(lin.getAttribute("y1")));
      }
      if (stringLength(lin.getAttribute("y2")) > 0) {
        gradient.setY2(Float.parseFloat(lin.getAttribute("y2")));
      }

      String ref = lin.getAttributeNS("http://www.w3.org/1999/xlink", "href");
      if (stringLength(ref) > 0) {
        gradient.reference(ref.substring(1));
        toResolve.add(gradient);
      } else {
        NodeList steps = lin.getElementsByTagName("stop");
        for (int j = 0; j < steps.getLength(); j++) {
          Element s = (Element) steps.item(j);
          float offset = Float.parseFloat(s.getAttribute("offset"));

          String colInt = Util.extractStyle(s.getAttribute("style"), "stop-color");
          String opaInt = Util.extractStyle(s.getAttribute("style"), "stop-opacity");

          int col = Integer.parseInt(colInt.substring(1), 16);
          Color stopColor = new Color(col);
          stopColor.a = Float.parseFloat(opaInt);

          gradient.addStep(offset, stopColor);
        }

        gradient.getImage();
      }

      diagram.addGradient(name, gradient);
    }

    NodeList radial = element.getElementsByTagName("radialGradient");
    for (int i = 0; i < radial.getLength(); i++) {
      Element rad = (Element) radial.item(i);
      String name = rad.getAttribute("id");
      Gradient gradient = new Gradient(name, true);

      gradient.setTransform(Util.getTransform(rad, "gradientTransform"));

      if (stringLength(rad.getAttribute("cx")) > 0) {
        gradient.setX1(Float.parseFloat(rad.getAttribute("cx")));
      }
      if (stringLength(rad.getAttribute("cy")) > 0) {
        gradient.setY1(Float.parseFloat(rad.getAttribute("cy")));
      }
      if (stringLength(rad.getAttribute("fx")) > 0) {
        gradient.setX2(Float.parseFloat(rad.getAttribute("fx")));
      }
      if (stringLength(rad.getAttribute("fy")) > 0) {
        gradient.setY2(Float.parseFloat(rad.getAttribute("fy")));
      }
      if (stringLength(rad.getAttribute("r")) > 0) {
        gradient.setR(Float.parseFloat(rad.getAttribute("r")));
      }

      String ref = rad.getAttributeNS("http://www.w3.org/1999/xlink", "href");
      if (stringLength(ref) > 0) {
        gradient.reference(ref.substring(1));
        toResolve.add(gradient);
      } else {
        NodeList steps = rad.getElementsByTagName("stop");
        for (int j = 0; j < steps.getLength(); j++) {
          Element s = (Element) steps.item(j);
          float offset = Float.parseFloat(s.getAttribute("offset"));

          String colInt = Util.extractStyle(s.getAttribute("style"), "stop-color");
          String opaInt = Util.extractStyle(s.getAttribute("style"), "stop-opacity");

          int col = Integer.parseInt(colInt.substring(1), 16);
          Color stopColor = new Color(col);
          stopColor.a = Float.parseFloat(opaInt);

          gradient.addStep(offset, stopColor);
        }

        gradient.getImage();
      }

      diagram.addGradient(name, gradient);
    }

    for (int i = 0; i < toResolve.size(); i++) {
      ((Gradient) toResolve.get(i)).resolve(diagram);
      ((Gradient) toResolve.get(i)).getImage();
    }
  }
示例#15
0
  public void drawChat(int par1) {
    if (this.mc.gameSettings.chatVisibility != 2) {
      byte var2 = 10;
      boolean var3 = false;
      int var4 = 0;
      int var5 = this.chatLines.size();
      float var6 = this.mc.gameSettings.chatOpacity * 0.9F + 0.1F;

      if (var5 > 0) {
        if (this.getChatOpen()) {
          var2 = 20;
          var3 = true;
        }

        int line = 0;
        int var7;
        int var9;
        int var12;
        int c = 0;

        for (var7 = 0; var7 + this.field_73768_d < this.chatLines.size() && var7 < var2; ++var7) {
          ChatLine var8 = (ChatLine) this.chatLines.get(var7 + this.field_73768_d);

          if (var8 != null) {
            var9 = par1 - var8.getUpdatedCounter();

            if (var9 < 200 || var3) {
              double var10 = (double) var9 / 200.0D;
              var10 = 1.0D - var10;
              var10 *= 10.0D;

              if (var10 < 0.0D) {
                var10 = 0.0D;
              }

              if (var10 > 1.0D) {
                var10 = 1.0D;
              }

              var10 *= var10;
              var12 = (int) (255.0D * var10);

              if (var3) {
                var12 = 255;
              }

              var12 = (int) ((float) var12 * var6);
              ++var4;

              if (var12 > 3) {
                c += 1;
                byte var13 = 3;
                int var14 = -var7 * 9;
                line += 9;

                GL11.glEnable(GL11.GL_BLEND);
                String var15 = var8.getChatLineString();

                if (!this.mc.gameSettings.chatColours) {
                  var15 = StringUtils.stripControlCodes(var15);
                }

                if (var12 / 2 << 24 == 33554432) {
                  c -= 1;
                }

                // chong = var12;
              }
            }
          }
        }

        if (c != 0) { // && Pringles.manager.chat.isEnabled()) {
          drawBorderedRect(
              3, 0 - (c * 9 + 7), 327, 0 - (c * 9 - 5), 1, -15658735, true); // , -2146365167);
          TTF.drawShadowString(
              font, "Chat", 5, 2 - (c * 9 + 6), org.newdawn.slick.Color.decode("0xFFFFFF"));
          drawBorderedRect(
              3, -c * 9 + 7, 327, -c * 9 + 12 + line - 2, 1, -15658735, true); // -2146365167);
        }

        for (var7 = 0; var7 + this.field_73768_d < this.chatLines.size() && var7 < var2; ++var7) {
          ChatLine var8 = (ChatLine) this.chatLines.get(var7 + this.field_73768_d);

          if (var8 != null) {
            var9 = par1 - var8.getUpdatedCounter();

            if (var9 < 200 || var3) {
              double var10 = (double) var9 / 200.0D;
              var10 = 1.0D - var10;
              var10 *= 10.0D;

              if (var10 < 0.0D) {
                var10 = 0.0D;
              }

              if (var10 > 1.0D) {
                var10 = 1.0D;
              }

              var10 *= var10;
              var12 = (int) (255.0D * var10);

              if (var3) {
                var12 = 255;
              }

              var12 = (int) ((float) var12 * var6);
              ++var4;

              if (var12 > 3) {
                c += 1;
                byte var13 = 3;
                int var14 = -var7 * 9;
                line += 9;
                // if (!Pringles.manager.chat.isEnabled())
                drawRect(var13, var14 - 1, 327, var14 + 8, var12 / 2 << 24);

                GL11.glEnable(GL11.GL_BLEND);
                String var15 = var8.getChatLineString();

                if (!this.mc.gameSettings.chatColours) {
                  var15 = StringUtils.stripControlCodes(var15);
                }

                if (var12 / 2 << 24 == 33554432) {
                  c -= 1;
                }

                TTF.drawShadowString(
                    font,
                    var15,
                    var13,
                    var14,
                    org.newdawn.slick.Color.decode(
                        "0xFFFFFF")); // 16777215 + org.newdawn.slick.Color((var12 << 24)));
                // chong = var12;
              }
            }
          }
        }
        if (var3) {
          var7 = this.mc.fontRenderer.FONT_HEIGHT;
          GL11.glTranslatef(0.0F, (float) var7, 0.0F);
          int var16 = var5 * var7 + var5;
          var9 = var4 * var7 + var4;
          int var17 = this.field_73768_d * var9 / var5;
          int var11 = var9 * var9 / var16;

          if (var16 != var9) {
            var12 = var17 > 0 ? 170 : 96;
            int var18 = this.field_73769_e ? 13382451 : 3355562;
            drawRect(0, -var17, 2, -var17 - var11, var18 + (var12 << 24));
            drawRect(2, -var17, 1, -var17 - var11, 13421772 + (var12 << 24));
          }
        }
      }
    }
  }
示例#16
0
 public void SetColor(Color refCol) {
   c.a = refCol.a;
   c.r = refCol.r;
   c.g = refCol.g;
   c.b = refCol.b;
 }
示例#17
0
 /**
  * A convenience method to <i>put</i> a given pixel's color using Slick's color class. See the
  * other putPixel method for details.
  *
  * @param rgba the RGBA components of the pixel
  */
 public PixelData putPixel(Color rgba) {
   return putPixel(rgba.getRed(), rgba.getGreen(), rgba.getBlue(), rgba.getAlpha());
 }
示例#18
0
 /**
  * A convenience method to set a given pixel's color using Slick's color class. See the other
  * setPixel method for details.
  *
  * @param x the x position of the pixel
  * @param y the y position of the pixel
  * @param rgba the RGBA components of the pixel
  * @see setPixel(int x, int y, int r, int g, int b, int a)
  */
 public void setPixel(int x, int y, Color rgba) {
   setPixel(x, y, rgba.getRed(), rgba.getGreen(), rgba.getBlue(), rgba.getAlpha());
 }
示例#19
0
 public void bindColor() {
   c.bind();
 }
示例#20
0
 public void setActive(final boolean active) {
   if (!active) {
     fadeOutColor.a = 1.f;
   }
   this.active = active;
 }
示例#21
0
  /**
   * Render all visible map items
   *
   * @param g the graphics component that is used to render the screen
   * @param c the game container the map is rendered in
   */
  public void render(final Graphics g, final GameContainer c) {
    if (!active) {
      return;
    }

    if (legacyRendering) {
      renderImpl(g);
    } else {
      Graphics usedGraphics = g;
      if (gameScreenImage == null) {
        try {
          gameScreenImage = new Image(c.getWidth(), c.getHeight(), SGL.GL_LINEAR);
        } catch (SlickException e) {
          legacyRendering = true;
          LOGGER.warn("Rendering to texture fails. Using legacy direct rendering.");
          render(g, c);
          return;
        }
      }

      try {
        usedGraphics = gameScreenImage.getGraphics();
      } catch (SlickException e) {
        legacyRendering = true;
        LOGGER.warn("Fetching render to texture context failed. Switching to legacy rendering.");
        render(g, c);
        return;
      }

      renderImpl(usedGraphics);

      if (gameScreenImage != null) {
        if (fogShader == null) {
          try {
            fogShader =
                ShaderProgram.loadProgram(
                    "illarion/client/graphics/shader/fog.vert",
                    "illarion/client/graphics/shader/fog.frag");
          } catch (SlickException e) {
            LOGGER.error("Error loading shader!", e);
          }
        }

        if (fogShader != null) {
          fogShader.bind();
          fogShader.setUniform1i("tex0", 0);

          final float x = 0.5f * gameScreenImage.getTextureWidth();
          final float y = 0.5f * gameScreenImage.getTextureHeight();
          fogShader.setUniform2f("center", x, y);
          fogShader.setUniform1f(
              "density",
              World.getWeather().getFog() * ((float) gameScreenImage.getHeight() / 200.f));

          g.drawImage(gameScreenImage, 0, 0);

          fogShader.unbind();
        } else {
          g.drawImage(gameScreenImage, 0, 0);
        }
        Camera.getInstance().renderDebug(g);
      }
    }

    if (fadeOutColor.getAlpha() > 0) {
      g.setColor(fadeOutColor);
      g.setLineWidth(3.f);
      g.fillRect(0, 0, c.getWidth(), c.getHeight());
    }
  }
示例#22
0
 public static void visualSeekColors(
     Color currentColor, float targetR, float targetG, float targetB, float animationSpeed) {
   currentColor.r += (targetR - currentColor.r) * animationSpeed;
   currentColor.g += (targetG - currentColor.g) * animationSpeed;
   currentColor.b += (targetB - currentColor.b) * animationSpeed;
 }
示例#23
0
 public void onLeave() {
   color.a = 0;
   tooltip = false;
 }
示例#24
0
 public void onHover() {
   color.a = .6f;
   tooltip = true;
 }
示例#25
0
 /** Updates enemy's opacity. Enemys opacity is relative to it's healt. */
 private void updateOpacity() {
   healtColor.a = 1 / this.maxHealt * currentHealt;
 }