mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 06:11:50 +09:00
new watch design consistent with existing UI
This commit is contained in:
BIN
assets/mods/basegame/fonts/watch_new.tga
LFS
Normal file
BIN
assets/mods/basegame/fonts/watch_new.tga
LFS
Normal file
Binary file not shown.
BIN
assets/mods/basegame/gui/old_watchface_atlas_floatey.tga
LFS
Normal file
BIN
assets/mods/basegame/gui/old_watchface_atlas_floatey.tga
LFS
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -212,8 +212,8 @@ abstract class GameItem : Comparable<GameItem>, Cloneable {
|
|||||||
@JvmStatic val BODY_ARMOUR = 0
|
@JvmStatic val BODY_ARMOUR = 0
|
||||||
@JvmStatic val BODY_BACKPACK = 1 // wings, jetpacks, etc.
|
@JvmStatic val BODY_BACKPACK = 1 // wings, jetpacks, etc.
|
||||||
|
|
||||||
@JvmStatic val FOOTWEAR = 2
|
@JvmStatic val HEADGEAR = 2
|
||||||
@JvmStatic val HEADGEAR = 3
|
@JvmStatic val FOOTWEAR = 3
|
||||||
|
|
||||||
@JvmStatic val HAND_GRIP = 4
|
@JvmStatic val HAND_GRIP = 4
|
||||||
@JvmStatic val HAND_GAUNTLET = 5
|
@JvmStatic val HAND_GAUNTLET = 5
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
uiWatchTierOne.setAsAlwaysVisible()
|
uiWatchTierOne.setAsAlwaysVisible()
|
||||||
uiWatchTierOne.setPosition(
|
uiWatchTierOne.setPosition(
|
||||||
((Terrarum.WIDTH - AppLoader.getTvSafeActionWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
((Terrarum.WIDTH - AppLoader.getTvSafeActionWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||||
AppLoader.getTvSafeGraphicsHeight() + 7
|
AppLoader.getTvSafeGraphicsHeight() + 8
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -933,7 +933,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
uiWatchBasic.setPosition(Terrarum.WIDTH - uiWatchBasic.width, 0)
|
uiWatchBasic.setPosition(Terrarum.WIDTH - uiWatchBasic.width, 0)
|
||||||
uiWatchTierOne.setPosition(
|
uiWatchTierOne.setPosition(
|
||||||
((Terrarum.WIDTH - AppLoader.getTvSafeGraphicsWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
((Terrarum.WIDTH - AppLoader.getTvSafeGraphicsWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||||
AppLoader.getTvSafeGraphicsHeight() + 7
|
AppLoader.getTvSafeGraphicsHeight() + 8
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
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.ModMgr
|
||||||
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2019-01-24.
|
||||||
|
*/
|
||||||
|
object WatchFont : BitmapFont() {
|
||||||
|
internal val W = 9
|
||||||
|
internal val H = 12
|
||||||
|
|
||||||
|
internal val fontSheet = TextureRegionPack(ModMgr.getGdxFile("basegame", "fonts/watch_new.tga"), W, H)
|
||||||
|
|
||||||
|
init {
|
||||||
|
setOwnsTexture(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun draw(batch: Batch, str: CharSequence, x: Float, y: Float): GlyphLayout? {
|
||||||
|
|
||||||
|
str.forEachIndexed { index, c ->
|
||||||
|
batch.draw(
|
||||||
|
fontSheet.get((c - '0') % 16, (c - '0') / 16),
|
||||||
|
x + W * index, y
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLineHeight() = H.toFloat()
|
||||||
|
override fun getCapHeight() = getLineHeight()
|
||||||
|
override fun getXHeight() = getLineHeight()
|
||||||
|
}
|
||||||
@@ -8,9 +8,7 @@ import net.torvald.terrarum.*
|
|||||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||||
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
||||||
import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
|
import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
|
||||||
import net.torvald.terrarum.modulebasegame.imagefont.Watch7SegMain
|
import net.torvald.terrarum.modulebasegame.imagefont.WatchFont
|
||||||
import net.torvald.terrarum.modulebasegame.imagefont.Watch7SegSmall
|
|
||||||
import net.torvald.terrarum.modulebasegame.imagefont.WatchDotAlph
|
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
@@ -19,7 +17,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
|||||||
*/
|
*/
|
||||||
class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
||||||
override var width = 160
|
override var width = 160
|
||||||
override var height = 25
|
override var height = 23
|
||||||
override var openCloseTime: Second = 0f
|
override var openCloseTime: Second = 0f
|
||||||
|
|
||||||
private var ELuptimer = 10f // init value higher than uptime: to make the light turned off by default
|
private var ELuptimer = 10f // init value higher than uptime: to make the light turned off by default
|
||||||
@@ -28,18 +26,16 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
|||||||
|
|
||||||
private var atlas = TextureRegionPack(ModMgr.getPath("basegame", "gui/watchface_atlas.tga"), width, height)
|
private var atlas = TextureRegionPack(ModMgr.getPath("basegame", "gui/watchface_atlas.tga"), width, height)
|
||||||
|
|
||||||
private var littleFont = Watch7SegSmall
|
private var watchFont = WatchFont
|
||||||
private var timeFont = Watch7SegMain
|
|
||||||
private var textFont = WatchDotAlph
|
|
||||||
private var moonDial = TextureRegionPack(ModMgr.getPath("basegame", "fonts/watch_17pxmoondial.tga"), 17, 17)
|
private var moonDial = TextureRegionPack(ModMgr.getPath("basegame", "fonts/watch_17pxmoondial.tga"), 17, 17)
|
||||||
private var moonDialCount = moonDial.horizontalCount
|
private var moonDialCount = moonDial.horizontalCount
|
||||||
|
|
||||||
private val drawCol = Color(1f,1f,1f,0.5f)
|
private val drawCol = Color(1f,1f,1f,UIQuickslotBar.DISPLAY_OPACITY)
|
||||||
private val lcdLitColELoff = Color(0x141414_aa)
|
private val lcdLitColELoff = Color(0xc0c0c0ff.toInt()) mul drawCol
|
||||||
private val lcdLitColELon = Color(0x141414_ff)
|
private val lcdLitColELon = Color(0x404040ff) mul drawCol
|
||||||
|
|
||||||
private val lcdLitCol: Color
|
private val lcdLitCol: Color = lcdLitColELoff
|
||||||
get() = if (ELon) lcdLitColELon else lcdLitColELoff
|
//get() = if (ELon) lcdLitColELon else lcdLitColELoff
|
||||||
|
|
||||||
private val worldTime: WorldTime
|
private val worldTime: WorldTime
|
||||||
get() = (Terrarum.ingame!!.world as GameWorldExtension).time
|
get() = (Terrarum.ingame!!.world as GameWorldExtension).time
|
||||||
@@ -62,33 +58,30 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
|||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
// light overlay or EL
|
// light overlay or EL
|
||||||
|
/*blendNormal(batch)
|
||||||
if (ELon) {
|
if (ELon) {
|
||||||
blendNormal(batch)
|
|
||||||
batch.draw(atlas.get(0, 2), 0f, 0f)
|
batch.draw(atlas.get(0, 2), 0f, 0f)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// backplate
|
// backplate
|
||||||
batch.color = Color.WHITE
|
|
||||||
batch.draw(atlas.get(0, 0), 0f, 0f)
|
batch.draw(atlas.get(0, 0), 0f, 0f)
|
||||||
}
|
}*/
|
||||||
|
// disabling light button
|
||||||
// LCD back
|
batch.color = drawCol
|
||||||
blendNormal(batch)
|
batch.draw(atlas.get(0, 0), 0f, 0f)
|
||||||
batch.draw(atlas.get(0, 3), 0f, 0f)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// day name
|
// day name
|
||||||
batch.color = lcdLitCol
|
batch.color = lcdLitCol
|
||||||
textFont.draw(batch, worldTime.getDayNameShort().toUpperCase(), 71f, 7f)
|
watchFont.draw(batch, worldTime.getDayNameShort().toUpperCase(), 73f, 7f)
|
||||||
|
|
||||||
// day
|
// day
|
||||||
littleFont.draw(batch, worldTime.days.toString().padStart(2, ' '), 110f, 6f)
|
watchFont.draw(batch, worldTime.days.toString().padStart(2, '@'), 107f, 7f)
|
||||||
|
|
||||||
// hour
|
// hour
|
||||||
littleFont.draw(batch, worldTime.hours.toString().padStart(2, '/'), 26f, 6f)
|
watchFont.draw(batch, worldTime.hours.toString().padStart(2, '@'), 27f, 7f)
|
||||||
// minute
|
// minute
|
||||||
littleFont.draw(batch, worldTime.minutes.toString().padStart(2, '0'), 48f, 6f)
|
watchFont.draw(batch, worldTime.minutes.toString().padStart(2, '0'), 49f, 7f)
|
||||||
|
|
||||||
// season marker
|
// season marker
|
||||||
batch.draw(atlas.get(1, worldTime.months - 1), 0f, 0f)
|
batch.draw(atlas.get(1, worldTime.months - 1), 0f, 0f)
|
||||||
@@ -97,7 +90,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
|||||||
// moon dial
|
// moon dial
|
||||||
val moonPhase = (worldTime.moonPhase * moonDialCount).roundInt() % moonDialCount
|
val moonPhase = (worldTime.moonPhase * moonDialCount).roundInt() % moonDialCount
|
||||||
batch.color = lcdLitCol
|
batch.color = lcdLitCol
|
||||||
batch.draw(moonDial.get(moonPhase, 0), 6f, 4f)
|
batch.draw(moonDial.get(moonPhase, 0), 6f, 3f)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
BIN
work_files/UI/inventory_equip_icons.psd
LFS
Normal file
BIN
work_files/UI/inventory_equip_icons.psd
LFS
Normal file
Binary file not shown.
Binary file not shown.
BIN
work_files/graphics/gui/watches/floatey_smol_consistent.psd
LFS
Normal file
BIN
work_files/graphics/gui/watches/floatey_smol_consistent.psd
LFS
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user