summaryrefslogtreecommitdiff
path: root/src/main/kotlin/de/romjaki/pluggabledino/states/SplashScreen.kt
blob: d39b31a29da2fe13eb8d210012b8893adcb45555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package de.romjaki.pluggabledino.states

import de.romjaki.pluggabledino.*
import org.newdawn.slick.GameContainer
import org.newdawn.slick.Graphics
import org.newdawn.slick.Image
import org.newdawn.slick.Input
import org.newdawn.slick.state.BasicGameState
import org.newdawn.slick.state.StateBasedGame


class SplashScreen : BasicGameState() {
    override fun init(container: GameContainer?, game: StateBasedGame?) {
    }

    override fun update(container: GameContainer?, game: StateBasedGame?, delta: Int) {
        container!!
        game!!
        val input = container.input
        if (input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
            input.clearMousePressedRecord()
            game.enterState(MAINMENU)
        }
        if (input.isKeyDown(Input.KEY_Q)) {
            System.exit(0)
        }
    }

    override fun getID(): Int =
            SPLASHSCREEN


    override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
        g!!
        g.drawImage(splash, 0f, 0f)
        g.drawStringCentered("CLICK ANYWHERE TO CONTINUE", WIDTH / 2f, HEIGHT / 2f)
    }

}