public class Input
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Signal<java.lang.Boolean> |
focus
A signal emitted when the game application gains or loses focus.
|
boolean |
keyboardEnabled
Enables or disables keyboard interaction.
|
Signal<Keyboard.Event> |
keyboardEvents
A signal via which keyboard events are emitted.
|
boolean |
mouseEnabled
Enables or disables mouse interaction.
|
Signal<Mouse.Event> |
mouseEvents
A signal which emits mouse events.
|
boolean |
touchEnabled
Enables or disables touch interaction.
|
Signal<Touch.Event[]> |
touchEvents
A signal via which touch events are emitted.
|
Modifier and Type | Method and Description |
---|---|
RFuture<java.lang.String> |
getText(Keyboard.TextType textType,
java.lang.String label,
java.lang.String initialValue)
Requests a line of text from the user.
|
RFuture<java.lang.String> |
getText(Keyboard.TextType textType,
java.lang.String label,
java.lang.String initialValue,
java.lang.String ok,
java.lang.String cancel)
Requests a line of text from the user.
|
boolean |
hasHardwareKeyboard()
Returns true if this device has a hardware keyboard, false if not.
|
boolean |
hasMouse()
Returns true if this platform has mouse input.
|
boolean |
hasMouseLock()
Returns true if this platform supports mouse locking.
|
boolean |
hasTouch()
Returns true if this platform has touch input.
|
boolean |
isMouseLocked()
Returns whether the mouse is currently locked.
|
void |
setMouseLocked(boolean locked)
Lock or unlock the mouse.
|
RFuture<java.lang.Boolean> |
sysDialog(java.lang.String title,
java.lang.String text,
java.lang.String ok,
java.lang.String cancel)
Displays a system dialog with the specified title and text, an OK button and optionally a
Cancel button.
|
public boolean mouseEnabled
public boolean touchEnabled
public boolean keyboardEnabled
public Signal<Mouse.Event> mouseEvents
public Signal<Touch.Event[]> touchEvents
public Signal<Keyboard.Event> keyboardEvents
public Signal<java.lang.Boolean> focus
public boolean hasMouse()
public boolean hasTouch()
public boolean hasHardwareKeyboard()
getText(playn.core.Keyboard.TextType, java.lang.String, java.lang.String)
for text entry on a
non-hardware-keyboard having device.public boolean hasMouseLock()
public boolean isMouseLocked()
public void setMouseLocked(boolean locked)
public RFuture<java.lang.String> getText(Keyboard.TextType textType, java.lang.String label, java.lang.String initialValue)
textType
- the expected type of text. On mobile devices this hint may be used to display a
keyboard customized to the particular type of text.label
- a label to display over the text entry interface, may be null.initialValue
- the initial value to display in the text input field, may be null.public RFuture<java.lang.String> getText(Keyboard.TextType textType, java.lang.String label, java.lang.String initialValue, java.lang.String ok, java.lang.String cancel)
textType
- the expected type of text. On mobile devices this hint may be used to display a
keyboard customized to the particular type of text.label
- a label to display over the text entry interface, may be null.initialValue
- the initial value to display in the text input field, may be null.ok
- the text of the button which will deliver a true
result and be placed in
"OK" position for the platform.cancel
- the text of the button that will deliver a false
result and be placed in
"Cancel" position.public RFuture<java.lang.Boolean> sysDialog(java.lang.String title, java.lang.String text, java.lang.String ok, java.lang.String cancel)
title
- the title for the dialog window. Note: some platforms (mainly mobile) do not
display the title, so be sure your dialog makes sense if only text
is showing.text
- the text of the dialog. The text will be wrapped by the underlying platform, but
PlayN will do its utmost to ensure that newlines are honored by the platform in question so
that hard line breaks and blank lines are reproduced correctly.ok
- the text of the button which will deliver a true
result and be placed in
"OK" position for the platform. Note: the HTML platform does not support customizing this
label, so on that platform the label will be "OK". Yay for HTML5.cancel
- the text of the button that will deliver a false
result and be placed in
"Cancel" position. If null
is supplied, the dialog will only have an OK button. Note:
the HTML platform does not support customizing this label, so on that platform a non-null
cancel string will result in the button reading "Cancel". Yay for HTML5.true
or false
when the user clicks the OK or
cancel buttons respectively. If some unexpected error occurs displaying the dialog (unlikley),
it will be reported by failing the future.Copyright © 2019. All Rights Reserved.