You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
Kotlin
57 lines
1.5 KiB
Kotlin
package com.last.commit
|
|
|
|
import com.badlogic.gdx.Game
|
|
import com.badlogic.gdx.Gdx
|
|
import com.badlogic.gdx.Screen
|
|
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
|
import com.badlogic.gdx.scenes.scene2d.ui.Skin
|
|
import com.last.commit.inventory.Inventory
|
|
import com.last.commit.screen.*
|
|
import com.last.commit.stages.DialogStage
|
|
|
|
|
|
/** [com.badlogic.gdx.ApplicationListener] implementation shared by all platforms. */
|
|
class Game : Game() {
|
|
|
|
lateinit var state: GameState
|
|
|
|
lateinit var loading: Screen
|
|
lateinit var menu: Screen
|
|
lateinit var gameplay: Screen
|
|
lateinit var settings: Screen
|
|
|
|
lateinit var font: BitmapFont
|
|
|
|
override fun create() {
|
|
font = BitmapFont()
|
|
createState()
|
|
createScreens()
|
|
|
|
changeScreen(Screens.LOADING)
|
|
}
|
|
|
|
private fun createScreens() {
|
|
loading = LoadingScreen(TimeTravelAssetManager, this)
|
|
menu = MainMenu(this)
|
|
gameplay = FirstScreen(this)
|
|
settings = Settings(this)
|
|
}
|
|
|
|
fun changeScreen(screen: Screens) {
|
|
println("changing screen to $screen")
|
|
when (screen) {
|
|
Screens.LOADING -> setScreen(loading)
|
|
Screens.MAIN_MENU -> setScreen(menu)
|
|
Screens.SETTINGS -> setScreen(settings)
|
|
Screens.GAME -> setScreen(gameplay)
|
|
}
|
|
}
|
|
|
|
fun createState() {
|
|
state = GameState(
|
|
Inventory(),
|
|
null,
|
|
DialogStage(Skin(Gdx.files.internal("ui/uiskin.json")))
|
|
)
|
|
}
|
|
} |