mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
asset archiving wip
This commit is contained in:
@@ -149,8 +149,8 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
private lateinit var worldFBO: Float16FrameBuffer
|
||||
|
||||
private val warning32bitJavaIcon = TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/32_bit_warning.tga")))
|
||||
private val warningAppleRosettaIcon = TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/apple_rosetta_warning.tga")))
|
||||
private val warning32bitJavaIcon = TextureRegion(Texture(AssetCache.getFileHandle("graphics/gui/32_bit_warning.tga")))
|
||||
private val warningAppleRosettaIcon = TextureRegion(Texture(AssetCache.getFileHandle("graphics/gui/apple_rosetta_warning.tga")))
|
||||
|
||||
init {
|
||||
gameUpdateGovernor = ConsistentUpdateRate.also { it.reset() }
|
||||
@@ -219,7 +219,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
// load a half-gradient texture that would be used throughout the titlescreen and its sub UIs
|
||||
CommonResourcePool.addToLoadingList("title_halfgrad") {
|
||||
Texture(Gdx.files.internal("./assets/graphics/halfgrad.tga")).also {
|
||||
Texture(AssetCache.getFileHandle("graphics/halfgrad.tga")).also {
|
||||
it.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.audio.Music
|
||||
import net.torvald.terrarum.AssetCache
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
|
||||
@@ -35,7 +36,7 @@ internal object MusicTest : ConsoleCommand {
|
||||
File("./assets/sounds/test/${args[1]}").absoluteFile.toURI().toURL()
|
||||
).playAsMusic(1f, 1f, false)*/
|
||||
|
||||
music = Gdx.audio.newMusic(Gdx.files.internal("./assets/sounds/test/${args[1]}"))
|
||||
music = Gdx.audio.newMusic(AssetCache.getFileHandle("sounds/test/${args[1]}"))
|
||||
music!!.play()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.gameitems
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.AssetCache
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
@@ -29,7 +30,7 @@ class ItemTapestry(originalID: ItemID) : FixtureItemBase(originalID, "net.torval
|
||||
@Transient override val makeFixture: (String) -> FixtureBase = { moduleName: String ->
|
||||
FixtureTapestry(
|
||||
// TODO use extra["fileRef"] (string) and extra["framingMaterial"] (string)
|
||||
Gdx.files.internal("assets/monkey_island").readBytes(),
|
||||
AssetCache.getFileHandle("monkey_island").readBytes(),
|
||||
Block.PLANK_NORMAL
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.imagefont
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout
|
||||
import net.torvald.terrarum.AssetCache
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
@@ -22,7 +23,7 @@ class NewRunes : BitmapFont() {
|
||||
null
|
||||
|
||||
|
||||
private val runes = TextureRegionPack("./assets/graphics/fonts/newrunes.tga", runeSize, runeSize)
|
||||
private val runes = TextureRegionPack(AssetCache.getFileHandle("graphics/fonts/newrunes.tga"), runeSize, runeSize)
|
||||
|
||||
var scale = 1
|
||||
var linegap = 8
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.AssetCache
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.TerrarumScreenSize
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
@@ -22,10 +23,10 @@ object ControlPanelCommon {
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("gui_hrule") {
|
||||
TextureRegionPack(Gdx.files.internal("assets/graphics/gui/hrule.tga"), 216, 20)
|
||||
TextureRegionPack(AssetCache.getFileHandle("graphics/gui/hrule.tga"), 216, 20)
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("gui_slider_horz_backdrop_contrast") {
|
||||
TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/slider_background_contrast.tga")).also {
|
||||
TextureRegion(Texture(AssetCache.getFileHandle("graphics/gui/slider_background_contrast.tga")).also {
|
||||
it.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.AssetCache
|
||||
import net.torvald.terrarum.toInt
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -28,7 +29,7 @@ object ItemSlotImageFactory {
|
||||
/** Blend mode: screen */
|
||||
val CELLCOLOUR_BLACK_ACTIVE = Color(0x282828ff)
|
||||
|
||||
val slotImage = TextureRegionPack(Gdx.files.internal("./assets/graphics/gui/quickbar/item_slots_atlas2.tga"), TILE_WIDTH, TILE_HEIGHT) // must have same w/h as slotLarge
|
||||
val slotImage = TextureRegionPack(AssetCache.getFileHandle("graphics/gui/quickbar/item_slots_atlas2.tga"), TILE_WIDTH, TILE_HEIGHT) // must have same w/h as slotLarge
|
||||
|
||||
fun produce(isBlack: Boolean, number: Int?, sprite: TextureRegion?): ItemSlotImage {
|
||||
return ItemSlotImage(slotImage.get(number ?: 10, 0 or isBlack.toInt().shl(1)), sprite)
|
||||
|
||||
@@ -67,7 +67,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
|
||||
// will be disposed by Terrarum (application main instance)
|
||||
val SEGMENT_BLACK = TextureRegionPack("assets/graphics/gui/message_black.tga", 8, 56)
|
||||
val SEGMENT_WHITE = TextureRegionPack("assets/graphics/gui/message_white.tga", 8, 56)
|
||||
val SEGMENT_BLACK = TextureRegionPack(AssetCache.getFileHandle("graphics/gui/message_black.tga"), 8, 56)
|
||||
val SEGMENT_WHITE = TextureRegionPack(AssetCache.getFileHandle("graphics/gui/message_white.tga"), 8, 56)
|
||||
}
|
||||
}*/
|
||||
|
||||
@@ -76,7 +76,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
readFromLang = true,
|
||||
textAreaWidth = 100,
|
||||
defaultSelection = 0,
|
||||
iconSpriteSheet = TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20),
|
||||
iconSpriteSheet = TextureRegionPack(AssetCache.getFileHandle("graphics/gui/inventory/category.tga"), 20, 20),
|
||||
iconSpriteSheetIndices = intArrayOf(9,6,7,1,0,2,3,4,5,8),
|
||||
iconCol = defaultTextColour,
|
||||
highlightBackCol = Color(0xb8b8b8_ff.toInt()),
|
||||
@@ -108,7 +108,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
|
||||
private val scrollImageButtonAtlas = TextureRegionPack(
|
||||
Gdx.files.internal("assets/graphics/gui/inventory/page_arrow_button.tga"),
|
||||
AssetCache.getFileHandle("graphics/gui/inventory/page_arrow_button.tga"),
|
||||
40, 54
|
||||
)
|
||||
private val scrollLeftButton = UIItemImageButton(this,
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.AssetCache
|
||||
import net.torvald.terrarum.GdxColorMap
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.ui.Toolkit
|
||||
@@ -86,7 +87,7 @@ abstract class UIItemInventoryCellBase(
|
||||
}
|
||||
|
||||
object UIItemInventoryCellCommonRes {
|
||||
val meterColourMap = GdxColorMap(Gdx.files.internal("./assets/clut/health_bar_colouring_4096.tga"))
|
||||
val meterColourMap = GdxColorMap(AssetCache.getFileHandle("clut/health_bar_colouring_4096.tga"))
|
||||
val meterBackDarkening = Color(0x666666ff.toInt())
|
||||
|
||||
fun getHealthMeterColour(value: Float, start: Float, end: Float): Color {
|
||||
|
||||
@@ -66,7 +66,7 @@ open class UIItemInventoryItemGrid(
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("inventory_walletnumberfont") {
|
||||
TextureRegionPack("./assets/graphics/fonts/inventory_wallet_numbers.tga", 20, 9)
|
||||
TextureRegionPack(AssetCache.getFileHandle("graphics/fonts/inventory_wallet_numbers.tga"), 20, 9)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
@@ -105,7 +105,7 @@ open class UIItemInventoryItemGrid(
|
||||
var inventorySortList = ArrayList<InventoryPair>()
|
||||
protected var rebuildList = true
|
||||
|
||||
protected val walletFont = TextureRegionPack("./assets/graphics/fonts/inventory_wallet_numbers.tga", 20, 9)
|
||||
protected val walletFont = TextureRegionPack(AssetCache.getFileHandle("graphics/fonts/inventory_wallet_numbers.tga"), 20, 9)
|
||||
protected var walletText = ""
|
||||
|
||||
|
||||
|
||||
@@ -103,10 +103,10 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : Advanceable() {
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("terrarum-defaultsavegamethumb") {
|
||||
TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/savegame_thumb_placeholder.png")))
|
||||
TextureRegion(Texture(AssetCache.getFileHandle("graphics/gui/savegame_thumb_placeholder.png")))
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("savegame_status_icon") {
|
||||
TextureRegionPack("assets/graphics/gui/savegame_status_icon.tga", 24, 24)
|
||||
TextureRegionPack(AssetCache.getFileHandle("graphics/gui/savegame_status_icon.tga"), 24, 24)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class UILoadList(val full: UILoadSavegame) : UICanvas() {
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("gradtile32") {
|
||||
TextureRegionPack("assets/graphics/gui/gradtile32.tga", 1, 32)
|
||||
TextureRegionPack(AssetCache.getFileHandle("graphics/gui/gradtile32.tga"), 1, 32)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
||||
handler.allowESCtoClose = false
|
||||
|
||||
CommonResourcePool.addToLoadingList("terrarum-defaultsavegamethumb") {
|
||||
TextureRegion(Texture(Gdx.files.internal("assets/graphics/gui/savegame_thumb_placeholder.png")))
|
||||
TextureRegion(Texture(AssetCache.getFileHandle("graphics/gui/savegame_thumb_placeholder.png")))
|
||||
}
|
||||
CommonResourcePool.addToLoadingList("savegame_status_icon") {
|
||||
TextureRegionPack("assets/graphics/gui/savegame_status_icon.tga", 24, 24)
|
||||
TextureRegionPack(AssetCache.getFileHandle("graphics/gui/savegame_status_icon.tga"), 24, 24)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class BTeXTest(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
Thread {
|
||||
try {
|
||||
measureTimeMillis {
|
||||
val f = BTeXParser.invoke(Gdx.files.internal("./assets/mods/basegame/books/$filePath"), varMap, typesetProgress)
|
||||
val f = BTeXParser.invoke(AssetCache.getFileHandle("mods/basegame/books/$filePath"), varMap, typesetProgress)
|
||||
document = f.first
|
||||
documentHandler = f.second
|
||||
}.also {
|
||||
@@ -130,7 +130,7 @@ class BTeXTest(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
else {
|
||||
measureTimeMillis {
|
||||
document = BTeXDocument.fromFile(Gdx.files.internal("./assets/mods/basegame/books/$filePath"))
|
||||
document = BTeXDocument.fromFile(AssetCache.getFileHandle("mods/basegame/books/$filePath"))
|
||||
}.also {
|
||||
println("Time spent on loading [ms]: $it")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user