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 GuiElementDimensionsCalculates content dimensions for this element.@Nullable String@Nullable StringbooleanImageGuiElement is not focusable so this will return false.removeChild(GuiElement<?, ?> child) ImageGuiElement does not render children so this method will do nothing.voidrenderContent(Renderer renderer) Method to render the main content of the gui element (not borders, backgrounds, etc.).self()setAssetId(String assetId) Sets the id of theSpriteSheetasset to be rendered.setSpriteId(String spriteId) Sets the id of the sprite within theSpriteSheetto 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, isAttached, isFocussed, isHovered, isLayoutChanged, render, renderChildren, requestFocus, setId, setVirtualKeyboardVisible, styles
-
Constructor Details
-
SpriteGuiElement
public SpriteGuiElement()
-
-
Method Details
-
renderContent
Description copied from class:GuiElementMethod to render the main content of the gui element (not borders, backgrounds, etc.).- Specified by:
renderContentin classGuiElement<BaseStyles,SpriteGuiElement> - Parameters:
renderer- theRendererinstance
-
calculateContentDimensions
Description copied from class:GuiElementCalculates content dimensions for this element. If its dimensions are derived from only its children then it should return null.- Specified by:
calculateContentDimensionsin classGuiElement<BaseStyles,SpriteGuiElement> - Returns:
- the dimensions of the content of this element or null if only children dimensions matter
-
self
- Specified by:
selfin classGuiElement<BaseStyles,SpriteGuiElement> - Returns:
- A correctly typed reference to this
GuiElement
-
isFocusable
public boolean isFocusable()ImageGuiElement is not focusable so this will return false.- Overrides:
isFocusablein classGuiElement<BaseStyles,SpriteGuiElement> - Returns:
- false
-
appendChildren
ImageGuiElement does not render children so this method will do nothing.- Overrides:
appendChildrenin 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:
removeChildin classGuiElement<BaseStyles,SpriteGuiElement> - Parameters:
child- the child element that will not be removed- Returns:
- this
-
getAssetId
- Returns:
- the id of the
SpriteSheetasset to be rendered
-
setAssetId
Sets the id of theSpriteSheetasset to be rendered.- Parameters:
assetId- the new asset id of the image- Returns:
- this
-
getSpriteId
- Returns:
- the id of the sprite within the
SpriteSheetto be rendered.
-
setSpriteId
Sets the id of the sprite within theSpriteSheetto be rendered.- Parameters:
spriteId- the sprite id to be rendered- Returns:
- this
-