diff options
author | romangraef <roman.graef@gmail.com> | 2018-05-30 12:06:31 +0200 |
---|---|---|
committer | romangraef <roman.graef@gmail.com> | 2018-05-30 12:06:31 +0200 |
commit | 2ac18d91635b023db7ff3918f5041cb51ed1c968 (patch) | |
tree | 8caffe3c5807e105eb474e2277ece57dc82823c3 /src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt | |
download | pluggabledino-2ac18d91635b023db7ff3918f5041cb51ed1c968.tar.gz pluggabledino-2ac18d91635b023db7ff3918f5041cb51ed1c968.tar.bz2 pluggabledino-2ac18d91635b023db7ff3918f5041cb51ed1c968.zip |
Initial commit
Diffstat (limited to 'src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt')
-rw-r--r-- | src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt new file mode 100644 index 0000000..5003232 --- /dev/null +++ b/src/main/kotlin/de/romjaki/pluggabledino/states/SettingsState.kt @@ -0,0 +1,42 @@ +package de.romjaki.pluggabledino.states + +import de.romjaki.pluggabledino.HEIGHT +import de.romjaki.pluggabledino.MAINMENU +import de.romjaki.pluggabledino.SETTINGS +import de.romjaki.pluggabledino.WIDTH +import de.romjaki.pluggabledino.api.Button +import org.newdawn.slick.Color +import org.newdawn.slick.GameContainer +import org.newdawn.slick.Graphics +import org.newdawn.slick.state.BasicGameState +import org.newdawn.slick.state.StateBasedGame + +class SettingsState : BasicGameState() { + override fun init(container: GameContainer?, game: StateBasedGame?) { + game!! + backButton.addClickHandler { + game.enterState(MAINMENU) + } + } + + override fun enter(container: GameContainer?, game: StateBasedGame?) { + backButton.enter() + } + + override fun update(container: GameContainer?, game: StateBasedGame?, delta: Int) { + container!! + backButton.update(container.input) + } + + override fun getID(): Int = + SETTINGS + + val backButton = Button("BACK", WIDTH / 2f, HEIGHT / 8 * 7f) + + override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) { + g!! + g.background = Color.lightGray + backButton.draw(g) + } + +} |