diff --git a/android/assets/images/background2.jpg b/android/assets/images/background2.jpg new file mode 100644 index 0000000..de89d62 Binary files /dev/null and b/android/assets/images/background2.jpg differ diff --git a/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java b/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java index e7a181e..6f3dc78 100644 --- a/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java +++ b/core/src/de/samdev/colorrunner/screens/menu/MainMenu.java @@ -3,6 +3,9 @@ package de.samdev.colorrunner.screens.menu; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; 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.TextureAtlas; import com.badlogic.gdx.scenes.scene2d.InputEvent; @@ -24,7 +27,8 @@ public class MainMenu implements Screen { private Stage stage = new Stage(); 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"), 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 buttonExit = new TextButton("Exit", skin); private TextButton buttonOption = new TextButton("Option", skin); + private Label title = new Label("Color Runner", skin); @@ -41,7 +46,17 @@ public class MainMenu implements Screen { public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); 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.draw(); diff --git a/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java b/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java index 9b2e239..d6af193 100644 --- a/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java +++ b/core/src/de/samdev/colorrunner/screens/menu/OptionMenuScreen.java @@ -4,6 +4,9 @@ import com.badlogic.gdx.Game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; 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.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.Stage; @@ -19,19 +22,31 @@ public class OptionMenuScreen implements Screen{ private Stage stage = new Stage(); 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"), 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); @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); 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.draw(); diff --git a/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java b/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java index 28ccbf9..bb97669 100644 --- a/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java +++ b/core/src/de/samdev/colorrunner/screens/menu/SplashScreen.java @@ -40,7 +40,7 @@ public class SplashScreen implements Screen { sB.end(); loadTime += delta; - if (loadTime > 1.9) + if (loadTime > 0.9) ((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu()); }