MainMenu not working D:

master
GammelJan 6 years ago
parent 8c1b5b9d88
commit f94e2785c9

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

@ -7,7 +7,7 @@ public class Main extends ApplicationAdapter {
View v; View v;
Main(){ public Main(){
v = new View(); v = new View();
} }

@ -5,29 +5,42 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.Sprite;
public class View extends ApplicationAdapter { public class View extends ApplicationAdapter {
SpriteBatch batch; SpriteBatch batch;
Texture img; Texture b;
Texture t;
Sprite button;
Sprite title;
@Override @Override
public void create () { public void create () {
batch = new SpriteBatch(); batch = new SpriteBatch();
img = new Texture("badlogic.jpg"); b = new Texture("button.png");
t = new Texture("title.png");
button = new Sprite(b);
title = new Sprite(t);
title.setX(0);
title.setY(0);
button.setX(75);
button.setY(150);
} }
@Override @Override
public void render () { public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin(); batch.begin();
batch.draw(img, 0, 0); title.draw(batch);
button.draw(batch);
batch.end(); batch.end();
} }
@Override @Override
public void dispose () { public void dispose () {
batch.dispose(); batch.dispose();
img.dispose();
} }
} }

Loading…
Cancel
Save