mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 19:14:05 +09:00
gdx 1.10/lwjgl3 migration; removing old Lua stuffs
This commit is contained in:
@@ -5,7 +5,6 @@ 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
|
||||
|
||||
@@ -62,7 +61,7 @@ class Notification : UICanvas() {
|
||||
val displayedTextWidth = maxOf(240, realTextWidth)
|
||||
|
||||
// force the UI to the centre of the screen
|
||||
this.posX = (AppLoader.screenW - displayedTextWidth) / 2
|
||||
this.posX = (AppLoader.screenSize.screenW - displayedTextWidth) / 2
|
||||
|
||||
val textHeight = message.size * AppLoader.fontGame.lineHeight
|
||||
|
||||
|
||||
@@ -70,8 +70,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, AppLoader.screenW - parent.uiPalette.width)
|
||||
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, AppLoader.screenH - parent.uiPalette.height)
|
||||
parent.uiPalette.posX = parent.uiPalette.posX.coerceIn(0, AppLoader.screenSize.screenW - parent.uiPalette.width)
|
||||
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, AppLoader.screenSize.screenH - parent.uiPalette.height)
|
||||
},
|
||||
{
|
||||
parent.currentPenMode = BuildingMaker.PENMODE_PENCIL_ERASE
|
||||
|
||||
@@ -52,40 +52,4 @@ class UIBuildingMakerToolbox : UICanvas() {
|
||||
override fun dispose() {
|
||||
toolsTexture.dispose()
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
return super.mouseMoved(screenX, screenY)
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
return super.touchDragged(screenX, screenY, pointer)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchUp(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
return super.scrolled(amount)
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
return super.keyDown(keycode)
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
return super.keyUp(keycode)
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
return super.keyTyped(character)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
class UICheatDetected : UICanvas() {
|
||||
|
||||
override var width: Int
|
||||
get() = AppLoader.screenW
|
||||
get() = AppLoader.screenSize.screenW
|
||||
set(value) { throw UnsupportedOperationException() }
|
||||
|
||||
override var height: Int
|
||||
get() = AppLoader.screenH
|
||||
get() = AppLoader.screenSize.screenH
|
||||
set(value) { throw UnsupportedOperationException() }
|
||||
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_HOR
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELLS_VRT
|
||||
@@ -23,8 +22,8 @@ internal class UIInventoryCells(
|
||||
val full: UIInventoryFull
|
||||
) : UICanvas() {
|
||||
|
||||
override var width: Int = AppLoader.screenW
|
||||
override var height: Int = AppLoader.screenH
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var openCloseTime: Second = 0.0f
|
||||
|
||||
companion object {
|
||||
@@ -56,7 +55,7 @@ internal class UIInventoryCells(
|
||||
full,
|
||||
full.actor.inventory,
|
||||
full.actor as ActorWithBody,
|
||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (AppLoader.screenW - internalWidth) / 2,
|
||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (AppLoader.screenSize.screenW - internalWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
{ rebuildList() }
|
||||
)
|
||||
|
||||
@@ -15,8 +15,8 @@ import net.torvald.terrarum.ui.UIItemTextButtonList.Companion.DEFAULT_LINE_HEIGH
|
||||
|
||||
class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
override var width: Int = AppLoader.screenW
|
||||
override var height: Int = AppLoader.screenH
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var openCloseTime = 0.0f
|
||||
|
||||
private val gameMenu = arrayOf("MENU_LABEL_MAINMENU", "MENU_LABEL_DESKTOP", "MENU_OPTIONS_CONTROLS", "MENU_OPTIONS_SOUND", "MENU_LABEL_GRAPHICS")
|
||||
@@ -24,7 +24,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
private val gameMenuListWidth = 400
|
||||
private val gameMenuButtons = UIItemTextButtonList(
|
||||
this, gameMenu,
|
||||
(AppLoader.screenW - gameMenuListWidth) / 2,
|
||||
(AppLoader.screenSize.screenW - gameMenuListWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2,
|
||||
gameMenuListWidth, gameMenuListHeight,
|
||||
readFromLang = true,
|
||||
|
||||
@@ -25,8 +25,8 @@ class UIInventoryFull(
|
||||
doNotWarnConstant: Boolean = false
|
||||
) : UICanvas(toggleKeyLiteral, toggleButtonLiteral, customPositioning, doNotWarnConstant) {
|
||||
|
||||
override var width: Int = AppLoader.screenW
|
||||
override var height: Int = AppLoader.screenH
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var openCloseTime: Second = 0.0f
|
||||
|
||||
companion object {
|
||||
@@ -34,7 +34,7 @@ class UIInventoryFull(
|
||||
|
||||
const val REQUIRED_MARGIN: Int = 138 // hard-coded value. Don't know the details. Range: [91-146]. I chose MAX-8 because cell gap is 8
|
||||
const val CELLS_HOR = 10
|
||||
val CELLS_VRT: Int; get() = (AppLoader.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryItemGrid.listGap) / // 134 is another magic number
|
||||
val CELLS_VRT: Int; get() = (AppLoader.screenSize.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryItemGrid.listGap) / // 134 is another magic number
|
||||
(UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap)
|
||||
|
||||
const val itemListToEquipViewGap = UIItemInventoryItemGrid.listGap // used to be 24; figured out that the extra gap does nothig
|
||||
@@ -45,8 +45,8 @@ class UIInventoryFull(
|
||||
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_OFFSET_X = 0 + (AppLoader.screenW - internalWidth) / 2
|
||||
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (AppLoader.screenH - internalHeight) / 2
|
||||
val INVENTORY_CELLS_OFFSET_X = 0 + (AppLoader.screenSize.screenW - internalWidth) / 2
|
||||
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (AppLoader.screenSize.screenH - internalHeight) / 2
|
||||
|
||||
val catBarWidth = 330
|
||||
|
||||
@@ -60,7 +60,7 @@ class UIInventoryFull(
|
||||
//val REQUIRED_MARGIN: Int = 138 // hard-coded value. Don't know the details. Range: [91-146]. I chose MAX-8 because cell gap is 8
|
||||
|
||||
//val CELLS_HOR = 10
|
||||
//val CELLS_VRT: Int; get() = (AppLoader.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryItemGrid.listGap) / // 134 is another magic number
|
||||
//val CELLS_VRT: Int; get() = (AppLoader.terrarumAppConfig.screenH - REQUIRED_MARGIN - 134 + UIItemInventoryItemGrid.listGap) / // 134 is another magic number
|
||||
// (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap)
|
||||
|
||||
//private val itemListToEquipViewGap = UIItemInventoryItemGrid.listGap // used to be 24; figured out that the extra gap does nothig
|
||||
@@ -71,8 +71,8 @@ class UIInventoryFull(
|
||||
//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_OFFSET_X = 0 + (AppLoader.screenW - internalWidth) / 2
|
||||
//val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (AppLoader.screenH - internalHeight) / 2
|
||||
//val INVENTORY_CELLS_OFFSET_X = 0 + (AppLoader.terrarumAppConfig.screenW - internalWidth) / 2
|
||||
//val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (AppLoader.terrarumAppConfig.screenH - internalHeight) / 2
|
||||
|
||||
init {
|
||||
handler.allowESCtoClose = true
|
||||
@@ -113,8 +113,8 @@ class UIInventoryFull(
|
||||
|
||||
val catBar = UIItemInventoryCatBar(
|
||||
this,
|
||||
(AppLoader.screenW - catBarWidth) / 2,
|
||||
42 + (AppLoader.screenH - internalHeight) / 2,
|
||||
(AppLoader.screenSize.screenW - catBarWidth) / 2,
|
||||
42 + (AppLoader.screenSize.screenH - internalHeight) / 2,
|
||||
internalWidth,
|
||||
catBarWidth,
|
||||
true,
|
||||
@@ -127,10 +127,10 @@ class UIInventoryFull(
|
||||
private val transitionalEscMenu = UIInventoryEscMenu(this)
|
||||
private val transitionPanel = UIItemHorizontalFadeSlide(
|
||||
this,
|
||||
(AppLoader.screenW - internalWidth) / 2,
|
||||
(AppLoader.screenSize.screenW - internalWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
AppLoader.screenW,
|
||||
AppLoader.screenH,
|
||||
AppLoader.screenSize.screenW,
|
||||
AppLoader.screenSize.screenH,
|
||||
1f,
|
||||
transitionalMinimap, transitionalItemCells, transitionalEscMenu
|
||||
)
|
||||
@@ -151,9 +151,9 @@ class UIInventoryFull(
|
||||
|
||||
}
|
||||
|
||||
internal var offsetX = ((AppLoader.screenW - internalWidth) / 2).toFloat()
|
||||
internal var offsetX = ((AppLoader.screenSize.screenW - internalWidth) / 2).toFloat()
|
||||
private set
|
||||
internal var offsetY = ((AppLoader.screenH - internalHeight) / 2).toFloat()
|
||||
internal var offsetY = ((AppLoader.screenSize.screenH - internalHeight) / 2).toFloat()
|
||||
private set
|
||||
|
||||
fun requestTransition(target: Int) = transitionPanel.requestTransition(target)
|
||||
@@ -172,9 +172,9 @@ class UIInventoryFull(
|
||||
//private val gradHeight = 48f
|
||||
private val shapeRenderer = ShapeRenderer()
|
||||
|
||||
internal var xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
||||
internal var xEnd = (AppLoader.screenSize.screenW + internalWidth).div(2).toFloat()
|
||||
private set
|
||||
internal var yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
||||
internal var yEnd = (AppLoader.screenSize.screenH + internalHeight).div(2).toFloat()
|
||||
private set
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
@@ -185,17 +185,17 @@ class UIInventoryFull(
|
||||
gdxSetBlendNormal()
|
||||
|
||||
|
||||
val gradTopStart = (AppLoader.screenH - internalHeight).div(2).toFloat()
|
||||
val gradBottomEnd = AppLoader.screenH - gradTopStart
|
||||
val gradTopStart = (AppLoader.screenSize.screenH - internalHeight).div(2).toFloat()
|
||||
val gradBottomEnd = AppLoader.screenSize.screenH - gradTopStart
|
||||
|
||||
shapeRenderer.inUse {
|
||||
shapeRenderer.rect(0f, gradTopStart, AppLoader.screenWf, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradBottomEnd, AppLoader.screenWf, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradTopStart, AppLoader.screenSize.screenWf, gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradBottomEnd, AppLoader.screenSize.screenWf, -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||
|
||||
shapeRenderer.rect(0f, gradTopStart + gradHeight, AppLoader.screenWf, internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
||||
shapeRenderer.rect(0f, gradTopStart + gradHeight, AppLoader.screenSize.screenWf, internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
||||
|
||||
shapeRenderer.rect(0f, 0f, AppLoader.screenWf, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, AppLoader.screenHf, AppLoader.screenWf, -(AppLoader.screenHf - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, 0f, AppLoader.screenSize.screenWf, gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
shapeRenderer.rect(0f, AppLoader.screenSize.screenHf, AppLoader.screenSize.screenWf, -(AppLoader.screenSize.screenHf - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||
}
|
||||
|
||||
|
||||
@@ -255,11 +255,11 @@ class UIInventoryFull(
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
|
||||
offsetX = ((AppLoader.screenW - internalWidth) / 2).toFloat()
|
||||
offsetY = ((AppLoader.screenH - internalHeight) / 2).toFloat()
|
||||
offsetX = ((AppLoader.screenSize.screenW - internalWidth) / 2).toFloat()
|
||||
offsetY = ((AppLoader.screenSize.screenH - internalHeight) / 2).toFloat()
|
||||
|
||||
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
||||
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
||||
xEnd = (AppLoader.screenSize.screenW + internalWidth).div(2).toFloat()
|
||||
yEnd = (AppLoader.screenSize.screenH + internalHeight).div(2).toFloat()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
private val debugvals = true
|
||||
|
||||
override var width: Int = AppLoader.screenW
|
||||
override var height: Int = AppLoader.screenH
|
||||
override var width: Int = AppLoader.screenSize.screenW
|
||||
override var height: Int = AppLoader.screenSize.screenH
|
||||
override var openCloseTime = 0.0f
|
||||
|
||||
private val MINIMAP_WIDTH = 800f
|
||||
@@ -115,23 +115,23 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
batch.begin()
|
||||
|
||||
if (debugvals) {
|
||||
AppLoader.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (AppLoader.screenW - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
|
||||
}
|
||||
|
||||
batch.projectionMatrix = camera.combined
|
||||
// 1px stroke
|
||||
batch.color = Color.WHITE
|
||||
batch.fillRect((AppLoader.screenW - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect((AppLoader.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect(-1 + (AppLoader.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((AppLoader.screenW - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect((AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect(-1 + (AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
|
||||
// control hints
|
||||
batch.color = Color.WHITE
|
||||
AppLoader.fontGame.draw(batch, full.minimapControlHelp, full.offsetX, full.yEnd - 20)
|
||||
|
||||
// the minimap
|
||||
batch.draw(minimapFBO.colorBufferTexture, (AppLoader.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
|
||||
batch.draw(minimapFBO.colorBufferTexture, (AppLoader.screenSize.screenW - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {}
|
||||
|
||||
@@ -523,12 +523,12 @@ class UIItemInventoryItemGrid(
|
||||
return true
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
super.scrolled(amount)
|
||||
override fun scrolled(amountX: Float, amountY: Float): Boolean {
|
||||
super.scrolled(amountX, amountY)
|
||||
|
||||
// scroll the item list (for now)
|
||||
if (mouseUp) {
|
||||
scrollItemPage(amount)
|
||||
scrollItemPage(amountX.toInt())
|
||||
}
|
||||
|
||||
return true
|
||||
|
||||
@@ -46,40 +46,4 @@ class UIProxyNewBuildingMaker : UICanvas() {
|
||||
override fun dispose() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
return super.mouseMoved(screenX, screenY)
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
return super.touchDragged(screenX, screenY, pointer)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchUp(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
return super.scrolled(amount)
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
return super.keyDown(keycode)
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
return super.keyUp(keycode)
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
return super.keyTyped(character)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
@@ -62,40 +62,4 @@ class UIProxyNewRandomGame : UICanvas() {
|
||||
override fun dispose() {
|
||||
TODO("not implemented")
|
||||
}
|
||||
|
||||
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
|
||||
return super.mouseMoved(screenX, screenY)
|
||||
}
|
||||
|
||||
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
|
||||
return super.touchDragged(screenX, screenY, pointer)
|
||||
}
|
||||
|
||||
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchDown(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
|
||||
return super.touchUp(screenX, screenY, pointer, button)
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
return super.scrolled(amount)
|
||||
}
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
return super.keyDown(keycode)
|
||||
}
|
||||
|
||||
override fun keyUp(keycode: Int): Boolean {
|
||||
return super.keyUp(keycode)
|
||||
}
|
||||
|
||||
override fun keyTyped(character: Char): Boolean {
|
||||
return super.keyTyped(character)
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
super.resize(width, height)
|
||||
}
|
||||
}
|
||||
@@ -83,10 +83,10 @@ class UIQuickslotBar : UICanvas() {
|
||||
handler.opacity = 0f
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
override fun scrolled(amountX: Float, amountY: Float): Boolean {
|
||||
// super.scrolled(amount) // no UIItems here
|
||||
|
||||
selection = selection.plus(if (amount > 1) 1 else if (amount < -1) -1 else 0).fmod(SLOT_COUNT)
|
||||
selection = selection.plus(if (amountX > 1) 1 else if (amountX < -1) -1 else 0).fmod(SLOT_COUNT)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -49,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(AppLoader.halfScreenW.toDouble(), AppLoader.halfScreenH.toDouble())
|
||||
val centre = Vector2(AppLoader.screenSize.halfScreenW.toDouble(), AppLoader.screenSize.halfScreenH.toDouble())
|
||||
val deg = -(centre - cursorPos).direction.toFloat()
|
||||
|
||||
selection = Math.round(deg * slotCount / FastMath.TWO_PI)
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.AppLoader.printdbgerr
|
||||
import net.torvald.terrarum.QNDTreeNode
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.Yaml
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.ui.UIItemTextButton
|
||||
@@ -221,9 +220,9 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun scrolled(amount: Int): Boolean {
|
||||
override fun scrolled(amountX: Float, amountY: Float): Boolean {
|
||||
screens.forEach {
|
||||
it.second.scrolled(amount) // again, underlying handler will block unnecessary renders
|
||||
it.second.scrolled(amountX, amountY) // again, underlying handler will block unnecessary renders
|
||||
}
|
||||
|
||||
return true
|
||||
@@ -300,6 +299,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() = AppLoader.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
||||
val menubarOffY: Int; get() = AppLoader.screenSize.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.EMDASH
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumScreenSize
|
||||
import net.torvald.terrarum.keyToIcon
|
||||
import net.torvald.terrarum.ui.Movement
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
@@ -39,8 +40,8 @@ class UIScreenZoom : UICanvas(
|
||||
|
||||
AppLoader.fontGame.draw(
|
||||
batch, zoomText,
|
||||
(AppLoader.screenW * AppLoader.TV_SAFE_GRAPHICS + 1).toInt().toFloat(),
|
||||
(AppLoader.screenH - height - AppLoader.getTvSafeGraphicsHeight()).toFloat()
|
||||
(AppLoader.screenSize.screenW * TerrarumScreenSize.TV_SAFE_GRAPHICS + 1).toInt().toFloat(),
|
||||
(AppLoader.screenSize.screenH - height - AppLoader.screenSize.tvSafeGraphicsHeight).toFloat()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ class UITitleCharactersList : UICanvas() {
|
||||
private val moduleAreaHMargin = 48
|
||||
private val moduleAreaBorder = 8
|
||||
|
||||
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = AppLoader.screenH - moduleAreaHMargin * 2
|
||||
override var width = AppLoader.screenSize.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = AppLoader.screenSize.screenH - moduleAreaHMargin * 2
|
||||
|
||||
private val moduleInfoCells = ArrayList<UIItemSavegameInfoCell>()
|
||||
// build characters list
|
||||
|
||||
@@ -3,7 +3,6 @@ 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.Terrarum
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
@@ -21,13 +20,13 @@ class UITitleLanguage : UICanvas() {
|
||||
|
||||
|
||||
private val textAreaHMargin = 48
|
||||
override var width = (AppLoader.screenW * 0.75).toInt()
|
||||
override var height = AppLoader.screenH - textAreaHMargin * 2
|
||||
override var width = (AppLoader.screenSize.screenW * 0.75).toInt()
|
||||
override var height = AppLoader.screenSize.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(),
|
||||
AppLoader.screenW - width, textAreaHMargin,
|
||||
AppLoader.screenSize.screenW - width, textAreaHMargin,
|
||||
width, height,
|
||||
textAreaWidth = width,
|
||||
readFromLang = false,
|
||||
|
||||
@@ -21,8 +21,8 @@ class UITitleModules : UICanvas() {
|
||||
private val moduleAreaHMargin = 48
|
||||
private val moduleAreaBorder = 8
|
||||
|
||||
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = AppLoader.screenH - moduleAreaHMargin * 2
|
||||
override var width = AppLoader.screenSize.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||
override var height = AppLoader.screenSize.screenH - moduleAreaHMargin * 2
|
||||
|
||||
|
||||
private val moduleInfoCells = ArrayList<UIItemModuleInfoCell>()
|
||||
|
||||
@@ -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() = AppLoader.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
||||
val menubarOffY: Int; get() = AppLoader.terrarumAppConfig.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
||||
|
||||
|
||||
private val textAreaHMargin = 48
|
||||
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - textAreaHMargin
|
||||
override var height = AppLoader.screenH - textAreaHMargin * 2
|
||||
override var width = AppLoader.screenSize.screenW - UIRemoCon.remoConWidth - textAreaHMargin
|
||||
override var height = AppLoader.screenSize.screenH - textAreaHMargin * 2
|
||||
private val textArea = UIItemTextArea(this,
|
||||
UIRemoCon.remoConWidth, textAreaHMargin,
|
||||
width, height
|
||||
|
||||
@@ -50,8 +50,8 @@ class UIVitalMetre(
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
handler.setPosition(
|
||||
AppLoader.halfScreenW,
|
||||
AppLoader.halfScreenH
|
||||
AppLoader.screenSize.halfScreenW,
|
||||
AppLoader.screenSize.halfScreenH
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user