com.badlogic.gdx.Input.TextInputListener Java Examples
The following examples show how to use
com.badlogic.gdx.Input.TextInputListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainMenuScreen.java From killingspree with MIT License | 5 votes |
@Override public void show() { font = game.getFont(170); batch = new SpriteBatch(); camera = new OrthographicCamera(); viewport = new FitViewport(1280, 720, camera); camera.setToOrtho(false, 1280, 720); buttons = new ArrayList<MyButton>(); addAllButtons(); final Preferences prefs = Gdx.app.getPreferences("profile"); String name = prefs.getString("name"); name = name.trim(); if (name.length() == 0) { Gdx.input.getTextInput(new TextInputListener() { @Override public void input(String text) { prefs.putString("name", text); prefs.flush(); } @Override public void canceled() { } }, "Enter name", ""); } }
Example #2
Source File: ClientDiscoveryScreen.java From killingspree with MIT License | 5 votes |
private void processButton() { if (currentButton == backButton) { game.setScreen(new MainMenuScreen(game)); } else if (currentButton == refreshButton) { addIpButtons(); } else if (currentButton == manualIpButton) { if (pressedButton) { return; } pressedButton = true; Gdx.input.getTextInput(new TextInputListener() { @Override public void input(String text) { joinGame(text); } @Override public void canceled() { pressedButton = false; } }, "Enter IP", ""); } else { if (!pressedButton) { pressedButton = true; joinGame(currentButton.getText()); } } }