added SetScreen test

This commit is contained in:
Gulum
2017-10-14 04:02:39 +02:00
parent 9e81340ef8
commit 5041c18a20
4 changed files with 54 additions and 12 deletions

View File

@@ -9,6 +9,8 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.darkrp2d.input.CommandStream;
import com.darkrp2d.input.InputHandler;
import com.darkrp2d.input.commands.Command;
import com.darkrp2d.input.commands.MenuCommand;
import com.darkrp2d.scenes.menu.MenuScreen;
public class DarkRP2D extends Game {
@@ -18,12 +20,11 @@ public class DarkRP2D extends Game {
@Override
public void create () {
//Sets inputs
Gdx.input.setInputProcessor(new InputHandler());
font = new BitmapFont();
batch = new SpriteBatch();
//Sets inputs
Gdx.input.setInputProcessor(new InputHandler(new MenuCommand(this, new MenuScreen(this))));
}
@Override
@@ -34,9 +35,10 @@ public class DarkRP2D extends Game {
currentCommand.execute();
}
//Render stuff
super.render();
Gdx.gl.glClearColor(0.f, 0.f, 0.f, 1.f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
super.render();
batch.begin();
GlyphLayout layout = new GlyphLayout(font, "Hello World");
font.draw(batch, layout, Gdx.graphics.getWidth()/2-layout.width/2, Gdx.graphics.getHeight()/2-layout.height/2);