@Override public void renderImage( @Nonnull final Graphics g, final int x, final int y, final int w, final int h, final int srcX, final int srcY, final int srcW, final int srcH, @Nonnull final Color color, final float scale, final int centerX, final int centerY) { final int scaledWidth = Math.round(w * scale); final int scaledHeight = Math.round(h * scale); final int fixedX = x + Math.round((w - scaledWidth) * ((float) centerX / (float) w)); final int fixedY = y + Math.round((h - scaledHeight) * ((float) centerY / (float) h)); if (isOnMapArea()) { final int offsetX = (FastMath.sqrt(FastMath.sqr(currentDeltaX) / 2) * -FastMath.sign(currentDeltaX)) + (FastMath.sqrt(FastMath.sqr(currentDeltaY) / 2) * -FastMath.sign(currentDeltaY)); final int offsetY = (FastMath.sqrt(FastMath.sqr(currentDeltaX) / 2) * FastMath.sign(currentDeltaX)) + (FastMath.sqrt(FastMath.sqr(currentDeltaY) / 2) * -FastMath.sign(currentDeltaY)); final Color renderColor; if (available) { renderColor = POINTER_COLOR; } else { renderColor = color; } g.drawTexture( pointSprite.getFrame(0), fixedX - offsetX, fixedY - offsetY, scaledWidth, scaledHeight, srcX, srcY, srcW, srcH, centerX - fixedX, centerY - fixedY, 0.f, renderColor); } }
@Override public void renderImage( @Nonnull final Graphics g, final int x, final int y, final int width, final int height, @Nonnull final Color color, final float imageScale) { renderImage( g, x, y, width, height, 0, 0, pointSprite.getWidth(), pointSprite.getHeight(), color, imageScale, pointSprite.getWidth() / 2, pointSprite.getHeight() / 2); }
@Override public int getHeight() { return pointSprite.getHeight(); }
@Override public int getWidth() { return pointSprite.getWidth(); }