Class TPPlatform

java.lang.Object
tripleplay.platform.TPPlatform

public abstract class TPPlatform extends Object
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 Details

    • TPPlatform

      public TPPlatform()
  • Method Details

    • instance

      public static TPPlatform instance()
      Returns the currently registered TPPlatform instance.
    • hasNativeTextFields

      public boolean hasNativeTextFields()
      Returns true if this platform supports native text fields.
    • createNativeTextField

      public NativeTextField createNativeTextField(Field.Native field)
      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, use hasNativeTextFields() to check.
    • refresh

      public NativeTextField refresh(NativeTextField previous)
      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

      public void setKeyboardFocusController(KeyboardFocusController ctrl)
      Sets the instance of KeyboardFocusController to use for keyboard focus management, or null for none.
    • keyboardActivity

      public react.SignalView<Void> 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

      public ImageOverlay createImageOverlay(Image image)
    • focus

      public react.ValueView<Field> focus()
      Gets a view of the Field that is currently in focus. Implemented in iOS and JRE if hasNativeTextFields(), 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 a Root containing some Field 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