diff --git a/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/Drop.kt b/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/Drop.kt new file mode 100644 index 0000000..155599c --- /dev/null +++ b/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/Drop.kt @@ -0,0 +1,29 @@ +package com.badlogic.drop + +import com.badlogic.gdx.Game +import com.badlogic.gdx.Gdx +import com.badlogic.gdx.graphics.g2d.BitmapFont +import com.badlogic.gdx.graphics.g2d.SpriteBatch +import com.badlogic.gdx.utils.viewport.FitViewport + +class Drop : Game() { + val batch: SpriteBatch = SpriteBatch() + val viewport: FitViewport = FitViewport(8f, 5f) // We put viewport above font for the .appy scope function + val font: BitmapFont = BitmapFont().apply { + setUseIntegerPositions(false) + data.scale(viewport.worldHeight / Gdx.graphics.height) + } + + override fun create(): Unit { + this.screen = MainMenuScreen(this) + } + + override fun render() { + super.render() + } + + override fun dispose() { + batch.dispose() + font.dispose() + } +} diff --git a/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/GameScreen.kt b/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/GameScreen.kt new file mode 100644 index 0000000..2b1fc71 --- /dev/null +++ b/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/GameScreen.kt @@ -0,0 +1,34 @@ +package com.badlogic.drop + +import com.badlogic.gdx.Screen + +class GameScreen(val newGame: Drop) : Screen { + override fun show() { + TODO("Not yet implemented") + } + + override fun render(delta: Float) { + TODO("Not yet implemented") + } + + override fun resize(width: Int, height: Int) { + TODO("Not yet implemented") + } + + override fun pause() { + TODO("Not yet implemented") + } + + override fun resume() { + TODO("Not yet implemented") + } + + override fun hide() { + TODO("Not yet implemented") + } + + override fun dispose() { + TODO("Not yet implemented") + } + +} diff --git a/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/MainMenuScreen.kt b/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/MainMenuScreen.kt new file mode 100644 index 0000000..5e0043d --- /dev/null +++ b/Exercises/Drop/core/src/main/kotlin/com/badlogic/drop/MainMenuScreen.kt @@ -0,0 +1,54 @@ +package com.badlogic.drop + +import com.badlogic.gdx.Screen +import com.badlogic.gdx.Gdx +import com.badlogic.gdx.graphics.Color +import com.badlogic.gdx.utils.ScreenUtils + +class MainMenuScreen(val newGame: Drop) : Screen { + + val game: Drop = newGame + + override fun show() { + TODO("Not yet implemented") + } + + override fun render(delta: Float) { + ScreenUtils.clear(Color.BLACK) + + game.viewport.apply() + game.batch.projectionMatrix = game.viewport.camera.combined + + game.batch.begin() + + game.font.draw(game.batch, "Wekcine to Drop!!!", 1f, 1.5f) + game.font.draw(game.batch, "Tap anywhere to begin!", 1f, 1f) + + game.batch.end() + + if (Gdx.input.isTouched) { + game.screen = GameScreen(game) + } + + } + + override fun resize(width: Int, height: Int) { + TODO("Not yet implemented") + } + + override fun pause() { + TODO("Not yet implemented") + } + + override fun resume() { + TODO("Not yet implemented") + } + + override fun hide() { + TODO("Not yet implemented") + } + + override fun dispose() { + TODO("Not yet implemented") + } +}