From 2a20cadb217a22a698a13c6f38bb355f58569b7f Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Tue, 31 Oct 2023 00:59:58 -0700 Subject: [PATCH] Java client: Adjust emoji position for scaling https://sourceforge.net/p/arianne/bugs/5999/ --- .../stendhal/client/gui/j2d/RemovableSprite.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/games/stendhal/client/gui/j2d/RemovableSprite.java b/src/games/stendhal/client/gui/j2d/RemovableSprite.java index f654f22ecd6..b8fcc3081fe 100755 --- a/src/games/stendhal/client/gui/j2d/RemovableSprite.java +++ b/src/games/stendhal/client/gui/j2d/RemovableSprite.java @@ -15,6 +15,7 @@ import java.awt.Graphics; import java.awt.Rectangle; +import games.stendhal.client.GameScreen; import games.stendhal.client.GameScreenSpriteHelper; import games.stendhal.client.entity.Entity; import games.stendhal.client.sprite.Sprite; @@ -137,8 +138,15 @@ private void drawAttached(final Graphics g) { public void drawEmoji(final Graphics g) { final int svx = GameScreenSpriteHelper.getScreenViewX(); final int svy = GameScreenSpriteHelper.getScreenViewY(); - final int sx = GameScreenSpriteHelper.convertWorldToPixelUnits(owner.getX()); - final int sy = GameScreenSpriteHelper.convertWorldToPixelUnits(owner.getY()); + int sx; + int sy; + if (GameScreen.get().isScaled()) { + sx = GameScreenSpriteHelper.convertWorldXToScaledScreen(owner.getX()); + sy = GameScreenSpriteHelper.convertWorldYToScaledScreen(owner.getY()); + } else { + sx = GameScreenSpriteHelper.convertWorldToPixelUnits(owner.getX()); + sy = GameScreenSpriteHelper.convertWorldToPixelUnits(owner.getY()); + } sprite.draw(g, sx - svx - 16, sy - svy - 32); }