mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 16:46:07 +09:00
Various Loadscreens WIP
This commit is contained in:
@@ -3,8 +3,7 @@ package net.torvald.terrarum.modulebasegame
|
||||
import com.badlogic.gdx.ScreenAdapter
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.IngameInstance
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.util.CircularArray
|
||||
import kotlin.math.roundToInt
|
||||
@@ -14,10 +13,12 @@ import kotlin.math.roundToInt
|
||||
*
|
||||
* Created by minjaesong on 2019-11-09.
|
||||
*/
|
||||
class WorldgenLoadScreen(private var world: GameWorld, private var screenToLoad: IngameInstance) : ScreenAdapter() {
|
||||
class WorldgenLoadScreen(private val world: GameWorld, screenToBeLoaded: IngameInstance) : LoadScreenBase() {
|
||||
|
||||
// a Class impl is chosen to make resize-handling easier, there's not much benefit making this a singleton anyway
|
||||
|
||||
override var screenToLoad: IngameInstance? = screenToBeLoaded
|
||||
|
||||
companion object {
|
||||
private const val WIDTH_RATIO = 0.6
|
||||
}
|
||||
@@ -25,13 +26,9 @@ class WorldgenLoadScreen(private var world: GameWorld, private var screenToLoad:
|
||||
private val previewWidth = (AppLoader.screenW * WIDTH_RATIO).roundToInt()
|
||||
private val previewHeight = (AppLoader.screenW * WIDTH_RATIO * world.height / world.width).roundToInt()
|
||||
|
||||
private lateinit var screenLoadingThread: Thread
|
||||
|
||||
private lateinit var previewPixmap: Pixmap
|
||||
private lateinit var previewTexture: Texture
|
||||
|
||||
private val messages = CircularArray<String>(20, true) // this many texts will be shown at once
|
||||
|
||||
override fun show() {
|
||||
previewPixmap = Pixmap(previewWidth, previewHeight, Pixmap.Format.RGBA8888)
|
||||
previewTexture = Texture(1, 1, Pixmap.Format.RGBA8888)
|
||||
@@ -42,6 +39,12 @@ class WorldgenLoadScreen(private var world: GameWorld, private var screenToLoad:
|
||||
previewTexture = Texture(previewPixmap)
|
||||
|
||||
//
|
||||
AppLoader.batch.inUse {
|
||||
it.draw(previewTexture,
|
||||
(AppLoader.screenW - previewWidth).div(2f).round(),
|
||||
(AppLoader.screenH - previewHeight.times(1.25f)).div(2f).round()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
Reference in New Issue
Block a user