java.lang.Object
technology.sola.engine.graphics.gui.GuiDocument
GuiDocument is a container for
GuiElement
that also handles passing various key and mouse events to the
currently active root element set via setRootElement(GuiElement)
.-
Constructor Summary
ConstructorsConstructorDescriptionGuiDocument
(SolaPlatform platform, AssetLoaderProvider assetLoaderProvider, MouseInput mouseInput) Creates a new GuiDocument instance, registering listeners for key and mouse related events. -
Method Summary
Modifier and TypeMethodDescription<T extends GuiElement<?,
?>>
TfindElementById
(String id, Class<T> elementClass) Searches the document for aGuiElement
with the desired id.boolean
isFocussed
(GuiElement<?, ?> guiElement) Checks to see if aGuiElement
currently has focus.void
Renders the root element to theRenderer
.void
requestFocus
(GuiElement<?, ?> guiElement) Gives the desiredGuiElement
focus.void
setRootElement
(GuiElement<?, ?> rootEle) Sets the current root element that is used for rendering and receiving events to the desiredGuiElement
.
-
Constructor Details
-
GuiDocument
public GuiDocument(SolaPlatform platform, AssetLoaderProvider assetLoaderProvider, MouseInput mouseInput) Creates a new GuiDocument instance, registering listeners for key and mouse related events.- Parameters:
platform
- theSolaPlatform
assetLoaderProvider
- theAssetLoaderProvider
mouseInput
- theMouseInput
-
-
Method Details
-
setRootElement
Sets the current root element that is used for rendering and receiving events to the desiredGuiElement
. Also updates the currently focussed element.- Parameters:
rootEle
- the new root element
-
findElementById
Searches the document for aGuiElement
with the desired id.- Type Parameters:
T
- the type of the element- Parameters:
id
- the id of the elementelementClass
- the class of the element- Returns:
- the element
-
isFocussed
Checks to see if aGuiElement
currently has focus.- Parameters:
guiElement
- the element to check- Returns:
- true if the element is currently focussed
-
requestFocus
Gives the desiredGuiElement
focus.- Parameters:
guiElement
- the new element to be focussed
-
render
Renders the root element to theRenderer
.- Parameters:
renderer
- the renderer
-