Basic setup

This commit is contained in:
BlueNutterfly 2018-11-10 21:32:04 +04:00
parent 8f00390eed
commit dd6aa7da5f
2 changed files with 21 additions and 12 deletions

View File

@ -2,32 +2,38 @@ package com.me.brickbuster;
import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
public class BrickBuster extends ApplicationAdapter { public class BrickBuster extends ApplicationAdapter {
SpriteBatch batch;
Texture img; public static final int WIDTH = 800;
public static final int HEIGHT = 600;
public static final String TITLE = "Brick Buster";
ShapeRenderer shapeRenderer;
@Override @Override
public void create () { public void create () {
batch = new SpriteBatch(); this.shapeRenderer = new ShapeRenderer();
img = new Texture("badlogic.jpg");
} }
@Override @Override
public void render () { public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClearColor(0.5f,1,1,1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin(); this.shapeRenderer.begin(ShapeType.Filled);
batch.draw(img, 0, 0); this.shapeRenderer.setColor(Color.CHARTREUSE);
batch.end(); this.shapeRenderer.circle(0,0, 100, 50);
this.shapeRenderer.end();
} }
@Override @Override
public void dispose () { public void dispose () {
batch.dispose();
img.dispose();
} }
} }

View File

@ -7,6 +7,9 @@ import com.me.brickbuster.BrickBuster;
public class DesktopLauncher { public class DesktopLauncher {
public static void main (String[] arg) { public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = BrickBuster.WIDTH;
config.height = BrickBuster.HEIGHT;
config.title = BrickBuster.TITLE;
new LwjglApplication(new BrickBuster(), config); new LwjglApplication(new BrickBuster(), config);
} }
} }