initial project

This commit is contained in:
Gulum
2017-10-13 18:55:50 +02:00
commit 9e81340ef8
19 changed files with 728 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package com.darkrp2d;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.darkrp2d.input.CommandStream;
import com.darkrp2d.input.InputHandler;
import com.darkrp2d.input.commands.Command;
public class DarkRP2D extends Game {
public BitmapFont font;
public SpriteBatch batch;
@Override
public void create () {
//Sets inputs
Gdx.input.setInputProcessor(new InputHandler());
font = new BitmapFont();
batch = new SpriteBatch();
}
@Override
public void render () {
//Update stuff
Command currentCommand = CommandStream.pollCommand();
if(currentCommand != null) {
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);
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);
batch.end();
}
@Override
public void dispose () {
}
}