mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Rydder opp i IPAddressScreen
Retter tekst som blir vist når en server ikke kan kobles til Legger til manglende kommentarer Fjerner unødvendige feltvariabler
This commit is contained in:
parent
d8e180cc8e
commit
e37adf77d8
@ -1,4 +1,4 @@
|
||||
package inf112.fiasko.roborally.game_wrapper;
|
||||
package inf112.fiasko.roborally.game_wrapper.screens;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
@ -11,28 +11,30 @@ import com.badlogic.gdx.scenes.scene2d.ui.TextField;
|
||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||
import com.badlogic.gdx.utils.viewport.FitViewport;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
import inf112.fiasko.roborally.game_wrapper.RoboRallyWrapper;
|
||||
import inf112.fiasko.roborally.networking.RoboRallyClient;
|
||||
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* This screen allows the user to enter the ip address to connect to
|
||||
*/
|
||||
public class IPAddressScreen extends AbstractScreen {
|
||||
private final RoboRallyWrapper roboRallyWrapper;
|
||||
|
||||
private final OrthographicCamera camera;
|
||||
private final Viewport viewport;
|
||||
private final Stage stage;
|
||||
private final int applicationWidth = 600;
|
||||
private final int applicationHeight = 800;
|
||||
private TextField txtinput;
|
||||
private TextButton loginbutton;
|
||||
|
||||
public IPAddressScreen(final RoboRallyWrapper roboRallyWrapper) {
|
||||
|
||||
stage = new Stage();
|
||||
|
||||
Skin skin = new Skin(Gdx.files.internal("uiskin.json"));
|
||||
loginbutton = new TextButton("click",skin);
|
||||
TextButton loginbutton = new TextButton("click", skin);
|
||||
loginbutton.setSize(300,60);
|
||||
loginbutton.setPosition(300,300);
|
||||
loginbutton.addListener(new ClickListener(){
|
||||
@ -43,7 +45,8 @@ public class IPAddressScreen extends AbstractScreen {
|
||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getUsernameScreen(roboRallyWrapper));
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
JOptionPane.showMessageDialog(null, "A basic JOptionPane message dialog");
|
||||
JOptionPane.showMessageDialog(null, "Could not connect to the server."
|
||||
+ " Please make sure the ip address you typed is correct, and that the server is online.");
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -70,7 +73,7 @@ public class IPAddressScreen extends AbstractScreen {
|
||||
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
|
||||
|
||||
roboRallyWrapper.batch.begin();
|
||||
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Click the button to enter IP to join server",
|
||||
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Enter IP address and click the button to join a server",
|
||||
applicationWidth / 2f - 380 / 2f,applicationHeight / 2f + 100,380, 1, true);
|
||||
roboRallyWrapper.batch.end();
|
||||
stage.draw();
|
Loading…
x
Reference in New Issue
Block a user