lagde en input class for å ta inn en string

This commit is contained in:
Tobydrama 2020-03-31 15:45:47 +02:00
parent 6bb6e4965c
commit abcd0d34ee
3 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,13 @@
package inf112.fiasko.roborally.game_wrapper;
import com.badlogic.gdx.Input;
public class MyTextInputListener implements Input.TextInputListener {
@Override
public void input (String text) {
}
@Override
public void canceled () {
}
}

View File

@ -22,7 +22,7 @@ public class RoboRallyWrapper extends Game {
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("assets/Montserrat-Regular.fnt"));
this.screenManager = new ScreenManager();
this.setScreen(screenManager.getMainMenuScreen(this));
this.setScreen(screenManager.getStartMenuScreen(this));
try {
RoboRallyServer server = new RoboRallyServer();
RoboRallyClient client = new RoboRallyClient();

View File

@ -1,6 +1,7 @@
package inf112.fiasko.roborally.game_wrapper;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
@ -35,6 +36,8 @@ public class StartMenuScreen implements Screen {
serverButton.addListener(new InputListener() {
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
MyTextInputListener nameinput = new MyTextInputListener();
Gdx.input.getTextInput(nameinput, "Name input", "input name her", "");
press = true;
return true;//her we do stuff
}
@ -50,6 +53,9 @@ public class StartMenuScreen implements Screen {
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
press = true;
MyTextInputListener nameinput = new MyTextInputListener();
Gdx.input.getTextInput(nameinput, "Name input", "input name her", "");
return true;//her we do stuff
}
});
@ -67,6 +73,7 @@ public class StartMenuScreen implements Screen {
return true;//her we do stuff
}
});
}
@Override