diff --git a/android/assets/images/samlogo.png b/android/assets/images/samlogo.png new file mode 100644 index 0000000..3a55dae Binary files /dev/null and b/android/assets/images/samlogo.png differ diff --git a/core/src/de/samdev/clorrunner/screens/menu/MainMenu.java b/core/src/de/samdev/clorrunner/screens/menu/MainMenu.java new file mode 100644 index 0000000..03d53c4 --- /dev/null +++ b/core/src/de/samdev/clorrunner/screens/menu/MainMenu.java @@ -0,0 +1,58 @@ +package de.samdev.clorrunner.screens.menu; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.Screen; +import com.badlogic.gdx.graphics.GL20; +import com.badlogic.gdx.scenes.scene2d.Stage; + +public class MainMenu implements Screen { + + private Stage stage = new Stage(); + + @Override + public void render(float delta) { + Gdx.gl.glClearColor(0, 0, 0, 1); + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + stage.act(); + stage.draw(); + + + } + + @Override + public void resize(int width, int height) { + // TODO Auto-generated method stub + + } + + @Override + public void show() { + // TODO Auto-generated method stub + + } + + @Override + public void hide() { + dispose(); + + } + + @Override + public void pause() { + // TODO Auto-generated method stub + + } + + @Override + public void resume() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + stage.dispose(); + + } + +} diff --git a/core/src/de/samdev/clorrunner/screens/menu/SplashScreen.java b/core/src/de/samdev/clorrunner/screens/menu/SplashScreen.java new file mode 100644 index 0000000..7863f30 --- /dev/null +++ b/core/src/de/samdev/clorrunner/screens/menu/SplashScreen.java @@ -0,0 +1,106 @@ +package de.samdev.clorrunner.screens.menu; + +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.math.MathUtils; + + +import de.samdev.colorrunner.screens.gameScreen.GameScreen; + +public class SplashScreen implements Screen { + + private float loadTime = 0; + + private int random = MathUtils.random(5); + private Texture logo = new Texture("images/samlogo.png"); + + private OrthographicCamera cam = new OrthographicCamera(); + private SpriteBatch sB; + + + + + @Override + public void render(float delta) { + + + if(random == 0){ + Gdx.gl.glClearColor(0.4f, 0, 0, 1); // Rot + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + }else if (random == 1){ + Gdx.gl.glClearColor(0.8f, 0.8f, 0, 1); //Gelb + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + }else if ((random == 2)){ + Gdx.gl.glClearColor(1, 0.5f, 0.25f, 1); //Orange + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + }else if (random == 3){ + Gdx.gl.glClearColor(0.25f, 0.5f, 1, 1); //Blau + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + }else if (random == 4){ + Gdx.gl.glClearColor(0, 0.8f, 0.3f, 1); //Grün + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + }else if (random == 5){ + Gdx.gl.glClearColor(1, 1, 1, 1); //Weiß + Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); + } + + + sB.begin(); + sB.draw(logo, -9, + -8, 18, 16); + sB.end(); + + loadTime += delta; + if (loadTime > 0.5) + ((Game) Gdx.app.getApplicationListener()).setScreen(new GameScreen()); + + } + + @Override + public void resize(int width, int height) { + // TODO Auto-generated method stub + + } + + @Override + public void show() { + + sB = new SpriteBatch(); + + this.cam = new OrthographicCamera(20,40); + this.cam.position.set(20 / 2, 40 / 2, 0); + sB.setProjectionMatrix(cam.combined); + cam.update(); + + } + + @Override + public void hide() { + dispose(); + + } + + @Override + public void pause() { + // TODO Auto-generated method stub + + } + + @Override + public void resume() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + logo.dispose(); + + } + +} diff --git a/core/src/de/samdev/colorrunner/CRGame.java b/core/src/de/samdev/colorrunner/CRGame.java index c650dbb..fb46943 100644 --- a/core/src/de/samdev/colorrunner/CRGame.java +++ b/core/src/de/samdev/colorrunner/CRGame.java @@ -2,18 +2,19 @@ package de.samdev.colorrunner; import com.badlogic.gdx.Game; +import de.samdev.clorrunner.screens.menu.SplashScreen; import de.samdev.colorrunner.screens.gameScreen.GameScreen; public class CRGame extends Game { - private GameScreen gameScreen; + private SplashScreen SplashScreen; @Override public void create() { - gameScreen = new GameScreen(); + SplashScreen = new SplashScreen(); //---------------------------------- - setScreen(gameScreen); + setScreen(SplashScreen); } }