mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
wait spinner
This commit is contained in:
BIN
assets/graphics/gui/inline_loading_spinner.tga
LFS
Normal file
BIN
assets/graphics/gui/inline_loading_spinner.tga
LFS
Normal file
Binary file not shown.
@@ -381,6 +381,7 @@ public class App implements ApplicationListener {
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("blockmarkings_common", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/blocks/block_markings_common.tga"), 16, 16, 0, 0, 0, 0, false, false, false));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("blockmarking_actor", () -> new BlockMarkerActor());
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("loading_circle_64", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/loading_circle_64.tga"), 64, 64, 0, 0, 0, 0, false, false, false));
|
||||
CommonResourcePool.INSTANCE.addToLoadingList("inline_loading_spinner", () -> new TextureRegionPack(Gdx.files.internal("assets/graphics/gui/inline_loading_spinner.tga"), 20, 20, 0, 0, 0, 0, false, false, false));
|
||||
|
||||
newTempFile("wenquanyi.tga"); // temp file required by the font
|
||||
|
||||
|
||||
@@ -5,11 +5,8 @@ import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.printdbgerr
|
||||
import net.torvald.terrarum.QNDTreeNode
|
||||
import net.torvald.terrarum.TitleScreen
|
||||
import net.torvald.terrarum.Yaml
|
||||
import net.torvald.terrarum.serialise.WriteConfig
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemTextButton
|
||||
@@ -280,11 +277,30 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
||||
tagsCollection = tags
|
||||
)
|
||||
|
||||
private val spinner = CommonResourcePool.getAsTextureRegionPack("inline_loading_spinner")
|
||||
private var spinnerTimer = 0f
|
||||
private var spinnerFrame = 0
|
||||
private val spinnerInterval = 1f / 60f
|
||||
|
||||
fun update(delta: Float) {
|
||||
spinnerTimer += delta
|
||||
if (spinnerTimer > spinnerInterval) {
|
||||
spinnerFrame = (spinnerFrame + 1) % 32
|
||||
spinnerTimer -= spinnerInterval
|
||||
}
|
||||
|
||||
menubar.update(delta)
|
||||
}
|
||||
|
||||
fun render(batch: SpriteBatch, camera: Camera) {
|
||||
val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8)
|
||||
|
||||
val inlineOffsetY = if (App.GAME_LOCALE.startsWith("th")) 0f
|
||||
else if (App.GAME_LOCALE.startsWith("ko")) 0f
|
||||
else 1f
|
||||
|
||||
batch.draw(spin, menubar.posX + paddingLeft - 5f, menubar.posY + (lineHeight - 20) / 2 - inlineOffsetY)
|
||||
|
||||
menubar.render(batch, camera)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user