Module technology.sola.engine
Class SpriteGuiElement
java.lang.Object
technology.sola.engine.graphics.gui.GuiElement<BaseStyles,SpriteGuiElement>
technology.sola.engine.graphics.gui.elements.SpriteGuiElement
SpriteGuiElement is a
GuiElement
that renders a sprite from a SpriteSheet
in a GUI. It does not
render child elements.-
Field Summary
Fields inherited from class technology.sola.engine.graphics.gui.GuiElement
children, contentBounds, styleContainer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappendChildren
(GuiElement<?, ?>... children) ImageGuiElement does not render children so this method will do nothing.@Nullable GuiElementDimensions
Calculates content dimensions for this element.@Nullable String
List<GuiElement<?,
?>> ImageGuiElement does not render children so this method will return an empty List.@Nullable String
boolean
ImageGuiElement is not focusable so this will return false.removeChild
(GuiElement<?, ?> child) ImageGuiElement does not render children so this method will do nothing.void
renderContent
(Renderer renderer) Method to render the main content of the gui element (not borders, backgrounds, etc.).setAssetId
(String assetId) Sets the id of theSpriteSheet
asset to be rendered.setSpriteId
(String spriteId) Sets the id of the sprite within theSpriteSheet
to be rendered.Methods inherited from class technology.sola.engine.graphics.gui.GuiElement
addStyle, addStyle, addStyles, events, findElementById, findElementsByType, findFocussedChildIndex, getAssetLoaderProvider, getBounds, getContentBounds, getFocusableChildren, getId, getParent, invalidateLayout, isActive, isFocussed, isHovered, isLayoutChanged, render, renderChildren, requestFocus, setId, styles
-
Constructor Details
-
SpriteGuiElement
public SpriteGuiElement()
-
-
Method Details
-
renderContent
Description copied from class:GuiElement
Method to render the main content of the gui element (not borders, backgrounds, etc.).- Specified by:
renderContent
in classGuiElement<BaseStyles,
SpriteGuiElement> - Parameters:
renderer
- theRenderer
instance
-
calculateContentDimensions
Description copied from class:GuiElement
Calculates content dimensions for this element. If its dimensions are derived from only its children then it should return null.- Specified by:
calculateContentDimensions
in classGuiElement<BaseStyles,
SpriteGuiElement> - Returns:
- the dimensions of the content of this element or null if only children dimensions matter
-
isFocusable
public boolean isFocusable()ImageGuiElement is not focusable so this will return false.- Overrides:
isFocusable
in classGuiElement<BaseStyles,
SpriteGuiElement> - Returns:
- false
-
appendChildren
ImageGuiElement does not render children so this method will do nothing.- Overrides:
appendChildren
in classGuiElement<BaseStyles,
SpriteGuiElement> - Parameters:
children
- the child elements that will not be added- Returns:
- this
-
removeChild
ImageGuiElement does not render children so this method will do nothing.- Overrides:
removeChild
in classGuiElement<BaseStyles,
SpriteGuiElement> - Parameters:
child
- the child element that will not be removed- Returns:
- this
-
getChildren
ImageGuiElement does not render children so this method will return an empty List.- Overrides:
getChildren
in classGuiElement<BaseStyles,
SpriteGuiElement> - Returns:
- empty List
-
getAssetId
- Returns:
- the id of the
SpriteSheet
asset to be rendered
-
setAssetId
Sets the id of theSpriteSheet
asset to be rendered.- Parameters:
assetId
- the new asset id of the image- Returns:
- this
-
getSpriteId
- Returns:
- the id of the sprite within the
SpriteSheet
to be rendered.
-
setSpriteId
Sets the id of the sprite within theSpriteSheet
to be rendered.- Parameters:
spriteId
- the sprite id to be rendered- Returns:
- this
-