Class AnimationObject

java.lang.Object
com.iragui.objects.GUIObject
com.iragui.objects.AnimationObject
Direct Known Subclasses:
ButtonObject

public abstract class AnimationObject extends GUIObject
Abstract GUI object that displays an animated sequence of WrappedBufferedImage frames.

The current frame can be switched using setFrame(int), and visibility is handled per-frame while respecting the animation’s overall visibility state.

  • Constructor Details

    • AnimationObject

      public AnimationObject(String name, int layer, GUI gui, int x, int y, int sizeX, int sizeY, boolean nearestFilter, boolean rgba, boolean updates, boolean includeKeyCallback, boolean includeMouseCallback, WrappedBufferedImage[] images)
      Constructs a new AnimationObject.
      Parameters:
      name - object name
      layer - rendering layer
      gui - parent GUI
      x - X position
      y - Y position
      sizeX - width in pixels
      sizeY - height in pixels
      nearestFilter - whether to use nearest-neighbor filtering
      rgba - whether the image has an alpha channel
      updates - whether this object should be updated
      includeKeyCallback - whether to receive key input callbacks
      includeMouseCallback - whether to receive mouse input callbacks
      images - the sequence of frames for this animation
  • Method Details

    • destroyObject

      public void destroyObject()
      Destroys this animation and all of its frames.
      Overrides:
      destroyObject in class GUIObject
    • setX

      public void setX(int x)
      Sets the X position of this object and all frames.
      Overrides:
      setX in class GUIObject
      Parameters:
      x - new X position
    • setY

      public void setY(int y)
      Sets the Y position of this object and all frames.
      Overrides:
      setY in class GUIObject
      Parameters:
      y - new Y position
    • getFrame

      public int getFrame()
      Returns the current frame index.
      Returns:
      current frame
    • setFrame

      public void setFrame(int frame)
      Sets the active frame index. All other frames are hidden.
      Parameters:
      frame - frame index to display
    • setLayer

      public void setLayer(int layer)
      Sets the rendering layer and updates parent GUI ordering.
      Overrides:
      setLayer in class GUIObject
    • setWinLimitX

      public void setWinLimitX(int x)
      Overrides:
      setWinLimitX in class GUIObject
    • setWinLimitY

      public void setWinLimitY(int y)
      Overrides:
      setWinLimitY in class GUIObject
    • setWinMinX

      public void setWinMinX(int x)
      Overrides:
      setWinMinX in class GUIObject
    • setWinMinY

      public void setWinMinY(int y)
      Overrides:
      setWinMinY in class GUIObject
    • setLimitX

      public void setLimitX(int x)
      Overrides:
      setLimitX in class GUIObject
    • setLimitY

      public void setLimitY(int y)
      Overrides:
      setLimitY in class GUIObject
    • setMinX

      public void setMinX(int x)
      Overrides:
      setMinX in class GUIObject
    • setMinY

      public void setMinY(int y)
      Overrides:
      setMinY in class GUIObject
    • setVisible

      public void setVisible()
      Makes the current frame visible. Sets the flag that any frame is visible.
      Overrides:
      setVisible in class GUIObject
    • hide

      public void hide()
      Hides all frames and marks the animation as not visible.
      Overrides:
      hide in class GUIObject
    • getVisible

      public boolean getVisible()
      Returns whether the current frame is visible.
      Overrides:
      getVisible in class GUIObject
      Returns:
      true if the current frame is visible
    • getAnyFrameVisible

      public boolean getAnyFrameVisible()
      Returns whether any frame in this animation has been marked as visible.
      Returns:
      true if any frame is visible
    • getFrames

      public TreeMap<Integer, WrappedBufferedImage> getFrames()
      Returns all frames of this animation.
      Returns:
      map of frame index to WrappedBufferedImage