mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-06 08:38:30 +09:00
working new loadscreen (not worldgen)
This commit is contained in:
@@ -592,7 +592,7 @@ public class App implements ApplicationListener {
|
|||||||
|
|
||||||
|
|
||||||
FrameBufferManager.begin(renderFBO);
|
FrameBufferManager.begin(renderFBO);
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f);
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f);
|
||||||
setCameraPosition(0, 0);
|
setCameraPosition(0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ object ErrorDisp : Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ object SanicLoadScreen : LoadScreenBase() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
textFbo.inAction(null, null) {
|
textFbo.inAction(null, null) {
|
||||||
gdxClearAndEnableBlend(0f, 0f, 0f, 0f)
|
gdxClearAndEnableBlend(0f, 0f, 0f, 0f)
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ object TerrarumPostProcessor : Disposable {
|
|||||||
outFBO.inAction(camera, batch) {
|
outFBO.inAction(camera, batch) {
|
||||||
App.measureDebugTime("Renderer.PostProcessor") {
|
App.measureDebugTime("Renderer.PostProcessor") {
|
||||||
|
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
fbo.colorBufferTexture.setFilter(
|
fbo.colorBufferTexture.setFilter(
|
||||||
Texture.TextureFilter.Linear,
|
Texture.TextureFilter.Linear,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class ChunkLoadingLoadScreen(screenToBeLoaded: IngameInstance, private val world
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
val drawWidth = Toolkit.drawWidth
|
val drawWidth = Toolkit.drawWidth
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import kotlin.math.sqrt
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2023-10-30.
|
* Created by minjaesong on 2023-10-30.
|
||||||
*/
|
*/
|
||||||
class FancyWorldGenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidth: Int, private val worldheight: Int, override var preLoadJob: (LoadScreenBase) -> Unit) : LoadScreenBase() {
|
class FancyWorldReadLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidth: Int, private val worldheight: Int, override var preLoadJob: (LoadScreenBase) -> Unit) : LoadScreenBase() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
CommonResourcePool.addToLoadingList("basegame-gui-loadscrlayer01") {
|
CommonResourcePool.addToLoadingList("basegame-gui-loadscrlayer01") {
|
||||||
@@ -58,8 +58,10 @@ class FancyWorldGenLoadScreen(screenToBeLoaded: IngameInstance, private val worl
|
|||||||
TextureRegionPack(it, visibleTileSize, imgYoff + previewHeight, gapSize, 0, xoff, 0)
|
TextureRegionPack(it, visibleTileSize, imgYoff + previewHeight, gapSize, 0, xoff, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var chunksLoaded = 0 // only increments when all the chunks were loaded
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
App.batch.inUse { val it = it as FlippingSpriteBatch
|
App.batch.inUse { val it = it as FlippingSpriteBatch
|
||||||
it.color = Color.WHITE
|
it.color = Color.WHITE
|
||||||
@@ -82,16 +84,17 @@ class FancyWorldGenLoadScreen(screenToBeLoaded: IngameInstance, private val worl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getProgress(): Int {
|
private fun getProgress(): Int {
|
||||||
return 42
|
return (chunksLoaded.toDouble() / vtilesCount).roundToInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getStage(): Int {
|
private fun getStage(): Int {
|
||||||
return 2
|
return 2 // fixed value for Read screen
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawTiles(batch: FlippingSpriteBatch, layerCount: Int, tileCount: Int, x: Float, y: Float) {
|
private fun drawTiles(batch: FlippingSpriteBatch, layerCount: Int, tileCount: Int, x: Float, y: Float) {
|
||||||
for (layer in 0 until layerCount) {
|
for (layer in 0 until layerCount) {
|
||||||
for (i in 0 until if (layer == layerCount - 1) tileCount else htilesCount) {
|
// for (i in 0 until if (layer == layerCount - 1) tileCount else htilesCount) {
|
||||||
|
for (i in 0 until tileCount) {
|
||||||
batch.draw(tiles[layer].get(i, 0), x + i * tileSize, y)
|
batch.draw(tiles[layer].get(i, 0), x + i * tileSize, y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
val drawWidth = Toolkit.drawWidth
|
val drawWidth = Toolkit.drawWidth
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ import net.torvald.terrarum.gameworld.BlockLayerI16F16
|
|||||||
import net.torvald.terrarum.gameworld.BlockLayerI16I8
|
import net.torvald.terrarum.gameworld.BlockLayerI16I8
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.modulebasegame.ChunkLoadingLoadScreen
|
import net.torvald.terrarum.modulebasegame.FancyWorldReadLoadScreen
|
||||||
import net.torvald.terrarum.modulebasegame.FancyWorldGenLoadScreen
|
|
||||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
||||||
@@ -163,7 +162,7 @@ object LoadSavegame {
|
|||||||
|
|
||||||
|
|
||||||
val loadJob = { it: LoadScreenBase ->
|
val loadJob = { it: LoadScreenBase ->
|
||||||
val loadscreen = it as FancyWorldGenLoadScreen
|
val loadscreen = it as FancyWorldReadLoadScreen
|
||||||
loadscreen.addMessage(Lang["MENU_IO_LOADING"])
|
loadscreen.addMessage(Lang["MENU_IO_LOADING"])
|
||||||
|
|
||||||
|
|
||||||
@@ -201,6 +200,7 @@ object LoadSavegame {
|
|||||||
|
|
||||||
ReadWorld.decodeChunkToLayer(chunkFile.getContent(), worldLayer[layer]!!, chunkXY.x, chunkXY.y)
|
ReadWorld.decodeChunkToLayer(chunkFile.getContent(), worldLayer[layer]!!, chunkXY.x, chunkXY.y)
|
||||||
}
|
}
|
||||||
|
it.chunksLoaded += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
loadscreen.addMessage("Updating Block Mappings...")
|
loadscreen.addMessage("Updating Block Mappings...")
|
||||||
@@ -211,7 +211,7 @@ object LoadSavegame {
|
|||||||
printdbg(this, "World loaded: ${newIngame.worldDisk.getDiskName(Common.CHARSET)}")
|
printdbg(this, "World loaded: ${newIngame.worldDisk.getDiskName(Common.CHARSET)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
val loadScreen = FancyWorldGenLoadScreen(newIngame, world.width, world.height, loadJob)
|
val loadScreen = FancyWorldReadLoadScreen(newIngame, world.width, world.height, loadJob)
|
||||||
Terrarum.setCurrentIngameInstance(newIngame)
|
Terrarum.setCurrentIngameInstance(newIngame)
|
||||||
App.setLoadScreen(loadScreen)
|
App.setLoadScreen(loadScreen)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ object StaticLoadScreenSubstitute {
|
|||||||
operator fun invoke(batch: SpriteBatch) {
|
operator fun invoke(batch: SpriteBatch) {
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
batch.begin()
|
batch.begin()
|
||||||
|
|
||||||
|
|||||||
@@ -312,7 +312,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
// to hide the "flipped skybox" artefact
|
// to hide the "flipped skybox" artefact
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|
||||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
gdxClearAndEnableBlend(.063f, .070f, .086f, 1f)
|
||||||
|
|
||||||
batch.begin()
|
batch.begin()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user