initial project
This commit is contained in:
51
core/src/com/darkrp2d/DarkRP2D.java
Executable file
51
core/src/com/darkrp2d/DarkRP2D.java
Executable 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 () {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user