better drop shadow for tooltip

This commit is contained in:
minjaesong
2021-08-04 17:20:10 +09:00
parent 7b029126f3
commit c6c8d02118
6 changed files with 46 additions and 12 deletions

View File

@@ -79,7 +79,7 @@ open class GameWorld : Disposable {
@TEMzPayload("WiNt", TEMzPayload.EXTERNAL_JSON)
private val wirings: HashMap<BlockAddress, WiringNode>
private val wiringGraph = HashMap<BlockAddress, HashMap<ItemID, Byte>>()
private val wiringGraph = HashMap<BlockAddress, HashMap<ItemID, WiringSimCell>>()
private val WIRE_POS_MAP = byteArrayOf(1,2,4,8)
/**
@@ -353,7 +353,17 @@ open class GameWorld : Disposable {
}
fun getWireGraphUnsafe(blockAddr: BlockAddress, itemID: ItemID): Byte? {
return wiringGraph[blockAddr]?.get(itemID)
return wiringGraph[blockAddr]?.get(itemID)?.con
}
fun getWireStateOf(x: Int, y: Int, itemID: ItemID): Vector2? {
val (x, y) = coerceXY(x, y)
val blockAddr = LandUtil.getBlockAddr(this, x, y)
return getWireStateUnsafe(blockAddr, itemID)
}
fun getWireStateUnsafe(blockAddr: BlockAddress, itemID: ItemID): Vector2? {
return wiringGraph[blockAddr]?.get(itemID)?.state
}
fun setWireGraphOf(x: Int, y: Int, itemID: ItemID, byte: Byte) {
@@ -363,10 +373,29 @@ open class GameWorld : Disposable {
}
fun setWireGraphOfUnsafe(blockAddr: BlockAddress, itemID: ItemID, byte: Byte) {
if (wiringGraph[blockAddr] == null)
if (wiringGraph[blockAddr] == null) {
wiringGraph[blockAddr] = HashMap()
wiringGraph[blockAddr]!![itemID] = WiringSimCell(byte)
}
else {
wiringGraph[blockAddr]!![itemID]!!.con = byte
}
}
wiringGraph[blockAddr]!![itemID] = byte
fun setWireStateOf(x: Int, y: Int, itemID: ItemID, vector: Vector2) {
val (x, y) = coerceXY(x, y)
val blockAddr = LandUtil.getBlockAddr(this, x, y)
return setWireStateOfUnsafe(blockAddr, itemID, vector)
}
fun setWireStateOfUnsafe(blockAddr: BlockAddress, itemID: ItemID, vector: Vector2) {
if (wiringGraph[blockAddr] == null) {
wiringGraph[blockAddr] = HashMap()
wiringGraph[blockAddr]!![itemID] = WiringSimCell(0, vector)
}
else {
wiringGraph[blockAddr]!![itemID]!!.state = vector
}
}
fun getAllWiresFrom(x: Int, y: Int): SortedArrayList<ItemID>? {
@@ -560,6 +589,11 @@ open class GameWorld : Disposable {
}
}
data class WiringSimCell(
var con: Byte = 0, // connections
var state: Vector2 = Vector2(0.0, 0.0)
)
fun getTemperature(worldTileX: Int, worldTileY: Int): Float? {
return null
}

View File

@@ -10,7 +10,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
*/
object FloatDrawer : Disposable {
val tile = TextureRegionPack("assets/graphics/gui/message_white_tileable.tga", 16, 16)
val tile = TextureRegionPack("assets/graphics/gui/message_white_tileable.tga", 36, 36)
init {
AppLoader.disposableSingletonsPool.add(this)

View File

@@ -40,7 +40,7 @@ class UITooltip : UICanvas() {
val mouseX = 4f
val mouseY = 6f
val tooltipYoff = 12
val tooltipYoff = 50
val tooltipY = mouseY - height + tooltipYoff
val txtW = msgWidth + 2f * textMarginX

Binary file not shown.