test with backgrounds
This commit is contained in:
parent
2253d55fd2
commit
dba41061a4
Binary file not shown.
After Width: | Height: | Size: 728 KiB |
|
@ -3,6 +3,9 @@ package de.samdev.colorrunner.screens.menu;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.Gdx2DPixmap;
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
|
@ -24,7 +27,8 @@ public class MainMenu implements Screen {
|
||||||
|
|
||||||
private Stage stage = new Stage();
|
private Stage stage = new Stage();
|
||||||
private Table table = new Table();
|
private Table table = new Table();
|
||||||
private CRGame game;
|
private OrthographicCamera cam = new OrthographicCamera();
|
||||||
|
private Texture background = new Texture("images/background2.jpg");
|
||||||
|
|
||||||
private Skin skin = new Skin(Gdx.files.internal("skins/menuSkin.json"),
|
private Skin skin = new Skin(Gdx.files.internal("skins/menuSkin.json"),
|
||||||
new TextureAtlas(Gdx.files.internal("skins/menuSkin.pack")));
|
new TextureAtlas(Gdx.files.internal("skins/menuSkin.pack")));
|
||||||
|
@ -34,6 +38,7 @@ public class MainMenu implements Screen {
|
||||||
private TextButton buttonPlay2 = new TextButton("Play Endless", skin);
|
private TextButton buttonPlay2 = new TextButton("Play Endless", skin);
|
||||||
private TextButton buttonExit = new TextButton("Exit", skin);
|
private TextButton buttonExit = new TextButton("Exit", skin);
|
||||||
private TextButton buttonOption = new TextButton("Option", skin);
|
private TextButton buttonOption = new TextButton("Option", skin);
|
||||||
|
|
||||||
|
|
||||||
private Label title = new Label("Color Runner", skin);
|
private Label title = new Label("Color Runner", skin);
|
||||||
|
|
||||||
|
@ -41,7 +46,17 @@ public class MainMenu implements Screen {
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
cam.setToOrtho(false, (float)Gdx.graphics.getWidth() / 2.0F, (float)Gdx.graphics.getHeight() / 2.0F);
|
||||||
|
|
||||||
|
SpriteBatch sb = new SpriteBatch();
|
||||||
|
sb.setProjectionMatrix(cam.combined);
|
||||||
|
sb.begin();
|
||||||
|
sb.draw(background, 0, 0);
|
||||||
|
sb.end();
|
||||||
|
|
||||||
stage.act();
|
stage.act();
|
||||||
|
|
||||||
stage.draw();
|
stage.draw();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ import com.badlogic.gdx.Game;
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||||
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Stage;
|
import com.badlogic.gdx.scenes.scene2d.Stage;
|
||||||
|
@ -19,19 +22,31 @@ public class OptionMenuScreen implements Screen{
|
||||||
|
|
||||||
private Stage stage = new Stage();
|
private Stage stage = new Stage();
|
||||||
private Table table = new Table();
|
private Table table = new Table();
|
||||||
|
private Texture background = new Texture("images/background2.jpg");
|
||||||
|
private OrthographicCamera cam = new OrthographicCamera();
|
||||||
|
|
||||||
private Skin skin = new Skin(Gdx.files.internal("skins/menuSkin.json"),
|
private Skin skin = new Skin(Gdx.files.internal("skins/menuSkin.json"),
|
||||||
new TextureAtlas(Gdx.files.internal("skins/menuSkin.pack")));
|
new TextureAtlas(Gdx.files.internal("skins/menuSkin.pack")));
|
||||||
|
|
||||||
|
public OptionMenuScreen() {
|
||||||
|
//cam.setToOrtho(false, (float)Gdx.graphics.getWidth() / 2, (float)Gdx.graphics.getHeight() / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private Label title = new Label("Option", skin);
|
private Label title = new Label("Option", skin);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(float delta) {
|
public void render(float delta) {
|
||||||
Gdx.gl.glClearColor(0, 0, 0, 1);
|
Gdx.gl.glClearColor(0, 0, 0, 1);
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
|
cam.setToOrtho(false, (float)Gdx.graphics.getWidth() / 2.0F, (float)Gdx.graphics.getHeight() / 2.0F);
|
||||||
|
|
||||||
|
SpriteBatch sb = new SpriteBatch();
|
||||||
|
sb.setProjectionMatrix(cam.combined);
|
||||||
|
sb.begin();
|
||||||
|
sb.draw(background, 0, 0);
|
||||||
|
sb.end();
|
||||||
|
|
||||||
stage.act();
|
stage.act();
|
||||||
stage.draw();
|
stage.draw();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SplashScreen implements Screen {
|
||||||
sB.end();
|
sB.end();
|
||||||
|
|
||||||
loadTime += delta;
|
loadTime += delta;
|
||||||
if (loadTime > 1.9)
|
if (loadTime > 0.9)
|
||||||
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());
|
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue