mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
asset archiving wip
This commit is contained in:
@@ -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