streamer mode wip

This commit is contained in:
minjaesong
2021-10-06 00:18:39 +09:00
parent 907dc9a936
commit 2c6dc8750a
19 changed files with 82 additions and 57 deletions

View File

@@ -11,5 +11,6 @@
"MENU_LABEL_RESET" : "Reset", "MENU_LABEL_RESET" : "Reset",
"GAME_32BIT_WARNING1": "It looks like youre running a 32-Bit version of Java.", "GAME_32BIT_WARNING1": "It looks like youre running a 32-Bit version of Java.",
"GAME_32BIT_WARNING2": "Please download and install the latest 64-Bit Java at:", "GAME_32BIT_WARNING2": "Please download and install the latest 64-Bit Java at:",
"GAME_32BIT_WARNING3": "https://www.java.com/en/download/" "GAME_32BIT_WARNING3": "https://www.java.com/en/download/",
"MENU_OPTION_STREAMERS_LAYOUT": "Chat Overlay Mode"
} }

View File

@@ -10,5 +10,6 @@
"MENU_LABEL_RESET" : "재설정", "MENU_LABEL_RESET" : "재설정",
"GAME_32BIT_WARNING1": "32비트 버전의 Java를 사용중인 것 같습니다.", "GAME_32BIT_WARNING1": "32비트 버전의 Java를 사용중인 것 같습니다.",
"GAME_32BIT_WARNING2": "아래 링크에서 최신 64비트 Java를 내려받아 설치해주세요.", "GAME_32BIT_WARNING2": "아래 링크에서 최신 64비트 Java를 내려받아 설치해주세요.",
"GAME_32BIT_WARNING3": "https://www.java.com/ko/download/" "GAME_32BIT_WARNING3": "https://www.java.com/ko/download/",
"MENU_OPTION_STREAMERS_LAYOUT": "스트리머 채팅창 모드"
} }

View File

@@ -96,6 +96,7 @@ object DefaultConfig {
"fx_dither" to true, "fx_dither" to true,
"fx_retro" to false, "fx_retro" to false,
"fx_backgroundblur" to true, "fx_backgroundblur" to true,
"fx_streamerslayout" to false,
//"fx_3dlut" to false, //"fx_3dlut" to false,

View File

@@ -14,6 +14,7 @@ import com.badlogic.gdx.math.Matrix4
import com.badlogic.gdx.utils.Disposable import com.badlogic.gdx.utils.Disposable
import net.torvald.terrarum.gamecontroller.KeyToggler import net.torvald.terrarum.gamecontroller.KeyToggler
import net.torvald.terrarum.ui.BasicDebugInfoWindow import net.torvald.terrarum.ui.BasicDebugInfoWindow
import net.torvald.terrarum.ui.Toolkit
/** /**
* Must be called by the App Loader * Must be called by the App Loader
@@ -88,6 +89,7 @@ object PostProcessor : Disposable {
drawSafeArea() drawSafeArea()
} }
if (KeyToggler.isOn(Input.Keys.F1)) { if (KeyToggler.isOn(Input.Keys.F1)) {
batch.color = Color.WHITE batch.color = Color.WHITE
batch.inUse { batch.inUse {
@@ -150,29 +152,31 @@ object PostProcessor : Disposable {
val tvSafeArea2W = App.scr.tvSafeActionWidth.toFloat() val tvSafeArea2W = App.scr.tvSafeActionWidth.toFloat()
val tvSafeArea2H = App.scr.tvSafeActionHeight.toFloat() val tvSafeArea2H = App.scr.tvSafeActionHeight.toFloat()
val scrw = Toolkit.drawWidthf
shapeRenderer.inUse(ShapeRenderer.ShapeType.Line) { shapeRenderer.inUse(ShapeRenderer.ShapeType.Line) {
// centre ind // centre ind
shapeRenderer.color = safeAreaCol2 shapeRenderer.color = safeAreaCol2
shapeRenderer.line(0f, 0f, App.scr.wf, App.scr.hf) shapeRenderer.line(0f, 0f, scrw, App.scr.hf)
shapeRenderer.line(0f, App.scr.hf, App.scr.wf, 0f) shapeRenderer.line(0f, App.scr.hf, scrw, 0f)
// safe action area // safe action area
shapeRenderer.color = safeAreaCol2 shapeRenderer.color = safeAreaCol2
shapeRenderer.rect( shapeRenderer.rect(
tvSafeArea2W, tvSafeArea2H, App.scr.width - 2 * tvSafeArea2W, App.scr.height - 2 * tvSafeArea2H tvSafeArea2W, tvSafeArea2H, scrw - 2 * tvSafeArea2W, App.scr.height - 2 * tvSafeArea2H
) )
// safe graphics area // safe graphics area
shapeRenderer.color = safeAreaCol shapeRenderer.color = safeAreaCol
shapeRenderer.rect( shapeRenderer.rect(
tvSafeAreaW, tvSafeAreaH, App.scr.width - 2 * tvSafeAreaW, App.scr.height - 2 * tvSafeAreaH tvSafeAreaW, tvSafeAreaH, scrw - 2 * tvSafeAreaW, App.scr.height - 2 * tvSafeAreaH
) )
// default res ind // default res ind
shapeRenderer.color = defaultResCol shapeRenderer.color = defaultResCol
shapeRenderer.rect( shapeRenderer.rect(
(App.scr.width - TerrarumScreenSize.minimumW).div(2).toFloat(), (scrw - TerrarumScreenSize.minimumW).div(2).toFloat(),
(App.scr.height - TerrarumScreenSize.minimumH).div(2).toFloat(), (App.scr.height - TerrarumScreenSize.minimumH).div(2).toFloat(),
TerrarumScreenSize.minimumW.toFloat(), TerrarumScreenSize.minimumW.toFloat(),
TerrarumScreenSize.minimumH.toFloat() TerrarumScreenSize.minimumH.toFloat()
@@ -190,14 +194,14 @@ object PostProcessor : Disposable {
batch.color = defaultResCol batch.color = defaultResCol
App.fontSmallNumbers.draw( App.fontSmallNumbers.draw(
batch, defaultResStr, batch, defaultResStr,
(App.scr.width - TerrarumScreenSize.minimumW).div(2).toFloat(), (scrw - TerrarumScreenSize.minimumW).div(2).toFloat(),
(App.scr.height - TerrarumScreenSize.minimumH).div(2).toFloat() (App.scr.height - TerrarumScreenSize.minimumH).div(2).toFloat()
) )
batch.color = currentResCol batch.color = currentResCol
App.fontSmallNumbers.draw( App.fontSmallNumbers.draw(
batch, currentResStr, batch, currentResStr,
App.scr.width - 80f, scrw - 80f,
0f 0f
) )
} }

View File

@@ -1,5 +1,7 @@
package net.torvald.terrarum package net.torvald.terrarum
import kotlin.math.roundToInt
class TerrarumScreenSize(scrw: Int = defaultW, scrh: Int = defaultH) { class TerrarumScreenSize(scrw: Int = defaultW, scrh: Int = defaultH) {
companion object { companion object {
@@ -21,7 +23,7 @@ class TerrarumScreenSize(scrw: Int = defaultW, scrh: Int = defaultH) {
var halfwf: Float = 0f; private set var halfwf: Float = 0f; private set
var halfhf: Float = 0f; private set var halfhf: Float = 0f; private set
var aspectRatio: Float = 0f; private set var aspectRatio: Float = 0f; private set
var chatWidth: Int = 0; private set
val tvSafeGraphicsWidth: Int; get() = Math.round(width * TV_SAFE_GRAPHICS) val tvSafeGraphicsWidth: Int; get() = Math.round(width * TV_SAFE_GRAPHICS)
@@ -43,6 +45,7 @@ class TerrarumScreenSize(scrw: Int = defaultW, scrh: Int = defaultH) {
halfwf = wf / 2f halfwf = wf / 2f
halfhf = hf / 2f halfhf = hf / 2f
aspectRatio = wf / hf aspectRatio = wf / hf
chatWidth = (width - (width * 0.84375).roundToInt()) and 0x7FFFFFFE
} }
} }

View File

@@ -321,11 +321,12 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
TerrarumAppConfiguration.COPYRIGHT_DATE_NAME, TerrarumAppConfiguration.COPYRIGHT_DATE_NAME,
TerrarumAppConfiguration.COPYRIGHT_LICENSE TerrarumAppConfiguration.COPYRIGHT_LICENSE
) )
val drawWidth = Toolkit.drawWidth
COPYTING.forEachIndexed { index, s -> COPYTING.forEachIndexed { index, s ->
val textWidth = App.fontGame.getWidth(s) val textWidth = App.fontGame.getWidth(s)
App.fontGame.draw(batch, s, App.fontGame.draw(batch, s,
(App.scr.width - textWidth - 1f).toInt().toFloat(), (drawWidth - textWidth - 1f).toInt().toFloat(),
(App.scr.height - App.fontGame.lineHeight * (COPYTING.size - index) - 1f).toInt().toFloat() (App.scr.height - App.fontGame.lineHeight * (COPYTING.size - index) - 1f).toInt().toFloat()
) )
} }
@@ -345,7 +346,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
for (i in 0..2) { for (i in 0..2) {
val text = Lang.get("GAME_32BIT_WARNING${i+1}", (i != 2)) val text = Lang.get("GAME_32BIT_WARNING${i+1}", (i != 2))
if (i == 2) batch.color = UIItemTextButton.defaultHighlightCol if (i == 2) batch.color = UIItemTextButton.defaultHighlightCol
App.fontGame.draw(batch, text, ((App.scr.width - App.fontGame.getWidth(text)) / 2).toFloat(), yoff + imgTxtGap + 64f + linegap + i*(20+linegap)) App.fontGame.draw(batch, text, ((drawWidth - App.fontGame.getWidth(text)) / 2).toFloat(), yoff + imgTxtGap + 64f + linegap + i*(20+linegap))
} }
} }
} }

View File

@@ -37,6 +37,7 @@ import net.torvald.terrarum.realestate.LandUtil
import net.torvald.terrarum.serialise.* import net.torvald.terrarum.serialise.*
import net.torvald.terrarum.tvda.VDUtil import net.torvald.terrarum.tvda.VDUtil
import net.torvald.terrarum.tvda.VirtualDisk import net.torvald.terrarum.tvda.VirtualDisk
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UIAutosaveNotifier import net.torvald.terrarum.ui.UIAutosaveNotifier
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.weather.WeatherMixer import net.torvald.terrarum.weather.WeatherMixer
@@ -391,6 +392,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
//consoleHandler = ConsoleWindow() //consoleHandler = ConsoleWindow()
//consoleHandler.setPosition(0, 0) //consoleHandler.setPosition(0, 0)
val drawWidth = Toolkit.drawWidth
@@ -402,11 +404,11 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// quick bar // quick bar
uiQuickBar = UIQuickslotBar() uiQuickBar = UIQuickslotBar()
uiQuickBar.isVisible = true uiQuickBar.isVisible = true
uiQuickBar.setPosition((App.scr.width - uiQuickBar.width) / 2, App.scr.tvSafeGraphicsHeight) uiQuickBar.setPosition((drawWidth - uiQuickBar.width) / 2, App.scr.tvSafeGraphicsHeight)
// pie menu // pie menu
uiPieMenu = UIQuickslotPie() uiPieMenu = UIQuickslotPie()
uiPieMenu.setPosition(App.scr.halfw, App.scr.halfh) uiPieMenu.setPosition(drawWidth / 2, App.scr.halfh)
// vital metre // vital metre
// fill in getter functions by // fill in getter functions by
@@ -425,7 +427,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
uiWatchTierOne = UITierOneWatch() uiWatchTierOne = UITierOneWatch()
uiWatchTierOne.setAsAlwaysVisible() uiWatchTierOne.setAsAlwaysVisible()
uiWatchTierOne.setPosition( uiWatchTierOne.setPosition(
((App.scr.width - App.scr.tvSafeActionWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width), ((drawWidth - App.scr.tvSafeActionWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
App.scr.tvSafeGraphicsHeight + 8 App.scr.tvSafeGraphicsHeight + 8
) )
@@ -1171,7 +1173,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
IngameRenderer.resize(App.scr.width, App.scr.height) IngameRenderer.resize(App.scr.width, App.scr.height)
val drawWidth = Toolkit.drawWidth
if (gameInitialised) { if (gameInitialised) {
//LightmapRenderer.fireRecalculateEvent() //LightmapRenderer.fireRecalculateEvent()
@@ -1182,8 +1184,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// resize UIs // resize UIs
notifier.setPosition( notifier.setPosition(
(App.scr.width - notifier.width) / 2, App.scr.height - notifier.height) (drawWidth - notifier.width) / 2, App.scr.height - notifier.height)
uiQuickBar.setPosition((App.scr.width - uiQuickBar.width) / 2, App.scr.tvSafeGraphicsHeight) uiQuickBar.setPosition((drawWidth - uiQuickBar.width) / 2, App.scr.tvSafeGraphicsHeight)
// inventory // inventory
/*uiInventoryPlayer = /*uiInventoryPlayer =
@@ -1195,9 +1197,9 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// basic watch-style notification bar (temperature, new mail) // basic watch-style notification bar (temperature, new mail)
uiBasicInfo.setPosition(App.scr.width - uiBasicInfo.width, 0) uiBasicInfo.setPosition(drawWidth - uiBasicInfo.width, 0)
uiWatchTierOne.setPosition( uiWatchTierOne.setPosition(
((App.scr.width - App.scr.tvSafeGraphicsWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width), ((drawWidth - App.scr.tvSafeGraphicsWidth) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
App.scr.tvSafeGraphicsHeight + 8 App.scr.tvSafeGraphicsHeight + 8
) )
} }

View File

@@ -10,18 +10,19 @@ import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_HO
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_VRT import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_VRT
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_X import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_X
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.internalWidth
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVEN_DEBUG_MODE
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.controlHelpHeight import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.controlHelpHeight
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.internalWidth
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.createInvCellGenericKeyDownFun import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.createInvCellGenericKeyDownFun
import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.createInvCellGenericTouchDownFun import net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.createInvCellGenericTouchDownFun
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
internal class UIInventoryCells( internal class UIInventoryCells(
val full: UIInventoryFull val full: UIInventoryFull
) : UICanvas() { ) : UICanvas() {
override var width: Int = App.scr.width override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height override var height: Int = App.scr.height
override var openCloseTime: Second = 0.0f override var openCloseTime: Second = 0.0f
@@ -52,7 +53,7 @@ internal class UIInventoryCells(
private val equipped: UIItemInventoryEquippedView = private val equipped: UIItemInventoryEquippedView =
UIItemInventoryEquippedView( UIItemInventoryEquippedView(
full, full,
internalWidth - UIItemInventoryEquippedView.WIDTH + (App.scr.width - internalWidth) / 2, internalWidth - UIItemInventoryEquippedView.WIDTH + (width - internalWidth) / 2,
INVENTORY_CELLS_OFFSET_Y, INVENTORY_CELLS_OFFSET_Y,
{ rebuildList() } { rebuildList() }
) )

View File

@@ -9,6 +9,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_UI_HEIGHT import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_UI_HEIGHT
import net.torvald.terrarum.serialise.WriteSavegame import net.torvald.terrarum.serialise.WriteSavegame
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItem import net.torvald.terrarum.ui.UIItem
import net.torvald.terrarum.ui.UIItemTextButtonList import net.torvald.terrarum.ui.UIItemTextButtonList
@@ -17,7 +18,7 @@ import java.io.File
class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() { class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
override var width: Int = App.scr.width override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height override var height: Int = App.scr.height
override var openCloseTime = 0.0f override var openCloseTime = 0.0f
@@ -32,7 +33,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
private val gameMenuListWidth = 400 private val gameMenuListWidth = 400
private val gameMenuButtons = UIItemTextButtonList( private val gameMenuButtons = UIItemTextButtonList(
this, DEFAULT_LINE_HEIGHT, gameMenu, this, DEFAULT_LINE_HEIGHT, gameMenu,
(App.scr.width - gameMenuListWidth) / 2, (width - gameMenuListWidth) / 2,
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2, INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2,
gameMenuListWidth, gameMenuListHeight, gameMenuListWidth, gameMenuListHeight,
readFromLang = true, readFromLang = true,
@@ -45,7 +46,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
) )
private val areYouSureMainMenuButtons = UIItemTextButtonList( private val areYouSureMainMenuButtons = UIItemTextButtonList(
this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_RETURN_MAIN_QUESTION", "MENU_LABEL_RETURN_MAIN", "MENU_LABEL_CANCEL"), this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_RETURN_MAIN_QUESTION", "MENU_LABEL_RETURN_MAIN", "MENU_LABEL_CANCEL"),
(App.scr.width - gameMenuListWidth) / 2, (width - gameMenuListWidth) / 2,
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2, INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3, gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3,
readFromLang = true, readFromLang = true,
@@ -58,7 +59,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
) )
private val areYouSureQuitButtons = UIItemTextButtonList( private val areYouSureQuitButtons = UIItemTextButtonList(
this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_DESKTOP_QUESTION", "MENU_LABEL_DESKTOP", "MENU_LABEL_CANCEL"), this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_DESKTOP_QUESTION", "MENU_LABEL_DESKTOP", "MENU_LABEL_CANCEL"),
(App.scr.width - gameMenuListWidth) / 2, (width - gameMenuListWidth) / 2,
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2, INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3, gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3,
readFromLang = true, readFromLang = true,

View File

@@ -11,6 +11,7 @@ import net.torvald.terrarum.App.*
import net.torvald.terrarum.blockstats.MinimapComposer import net.torvald.terrarum.blockstats.MinimapComposer
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemHorizontalFadeSlide import net.torvald.terrarum.ui.UIItemHorizontalFadeSlide
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
@@ -28,7 +29,7 @@ class UIInventoryFull(
val actor: ActorHumanoid val actor: ActorHumanoid
get() = INGAME.actorNowPlaying!! get() = INGAME.actorNowPlaying!!
override var width: Int = App.scr.width override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height override var height: Int = App.scr.height
override var openCloseTime: Second = 0.0f override var openCloseTime: Second = 0.0f
@@ -48,7 +49,7 @@ class UIInventoryFull(
val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.listGap val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.listGap
val INVENTORY_CELLS_UI_HEIGHT: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryItemGrid.listGap val INVENTORY_CELLS_UI_HEIGHT: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryItemGrid.listGap
val INVENTORY_CELLS_OFFSET_X = 0 + (App.scr.width - internalWidth) / 2 val INVENTORY_CELLS_OFFSET_X = 0 + (Toolkit.drawWidth - internalWidth) / 2
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (App.scr.height - internalHeight) / 2 val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (App.scr.height - internalHeight) / 2
val catBarWidth = 330 val catBarWidth = 330
@@ -148,7 +149,7 @@ class UIInventoryFull(
val catBar = UIItemInventoryCatBar( val catBar = UIItemInventoryCatBar(
this, this,
(App.scr.width - catBarWidth) / 2, (width - catBarWidth) / 2,
42 + (App.scr.height - internalHeight) / 2, 42 + (App.scr.height - internalHeight) / 2,
internalWidth, internalWidth,
catBarWidth, catBarWidth,
@@ -162,9 +163,9 @@ class UIInventoryFull(
private val transitionalEscMenu = UIInventoryEscMenu(this) private val transitionalEscMenu = UIInventoryEscMenu(this)
private val transitionPanel = UIItemHorizontalFadeSlide( private val transitionPanel = UIItemHorizontalFadeSlide(
this, this,
(App.scr.width - internalWidth) / 2, (width - internalWidth) / 2,
INVENTORY_CELLS_OFFSET_Y, INVENTORY_CELLS_OFFSET_Y,
App.scr.width, width,
App.scr.height, App.scr.height,
1f, 1f,
transitionalMinimap, transitionalItemCells, transitionalEscMenu transitionalMinimap, transitionalItemCells, transitionalEscMenu
@@ -213,7 +214,7 @@ class UIInventoryFull(
} }
internal var offsetX = ((App.scr.width - internalWidth) / 2).toFloat() internal var offsetX = ((width - internalWidth) / 2).toFloat()
private set private set
internal var offsetY = ((App.scr.height - internalHeight) / 2).toFloat() internal var offsetY = ((App.scr.height - internalHeight) / 2).toFloat()
private set private set
@@ -234,7 +235,7 @@ class UIInventoryFull(
//private val gradHeight = 48f //private val gradHeight = 48f
private val shapeRenderer = ShapeRenderer() private val shapeRenderer = ShapeRenderer()
internal var xEnd = (App.scr.width + internalWidth).div(2).toFloat() internal var xEnd = (width + internalWidth).div(2).toFloat()
private set private set
internal var yEnd = (App.scr.height + internalHeight).div(2).toFloat() internal var yEnd = (App.scr.height + internalHeight).div(2).toFloat()
private set private set
@@ -299,10 +300,10 @@ class UIInventoryFull(
override fun resize(width: Int, height: Int) { override fun resize(width: Int, height: Int) {
super.resize(width, height) super.resize(width, height)
offsetX = ((App.scr.width - internalWidth) / 2).toFloat() offsetX = ((width - internalWidth) / 2).toFloat()
offsetY = ((App.scr.height - internalHeight) / 2).toFloat() offsetY = ((App.scr.height - internalHeight) / 2).toFloat()
xEnd = (App.scr.width + internalWidth).div(2).toFloat() xEnd = (width + internalWidth).div(2).toFloat()
yEnd = (App.scr.height + internalHeight).div(2).toFloat() yEnd = (App.scr.height + internalHeight).div(2).toFloat()
} }
} }

View File

@@ -9,13 +9,14 @@ import net.torvald.terrarum.*
import net.torvald.terrarum.blockstats.MinimapComposer import net.torvald.terrarum.blockstats.MinimapComposer
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_UI_HEIGHT import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_UI_HEIGHT
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() { class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
private val debugvals = true private val debugvals = true
override var width: Int = App.scr.width override var width: Int = Toolkit.drawWidth
override var height: Int = App.scr.height override var height: Int = App.scr.height
override var openCloseTime = 0.0f override var openCloseTime = 0.0f
@@ -115,23 +116,23 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
batch.begin() batch.begin()
if (debugvals) { if (debugvals) {
App.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (App.scr.width - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y) App.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (width - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
} }
batch.projectionMatrix = camera.combined batch.projectionMatrix = camera.combined
// 1px stroke // 1px stroke
batch.color = Color.WHITE batch.color = Color.WHITE
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f) batch.fillRect((width - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f) batch.fillRect((width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
batch.fillRect(-1 + (App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT) batch.fillRect(-1 + (width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
batch.fillRect((App.scr.width - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT) batch.fillRect((width - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
// control hints // control hints
batch.color = Color.WHITE batch.color = Color.WHITE
App.fontGame.draw(batch, full.minimapControlHelp, full.offsetX, full.yEnd - 20) App.fontGame.draw(batch, full.minimapControlHelp, full.offsetX, full.yEnd - 20)
// the minimap // the minimap
batch.draw(minimapFBO.colorBufferTexture, (App.scr.width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat()) batch.draw(minimapFBO.colorBufferTexture, (width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
} }
override fun doOpening(delta: Float) {} override fun doOpening(delta: Float) {}

View File

@@ -31,7 +31,7 @@ class UIKeyboardControlPanel : UICanvas() {
override var height = 600 override var height = 600
override var openCloseTime = 0f override var openCloseTime = 0f
private val drawX = (App.scr.width - width) / 2 private val drawX = (Toolkit.drawWidth - width) / 2
private val drawY = (App.scr.height - height) / 2 private val drawY = (App.scr.height - height) / 2
internal val kbx = drawX + 61 internal val kbx = drawX + 61
@@ -128,7 +128,7 @@ class UIKeyboardControlPanel : UICanvas() {
private val symbolGrapplingHook = labels.get(5,1) private val symbolGrapplingHook = labels.get(5,1)
private val symbolGamemenu = labels.get(6,2) private val symbolGamemenu = labels.get(6,2)
private val controlPalette = UIItemControlPaletteBaloon(this, (App.scr.width - 480) / 2, kby + 219) private val controlPalette = UIItemControlPaletteBaloon(this, (Toolkit.drawWidth - 480) / 2, kby + 219)
init { init {
keycaps.values.forEach { addUIitem(it) } keycaps.values.forEach { addUIitem(it) }

View File

@@ -44,7 +44,7 @@ class UILoadDemoSavefiles : UICanvas() {
} }
override var width: Int override var width: Int
get() = App.scr.width get() = Toolkit.drawWidth
set(value) {} set(value) {}
override var height: Int override var height: Int
get() = App.scr.height get() = App.scr.height
@@ -107,7 +107,7 @@ class UILoadDemoSavefiles : UICanvas() {
// read savegames // read savegames
var savegamesCount = 0 var savegamesCount = 0
App.savegames.forEach { skimmer -> App.savegames.forEach { skimmer ->
val x = uiX val x = uiX + if (App.getConfigBoolean("fx_streamerslayout")) App.scr.chatWidth / 2 else 0
val y = titleTopGradEnd + cellInterval * savegamesCount val y = titleTopGradEnd + cellInterval * savegamesCount
try { try {
addUIitem(UIItemDemoSaveCells(this, x, y, skimmer)) addUIitem(UIItemDemoSaveCells(this, x, y, skimmer))

View File

@@ -5,15 +5,16 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.jme3.math.FastMath import com.jme3.math.FastMath
import net.torvald.terrarum.App import net.torvald.terrarum.App
import net.torvald.terrarum.ItemCodex
import net.torvald.terrarum.Second import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.AVKey import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.modulebasegame.TerrarumIngame import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.COMMON_OPEN_CLOSE import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.COMMON_OPEN_CLOSE
import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.SLOT_COUNT import net.torvald.terrarum.modulebasegame.ui.UIQuickslotBar.Companion.SLOT_COUNT
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import org.dyn4j.geometry.Vector2 import org.dyn4j.geometry.Vector2
import net.torvald.terrarum.*
/** /**
* The Sims styled pie representation of the Quickslot. * The Sims styled pie representation of the Quickslot.
@@ -49,7 +50,7 @@ class UIQuickslotPie : UICanvas() {
// update controls // update controls
if (handler.isOpened || handler.isOpening) { if (handler.isOpened || handler.isOpening) {
val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble()) val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble())
val centre = Vector2(App.scr.halfw.toDouble(), App.scr.halfh.toDouble()) val centre = Vector2(Toolkit.drawWidth / 2.0, App.scr.halfh.toDouble())
val deg = -(centre - cursorPos).direction.toFloat() val deg = -(centre - cursorPos).direction.toFloat()
selection = Math.round(deg * slotCount / FastMath.TWO_PI) selection = Math.round(deg * slotCount / FastMath.TWO_PI)

View File

@@ -11,6 +11,7 @@ import net.torvald.terrarum.QNDTreeNode
import net.torvald.terrarum.TitleScreen import net.torvald.terrarum.TitleScreen
import net.torvald.terrarum.Yaml import net.torvald.terrarum.Yaml
import net.torvald.terrarum.serialise.WriteConfig import net.torvald.terrarum.serialise.WriteConfig
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextButton import net.torvald.terrarum.ui.UIItemTextButton
import net.torvald.terrarum.ui.UIItemTextButtonList import net.torvald.terrarum.ui.UIItemTextButtonList
@@ -309,7 +310,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
val remoConWidth = 160 val remoConWidth = 160
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1) fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1) fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
val menubarOffX: Int; get() = (0.11 * App.scr.width).toInt() val menubarOffX: Int; get() = (0.11 * Toolkit.drawWidth).toInt()
val menubarOffY: Int; get() = (0.82 * App.scr.height).toInt() val menubarOffY: Int; get() = (0.82 * App.scr.height).toInt()
} }
} }

View File

@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.App import net.torvald.terrarum.App
import net.torvald.terrarum.Second import net.torvald.terrarum.Second
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextButtonList import net.torvald.terrarum.ui.UIItemTextButtonList
@@ -32,7 +33,7 @@ class UITitleLanguage : UICanvas() {
private val textArea1 = UIItemTextButtonList(this, private val textArea1 = UIItemTextButtonList(this,
textButtonLineHeight, textButtonLineHeight,
localeFirstHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(), localeFirstHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(),
(App.scr.width - width) / 2, (App.scr.height - height) / 2, (Toolkit.drawWidth - width) / 2, (App.scr.height - height) / 2,
width / 2, height, width / 2, height,
textAreaWidth = width / 2, textAreaWidth = width / 2,
readFromLang = false, readFromLang = false,
@@ -45,7 +46,7 @@ class UITitleLanguage : UICanvas() {
private val textArea2 = UIItemTextButtonList(this, private val textArea2 = UIItemTextButtonList(this,
textButtonLineHeight, textButtonLineHeight,
localeSecondHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(), localeSecondHalf.map { Lang.getByLocale("MENU_LANGUAGE_THIS", it, true) ?: "!ERR: $it" }.toTypedArray(),
(App.scr.width - width) / 2 + (width / 2), (App.scr.height - height) / 2, (Toolkit.drawWidth - width) / 2 + (width / 2), (App.scr.height - height) / 2,
width / 2, height, width / 2, height,
textAreaWidth = width / 2, textAreaWidth = width / 2,
readFromLang = false, readFromLang = false,

View File

@@ -40,15 +40,19 @@ object Toolkit : Disposable {
baloonTile.dispose() baloonTile.dispose()
} }
val drawWidth: Int
get() = App.scr.width - if (App.getConfigBoolean("fx_streamerslayout")) App.scr.chatWidth else 0
val drawWidthf: Float
get() = drawWidth.toFloat()
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) { fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
val imageW = image.width val imageW = image.width
val targetW = ui?.width ?: App.scr.width val targetW = ui?.width ?: drawWidth
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat()) batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
} }
fun drawCentered(batch: SpriteBatch, image: TextureRegion, screenPosY: Int, ui: UICanvas? = null) { fun drawCentered(batch: SpriteBatch, image: TextureRegion, screenPosY: Int, ui: UICanvas? = null) {
val imageW = image.regionWidth val imageW = image.regionWidth
val targetW = ui?.width ?: App.scr.width val targetW = ui?.width ?: drawWidth
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat()) batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
} }

View File

@@ -167,8 +167,8 @@ object LightmapRenderer {
for_x_end = for_x_start + WorldCamera.zoomedWidth / TILE_SIZE + 3 for_x_end = for_x_start + WorldCamera.zoomedWidth / TILE_SIZE + 3
for_y_end = for_y_start + WorldCamera.zoomedHeight / TILE_SIZE + 3 // same fix as above for_y_end = for_y_start + WorldCamera.zoomedHeight / TILE_SIZE + 3 // same fix as above
for_draw_x_end = for_draw_x_start + WorldCamera.width / TILE_SIZE + 1 + LIGHTMAP_OVERRENDER for_draw_x_end = for_draw_x_start + WorldCamera.width / TILE_SIZE + 3 + LIGHTMAP_OVERRENDER
for_draw_y_end = for_draw_y_start + WorldCamera.height / TILE_SIZE + 1 + LIGHTMAP_OVERRENDER for_draw_y_end = for_draw_y_start + WorldCamera.height / TILE_SIZE + 3 + LIGHTMAP_OVERRENDER
camX = WorldCamera.x / TILE_SIZE camX = WorldCamera.x / TILE_SIZE
camY = WorldCamera.y / TILE_SIZE camY = WorldCamera.y / TILE_SIZE

View File

@@ -99,7 +99,8 @@ object WorldCamera {
val oldX = x.toFloat() val oldX = x.toFloat()
val newX1 = (player.hitbox.centeredX).toFloat() - (width / 2) val newX1 = (player.hitbox.centeredX).toFloat() - (width / 2) +
if (App.getConfigBoolean("fx_streamerslayout")) App.scr.chatWidth / 2 else 0
val newX2 = newX1 + worldWidth val newX2 = newX1 + worldWidth
val newX = if (Math.abs(newX1 - oldX) < Math.abs(newX2 - oldX)) newX1 else newX2 val newX = if (Math.abs(newX1 - oldX) < Math.abs(newX2 - oldX)) newX1 else newX2