本文整理了Java中com.badlogic.gdx.Input.setOnscreenKeyboardVisible()
方法的一些代码示例,展示了Input.setOnscreenKeyboardVisible()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Input.setOnscreenKeyboardVisible()
方法的具体详情如下:
包路径:com.badlogic.gdx.Input
类名称:Input
方法名:setOnscreenKeyboardVisible
[英]Sets the on-screen keyboard visible if available.
[中]将屏幕键盘设置为可见(如果可用)。
代码示例来源:origin: libgdx/libgdx
public void show (boolean visible) {
Gdx.input.setOnscreenKeyboardVisible(visible);
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void setOnscreenKeyboardVisible (boolean visible) {
input.setOnscreenKeyboardVisible(visible);
}
代码示例来源:origin: libgdx/libgdx
public void show (boolean visible) {
Gdx.input.setOnscreenKeyboardVisible(visible);
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public boolean keyTyped (char character) {
if (character == '\b' && text.length() >= 1) {
text = text.substring(0, text.length() - 1);
} else if (character == '\n') {
Gdx.input.setOnscreenKeyboardVisible(false);
} else {
text += character;
}
return false;
}
代码示例来源:origin: libgdx/libgdx
@Override
public void dispose () {
Gdx.input.setOnscreenKeyboardVisible(false);
glProfiler.disable();
visibleEntities.clear();
rng.setSeed(0);
state = 0;
bufferExtentIndex = 0;
cullingPolicy = CullingPolicy.OCCLUSION;
super.dispose();
}
代码示例来源:origin: libgdx/libgdx
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
font.draw(batch, "input: " + text, 0, Gdx.graphics.getHeight());
batch.end();
if (Gdx.input.justTouched()) Gdx.input.setOnscreenKeyboardVisible(true);
}
代码示例来源:origin: libgdx/libgdx
@Override
public void render () {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
font.draw(batch, textBuffer, 0, Gdx.graphics.getHeight() - 20);
batch.end();
// bring up the keyboard if we touch the screen
if (Gdx.input.justTouched()) {
Gdx.input.setOnscreenKeyboardVisible(true);
textBuffer = new SimpleCharSequence();
}
}
代码示例来源:origin: libgdx/libgdx
/** Focuses the next TextField. If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
* @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest. */
public void next (boolean up) {
Stage stage = getStage();
if (stage == null) return;
TextField current = this;
Vector2 currentCoords = current.getParent().localToStageCoordinates(tmp2.set(current.getX(), current.getY()));
Vector2 bestCoords = tmp1;
while (true) {
TextField textField = current.findNextTextField(stage.getActors(), null, bestCoords, currentCoords, up);
if (textField == null) { // Try to wrap around.
if (up)
currentCoords.set(Float.MIN_VALUE, Float.MIN_VALUE);
else
currentCoords.set(Float.MAX_VALUE, Float.MAX_VALUE);
textField = current.findNextTextField(stage.getActors(), null, bestCoords, currentCoords, up);
}
if (textField == null) {
Gdx.input.setOnscreenKeyboardVisible(false);
break;
}
if (stage.setKeyboardFocus(textField)) {
textField.selectAll();
break;
}
current = textField;
currentCoords.set(bestCoords);
}
}
代码示例来源:origin: libgdx/libgdx
/** Focuses the next TextField. If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
* @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest. */
public void next (boolean up) {
Stage stage = getStage();
if (stage == null) return;
TextField current = this;
Vector2 currentCoords = current.getParent().localToStageCoordinates(tmp2.set(current.getX(), current.getY()));
Vector2 bestCoords = tmp1;
while (true) {
TextField textField = current.findNextTextField(stage.getActors(), null, bestCoords, currentCoords, up);
if (textField == null) { // Try to wrap around.
if (up)
currentCoords.set(Float.MIN_VALUE, Float.MIN_VALUE);
else
currentCoords.set(Float.MAX_VALUE, Float.MAX_VALUE);
textField = current.findNextTextField(stage.getActors(), null, bestCoords, currentCoords, up);
}
if (textField == null) {
Gdx.input.setOnscreenKeyboardVisible(false);
break;
}
if (stage.setKeyboardFocus(textField)) {
textField.selectAll();
break;
}
current = textField;
currentCoords.set(bestCoords);
}
}
代码示例来源:origin: libgdx/libgdx
@Override
public void create () {
Gdx.input.setOnscreenKeyboardVisible(true);
super.create();
代码示例来源:origin: langurmonkey/gaiasky
@Override
public void show(boolean visible) {
Gdx.input.setOnscreenKeyboardVisible(visible);
}
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void show (boolean visible) {
Gdx.input.setOnscreenKeyboardVisible(visible);
}
}
代码示例来源:origin: kotcrab/vis-ui
/**
* Focuses the next TextField. If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
* @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest.
*/
public void next (boolean up) {
Stage stage = getStage();
if (stage == null) return;
getParent().localToStageCoordinates(tmp1.set(getX(), getY()));
VisTextField textField = findNextTextField(stage.getActors(), null, tmp2, tmp1, up);
if (textField == null) { // Try to wrap around.
if (up)
tmp1.set(Float.MIN_VALUE, Float.MIN_VALUE);
else
tmp1.set(Float.MAX_VALUE, Float.MAX_VALUE);
textField = findNextTextField(getStage().getActors(), null, tmp2, tmp1, up);
}
if (textField != null) {
textField.focusField();
textField.setCursorPosition(textField.getText().length());
} else
Gdx.input.setOnscreenKeyboardVisible(false);
}
代码示例来源:origin: langurmonkey/gaiasky
/** Focuses the next TextField. If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
* @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest. */
public void next(boolean up) {
Stage stage = getStage();
if (stage == null)
return;
getParent().localToStageCoordinates(tmp1.set(getX(), getY()));
TextField textField = findNextTextField(stage.getActors(), null, tmp2, tmp1, up);
if (textField == null) { // Try to wrap around.
if (up)
tmp1.set(Float.MIN_VALUE, Float.MIN_VALUE);
else
tmp1.set(Float.MAX_VALUE, Float.MAX_VALUE);
textField = findNextTextField(getStage().getActors(), null, tmp2, tmp1, up);
}
if (textField != null)
stage.setKeyboardFocus(textField);
else
Gdx.input.setOnscreenKeyboardVisible(false);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
/** Focuses the next TextField. If none is found, the keyboard is hidden. Does nothing if the text field is not in a stage.
* @param up If true, the TextField with the same or next smallest y coordinate is found, else the next highest. */
public void next (boolean up) {
Stage stage = getStage();
if (stage == null) return;
TextField current = this;
Vector2 currentCoords = current.getParent().localToStageCoordinates(tmp2.set(current.getX(), current.getY()));
Vector2 bestCoords = tmp1;
while (true) {
TextField textField = current.findNextTextField(stage.getActors(), null, bestCoords, currentCoords, up);
if (textField == null) { // Try to wrap around.
if (up)
currentCoords.set(Float.MIN_VALUE, Float.MIN_VALUE);
else
currentCoords.set(Float.MAX_VALUE, Float.MAX_VALUE);
textField = current.findNextTextField(stage.getActors(), null, bestCoords, currentCoords, up);
}
if (textField == null) {
Gdx.input.setOnscreenKeyboardVisible(false);
break;
}
if (stage.setKeyboardFocus(textField)) {
textField.selectAll();
break;
}
current = textField;
currentCoords.set(bestCoords);
}
}
内容来源于网络,如有侵权,请联系作者删除!