From 4ddf03762656e9b31d33a0470530c65cca77d675 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 24 Jan 2019 02:32:28 +0900 Subject: [PATCH] new TV-safe watch UI --- assets/graphics/! PSD to TGA imagemagick.bat | 15 ++++++++++ assets/mods/basegame/fonts/watch_dotalph.tga | 2 +- ...ce2_atlas.tga => old_watchface2_atlas.tga} | 0 .../mods/basegame/gui/old_watchface_atlas.tga | 3 ++ assets/mods/basegame/gui/watchface_atlas.tga | 4 +-- .../torvald/terrarum/modulebasegame/Ingame.kt | 30 ++++++++++++------- .../modulebasegame/ui/UITierOneWatch.kt | 18 +++++------ work_files/UI/overscan_safe_watches.psd | 3 ++ .../graphics/gui/watches/floatey_smol.psd | 3 ++ 9 files changed, 56 insertions(+), 22 deletions(-) create mode 100644 assets/graphics/! PSD to TGA imagemagick.bat rename assets/mods/basegame/gui/{watchface2_atlas.tga => old_watchface2_atlas.tga} (100%) create mode 100644 assets/mods/basegame/gui/old_watchface_atlas.tga create mode 100644 work_files/UI/overscan_safe_watches.psd create mode 100644 work_files/graphics/gui/watches/floatey_smol.psd diff --git a/assets/graphics/! PSD to TGA imagemagick.bat b/assets/graphics/! PSD to TGA imagemagick.bat new file mode 100644 index 000000000..851e47070 --- /dev/null +++ b/assets/graphics/! PSD to TGA imagemagick.bat @@ -0,0 +1,15 @@ +SET basefilename=%~d1%~p1%~n1 +SET inputextension=%~x1 +rem inputextension should be dot-psd +rem color space must be Lab16 + +IF "%inputextension%" NEQ ".psd" goto fail + +convert %1 -colorspace sRGB -write mpr:temp -background black -alpha Remove mpr:temp -compose Copy_Opacity -composite "%basefilename%.tga" + +exit + +:fail +echo "File not PSD" +pause +exit /b 1 diff --git a/assets/mods/basegame/fonts/watch_dotalph.tga b/assets/mods/basegame/fonts/watch_dotalph.tga index 7a1e392cc..bf959a073 100644 --- a/assets/mods/basegame/fonts/watch_dotalph.tga +++ b/assets/mods/basegame/fonts/watch_dotalph.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b962e0473595998b626bb58a0f356815dc29c642065dda8a9ce7d12950b5d3ea +oid sha256:407f3ee57fb702906f74499bf1a914c3a4a44ce9e23dfb70ec5af3ad78d73a87 size 12924 diff --git a/assets/mods/basegame/gui/watchface2_atlas.tga b/assets/mods/basegame/gui/old_watchface2_atlas.tga similarity index 100% rename from assets/mods/basegame/gui/watchface2_atlas.tga rename to assets/mods/basegame/gui/old_watchface2_atlas.tga diff --git a/assets/mods/basegame/gui/old_watchface_atlas.tga b/assets/mods/basegame/gui/old_watchface_atlas.tga new file mode 100644 index 000000000..f8df668fe --- /dev/null +++ b/assets/mods/basegame/gui/old_watchface_atlas.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b389c17a1d6ae5bd9b9bccfbd6ef3dd351113bc92264ded60c2bb6e8b622ecc3 +size 70764 diff --git a/assets/mods/basegame/gui/watchface_atlas.tga b/assets/mods/basegame/gui/watchface_atlas.tga index f8df668fe..a29dbd6a7 100644 --- a/assets/mods/basegame/gui/watchface_atlas.tga +++ b/assets/mods/basegame/gui/watchface_atlas.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b389c17a1d6ae5bd9b9bccfbd6ef3dd351113bc92264ded60c2bb6e8b622ecc3 -size 70764 +oid sha256:72827903ef9fa8a1c8d1d899cb6f1f2c6b8e8a35658613bb8685836da9cf70e2 +size 128044 diff --git a/src/net/torvald/terrarum/modulebasegame/Ingame.kt b/src/net/torvald/terrarum/modulebasegame/Ingame.kt index dc3bb15d2..e3a5462c6 100644 --- a/src/net/torvald/terrarum/modulebasegame/Ingame.kt +++ b/src/net/torvald/terrarum/modulebasegame/Ingame.kt @@ -337,7 +337,10 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { uiWatchTierOne = UITierOneWatch(actorNowPlaying) uiWatchTierOne.setAsAlwaysVisible() - uiWatchTierOne.setPosition(Terrarum.WIDTH - uiWatchTierOne.width, uiWatchBasic.height - 2) + uiWatchTierOne.setPosition( + ((Terrarum.WIDTH - AppLoader.getTvSafeActionWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width), + AppLoader.getTvSafeGraphicsHeight() + 7 + ) uiTooltip = UITooltip() @@ -512,14 +515,6 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { // TODO thread pool(?) CollisionSolver.process() - - visibleActorsRenderBehind = actorsRenderBehind.filter { it.inScreen() } - visibleActorsRenderMiddle = actorsRenderMiddle.filter { it.inScreen() } - visibleActorsRenderMidTop = actorsRenderMidTop.filter { it.inScreen() } - visibleActorsRenderFront = actorsRenderFront.filter { it.inScreen() } - visibleActorsRenderOverlay=actorsRenderOverlay.filter { it.inScreen() } - - WorldCamera.update(gameworld, actorNowPlaying) } @@ -542,6 +537,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { private fun renderGame() { Gdx.graphics.setTitle(getCanonicalTitle()) + filterVisibleActors() + IngameRenderer.invoke( world as GameWorldExtension, visibleActorsRenderBehind, @@ -556,6 +553,14 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { } + private fun filterVisibleActors() { + visibleActorsRenderBehind = actorsRenderBehind.filter { it.inScreen() } + visibleActorsRenderMiddle = actorsRenderMiddle.filter { it.inScreen() } + visibleActorsRenderMidTop = actorsRenderMidTop.filter { it.inScreen() } + visibleActorsRenderFront = actorsRenderFront.filter { it.inScreen() } + visibleActorsRenderOverlay=actorsRenderOverlay.filter { it.inScreen() } + } + private fun repossessActor() { // check if currently pocessed actor is removed from game if (!theGameHasActor(actorNowPlaying)) { @@ -913,6 +918,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { notifier.setPosition( (Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height) + uiQuickBar.setPosition((Terrarum.WIDTH - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight()) // inventory /*uiInventoryPlayer = @@ -925,7 +931,11 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) { // basic watch-style notification bar (temperature, new mail) uiWatchBasic.setPosition(Terrarum.WIDTH - uiWatchBasic.width, 0) - uiWatchTierOne.setPosition(Terrarum.WIDTH - uiWatchTierOne.width, uiWatchBasic.height - 2) + uiWatchTierOne.setPosition( + ((Terrarum.WIDTH - AppLoader.getTvSafeGraphicsWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width), + AppLoader.getTvSafeGraphicsHeight() + 7 + ) + } diff --git a/src/net/torvald/terrarum/modulebasegame/ui/UITierOneWatch.kt b/src/net/torvald/terrarum/modulebasegame/ui/UITierOneWatch.kt index 8961d27c0..3f18bc748 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/UITierOneWatch.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/UITierOneWatch.kt @@ -18,15 +18,15 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack * Created by minjaesong on 2017-06-11. */ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() { - override var width = 77 - override var height = 53 + override var width = 160 + override var height = 25 override var openCloseTime: Second = 0f private var ELuptimer = 10f // init value higher than uptime: to make the light turned off by default private val ELuptime = 4f private var ELon = false - private var atlas = TextureRegionPack(ModMgr.getPath("basegame", "gui/watchface2_atlas.tga"), width, height) + private var atlas = TextureRegionPack(ModMgr.getPath("basegame", "gui/watchface_atlas.tga"), width, height) private var littleFont = Watch7SegSmall private var timeFont = Watch7SegMain @@ -68,7 +68,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() { } else { // backplate - batch.color = drawCol + batch.color = Color.WHITE batch.draw(atlas.get(0, 0), 0f, 0f) } @@ -80,15 +80,15 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() { // day name batch.color = lcdLitCol - textFont.draw(batch, worldTime.getDayNameShort().toUpperCase(), 9f, 5f) + textFont.draw(batch, worldTime.getDayNameShort().toUpperCase(), 71f, 7f) // day - littleFont.draw(batch, worldTime.days.toString().padStart(2, ' '), 54f, 4f) + littleFont.draw(batch, worldTime.days.toString().padStart(2, ' '), 110f, 6f) // hour - timeFont.draw(batch, worldTime.hours.toString().padStart(2, '/'), 25f, 31f) + littleFont.draw(batch, worldTime.hours.toString().padStart(2, '/'), 26f, 6f) // minute - timeFont.draw(batch, worldTime.minutes.toString().padStart(2, '0'), 53f, 31f) + littleFont.draw(batch, worldTime.minutes.toString().padStart(2, '0'), 48f, 6f) // season marker batch.draw(atlas.get(1, worldTime.months - 1), 0f, 0f) @@ -97,7 +97,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() { // moon dial val moonPhase = (worldTime.moonPhase * moonDialCount).roundInt() % moonDialCount batch.color = lcdLitCol - batch.draw(moonDial.get(moonPhase, 0), 4f, 19f) + batch.draw(moonDial.get(moonPhase, 0), 6f, 4f) } override fun doOpening(delta: Float) { diff --git a/work_files/UI/overscan_safe_watches.psd b/work_files/UI/overscan_safe_watches.psd new file mode 100644 index 000000000..7482e84fe --- /dev/null +++ b/work_files/UI/overscan_safe_watches.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:081339e3062d40863d638fff2b1681cc1aaa3ad922b1b29767e0094002b8d350 +size 3282054 diff --git a/work_files/graphics/gui/watches/floatey_smol.psd b/work_files/graphics/gui/watches/floatey_smol.psd new file mode 100644 index 000000000..3ff493a9e --- /dev/null +++ b/work_files/graphics/gui/watches/floatey_smol.psd @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23160e2e4d6bc8c5a8cb4f60740a15b8f7425a863a02e106912b7f85bd9b616a +size 284172