backend stuffs in the Terrarum moved to the AppLoader

This commit is contained in:
minjaesong
2019-07-02 05:10:32 +09:00
parent 4c23cde4a9
commit 42dbaaa242
34 changed files with 214 additions and 252 deletions

View File

@@ -294,11 +294,11 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
uiToolbox.isVisible = true
uiToolbox.invocationArgument = arrayOf(this)
uiPaletteSelector.setPosition(Terrarum.WIDTH - uiPaletteSelector.width, 0)
uiPaletteSelector.setPosition(AppLoader.screenW - uiPaletteSelector.width, 0)
uiPaletteSelector.isVisible = true
notifier.setPosition(
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
actorNowPlaying?.setPosition(512 * 16.0, 149 * 16.0)
@@ -378,8 +378,8 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
// position the menu to where the cursor is
uiPenMenu.posX = Terrarum.mouseScreenX - uiPenMenu.width / 2
uiPenMenu.posY = Terrarum.mouseScreenY - uiPenMenu.height / 2
uiPenMenu.posX = uiPenMenu.posX.coerceIn(0, Terrarum.WIDTH - uiPenMenu.width)
uiPenMenu.posY = uiPenMenu.posY.coerceIn(0, Terrarum.HEIGHT - uiPenMenu.height)
uiPenMenu.posX = uiPenMenu.posX.coerceIn(0, AppLoader.screenW - uiPenMenu.width)
uiPenMenu.posY = uiPenMenu.posY.coerceIn(0, AppLoader.screenH - uiPenMenu.height)
// actually open
uiPenMenu.setAsOpen()
@@ -397,10 +397,10 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
}
override fun resize(width: Int, height: Int) {
IngameRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
IngameRenderer.resize(AppLoader.screenW, AppLoader.screenH)
uiToolbox.setPosition(0, 0)
notifier.setPosition(
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
println("[BuildingMaker] Resize event")
}
@@ -562,12 +562,12 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, usePhysic
// TODO resize-aware
private var coerceInStart = Point2d(
(Terrarum.WIDTH - hitbox.width) / 2.0,
(Terrarum.HEIGHT - hitbox.height) / 2.0
(AppLoader.screenW - hitbox.width) / 2.0,
(AppLoader.screenH - hitbox.height) / 2.0
)
private var coerceInEnd = Point2d(
parent.world.width * TILE_SIZE - (Terrarum.WIDTH - hitbox.width) / 2.0,
parent.world.height * TILE_SIZE - (Terrarum.HEIGHT - hitbox.height) / 2.0
parent.world.width * TILE_SIZE - (AppLoader.screenW - hitbox.width) / 2.0,
parent.world.height * TILE_SIZE - (AppLoader.screenH - hitbox.height) / 2.0
)
override fun update(delta: Float) {
@@ -590,7 +590,7 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, usePhysic
class YamlCommandExit : YamlInvokable {
override fun invoke(args: Array<Any>) {
AppLoader.setScreen(TitleScreen(Terrarum.batch))
AppLoader.setScreen(TitleScreen(AppLoader.batch))
}
}

View File

@@ -51,8 +51,8 @@ object IngameRenderer : Disposable {
val shaderAtoGrey: ShaderProgram
val shaderPassthru = SpriteBatch.createDefaultShader()
private val width = Terrarum.WIDTH
private val height = Terrarum.HEIGHT
private val width = AppLoader.screenW
private val height = AppLoader.screenH
private val widthf = width.toFloat()
private val heightf = height.toFloat()
@@ -608,7 +608,7 @@ object IngameRenderer : Disposable {
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
*/
private fun setCameraPosition(newX: Float, newY: Float) {
camera.position.set((-newX + Terrarum.HALFW).round(), (-newY + Terrarum.HALFH).round(), 0f)
camera.position.set((-newX + AppLoader.halfScreenW).round(), (-newY + AppLoader.halfScreenH).round(), 0f)
camera.update()
batch.projectionMatrix = camera.combined
}

View File

@@ -80,7 +80,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
companion object {
/** Sets camera position so that (0,0) would be top-left of the screen, (width, height) be bottom-right. */
fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
camera.position.set((-newX + Terrarum.HALFW).round(), (-newY + Terrarum.HALFH).round(), 0f)
camera.position.set((-newX + AppLoader.halfScreenW).round(), (-newY + AppLoader.halfScreenH).round(), 0f)
camera.update()
batch.projectionMatrix = camera.combined
}
@@ -166,7 +166,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
}
override fun show() {
//initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
//initViewPort(AppLoader.screenW, AppLoader.screenH)
// gameLoadMode and gameLoadInfoPayload must be set beforehand!!
@@ -292,8 +292,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// init notifier
notifier = Notification()
notifier.setPosition(
(Terrarum.WIDTH - notifier.width) / 2,
Terrarum.HEIGHT - notifier.height - AppLoader.getTvSafeGraphicsHeight()
(AppLoader.screenW - notifier.width) / 2,
AppLoader.screenH - notifier.height - AppLoader.getTvSafeGraphicsHeight()
)
@@ -310,11 +310,11 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// quick bar
uiQuickBar = UIQuickslotBar()
uiQuickBar.isVisible = true
uiQuickBar.setPosition((Terrarum.WIDTH - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
uiQuickBar.setPosition((AppLoader.screenW - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
// pie menu
uiPieMenu = uiQuickslotPie()
uiPieMenu.setPosition(Terrarum.HALFW, Terrarum.HALFH)
uiPieMenu.setPosition(AppLoader.halfScreenW, AppLoader.halfScreenH)
// vital metre
// fill in getter functions by
@@ -329,7 +329,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
uiWatchTierOne = UITierOneWatch(actorNowPlaying)
uiWatchTierOne.setAsAlwaysVisible()
uiWatchTierOne.setPosition(
((Terrarum.WIDTH - AppLoader.getTvSafeActionWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
((AppLoader.screenW - AppLoader.getTvSafeActionWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
AppLoader.getTvSafeGraphicsHeight() + 8
)
@@ -946,8 +946,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
/**
* @param width same as Terrarum.WIDTH
* @param height same as Terrarum.HEIGHT
* @param width same as AppLoader.screenW
* @param height same as AppLoader.screenH
* @see net.torvald.terrarum.Terrarum
*/
override fun resize(width: Int, height: Int) {
@@ -956,7 +956,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
//MegaRainGovernor.resize()
IngameRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
IngameRenderer.resize(AppLoader.screenW, AppLoader.screenH)
if (gameInitialised) {
@@ -968,22 +968,22 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
// resize UIs
notifier.setPosition(
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
uiQuickBar.setPosition((Terrarum.WIDTH - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
uiQuickBar.setPosition((AppLoader.screenW - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
// inventory
/*uiInventoryPlayer =
UIInventory(player,
width = 840,
height = Terrarum.HEIGHT - 160,
height = AppLoader.screenH - 160,
categoryWidth = 210
)*/
// basic watch-style notification bar (temperature, new mail)
uiBasicInfo.setPosition(Terrarum.WIDTH - uiBasicInfo.width, 0)
uiBasicInfo.setPosition(AppLoader.screenW - uiBasicInfo.width, 0)
uiWatchTierOne.setPosition(
((Terrarum.WIDTH - AppLoader.getTvSafeGraphicsWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
((AppLoader.screenW - AppLoader.getTvSafeGraphicsWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
AppLoader.getTvSafeGraphicsHeight() + 8
)

View File

@@ -69,8 +69,8 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
{
parent.uiPalette.isVisible = true
parent.uiPalette.setPosition(Gdx.input.x - parent.uiPalette.width / 2, Gdx.input.y - parent.uiPalette.height / 2)
parent.uiPalette.posX = parent.uiPalette.posX.coerceIn(0, Terrarum.WIDTH - parent.uiPalette.width)
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, Terrarum.HEIGHT - parent.uiPalette.height)
parent.uiPalette.posX = parent.uiPalette.posX.coerceIn(0, AppLoader.screenW - parent.uiPalette.width)
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, AppLoader.screenH - parent.uiPalette.height)
},
{
parent.currentPenMode = BuildingMaker.PENMODE_PENCIL_ERASE

View File

@@ -47,7 +47,7 @@ object MegaRainGovernor {
val h = body.height
bodies = Array(1024) {
//val pixmap = Pixmap(Terrarum.WIDTH * 2, Terrarum.HEIGHT / 4, Pixmap.Format.RGBA8888)
//val pixmap = Pixmap(AppLoader.screenW * 2, AppLoader.screenH / 4, Pixmap.Format.RGBA8888)
val pixmap = Pixmap(64, 64, Pixmap.Format.RGBA8888)
val rng = HQRNG()

View File

@@ -62,7 +62,7 @@ class Notification : UICanvas() {
val displayedTextWidth = maxOf(240, realTextWidth)
// force the UI to the centre of the screen
this.posX = (Terrarum.WIDTH - displayedTextWidth) / 2
this.posX = (AppLoader.screenW - displayedTextWidth) / 2
val textHeight = message.size * AppLoader.fontGame.lineHeight

View File

@@ -16,11 +16,11 @@ import net.torvald.terrarum.ui.UICanvas
class UICheatDetected : UICanvas() {
override var width: Int
get() = Terrarum.WIDTH
get() = AppLoader.screenW
set(value) { throw UnsupportedOperationException() }
override var height: Int
get() = Terrarum.HEIGHT
get() = AppLoader.screenH
set(value) { throw UnsupportedOperationException() }
override var openCloseTime: Second = 0f

View File

@@ -35,8 +35,8 @@ class UIInventoryFull(
private val debugvals = false
override var width: Int = Terrarum.WIDTH
override var height: Int = Terrarum.HEIGHT
override var width: Int = AppLoader.screenW
override var height: Int = AppLoader.screenH
private val itemListToEquipViewGap = 24
@@ -86,8 +86,8 @@ class UIInventoryFull(
val catBarWidth = 330
val categoryBar = UIItemInventoryCatBar(
this,
(Terrarum.WIDTH - catBarWidth) / 2,
42 + (Terrarum.HEIGHT - internalHeight) / 2,
(AppLoader.screenW - catBarWidth) / 2,
42 + (AppLoader.screenH - internalHeight) / 2,
catBarWidth
)
val catSelection: Int
@@ -102,8 +102,8 @@ class UIInventoryFull(
UIItemInventoryDynamicList(
this,
actor.inventory,
0 + (Terrarum.WIDTH - internalWidth) / 2,
109 + (Terrarum.HEIGHT - internalHeight) / 2
0 + (AppLoader.screenW - internalWidth) / 2,
109 + (AppLoader.screenH - internalHeight) / 2
)
@@ -112,15 +112,15 @@ class UIInventoryFull(
this,
actor.inventory,
actor as ActorWBMovable,
internalWidth - UIItemInventoryEquippedView.WIDTH + (Terrarum.WIDTH - internalWidth) / 2,
109 + (Terrarum.HEIGHT - internalHeight) / 2
internalWidth - UIItemInventoryEquippedView.WIDTH + (AppLoader.screenW - internalWidth) / 2,
109 + (AppLoader.screenH - internalHeight) / 2
)
private val gameMenu = arrayOf("MENU_LABEL_MAINMENU", "MENU_LABEL_DESKTOP", "MENU_OPTIONS_CONTROLS", "MENU_OPTIONS_SOUND", "MENU_LABEL_GRAPHICS")
private val gameMenuListHeight = DEFAULT_LINE_HEIGHT * gameMenu.size
private val gameMenuListWidth = 400
private val gameMenuButtons = UIItemTextButtonList(
this, gameMenu,
Terrarum.WIDTH + (Terrarum.WIDTH - gameMenuListWidth) / 2,
AppLoader.screenW + (AppLoader.screenW - gameMenuListWidth) / 2,
(itemList.height - gameMenuListHeight) / 2 + itemList.posY,
gameMenuListWidth, gameMenuListHeight,
readFromLang = true,
@@ -184,7 +184,7 @@ class UIInventoryFull(
// make gameMenuButtons work
gameMenuButtons.selectionChangeListener = { old, new ->
if (new == 0) {
AppLoader.setScreen(TitleScreen(Terrarum.batch))
AppLoader.setScreen(TitleScreen(AppLoader.batch))
}
else if (new == 1) {
Gdx.app.exit()
@@ -193,8 +193,8 @@ class UIInventoryFull(
}
private var offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
private var offsetY = ((Terrarum.HEIGHT - internalHeight) / 2).toFloat()
private var offsetX = ((AppLoader.screenW - internalWidth) / 2).toFloat()
private var offsetY = ((AppLoader.screenH - internalHeight) / 2).toFloat()
@@ -223,8 +223,8 @@ class UIInventoryFull(
private val weightBarWidth = 64f
private var xEnd = (Terrarum.WIDTH + internalWidth).div(2).toFloat()
private var yEnd = (Terrarum.HEIGHT + internalHeight).div(2).toFloat()
private var xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
private var yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
private var minimapRerenderTimer = 0f
private val minimapRerenderInterval = .5f
@@ -272,17 +272,17 @@ class UIInventoryFull(
gdxSetBlendNormal()
val gradTopStart = (Terrarum.HEIGHT - internalHeight).div(2).toFloat()
val gradBottomEnd = Terrarum.HEIGHT - gradTopStart
val gradTopStart = (AppLoader.screenH - internalHeight).div(2).toFloat()
val gradBottomEnd = AppLoader.screenH - gradTopStart
shapeRenderer.inUse {
shapeRenderer.rect(0f, gradTopStart, Terrarum.WIDTH.toFloat(), gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
shapeRenderer.rect(0f, gradBottomEnd, Terrarum.WIDTH.toFloat(), -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
shapeRenderer.rect(0f, gradTopStart, AppLoader.screenW.toFloat(), gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
shapeRenderer.rect(0f, gradBottomEnd, AppLoader.screenW.toFloat(), -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
shapeRenderer.rect(0f, gradTopStart + gradHeight, Terrarum.WIDTH.toFloat(), internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
shapeRenderer.rect(0f, gradTopStart + gradHeight, AppLoader.screenW.toFloat(), internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
shapeRenderer.rect(0f, 0f, Terrarum.WIDTH.toFloat(), gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
shapeRenderer.rect(0f, Terrarum.HEIGHT.toFloat(), Terrarum.WIDTH.toFloat(), -(Terrarum.HEIGHT.toFloat() - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
shapeRenderer.rect(0f, 0f, AppLoader.screenW.toFloat(), gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
shapeRenderer.rect(0f, AppLoader.screenH.toFloat(), AppLoader.screenW.toFloat(), -(AppLoader.screenH.toFloat() - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
}
@@ -330,16 +330,16 @@ class UIInventoryFull(
private val epsilon = 0.001f
private val minimapScrOffX: Float
get() = (currentScreen - 2f) * Terrarum.WIDTH
get() = (currentScreen - 2f) * AppLoader.screenW
/**
* - 0 on inventory screen
* - +WIDTH on minimap screen
* - -WIDTH on gamemenu screen
*/
private val inventoryScrOffX: Float
get() = (currentScreen - 1f) * Terrarum.WIDTH
get() = (currentScreen - 1f) * AppLoader.screenW
private val menuScrOffX: Float
get() = (currentScreen) * Terrarum.WIDTH
get() = (currentScreen) * AppLoader.screenW
private val MINIMAP_WIDTH = 800f
private val MINIMAP_HEIGHT = UIItemInventoryDynamicList.HEIGHT.toFloat()
@@ -431,20 +431,20 @@ class UIInventoryFull(
batch.begin()
AppLoader.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", minimapScrOffX + (Terrarum.WIDTH - MINIMAP_WIDTH) / 2, -10f + itemList.posY)
AppLoader.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", minimapScrOffX + (AppLoader.screenW - MINIMAP_WIDTH) / 2, -10f + itemList.posY)
batch.projectionMatrix = camera.combined
// 1px stroke
batch.color = Color.WHITE
batch.fillRect(-1 + minimapScrOffX + (Terrarum.WIDTH - MINIMAP_WIDTH) / 2, -1 + itemList.posY.toFloat(), 2 + MINIMAP_WIDTH, 2 + MINIMAP_HEIGHT)
batch.fillRect(-1 + minimapScrOffX + (AppLoader.screenW - MINIMAP_WIDTH) / 2, -1 + itemList.posY.toFloat(), 2 + MINIMAP_WIDTH, 2 + MINIMAP_HEIGHT)
// control hints
batch.color = Color.WHITE
AppLoader.fontGame.draw(batch, minimapControlHelp, offsetX + minimapScrOffX, yEnd - 20)
// the minimap
batch.draw(minimapFBO.colorBufferTexture, minimapScrOffX + (Terrarum.WIDTH - MINIMAP_WIDTH) / 2, itemList.posY.toFloat())
batch.draw(minimapFBO.colorBufferTexture, minimapScrOffX + (AppLoader.screenW - MINIMAP_WIDTH) / 2, itemList.posY.toFloat())
}
private fun renderScreenGamemenu(batch: SpriteBatch, camera: Camera) {
@@ -565,11 +565,11 @@ class UIInventoryFull(
override fun resize(width: Int, height: Int) {
super.resize(width, height)
offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
offsetY = ((Terrarum.HEIGHT - internalHeight) / 2).toFloat()
offsetX = ((AppLoader.screenW - internalWidth) / 2).toFloat()
offsetY = ((AppLoader.screenH - internalHeight) / 2).toFloat()
xEnd = (Terrarum.WIDTH + internalWidth).div(2).toFloat()
yEnd = (Terrarum.HEIGHT + internalHeight).div(2).toFloat()
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
}

View File

@@ -32,7 +32,7 @@ class UIProxyNewBuildingMaker : UICanvas() {
}
override fun endOpening(delta: Float) {
val ingame = BuildingMaker(Terrarum.batch)
val ingame = BuildingMaker(AppLoader.batch)
Terrarum.setCurrentIngameInstance(ingame)
LoadScreen.screenToLoad = ingame

View File

@@ -300,6 +300,6 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
val remoConWidth = 304
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
val menubarOffY: Int; get() = AppLoader.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
}
}

View File

@@ -3,8 +3,8 @@ package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blendNormal
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemList
@@ -19,8 +19,8 @@ class UITitleCharactersList : UICanvas() {
private val moduleAreaHMargin = 48
private val moduleAreaBorder = 8
override var width = Terrarum.WIDTH - UIRemoCon.remoConWidth - moduleAreaHMargin
override var height = Terrarum.HEIGHT - moduleAreaHMargin * 2
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
override var height = AppLoader.screenH - moduleAreaHMargin * 2
private val moduleInfoCells = ArrayList<UIItemSavegameInfoCell>()
// build characters list

View File

@@ -21,13 +21,13 @@ class UITitleLanguage : UICanvas() {
private val textAreaHMargin = 48
override var width = (Terrarum.WIDTH * 0.75).toInt()
override var height = Terrarum.HEIGHT - textAreaHMargin * 2
override var width = (AppLoader.screenW * 0.75).toInt()
override var height = AppLoader.screenH - textAreaHMargin * 2
private val localeList = Lang.languageList.toList().sorted()
private val textArea = UIItemTextButtonList(this,
localeList.map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }.toTypedArray(),
Terrarum.WIDTH - width, textAreaHMargin,
AppLoader.screenW - width, textAreaHMargin,
width, height,
textAreaWidth = width,
readFromLang = false,

View File

@@ -3,9 +3,9 @@ package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blendNormal
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemList
@@ -21,8 +21,8 @@ class UITitleModules : UICanvas() {
private val moduleAreaHMargin = 48
private val moduleAreaBorder = 8
override var width = Terrarum.WIDTH - UIRemoCon.remoConWidth - moduleAreaHMargin
override var height = Terrarum.HEIGHT - moduleAreaHMargin * 2
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
override var height = AppLoader.screenH - moduleAreaHMargin * 2
private val moduleInfoCells = ArrayList<UIItemModuleInfoCell>()

View File

@@ -6,7 +6,7 @@ package net.torvald.terrarum.modulebasegame.ui
val remoConWidth = 240
fun getRemoConHeight(menu: ArrayList<String>) = 36 * menu.size.plus(1)
fun getRemoConHeight(menu: Array<String>) = 36 * menu.size.plus(1)
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
val menubarOffY: Int; get() = AppLoader.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
}

View File

@@ -3,9 +3,9 @@ package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.CreditSingleton
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextArea
@@ -15,8 +15,8 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
private val textAreaHMargin = 48
override var width = Terrarum.WIDTH - UIRemoCon.remoConWidth - textAreaHMargin
override var height = Terrarum.HEIGHT - textAreaHMargin * 2
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - textAreaHMargin
override var height = AppLoader.screenH - textAreaHMargin * 2
private val textArea = UIItemTextArea(this,
UIRemoCon.remoConWidth, textAreaHMargin,
width, height

View File

@@ -5,9 +5,9 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.jme3.math.FastMath
import net.torvald.colourutil.CIELabUtil.darkerLab
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Second
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
import net.torvald.terrarum.ui.UICanvas
/**
@@ -50,8 +50,8 @@ class UIVitalMetre(
override fun updateUI(delta: Float) {
handler.setPosition(
Terrarum.HALFW,
Terrarum.HALFH
AppLoader.halfScreenW,
AppLoader.halfScreenH
)
}

View File

@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.jme3.math.FastMath
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.AVKey
@@ -48,7 +49,7 @@ class uiQuickslotPie : UICanvas() {
// update controls
if (handler.isOpened || handler.isOpening) {
val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble())
val centre = Vector2(Terrarum.HALFW.toDouble(), Terrarum.HALFH.toDouble())
val centre = Vector2(AppLoader.halfScreenW.toDouble(), AppLoader.halfScreenH.toDouble())
val deg = -(centre - cursorPos).direction.toFloat()
selection = Math.round(deg * slotCount / FastMath.TWO_PI)

View File

@@ -101,8 +101,8 @@ internal object WeatherMixer : RNGConsumer {
val playerPosY = player.hitbox.centeredY
kotlin.repeat(7) {
val rainParticle = ParticleMegaRain(
playerPosX + HQRNG().nextInt(Terrarum.WIDTH) - Terrarum.HALFW,
playerPosY - Terrarum.HEIGHT
playerPosX + HQRNG().nextInt(AppLoader.screenW) - AppLoader.halfScreenW,
playerPosY - AppLoader.screenH
)
(Terrarum.ingame!! as TerrarumIngame).addParticle(rainParticle)
}