mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 20:14:05 +09:00
better drop shadow for tooltip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -79,7 +79,7 @@ open class GameWorld : Disposable {
|
|||||||
@TEMzPayload("WiNt", TEMzPayload.EXTERNAL_JSON)
|
@TEMzPayload("WiNt", TEMzPayload.EXTERNAL_JSON)
|
||||||
private val wirings: HashMap<BlockAddress, WiringNode>
|
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)
|
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? {
|
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) {
|
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) {
|
fun setWireGraphOfUnsafe(blockAddr: BlockAddress, itemID: ItemID, byte: Byte) {
|
||||||
if (wiringGraph[blockAddr] == null)
|
if (wiringGraph[blockAddr] == null) {
|
||||||
wiringGraph[blockAddr] = HashMap()
|
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>? {
|
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? {
|
fun getTemperature(worldTileX: Int, worldTileY: Int): Float? {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
|||||||
*/
|
*/
|
||||||
object FloatDrawer : Disposable {
|
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 {
|
init {
|
||||||
AppLoader.disposableSingletonsPool.add(this)
|
AppLoader.disposableSingletonsPool.add(this)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class UITooltip : UICanvas() {
|
|||||||
val mouseX = 4f
|
val mouseX = 4f
|
||||||
val mouseY = 6f
|
val mouseY = 6f
|
||||||
|
|
||||||
val tooltipYoff = 12
|
val tooltipYoff = 50
|
||||||
val tooltipY = mouseY - height + tooltipYoff
|
val tooltipY = mouseY - height + tooltipYoff
|
||||||
|
|
||||||
val txtW = msgWidth + 2f * textMarginX
|
val txtW = msgWidth + 2f * textMarginX
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user