Class AnimationObject
java.lang.Object
com.iragui.objects.GUIObject
com.iragui.objects.AnimationObject
- Direct Known Subclasses:
ButtonObject
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.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionAnimationObject
(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 newAnimationObject
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Destroys this animation and all of its frames.boolean
Returns whether any frame in this animation has been marked as visible.int
getFrame()
Returns the current frame index.Returns all frames of this animation.boolean
Returns whether the current frame is visible.void
hide()
Hides all frames and marks the animation as not visible.void
setFrame
(int frame) Sets the active frame index.void
setLayer
(int layer) Sets the rendering layer and updates parent GUI ordering.void
setLimitX
(int x) void
setLimitY
(int y) void
setMinX
(int x) void
setMinY
(int y) void
Makes the current frame visible.void
setWinLimitX
(int x) void
setWinLimitY
(int y) void
setWinMinX
(int x) void
setWinMinY
(int y) void
setX
(int x) Sets the X position of this object and all frames.void
setY
(int y) Sets the Y position of this object and all frames.Methods inherited from class com.iragui.objects.GUIObject
allowReTexture, focus, getGlPixelInt, getHFlip, getLayer, getLimitX, getLimitY, getMinX, getMinY, getRotation, getScale, getSizeX, getSizeY, getTextureID, getVFlip, getWinLimitX, getWinLimitY, getWinMinX, getWinMinY, getX, getY, includesKeyCallback, includesMouseCallback, interactionInVisibleBounds, isDestroyed, isFocused, isNearestFilter, render, resetTextureID, sendKey, sendMouseButton, sendMousePos, sendMouseScroll, setAll, setAll, setHFlip, setNearestFilter, setPixel, setPreserveTextureIDOverride, setRotation, setScale, setTextureID, setVFlip, unfocus, update, updates
-
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 newAnimationObject
.- Parameters:
name
- object namelayer
- rendering layergui
- parent GUIx
- X positiony
- Y positionsizeX
- width in pixelssizeY
- height in pixelsnearestFilter
- whether to use nearest-neighbor filteringrgba
- whether the image has an alpha channelupdates
- whether this object should be updatedincludeKeyCallback
- whether to receive key input callbacksincludeMouseCallback
- whether to receive mouse input callbacksimages
- the sequence of frames for this animation
-
-
Method Details
-
destroyObject
public void destroyObject()Destroys this animation and all of its frames.- Overrides:
destroyObject
in classGUIObject
-
setX
-
setY
-
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
-
setWinLimitX
public void setWinLimitX(int x) - Overrides:
setWinLimitX
in classGUIObject
-
setWinLimitY
public void setWinLimitY(int y) - Overrides:
setWinLimitY
in classGUIObject
-
setWinMinX
public void setWinMinX(int x) - Overrides:
setWinMinX
in classGUIObject
-
setWinMinY
public void setWinMinY(int y) - Overrides:
setWinMinY
in classGUIObject
-
setLimitX
-
setLimitY
-
setMinX
-
setMinY
-
setVisible
public void setVisible()Makes the current frame visible. Sets the flag that any frame is visible.- Overrides:
setVisible
in classGUIObject
-
hide
-
getVisible
public boolean getVisible()Returns whether the current frame is visible.- Overrides:
getVisible
in classGUIObject
- 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
Returns all frames of this animation.- Returns:
- map of frame index to
WrappedBufferedImage
-