public void show (boolean visible) { Gdx.input.setOnscreenKeyboardVisible(visible); } }
@Override public void setOnscreenKeyboardVisible (boolean visible) { input.setOnscreenKeyboardVisible(visible); }
public void show (boolean visible) { Gdx.input.setOnscreenKeyboardVisible(visible); } }
@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; }
@Override public void dispose () { Gdx.input.setOnscreenKeyboardVisible(false); glProfiler.disable(); visibleEntities.clear(); rng.setSeed(0); state = 0; bufferExtentIndex = 0; cullingPolicy = CullingPolicy.OCCLUSION; super.dispose(); }
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); }
@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(); } }
/** 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); } }
/** 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); } }
@Override public void create () { Gdx.input.setOnscreenKeyboardVisible(true); super.create();
@Override public void show(boolean visible) { Gdx.input.setOnscreenKeyboardVisible(visible); } }
public void show (boolean visible) { Gdx.input.setOnscreenKeyboardVisible(visible); } }
/** * 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); }
/** 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); }
/** 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); } }