Class GameScreenSpriteHelper

java.lang.Object
games.stendhal.client.GameScreenSpriteHelper

public class GameScreenSpriteHelper extends Object
Some GameScreen methods that can be accessed by individual sprites.
  • Method Details

    • get

      public static GameScreenSpriteHelper get()
      Retrieves the singleton instance.
    • getScreenViewX

      public static int getScreenViewX()
      Gets the view X screen coordinate.
      Returns:
      The X coordinate of the left side.
    • getScreenViewY

      public static int getScreenViewY()
      Gets the view Y screen coordinate.
      Returns:
      The Y coordinate of the left side.
    • convertWorldToPixelUnits

      public static int convertWorldToPixelUnits(double w)
      Convert a world unit value to pixel units.
      Parameters:
      w - World value.
      Returns:
      A screen value (in pixels).
    • convertWorldXToScaledScreen

      public static int convertWorldXToScaledScreen(double x)
      Convert a world x coordinate to raw (native resolution) screen x coordinate.
      Parameters:
      x - World X coordinate.
      Returns:
      Pixel X coordinate on the screen.
    • convertWorldYToScaledScreen

      public static int convertWorldYToScaledScreen(double y)
      Convert a world y coordinate to raw (native resolution) screen y coordinate.
      Parameters:
      y - World Y coordinate.
      Returns:
      Pixel Y coordinate on the screen.
    • keepSpriteOnMapX

      public static int keepSpriteOnMapX(Sprite sprite, int sx)
      Try to keep a sprite on the map. Adjust the X coordinate.
      Parameters:
      sprite - Sprite to keep on the map.
      sx - Suggested X coordinate on screen.
      Returns:
      New X coordinate.
    • keepSpriteOnMapY

      public static int keepSpriteOnMapY(Sprite sprite, int sy)
      Try to keep a sprite on the map. Adjust the Y coordinate.
      Parameters:
      sprite - Sprite to keep on the map.
      sy - Suggested Y coordinate on screen.
      Returns:
      New Y coordinate.
    • findFreeTextBoxPosition

      public static int findFreeTextBoxPosition(Sprite sprite, int x, int sy)
      Adjust the position of boxes placed at the same point to make it clear for the player there are more than one.
      Parameters:
      sprite -
      x -
      sy -