Package tripleplay.ui
Class Interface
java.lang.Object
tripleplay.ui.Interface
- All Implemented Interfaces:
AutoCloseable
,react.Closeable
The main class that integrates the Triple Play UI with a PlayN game. This class is mainly
necessary to automatically validate hierarchies of
Element
s during each paint.
Create an interface instance, create Root
groups via the interface and add the
Element.layer
s into your scene graph wherever you desire.-
Nested Class Summary
Nested classes/interfaces inherited from interface react.Closeable
react.Closeable.Set, react.Closeable.Util
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<R extends Root>
RaddRoot
(R root) Adds a root to this interface.void
close()
createRoot
(Layout layout, Stylesheet sheet) Creates a root element with the specified layout and stylesheet.createRoot
(Layout layout, Stylesheet sheet, GroupLayer parent) Creates a root element with the specified layout and stylesheet and adds its layer to the specified parent.boolean
disposeRoot
(Root root) Removes the supplied root element from this interface and disposes its layer, iff it's currently added.void
Removes and disposes all roots in this interface.boolean
removeRoot
(Root root) Removes the supplied root element from this interface, iff it's currently added.roots()
Returns an iterable over the current roots.
-
Field Details
-
plat
The platform in which this interface is operating. -
frame
A signal emitted just before we render a frame. -
anim
An animator that can be used to animate things in this interface.
-
-
Constructor Details
-
Interface
Creates an interface forplat
. The interface will be connected toframe
to drive any per-frame animations and activity. Either provide a frame signal whose lifetime is the same as the interface (for exampleScreen.paint
), or callclose()
when this interface should be disconnected from the frame signal.
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacereact.Closeable
-
roots
Returns an iterable over the current roots. Don't delete from this iterable! -
createRoot
Creates a root element with the specified layout and stylesheet. -
createRoot
Creates a root element with the specified layout and stylesheet and adds its layer to the specified parent. -
addRoot
Adds a root to this interface. The root must have been created with this interface and not be added to any other interfaces. Generally you should usecreateRoot(tripleplay.ui.Layout, tripleplay.ui.Stylesheet)
, but this method is exposed for callers with special needs. -
removeRoot
Removes the supplied root element from this interface, iff it's currently added. If the root's layer has a parent, the layer will be removed from the parent as well. This leaves the Root's layer in existence, so it may be used again. If you're done with the Root and all of the elements inside of it, calldisposeRoot(tripleplay.ui.Root)
to free its resources.- Returns:
- true if the root was removed, false if it was not currently added.
-
disposeRoot
Removes the supplied root element from this interface and disposes its layer, iff it's currently added. Disposing the layer disposes the layers of all elements contained in the root as well. Use this method if you're done with the Root. If you'd like to reuse it, callremoveRoot(tripleplay.ui.Root)
instead.- Returns:
- true if the root was removed and disposed, false if it was not currently added.
-
disposeRoots
public void disposeRoots()Removes and disposes all roots in this interface.
-