Package tripleplay.platform
Class TPPlatform
java.lang.Object
tripleplay.platform.TPPlatform
The entry point for per-platform services made available by TriplePlay. This is akin to the
mechanism used by PlayN for its per-platform backends, and must be configured in a similar way.
In your per-platform bootstrap class, you must initialize the appropriate TriplePlay platform
backend if you wish to make use of these services.
public class TripleDemoJava {
public static void main (String[] args) {
JavaPlatform platform = JavaPlatform.register();
JavaTPPlatform.register(platform);
// etc.
}
}
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the currently focused field, if any.createImageOverlay
(Image image) Creates a native text field, if this platform supports it.react.ValueView<Field>
focus()
Gets a view of the Field that is currently in focus.boolean
Returns true if this platform supports native text fields.void
hideNativeOverlays
(pythagoras.f.IRectangle area) Hides the native widgets under the given screen area, using platform clipping if supported.static TPPlatform
instance()
Returns the currently registered TPPlatform instance.react.SignalView<Void>
Signal emitted when the user interacts with a native text field.refresh
(NativeTextField previous) Refreshes a native text field to match the current styles of its associated field instance.void
Updates the bounds of all known native fields.void
Sets the instance of KeyboardFocusController to use for keyboard focus management, or null for none.
-
Constructor Details
-
TPPlatform
public TPPlatform()
-
-
Method Details
-
instance
Returns the currently registered TPPlatform instance. -
hasNativeTextFields
public boolean hasNativeTextFields()Returns true if this platform supports native text fields. -
createNativeTextField
Creates a native text field, if this platform supports it. If the platform requires it, the field's styles may be resolved at this time.- Throws:
UnsupportedOperationException
- thrown if the platform lacks support for native text fields, usehasNativeTextFields()
to check.
-
refresh
Refreshes a native text field to match the current styles of its associated field instance. Depending on the implementation, a new native field may be returned, or the given one adjusted. -
setKeyboardFocusController
Sets the instance of KeyboardFocusController to use for keyboard focus management, or null for none. -
keyboardActivity
Signal emitted when the user interacts with a native text field. This allows games to qualify native text field usage as non-idle user behavior. -
createImageOverlay
-
focus
Gets a view of the Field that is currently in focus. Implemented in iOS and JRE ifhasNativeTextFields()
, otherwise remains null. Corresponds to the tripleplay field currently receiving native keyboard input. -
clearFocus
public void clearFocus()Clears the currently focused field, if any. -
refreshNativeBounds
public void refreshNativeBounds()Updates the bounds of all known native fields. This is useful for animating aRoot
containing someField
instances and changes its transform. -
hideNativeOverlays
public void hideNativeOverlays(pythagoras.f.IRectangle area) Hides the native widgets under the given screen area, using platform clipping if supported. The PlayN layers underneath the area should show through. Pointer events should also not interact with the native widgets within the area.- Parameters:
area
- the new area to hide, in screen coordinates, or null to show all
-