mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-10-31 09:43:45 +01:00 
			
		
		
		
	lagde en input class for å ta inn en string
This commit is contained in:
		| @@ -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 () { | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -22,7 +22,7 @@ public class RoboRallyWrapper extends Game { | |||||||
|         batch = new SpriteBatch(); |         batch = new SpriteBatch(); | ||||||
|         font = new BitmapFont(Gdx.files.internal("assets/Montserrat-Regular.fnt")); |         font = new BitmapFont(Gdx.files.internal("assets/Montserrat-Regular.fnt")); | ||||||
|         this.screenManager = new ScreenManager(); |         this.screenManager = new ScreenManager(); | ||||||
|         this.setScreen(screenManager.getMainMenuScreen(this)); |         this.setScreen(screenManager.getStartMenuScreen(this)); | ||||||
|         try { |         try { | ||||||
|             RoboRallyServer server = new RoboRallyServer(); |             RoboRallyServer server = new RoboRallyServer(); | ||||||
|             RoboRallyClient client = new RoboRallyClient(); |             RoboRallyClient client = new RoboRallyClient(); | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| package inf112.fiasko.roborally.game_wrapper; | package inf112.fiasko.roborally.game_wrapper; | ||||||
|  |  | ||||||
| import com.badlogic.gdx.Gdx; | import com.badlogic.gdx.Gdx; | ||||||
|  | import com.badlogic.gdx.Input; | ||||||
| import com.badlogic.gdx.Screen; | import com.badlogic.gdx.Screen; | ||||||
| import com.badlogic.gdx.graphics.GL20; | import com.badlogic.gdx.graphics.GL20; | ||||||
| import com.badlogic.gdx.graphics.OrthographicCamera; | import com.badlogic.gdx.graphics.OrthographicCamera; | ||||||
| @@ -35,6 +36,8 @@ public class StartMenuScreen implements Screen { | |||||||
|         serverButton.addListener(new InputListener() { |         serverButton.addListener(new InputListener() { | ||||||
|             @Override |             @Override | ||||||
|             public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { |             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; |                 press = true; | ||||||
|                 return true;//her we do stuff |                 return true;//her we do stuff | ||||||
|             } |             } | ||||||
| @@ -50,6 +53,9 @@ public class StartMenuScreen implements Screen { | |||||||
|             @Override |             @Override | ||||||
|             public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { |             public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { | ||||||
|                 press = true; |                 press = true; | ||||||
|  |                 MyTextInputListener nameinput = new MyTextInputListener(); | ||||||
|  |                 Gdx.input.getTextInput(nameinput, "Name input", "input name her", ""); | ||||||
|  |  | ||||||
|                 return true;//her we do stuff |                 return true;//her we do stuff | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
| @@ -67,6 +73,7 @@ public class StartMenuScreen implements Screen { | |||||||
|                 return true;//her we do stuff |                 return true;//her we do stuff | ||||||
|             } |             } | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tobydrama
					Tobydrama