diff --git a/assets/diamond.png b/assets/diamond.png new file mode 100644 index 0000000..24409b1 Binary files /dev/null and b/assets/diamond.png differ diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..15b5388 Binary files /dev/null and b/assets/logo.png differ diff --git a/core/src/com/redstrate/watersymbol/screens/MainMenuScreen.java b/core/src/com/redstrate/watersymbol/screens/MainMenuScreen.java index 5cda75b..5b10c86 100644 --- a/core/src/com/redstrate/watersymbol/screens/MainMenuScreen.java +++ b/core/src/com/redstrate/watersymbol/screens/MainMenuScreen.java @@ -4,7 +4,10 @@ import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.OrthographicCamera; +import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.GlyphLayout; +import com.badlogic.gdx.graphics.g2d.Sprite; +import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.utils.ScreenUtils; import com.redstrate.watersymbol.WaterSymbol; @@ -13,13 +16,25 @@ public class MainMenuScreen implements Screen { GlyphLayout titleLayout; + Texture logoTexture; + Texture diamondTexture; + Sprite backgroundSprite; + public MainMenuScreen(WaterSymbol game) { this.game = game; camera = new OrthographicCamera(); - camera.setToOrtho(false, 800, 480); + camera.setToOrtho(false, 800, 800); - titleLayout = new GlyphLayout(game.font, "WATER SYMBOL"); + logoTexture = new Texture("logo.png"); + + diamondTexture = new Texture("diamond.png"); + diamondTexture.setWrap(Texture.TextureWrap.Repeat, Texture.TextureWrap.Repeat); + + backgroundSprite = new Sprite(diamondTexture); + backgroundSprite.setColor(0.2f, 0.2f, 0.3f, 1.0f); + + titleLayout = new GlyphLayout(game.font, "PRESS ANY BUTTON"); } @Override @@ -29,15 +44,21 @@ public class MainMenuScreen implements Screen { @Override public void render(float delta) { - ScreenUtils.clear(0, 0, 0.2f, 1); + ScreenUtils.clear(0.02f, 0.01f, 0.2f, 1); camera.update(); game.batch.setProjectionMatrix(camera.combined); game.batch.begin(); - game.font.draw(game.batch, titleLayout, - (camera.viewportWidth / 2) - (titleLayout.width / 2), - camera.viewportHeight / 2); + + backgroundSprite.setPosition(camera.position.x - camera.viewportWidth / 2, camera.position.y - camera.viewportHeight / 2); + backgroundSprite.scroll(delta, delta); + backgroundSprite.draw(game.batch); + + game.batch.draw(logoTexture, camera.position.x - (logoTexture.getWidth() / 2), camera.position.y - 40); + + game.font.draw(game.batch, titleLayout, camera.position.x - (titleLayout.width / 2), camera.position.y - 60); + game.batch.end(); if(Gdx.input.isButtonJustPressed(Input.Buttons.LEFT)) { @@ -48,7 +69,10 @@ public class MainMenuScreen implements Screen { @Override public void resize(int width, int height) { - camera.setToOrtho(false, width, height); + camera.viewportWidth = 330; + camera.viewportHeight = 330 * ((float)height / (float)width); + + backgroundSprite.setSize(camera.viewportWidth, camera.viewportHeight); } @Override