mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 12:04:06 +09:00
debugwin: drawing ingame weatherboxes
This commit is contained in:
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulecomputers.gameitems
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import com.badlogic.gdx.utils.Disposable
|
import com.badlogic.gdx.utils.Disposable
|
||||||
@@ -118,7 +119,7 @@ class WearableWorldRadarUI(val device: VM) : UICanvas() {
|
|||||||
device.update(delta)
|
device.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ internal class UIHomeComputer : UICanvas(
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(otherBatch: SpriteBatch, otherCamera: Camera) {
|
override fun renderUI(otherBatch: SpriteBatch, otherCamera: OrthographicCamera) {
|
||||||
otherBatch.end()
|
otherBatch.end()
|
||||||
|
|
||||||
fbo.inAction(camera, batch) {
|
fbo.inAction(camera, batch) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum
|
package net.torvald.terrarum
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.modulebasegame.ui.UIRemoCon
|
import net.torvald.terrarum.modulebasegame.ui.UIRemoCon
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
@@ -17,7 +18,7 @@ class ModOptionsHost(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class UIFakeGradOverlay : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {}
|
override fun updateUI(delta: Float) {}
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.end()
|
batch.end()
|
||||||
val dither = App.getConfigBoolean("fx_dither")
|
val dither = App.getConfigBoolean("fx_dither")
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ class UIFakeBlurOverlay(val blurRadius: Float, val nodarken: Boolean) : UICanvas
|
|||||||
private val batchDrawCol = Color(-1)
|
private val batchDrawCol = Color(-1)
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {}
|
override fun updateUI(delta: Float) {}
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batchDrawCol.a = openness
|
batchDrawCol.a = openness
|
||||||
batch.color = batchDrawCol
|
batch.color = batchDrawCol
|
||||||
if (App.getConfigBoolean("fx_backgroundblur")) {
|
if (App.getConfigBoolean("fx_backgroundblur")) {
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package net.torvald.terrarum
|
package net.torvald.terrarum
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.*
|
||||||
import com.badlogic.gdx.graphics.Color
|
|
||||||
import com.badlogic.gdx.graphics.Pixmap
|
|
||||||
import com.badlogic.gdx.graphics.Texture
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.gameitems.GameItem
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
@@ -271,7 +268,7 @@ class UIItemInventoryCatBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
// button
|
// button
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.terrarum.gameitems.GameItem
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
@@ -53,7 +54,7 @@ class UIItemInventoryElemSimple(
|
|||||||
private var highlightToMainCol = false
|
private var highlightToMainCol = false
|
||||||
private var highlightToSubCol = false
|
private var highlightToSubCol = false
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|
||||||
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted
|
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.terrarum.gameitems.GameItem
|
import net.torvald.terrarum.gameitems.GameItem
|
||||||
@@ -78,7 +79,7 @@ class UIItemInventoryElemWide(
|
|||||||
var textHighlightMouseUpCol = Toolkit.Theme.COL_MOUSE_UP
|
var textHighlightMouseUpCol = Toolkit.Theme.COL_MOUSE_UP
|
||||||
var textHighlightNormalCol = Color.WHITE
|
var textHighlightNormalCol = Color.WHITE
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|
||||||
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted
|
highlightToMainCol = customHighlightRuleMain?.invoke(this) ?: (equippedSlot != null && highlightEquippedItem) || forceHighlighted
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.App.*
|
import net.torvald.terrarum.App.*
|
||||||
import net.torvald.terrarum.Terrarum.getPlayerSaveFiledesc
|
import net.torvald.terrarum.Terrarum.getPlayerSaveFiledesc
|
||||||
@@ -12,8 +14,8 @@ import net.torvald.terrarum.Terrarum.getWorldSaveFiledesc
|
|||||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||||
import net.torvald.terrarum.blockproperties.BlockPropUtil
|
import net.torvald.terrarum.blockproperties.BlockPropUtil
|
||||||
import net.torvald.terrarum.blockstats.TileSurvey
|
|
||||||
import net.torvald.terrarum.blockstats.MinimapComposer
|
import net.torvald.terrarum.blockstats.MinimapComposer
|
||||||
|
import net.torvald.terrarum.blockstats.TileSurvey
|
||||||
import net.torvald.terrarum.concurrent.ThreadExecutor
|
import net.torvald.terrarum.concurrent.ThreadExecutor
|
||||||
import net.torvald.terrarum.console.AVTracker
|
import net.torvald.terrarum.console.AVTracker
|
||||||
import net.torvald.terrarum.console.ActorsList
|
import net.torvald.terrarum.console.ActorsList
|
||||||
@@ -95,12 +97,24 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
/** Sets camera position so that (0,0) would be top-left of the screen, (width, height) be bottom-right. */
|
/** 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) {
|
fun setCameraPosition(batch: SpriteBatch, camera: OrthographicCamera, newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
}
|
}
|
||||||
|
fun setCameraPosition(batch: SpriteBatch, shape: ShapeRenderer, camera: OrthographicCamera, newX: Float, newY: Float) {
|
||||||
|
camera.setToOrtho(false, App.scr.wf, App.scr.hf)
|
||||||
|
camera.update()
|
||||||
|
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
||||||
|
camera.update()
|
||||||
|
shape.projectionMatrix = camera.combined
|
||||||
|
|
||||||
|
camera.setToOrtho(true, App.scr.wf, App.scr.hf)
|
||||||
|
camera.update()
|
||||||
|
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
||||||
|
camera.update()
|
||||||
|
batch.projectionMatrix = camera.combined
|
||||||
|
}
|
||||||
fun getCanonicalTitle() = App.GAME_NAME +
|
fun getCanonicalTitle() = App.GAME_NAME +
|
||||||
" $EMDASH F: ${Gdx.graphics.framesPerSecond}" +
|
" $EMDASH F: ${Gdx.graphics.framesPerSecond}" +
|
||||||
if (App.IS_DEVELOPMENT_BUILD)
|
if (App.IS_DEVELOPMENT_BUILD)
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
|
|
||||||
fun setCameraPosition(newX: Float, newY: Float) {
|
fun setCameraPosition(newX: Float, newY: Float) {
|
||||||
TerrarumIngame.setCameraPosition(batch, camera, newX, newY)
|
TerrarumIngame.setCameraPosition(batch, App.shapeRender, camera, newX, newY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormal(batch)
|
blendNormal(batch)
|
||||||
|
|
||||||
val textWidth = messagesList.map { AppLoader.fontGame.getWidth(it) }.sorted()[1]
|
val textWidth = messagesList.map { AppLoader.fontGame.getWidth(it) }.sorted()[1]
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
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
|
||||||
@@ -49,7 +50,7 @@ class Notification : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
fontCol.a = handler.opacity * OPACITY
|
fontCol.a = handler.opacity * OPACITY
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
|
||||||
@@ -15,7 +16,7 @@ object NullUI : UICanvas() {
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
@@ -86,7 +87,7 @@ class UIBasicInfo() : UICanvas() {
|
|||||||
|
|
||||||
private val lcdLitCol: Color = lcdLitColELoff
|
private val lcdLitCol: Color = lcdLitColELoff
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = drawCol
|
batch.color = drawCol
|
||||||
batch.draw(atlas.get(0, 0), 0f, 0f)
|
batch.draw(atlas.get(0, 0), 0f, 0f)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.BlockCodex
|
import net.torvald.terrarum.BlockCodex
|
||||||
import net.torvald.terrarum.ItemCodex
|
import net.torvald.terrarum.ItemCodex
|
||||||
@@ -126,7 +127,7 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
palette.forEach { it.render(batch, camera) }
|
palette.forEach { it.render(batch, camera) }
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
@@ -146,7 +147,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
|||||||
parent.tappedOnUI = true
|
parent.tappedOnUI = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// draw back
|
// draw back
|
||||||
batch.color = backCol
|
batch.color = backCol
|
||||||
Toolkit.fillCircle(batch,0, 0, SIZE, SIZE)
|
Toolkit.fillCircle(batch,0, 0, SIZE, SIZE)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.ModMgr
|
import net.torvald.terrarum.ModMgr
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
@@ -37,7 +38,7 @@ class UIBuildingMakerToolbox : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
tools.forEach { it.render(batch, camera) }
|
tools.forEach { it.render(batch, camera) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class UICheatDetected : UICanvas() {
|
|||||||
|
|
||||||
private val backgroundCol = Color(0x00000080)
|
private val backgroundCol = Color(0x00000080)
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
Terrarum.ingame?.consoleHandler?.setAsClose()
|
Terrarum.ingame?.consoleHandler?.setAsClose()
|
||||||
Terrarum.ingame?.consoleHandler?.isVisible = false
|
Terrarum.ingame?.consoleHandler?.isVisible = false
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.App.gamepadLabelLEFTRIGHT
|
import net.torvald.terrarum.App.gamepadLabelLEFTRIGHT
|
||||||
@@ -450,7 +451,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
if (openingClickLatched && !Terrarum.mouseDown) openingClickLatched = false
|
if (openingClickLatched && !Terrarum.mouseDown) openingClickLatched = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// NO super.render due to an infinite recursion
|
// NO super.render due to an infinite recursion
|
||||||
this.uiItems.forEach { it.render(batch, camera) }
|
this.uiItems.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
@@ -45,7 +46,7 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
uiItems.forEach { it.update(delta) }
|
uiItems.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
ControlPanelCommon.render("basegame.graphicscontrolpanel", width, batch)
|
ControlPanelCommon.render("basegame.graphicscontrolpanel", width, batch)
|
||||||
uiItems.forEach { it.render(batch, camera) }
|
uiItems.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.unicode.EMDASH
|
import net.torvald.unicode.EMDASH
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
@@ -168,7 +169,7 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
uiItems.forEach { it.update(delta) }
|
uiItems.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
val txt1 = Lang["MENU_LABEL_KEYBOARD_LAYOUT"]; val tw1 = App.fontGame.getWidth(txt1)
|
val txt1 = Lang["MENU_LABEL_KEYBOARD_LAYOUT"]; val tw1 = App.fontGame.getWidth(txt1)
|
||||||
@@ -266,7 +267,7 @@ private class UIItemInputKeycap(
|
|||||||
c in 0x1DC0..0x1DFF || c in 0x20D0..0x20FF || c in 0xFE20..0xFE2F ||
|
c in 0x1DC0..0x1DFF || c in 0x20D0..0x20FF || c in 0xFE20..0xFE2F ||
|
||||||
c == 0xE31 || c in 0xE33..0xE3A || c in 0xE47..0xE4E
|
c == 0xE31 || c in 0xE33..0xE3A || c in 0xE47..0xE4E
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
// key background
|
// key background
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.App.printdbg
|
import net.torvald.terrarum.App.printdbg
|
||||||
@@ -119,7 +120,7 @@ class UIImportAvatar(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
Lang["ERROR_AVATAR_ALREADY_EXISTS"], // 2
|
Lang["ERROR_AVATAR_ALREADY_EXISTS"], // 2
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
val textboxWidth = textboxIndices.maxOf { App.fontGame.getWidth(Lang["CONTEXT_IMPORT_AVATAR_INSTRUCTION_$it"]) }
|
val textboxWidth = textboxIndices.maxOf { App.fontGame.getWidth(Lang["CONTEXT_IMPORT_AVATAR_INSTRUCTION_$it"]) }
|
||||||
val textX = (Toolkit.drawWidth - textboxWidth) / 2
|
val textX = (Toolkit.drawWidth - textboxWidth) / 2
|
||||||
@@ -264,7 +265,7 @@ class UIItemCodeBox(parent: UIImportAvatar, initialX: Int, initialY: Int, val co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// draw box backgrounds
|
// draw box backgrounds
|
||||||
batch.color = UIInventoryFull.CELL_COL
|
batch.color = UIInventoryFull.CELL_COL
|
||||||
Toolkit.fillArea(batch, posX, posY, width, height)
|
Toolkit.fillArea(batch, posX, posY, width, height)
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
private val weightBarWidth = 60f
|
private val weightBarWidth = 60f
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// background
|
// background
|
||||||
blendNormal()
|
blendNormal()
|
||||||
batch.color = backgroundColour
|
batch.color = backgroundColour
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.App.printdbg
|
import net.torvald.terrarum.App.printdbg
|
||||||
@@ -84,7 +85,7 @@ internal class UIInventoryCells(
|
|||||||
equipped.update(delta)
|
equipped.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
//itemList.posX = itemList.initialX + inventoryScrOffX.roundToInt()
|
//itemList.posX = itemList.initialX + inventoryScrOffX.roundToInt()
|
||||||
itemList.render(batch, camera)
|
itemList.render(batch, camera)
|
||||||
//equipped.posX = equipped.initialX + inventoryScrOffX.roundToInt()
|
//equipped.posX = equipped.initialX + inventoryScrOffX.roundToInt()
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.App.printdbg
|
import net.torvald.terrarum.App.printdbg
|
||||||
@@ -178,31 +179,31 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
|||||||
|
|
||||||
// `screens` order
|
// `screens` order
|
||||||
private val screenRenders = arrayOf(
|
private val screenRenders = arrayOf(
|
||||||
{ batch: SpriteBatch, camera: Camera ->
|
{ batch: SpriteBatch, camera: OrthographicCamera ->
|
||||||
// control hints
|
// control hints
|
||||||
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
||||||
// text buttons
|
// text buttons
|
||||||
gameMenuButtons.render(batch, camera)
|
gameMenuButtons.render(batch, camera)
|
||||||
},
|
},
|
||||||
{ batch: SpriteBatch, camera: Camera ->
|
{ batch: SpriteBatch, camera: OrthographicCamera ->
|
||||||
// control hints
|
// control hints
|
||||||
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
||||||
keyboardSetupUI.render(batch, camera)
|
keyboardSetupUI.render(batch, camera)
|
||||||
},
|
},
|
||||||
{ batch: SpriteBatch, camera: Camera ->
|
{ batch: SpriteBatch, camera: OrthographicCamera ->
|
||||||
// control hints
|
// control hints
|
||||||
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
||||||
areYouSureMainMenuButtons.render(batch, camera)
|
areYouSureMainMenuButtons.render(batch, camera)
|
||||||
},
|
},
|
||||||
{ batch: SpriteBatch, camera: Camera ->
|
{ batch: SpriteBatch, camera: OrthographicCamera ->
|
||||||
savingUI.render(batch, camera)
|
savingUI.render(batch, camera)
|
||||||
},
|
},
|
||||||
{ batch: SpriteBatch, camera: Camera ->
|
{ batch: SpriteBatch, camera: OrthographicCamera ->
|
||||||
// control hints
|
// control hints
|
||||||
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
||||||
keyConfigUI.render(batch, camera)
|
keyConfigUI.render(batch, camera)
|
||||||
},
|
},
|
||||||
{ batch: SpriteBatch, camera: Camera ->
|
{ batch: SpriteBatch, camera: OrthographicCamera ->
|
||||||
// control hints
|
// control hints
|
||||||
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
App.fontGame.draw(batch, full.gameMenuControlHelp, full.offsetX, full.yEnd - 20)
|
||||||
languageUI.render(batch, camera)
|
languageUI.render(batch, camera)
|
||||||
@@ -281,7 +282,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
|||||||
yeet.update(delta)
|
yeet.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
screenRenders[screen](batch, camera)
|
screenRenders[screen](batch, camera)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
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.*
|
import net.torvald.terrarum.*
|
||||||
@@ -313,7 +314,7 @@ class UIInventoryFull(
|
|||||||
internal var yEnd = -YPOS_CORRECTION + (App.scr.height + internalHeight).div(2).toFloat()
|
internal var yEnd = -YPOS_CORRECTION + (App.scr.height + internalHeight).div(2).toFloat()
|
||||||
private set
|
private set
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
|
||||||
drawBackground(batch, 1f)
|
drawBackground(batch, 1f)
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
|||||||
minimapRerenderTimer += Gdx.graphics.deltaTime
|
minimapRerenderTimer += Gdx.graphics.deltaTime
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
val cellOffY = INVENTORY_CELLS_OFFSET_Y()
|
val cellOffY = INVENTORY_CELLS_OFFSET_Y()
|
||||||
val worldWidth = INGAME.world.width
|
val worldWidth = INGAME.world.width
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.terrarum.GdxColorMap
|
import net.torvald.terrarum.GdxColorMap
|
||||||
@@ -33,7 +34,7 @@ abstract class UIItemInventoryCellBase(
|
|||||||
open protected val highlightEquippedItem: Boolean = true // for some UIs that only cares about getting equipped slot number but not highlighting
|
open protected val highlightEquippedItem: Boolean = true // for some UIs that only cares about getting equipped slot number but not highlighting
|
||||||
) : UIItem(parentUI, initialX, initialY) {
|
) : UIItem(parentUI, initialX, initialY) {
|
||||||
abstract override fun update(delta: Float)
|
abstract override fun update(delta: Float)
|
||||||
abstract override fun render(batch: SpriteBatch, camera: Camera)
|
abstract override fun render(batch: SpriteBatch, camera: OrthographicCamera)
|
||||||
|
|
||||||
/** Custom highlight rule to highlight tihs button to primary accent colour (blue by default).
|
/** Custom highlight rule to highlight tihs button to primary accent colour (blue by default).
|
||||||
* Set to `null` to use default rule:
|
* Set to `null` to use default rule:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.spriteanimation.AssembledSpriteAnimation
|
import net.torvald.spriteanimation.AssembledSpriteAnimation
|
||||||
import net.torvald.spriteanimation.SheetSpriteAnimation
|
import net.torvald.spriteanimation.SheetSpriteAnimation
|
||||||
@@ -67,7 +68,7 @@ class UIItemInventoryEquippedView(
|
|||||||
itemGrid.forEach { it.update(delta) }
|
itemGrid.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|
||||||
val posXDelta = posX - oldPosX
|
val posXDelta = posX - oldPosX
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.UIItemInventoryCatBar.Companion.CAT_ALL
|
import net.torvald.terrarum.UIItemInventoryCatBar.Companion.CAT_ALL
|
||||||
@@ -289,7 +290,7 @@ open class UIItemInventoryItemGrid(
|
|||||||
// private fun getIconPosY(index: Int) =
|
// private fun getIconPosY(index: Int) =
|
||||||
// posY + 8 + 26 * index
|
// posY + 8 + 26 * index
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val posXDelta = posX - oldPosX
|
val posXDelta = posX - oldPosX
|
||||||
itemGrid.forEach { it.posX += posXDelta }
|
itemGrid.forEach { it.posX += posXDelta }
|
||||||
itemList.forEach { it.posX += posXDelta }
|
itemList.forEach { it.posX += posXDelta }
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.BlendMode
|
import net.torvald.terrarum.BlendMode
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
@@ -110,7 +111,7 @@ class UIItemListNavBarVertical(
|
|||||||
var itemPage = 0
|
var itemPage = 0
|
||||||
|
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val posXDelta = posX - oldPosX
|
val posXDelta = posX - oldPosX
|
||||||
|
|
||||||
gridModeButtons.forEach { it.posX += posXDelta }
|
gridModeButtons.forEach { it.posX += posXDelta }
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
@@ -30,7 +31,7 @@ class UIItemSaving(parentUI: UICanvas, initialX: Int, initialY: Int) : UIItem(pa
|
|||||||
init {
|
init {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// these things will not scroll along with the parent GUI!
|
// these things will not scroll along with the parent GUI!
|
||||||
val t = Lang["MENU_IO_SAVING"]
|
val t = Lang["MENU_IO_SAVING"]
|
||||||
val tlen = App.fontGame.getWidth(t)
|
val tlen = App.fontGame.getWidth(t)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
@@ -200,7 +201,7 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
controlPalette.update(delta)
|
controlPalette.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// batch.color = borderNormal
|
// batch.color = borderNormal
|
||||||
// Toolkit.drawBoxBorder(batch, drawX, drawY, width, height)
|
// Toolkit.drawBoxBorder(batch, drawX, drawY, width, height)
|
||||||
// batch.color = fillCol
|
// batch.color = fillCol
|
||||||
@@ -336,7 +337,7 @@ private class UIItemKeycap(
|
|||||||
super.update(delta)
|
super.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
batch.color = if (key == null)
|
batch.color = if (key == null)
|
||||||
@@ -446,7 +447,7 @@ class UIItemControlPaletteBaloon(val parent: UIKeyboardControlPanel, initialX: I
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
Toolkit.drawBaloon(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
Toolkit.drawBaloon(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ import java.util.zip.GZIPInputStream
|
|||||||
|
|
||||||
private var loadFiredFrameCounter = 0
|
private var loadFiredFrameCounter = 0
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
if (mode == MODE_INIT) {
|
if (mode == MODE_INIT) {
|
||||||
// "The Autosave is more recent than the manual save"
|
// "The Autosave is more recent than the manual save"
|
||||||
Toolkit.drawTextCentered(batch, App.fontGame, Lang["GAME_MORE_RECENT_AUTOSAVE1"], Toolkit.drawWidth, 0, altSelDrawY)
|
Toolkit.drawTextCentered(batch, App.fontGame, Lang["GAME_MORE_RECENT_AUTOSAVE1"], Toolkit.drawWidth, 0, altSelDrawY)
|
||||||
|
|||||||
@@ -304,7 +304,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
|
||||||
if (mode == 2) {
|
if (mode == 2) {
|
||||||
loadFired += 1
|
loadFired += 1
|
||||||
@@ -475,7 +475,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, false)
|
sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
|
private fun setCameraPosition(batch: SpriteBatch, camera: OrthographicCamera, newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
@@ -584,7 +584,7 @@ class UIItemPlayerCells(
|
|||||||
|
|
||||||
private val avatarViewWidth = 120
|
private val avatarViewWidth = 120
|
||||||
|
|
||||||
fun render(batch: SpriteBatch, camera: Camera, offX: Int, offY: Int) {
|
fun render(batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) {
|
||||||
// try to generate a texture
|
// try to generate a texture
|
||||||
if (!hasTexture) { acquirePlayerAvatar(); hasTexture = true }
|
if (!hasTexture) { acquirePlayerAvatar(); hasTexture = true }
|
||||||
|
|
||||||
@@ -652,7 +652,7 @@ class UIItemPlayerCells(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
render(batch, camera, 0, 0)
|
render(batch, camera, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,7 +819,7 @@ class UIItemWorldCells(
|
|||||||
highlightCol = if (mouseUp) Toolkit.Theme.COL_MOUSE_UP else Toolkit.Theme.COL_LIST_DEFAULT
|
highlightCol = if (mouseUp) Toolkit.Theme.COL_MOUSE_UP else Toolkit.Theme.COL_LIST_DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// try to generate a texture
|
// try to generate a texture
|
||||||
if (skimmer.initialised && !hasTexture) {
|
if (skimmer.initialised && !hasTexture) {
|
||||||
// load thumbnail or use stock if the file is not there
|
// load thumbnail or use stock if the file is not there
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class UILoadList(val full: UILoadSavegame) : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|
||||||
val cells = playerCells
|
val cells = playerCells
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
@@ -208,7 +209,7 @@ class UILoadManage(val full: UILoadSavegame) : UICanvas() {
|
|||||||
|
|
||||||
private var loadFiredFrameCounter = 0
|
private var loadFiredFrameCounter = 0
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val buttonYdelta = (full.titleTopGradEnd) - full.playerButtonSelected!!.posY
|
val buttonYdelta = (full.titleTopGradEnd) - full.playerButtonSelected!!.posY
|
||||||
full.playerButtonSelected!!.render(batch, camera, 0, buttonYdelta)
|
full.playerButtonSelected!!.render(batch, camera, 0, buttonYdelta)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.ui.Toolkit
|
import net.torvald.terrarum.ui.Toolkit
|
||||||
@@ -18,7 +19,7 @@ class UILoadNewCharacter(val full: UILoadSavegame) : UICanvas() {
|
|||||||
TODO("Not yet implemented")
|
TODO("Not yet implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
TODO("Not yet implemented")
|
TODO("Not yet implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
transitionPanel.update(delta)
|
transitionPanel.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
transitionPanel.render(batch, camera)
|
transitionPanel.render(batch, camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ class UILoadSavegame(val remoCon: UIRemoCon) : Advanceable() {
|
|||||||
super.resize(width, height)
|
super.resize(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
|
internal fun setCameraPosition(batch: SpriteBatch, camera: OrthographicCamera, newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.App.playersDir
|
import net.torvald.terrarum.App.playersDir
|
||||||
@@ -120,7 +121,7 @@ class UINewCharacter(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
// ui title
|
// ui title
|
||||||
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
|
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
@@ -151,7 +152,7 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
uiItems.forEach { it.update(delta) }
|
uiItems.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
// ui title
|
// ui title
|
||||||
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
|
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.*
|
||||||
import com.badlogic.gdx.graphics.Color
|
|
||||||
import com.badlogic.gdx.graphics.Pixmap
|
|
||||||
import com.badlogic.gdx.graphics.Texture
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.ItemCodex
|
import net.torvald.terrarum.ItemCodex
|
||||||
@@ -71,7 +68,7 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// draw title bar
|
// draw title bar
|
||||||
batch.color = UINSMenu.DEFAULT_TITLEBACKCOL
|
batch.color = UINSMenu.DEFAULT_TITLEBACKCOL
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
@@ -42,7 +43,7 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
uiItems.forEach { it.update(delta) }
|
uiItems.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
ControlPanelCommon.render("basegame.performancecontrolpanel", width, batch)
|
ControlPanelCommon.render("basegame.performancecontrolpanel", width, batch)
|
||||||
uiItems.forEach { it.render(batch, camera) }
|
uiItems.forEach { it.render(batch, camera) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
@@ -17,7 +18,7 @@ class UIProxyLoadLatestSave(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.SanicLoadScreen
|
import net.torvald.terrarum.SanicLoadScreen
|
||||||
@@ -21,7 +22,7 @@ class UIProxyNewBuildingMaker : UICanvas() {
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.random.HQRNG
|
import net.torvald.random.HQRNG
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
@@ -26,7 +27,7 @@ class UIProxyNewRandomGame(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun doOpening(delta: Float) {
|
override fun doOpening(delta: Float) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
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.*
|
import net.torvald.terrarum.*
|
||||||
@@ -84,7 +85,7 @@ class UIQuickslotBar : UICanvas() {
|
|||||||
|
|
||||||
private val itemCntTextCol = Color(0x404040ff)
|
private val itemCntTextCol = Color(0x404040ff)
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
|
||||||
(Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.let { actor ->
|
(Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.let { actor ->
|
||||||
for (i in 0 until SLOT_COUNT) {
|
for (i in 0 until SLOT_COUNT) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
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.*
|
import net.torvald.terrarum.*
|
||||||
@@ -66,7 +67,7 @@ class UIQuickslotPie : UICanvas() {
|
|||||||
|
|
||||||
private val drawColor = Color(1f, 1f, 1f, 1f)
|
private val drawColor = Color(1f, 1f, 1f, 1f)
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// draw radial thingies
|
// draw radial thingies
|
||||||
for (i in 0 until slotCount) {
|
for (i in 0 until slotCount) {
|
||||||
val qs = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.inventory?.getQuickslotItem(i)
|
val qs = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying?.inventory?.getQuickslotItem(i)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.App.*
|
import net.torvald.terrarum.App.*
|
||||||
@@ -213,7 +214,7 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
|
|||||||
openUI = external
|
openUI = external
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
remoConTray.render(batch, camera)
|
remoConTray.render(batch, camera)
|
||||||
openUI?.render(batch, camera)
|
openUI?.render(batch, camera)
|
||||||
}
|
}
|
||||||
@@ -307,7 +308,7 @@ open class UIRemoCon(val parent: TitleScreen, val treeRoot: QNDTreeNode<String>)
|
|||||||
menubar.update(delta)
|
menubar.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun render(batch: SpriteBatch, camera: Camera) {
|
fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
menubar.render(batch, camera)
|
menubar.render(batch, camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
@@ -40,7 +41,7 @@ class UIScreenZoom : UICanvas(
|
|||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
val offX = (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
|
val offX = (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
@@ -31,7 +32,7 @@ class UISoundControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
uiItems.forEach { it.update(delta) }
|
uiItems.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
ControlPanelCommon.render("basegame.soundcontrolpanel", width, batch)
|
ControlPanelCommon.render("basegame.soundcontrolpanel", width, batch)
|
||||||
uiItems.forEach { it.render(batch, camera) }
|
uiItems.forEach { it.render(batch, camera) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.gameactors.AVKey
|
import net.torvald.terrarum.gameactors.AVKey
|
||||||
@@ -179,7 +180,7 @@ internal class UIStorageChest : UICanvas(
|
|||||||
else
|
else
|
||||||
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} "
|
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} "
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// background fill
|
// background fill
|
||||||
UIInventoryFull.drawBackground(batch, 1f)
|
UIInventoryFull.drawBackground(batch, 1f)
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.gameworld.WorldTime
|
import net.torvald.terrarum.gameworld.WorldTime
|
||||||
@@ -55,7 +56,7 @@ class UITierOneWatch() : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// light overlay or EL
|
// light overlay or EL
|
||||||
/*blendNormal(batch)
|
/*blendNormal(batch)
|
||||||
if (ELon) {
|
if (ELon) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
@@ -104,7 +105,7 @@ class UITitleLanguage(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
textArea1.render(batch, camera)
|
textArea1.render(batch, camera)
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
moduleCells.clear()
|
moduleCells.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|
||||||
lateinit var savePixmap: Pixmap
|
lateinit var savePixmap: Pixmap
|
||||||
@@ -260,7 +260,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, true)
|
sliderFBO = FrameBuffer(Pixmap.Format.RGBA8888, uiWidth + 10, height, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
|
private fun setCameraPosition(batch: SpriteBatch, camera: OrthographicCamera, newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
camera.position.set((-newX + App.scr.halfw).roundToFloat(), (-newY + App.scr.halfh).roundToFloat(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
//println("UITitleRemoConRoot bro u even updatez")
|
//println("UITitleRemoConRoot bro u even updatez")
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
menubar.render(batch, camera)
|
menubar.render(batch, camera)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.CreditSingleton
|
import net.torvald.terrarum.CreditSingleton
|
||||||
@@ -31,7 +32,7 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
|||||||
textArea.update(delta)
|
textArea.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
textArea.render(batch, camera)
|
textArea.render(batch, camera)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
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
|
||||||
@@ -45,7 +46,7 @@ class UITooltip : UICanvas() {
|
|||||||
get() = 36 * 2 + font.lineHeight.toInt()
|
get() = 36 * 2 + font.lineHeight.toInt()
|
||||||
set(value) { throw Error("You are not supposed to set the height of the tooltip manually.") }
|
set(value) { throw Error("You are not supposed to set the height of the tooltip manually.") }
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val mouseXoff = 28f
|
val mouseXoff = 28f
|
||||||
val mouseYoff = 0f
|
val mouseYoff = 0f
|
||||||
val txtW = msgWidth + 2f * textMarginX
|
val txtW = msgWidth + 2f * textMarginX
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
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.colourutil.darkerLab
|
import net.torvald.colourutil.darkerLab
|
||||||
@@ -62,7 +63,7 @@ class UIVitalMetre(
|
|||||||
/**
|
/**
|
||||||
* g must be same as World Graphics!
|
* g must be same as World Graphics!
|
||||||
*/
|
*/
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// TODO now that we just can't draw arcs, we need to re-think about this
|
// TODO now that we just can't draw arcs, we need to re-think about this
|
||||||
|
|
||||||
/*if (vitalGetterVal() != null && vitalGetterMax() != null && player != null) {
|
/*if (vitalGetterVal() != null && vitalGetterMax() != null && player != null) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.gameworld.WorldTime
|
import net.torvald.terrarum.gameworld.WorldTime
|
||||||
@@ -78,7 +79,7 @@ class UIWallCalendar : UICanvas(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
UIInventoryFull.drawBackground(batch, 1f)
|
UIInventoryFull.drawBackground(batch, 1f)
|
||||||
|
|
||||||
val thisYear = INGAME.world.worldTime.years
|
val thisYear = INGAME.world.worldTime.years
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
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.*
|
import net.torvald.terrarum.*
|
||||||
@@ -116,7 +117,7 @@ class UIWorldPortal : UICanvas(
|
|||||||
transitionPanel.update(delta)
|
transitionPanel.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
drawBackground(batch, 1f)
|
drawBackground(batch, 1f)
|
||||||
|
|
||||||
// UI items
|
// UI items
|
||||||
@@ -329,7 +330,7 @@ class UIItemWorldPortalTopBar(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
// button
|
// button
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.gameactors.AVKey
|
import net.torvald.terrarum.gameactors.AVKey
|
||||||
@@ -171,7 +172,7 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas(), HasInventory {
|
|||||||
else
|
else
|
||||||
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} "
|
"${App.gamepadLabelStart} ${Lang["GAME_ACTION_CLOSE"]} "
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// background fill
|
// background fill
|
||||||
UIInventoryFull.drawBackground(batch, 1f)
|
UIInventoryFull.drawBackground(batch, 1f)
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
@@ -44,7 +45,7 @@ class UIWorldPortalDelete(private val full: UIWorldPortal) : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
full.selectedButton?.let {
|
full.selectedButton?.let {
|
||||||
val buttonYdelta = (App.scr.tvSafeGraphicsHeight + 172 + 36) - it.posY
|
val buttonYdelta = (App.scr.tvSafeGraphicsHeight + 172 + 36) - it.posY
|
||||||
val buttonXdelta = (Toolkit.drawWidth - it.width) / 2 - it.posX
|
val buttonXdelta = (Toolkit.drawWidth - it.width) / 2 - it.posX
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.*
|
||||||
import com.badlogic.gdx.graphics.Color
|
|
||||||
import com.badlogic.gdx.graphics.Pixmap
|
|
||||||
import com.badlogic.gdx.graphics.Texture
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import com.badlogic.gdx.utils.Disposable
|
import com.badlogic.gdx.utils.Disposable
|
||||||
@@ -339,7 +336,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
|
|||||||
private var selectedWorldThumb: TextureRegion? = null
|
private var selectedWorldThumb: TextureRegion? = null
|
||||||
|
|
||||||
val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons")
|
val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons")
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val memoryGaugeXpos = hx - memoryGaugeWidth - gridGap/2
|
val memoryGaugeXpos = hx - memoryGaugeWidth - gridGap/2
|
||||||
val memoryGaugeYpos = y + listHeight - buttonHeight
|
val memoryGaugeYpos = y + listHeight - buttonHeight
|
||||||
val textXpos = memoryGaugeXpos + 3
|
val textXpos = memoryGaugeXpos + 3
|
||||||
@@ -511,7 +508,7 @@ class UIItemWorldCellsSimple(
|
|||||||
super.update(delta)
|
super.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun render(batch: SpriteBatch, camera: Camera, offX: Int, offY: Int) {
|
fun render(batch: SpriteBatch, camera: OrthographicCamera, offX: Int, offY: Int) {
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
val posX = posX + offX
|
val posX = posX + offX
|
||||||
@@ -543,7 +540,7 @@ class UIItemWorldCellsSimple(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
render(batch, camera, 0, 0)
|
render(batch, camera, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
@@ -63,7 +64,7 @@ class UIWorldPortalRename(private val full: UIWorldPortal) : UICanvas() {
|
|||||||
|
|
||||||
private var oldPosX = full.posX
|
private var oldPosX = full.posX
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val posXDelta = posX - oldPosX
|
val posXDelta = posX - oldPosX
|
||||||
|
|
||||||
// ugh why won't you just scroll along??
|
// ugh why won't you just scroll along??
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
@@ -153,7 +154,7 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
|
|||||||
val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons")
|
val icons = CommonResourcePool.getAsTextureRegionPack("terrarum-basegame-worldportalicons")
|
||||||
|
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val memoryGaugeXpos = hx - memoryGaugeWidth/2
|
val memoryGaugeXpos = hx - memoryGaugeWidth/2
|
||||||
val memoryGaugeYpos = drawY + sizeSelY + buttonHeight + 10
|
val memoryGaugeYpos = drawY + sizeSelY + buttonHeight + 10
|
||||||
val textXpos = memoryGaugeXpos + 3
|
val textXpos = memoryGaugeXpos + 3
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ object Common {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun read(json: Json, jsonData: JsonValue, type: Class<*>?): WeatherStateBox {
|
override fun read(json: Json, jsonData: JsonValue, type: Class<*>?): WeatherStateBox {
|
||||||
return jsonData.asString().split(';').map { it.toDouble() }.let {
|
return jsonData.asString().split(';').map { it.toFloat() }.let {
|
||||||
WeatherStateBox(it[0], it[1], it[2], it[3], it[4])
|
WeatherStateBox(it[0], it[1], it[2], it[3], it[4])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ class DummyTogglePane : UICanvas() {
|
|||||||
uiItems.forEach { it.update(delta) }
|
uiItems.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.inUse {
|
batch.inUse {
|
||||||
batch.color = Color.CORAL
|
batch.color = Color.CORAL
|
||||||
Toolkit.fillArea(batch, 0f, 0f, 800f, 600f)
|
Toolkit.fillArea(batch, 0f, 0f, 800f, 600f)
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import com.badlogic.gdx.Input
|
|||||||
import com.badlogic.gdx.Input.Keys
|
import com.badlogic.gdx.Input.Keys
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.random.HQRNG
|
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.Terrarum.mouseTileX
|
import net.torvald.terrarum.Terrarum.mouseTileX
|
||||||
import net.torvald.terrarum.Terrarum.mouseTileY
|
import net.torvald.terrarum.Terrarum.mouseTileY
|
||||||
@@ -20,7 +20,6 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
|||||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory
|
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory
|
||||||
import net.torvald.terrarum.weather.WeatherMixer
|
import net.torvald.terrarum.weather.WeatherMixer
|
||||||
import net.torvald.terrarum.weather.WeatherStateBox
|
import net.torvald.terrarum.weather.WeatherStateBox
|
||||||
import net.torvald.terrarum.weather.Weatherbox
|
|
||||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
@@ -126,7 +125,10 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
|
|
||||||
private val tileCursX = 0; private val tileCursY = 4
|
private val tileCursX = 0; private val tileCursY = 4
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
TerrarumIngame.setCameraPosition(batch, App.shapeRender, camera, 0f, 0f)
|
||||||
|
|
||||||
|
|
||||||
// toggle show-something
|
// toggle show-something
|
||||||
showTimers = showTimers xor (Gdx.input.isKeyJustPressed(KEY_TIMERS) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT))
|
showTimers = showTimers xor (Gdx.input.isKeyJustPressed(KEY_TIMERS) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT))
|
||||||
showWeatherInfo = showWeatherInfo xor (Gdx.input.isKeyJustPressed(KEY_WEATHERS) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT))
|
showWeatherInfo = showWeatherInfo xor (Gdx.input.isKeyJustPressed(KEY_WEATHERS) && Gdx.input.isKeyPressed(Keys.CONTROL_LEFT))
|
||||||
@@ -137,7 +139,6 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
if (showWeatherInfo) drawWeatherInfo(batch)
|
if (showWeatherInfo) drawWeatherInfo(batch)
|
||||||
|
|
||||||
|
|
||||||
testBox.getAndUpdate(0.001, testBoxRng)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawMain(batch: SpriteBatch) {
|
private fun drawMain(batch: SpriteBatch) {
|
||||||
@@ -340,78 +341,104 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val testBox = WeatherStateBox(Math.random(), Math.random(), Math.random(), Math.random(), Math.random())
|
|
||||||
private val testBoxRng = HQRNG()
|
|
||||||
|
|
||||||
private fun drawWeatherInfo(batch: SpriteBatch) {
|
private fun drawWeatherInfo(batch: SpriteBatch) {
|
||||||
drawWeatherStateBox(batch, testBox, "Test", App.scr.width - 170, App.scr.height - 120)
|
drawWeatherStateBox(batch, WeatherMixer.weatherbox.windSpeed, "WindSpd", App.scr.width - 170, App.scr.height - 140 - 120, WeatherMixer.currentWeather.windSpeed * (1.0 + WeatherMixer.currentWeather.windSpeedVariance))
|
||||||
|
drawWeatherStateBox(batch, WeatherMixer.weatherbox.windDir, "WindDir", App.scr.width - 170, App.scr.height - 140)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val colHairline = Color(0xf22100ff.toInt())
|
private val colHairline = Color(0xf22100ff.toInt())
|
||||||
private val colGraph = Toolkit.Theme.COL_SELECTED
|
private val colGraph = Toolkit.Theme.COL_SELECTED
|
||||||
private val colGraphBack = Toolkit.Theme.COL_CELL_FILL
|
private val colGraphBack = Toolkit.Theme.COL_CELL_FILL
|
||||||
private val colGraphFore = Color(1f, 1f, 1f, 0.5f)
|
private val colGraphFore = Color(1f, 1f, 1f, 0.5f)
|
||||||
|
private val colGraphForf = Color(1f, 1f, 1f, 0.25f)
|
||||||
|
private val colGraphForg = Color(1f, 1f, 1f, 0.125f)
|
||||||
|
|
||||||
private fun drawWeatherStateBox(batch: SpriteBatch, box: WeatherStateBox, label: String, x: Int, y: Int) {
|
private fun drawWeatherStateBox(batch: SpriteBatch, box: WeatherStateBox, label: String, x: Int, y: Int, ymax: Double = 1.0) {
|
||||||
val bw = 50*3 + 1
|
val bw = 50*3 + 1
|
||||||
val bh = 40*2 + 1
|
val bh = 100
|
||||||
val yc = bh/2
|
|
||||||
val yh = yc
|
|
||||||
val xstart = (bw/3)*1
|
val xstart = (bw/3)*1
|
||||||
val xw = (bw/3)
|
val xw = (bw/3)
|
||||||
|
val MIN_RULE_GAP = 5.0
|
||||||
|
|
||||||
// back
|
// back
|
||||||
batch.color = colGraphBack
|
batch.color = colGraphBack
|
||||||
Toolkit.fillArea(batch, x, y, bw, bh)
|
Toolkit.fillArea(batch, x, y + 1, bw, bh - 1)
|
||||||
// frame
|
// frame
|
||||||
batch.color = colGraphFore
|
batch.color = colGraphFore
|
||||||
Toolkit.drawBoxBorder(batch, x + 1, y, bw - 1, bh)
|
Toolkit.drawBoxBorder(batch, x + 1, y + 1, bw - 1, bh - 1)
|
||||||
// grid
|
// x grids
|
||||||
Toolkit.drawStraightLine(batch, x + (bw/3)*1, y, y+bh, 1, true)
|
Toolkit.drawStraightLine(batch, x + (bw/3)*1, y, y+bh, 1, true)
|
||||||
Toolkit.drawStraightLine(batch, x + (bw/3)*2, y, y+bh, 1, true)
|
Toolkit.drawStraightLine(batch, x + (bw/3)*2, y, y+bh, 1, true)
|
||||||
// centreline
|
// y grids
|
||||||
Toolkit.drawStraightLine(batch, x, y + yc, x + bw, 1, false)
|
val yrange =
|
||||||
|
//// ymax small and bh tall enought to fit the 0.25 rules?
|
||||||
|
if (bh / ymax * 0.25 >= MIN_RULE_GAP)
|
||||||
|
(ymax.toInt() * 4 downTo 0).map { it * 0.25 }
|
||||||
|
//// ymax small and bh tall enought to fit the 0.5 rules?
|
||||||
|
else if (bh / ymax * 0.5 >= MIN_RULE_GAP)
|
||||||
|
(ymax.toInt() * 2 downTo 0).map { it * 0.5 }
|
||||||
|
//// ymax small and bh tall enought to fit the 1.0 rules?
|
||||||
|
else if (bh / ymax >= MIN_RULE_GAP)
|
||||||
|
(ymax.toInt() downTo 0).map { it * 1.0 }
|
||||||
|
//// ymax small and bh tall enought to fit the 2.0 rules?
|
||||||
|
else if (bh / ymax * 2.0 >= MIN_RULE_GAP)
|
||||||
|
(ymax.toInt() / 2 downTo 0).map { it * 2.0 }
|
||||||
|
//// ymax small and bh tall enought to fit the 5.0 rules?
|
||||||
|
else if (bh / ymax * 5.0 >= MIN_RULE_GAP)
|
||||||
|
(ymax.toInt() / 5 downTo 0).map { it * 5.0 }
|
||||||
|
//// ymax small and bh tall enought to fit the 10.0 rules?
|
||||||
|
else if (bh / ymax * 10.0 >= MIN_RULE_GAP)
|
||||||
|
(ymax.toInt() / 10 downTo 0).map { it * 10.0 }
|
||||||
|
else
|
||||||
|
(ymax.toInt() / 20 downTo 0).map { it * 20.0 }
|
||||||
|
|
||||||
|
yrange.forEach { d ->
|
||||||
|
val yc = bh - (bh / ymax * d).roundToInt()
|
||||||
|
batch.color = when (d % 1.0) {
|
||||||
|
0.0 -> colGraphFore
|
||||||
|
0.5 -> colGraphForf
|
||||||
|
else-> colGraphForg
|
||||||
|
}
|
||||||
|
Toolkit.drawStraightLine(batch, x, y + yc, x + bw, 1, false)
|
||||||
|
}
|
||||||
|
|
||||||
// graph points
|
// graph points
|
||||||
batch.color = colGraph
|
batch.color = colGraph
|
||||||
Toolkit.fillArea(batch, x + - 1, y + yc-(box.p0 * yh).roundToInt(), 3, 3)
|
Toolkit.fillArea(batch, x + - 1, y + bh-(box.p0 * bh / ymax).roundToInt(), 3, 3)
|
||||||
Toolkit.fillArea(batch, x + (bw/3)*1 - 1, y + yc-(box.p1 * yh).roundToInt(), 3, 3)
|
Toolkit.fillArea(batch, x + (bw/3)*1 - 1, y + bh-(box.p1 * bh / ymax).roundToInt(), 3, 3)
|
||||||
Toolkit.fillArea(batch, x + (bw/3)*2 - 1, y + yc-(box.p2 * yh).roundToInt(), 3, 3)
|
Toolkit.fillArea(batch, x + (bw/3)*2 - 1, y + bh-(box.p2 * bh / ymax).roundToInt(), 3, 3)
|
||||||
Toolkit.fillArea(batch, x + bw - 1, y + yc-(box.p3 * yh).roundToInt(), 3, 3)
|
Toolkit.fillArea(batch, x + bw - 1, y + bh-(box.p3 * bh / ymax).roundToInt(), 3, 3)
|
||||||
|
batch.end()
|
||||||
// interpolated values
|
// interpolated values
|
||||||
val pys = (0 until xw).map {
|
val pys = (0 until xw).map {
|
||||||
val px = it.toDouble() / xw
|
val px = it.toFloat() / xw
|
||||||
1 * yc - (yh * WeatherStateBox.interpolateCatmullRom(px, box.p0, box.p1, box.p2, box.p3)).roundToInt()
|
bh - (bh * WeatherStateBox.interpolateCatmullRom(px, box.p0, box.p1, box.p2, box.p3) / ymax).toFloat()
|
||||||
}
|
}
|
||||||
pys.forEachIndexed { index, py ->
|
|
||||||
val px = x + xstart + index
|
App.shapeRender.inUse {
|
||||||
if (index in 1 until pys.lastIndex) {
|
it.color = colGraph
|
||||||
val py0 = pys[index - 1]
|
for (index in 0 until pys.lastIndex) {
|
||||||
val py2 = pys[index + 1]
|
val px = x + xstart + index.toFloat()
|
||||||
val pys = ((py0 + py) / 2.0).roundToInt()
|
it.rectLine(
|
||||||
var pye = ((py + py2) / 2.0).roundToInt()
|
px,
|
||||||
if (pye - pys < 1) pye = pys + 1
|
App.scr.hf - 1 - (y + pys[index]),
|
||||||
Toolkit.drawStraightLine(batch, px, y + pys, y + pye, 1, true)
|
px + 1f,
|
||||||
}
|
App.scr.hf - 1 - (y + pys[index + 1]),
|
||||||
else if (index == pys.lastIndex) {
|
1.5f
|
||||||
val py0 = pys[index - 1]
|
)
|
||||||
val pys = ((py0 + py) / 2.0).roundToInt()
|
|
||||||
val pye = if (py - pys < 1) pys + 1 else py
|
|
||||||
Toolkit.drawStraightLine(batch, px, y + pys, y + pye, 1, true)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
val py2 = pys[index + 1]
|
|
||||||
var pye = ((py + py2) / 2.0).roundToInt()
|
|
||||||
if (pye - py < 1) pye = py + 1
|
|
||||||
Toolkit.drawStraightLine(batch, px, y + py, y + pye, 1, true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// hairline
|
// hairline
|
||||||
|
batch.begin()
|
||||||
batch.color = colHairline
|
batch.color = colHairline
|
||||||
Toolkit.drawStraightLine(batch, x + xstart + (box.x * xw).roundToInt(), y, y+bh, 1, true)
|
Toolkit.drawStraightLine(batch, x + xstart + (box.x * xw).roundToInt(), y, y+bh, 1, true)
|
||||||
|
|
||||||
// text
|
// text
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
App.fontSmallNumbers.draw(batch, "$ccY$label $ccG${box.get().toIntAndFrac(3)}", x.toFloat(), y - 14f)
|
App.fontSmallNumbers.draw(batch, "$ccY$label $ccG${box.get().toDouble().toIntAndFrac(3)}", x.toFloat(), y - 14f)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val processorName = App.processor.replace(Regex(""" Processor|( CPU)? @ [0-9.]+GHz"""), "") + if (App.is32BitJVM) " (32-bit)" else ""
|
private val processorName = App.processor.replace(Regex(""" Processor|( CPU)? @ [0-9.]+GHz"""), "") + if (App.is32BitJVM) " (32-bit)" else ""
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
@@ -102,7 +103,7 @@ class ConsoleWindow : UICanvas() {
|
|||||||
textinput.isEnabled = (isOpened && !isClosing)
|
textinput.isEnabled = (isOpened && !isClosing)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// background
|
// background
|
||||||
batch.color = UIColour
|
batch.color = UIColour
|
||||||
Toolkit.fillArea(batch, drawOffX, drawOffY, width.toFloat(), height.toFloat())
|
Toolkit.fillArea(batch, drawOffX, drawOffY, width.toFloat(), height.toFloat())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
@@ -50,7 +51,7 @@ class UIAutosaveNotifier : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8)
|
val spin = spinner.get(spinnerFrame % 8, spinnerFrame / 8)
|
||||||
val offX = App.scr.width - WIDTH - (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
|
val offX = App.scr.width - WIDTH - (App.scr.tvSafeGraphicsWidth * 1.25f).roundToInt().toFloat()
|
||||||
val offY = App.scr.height - HEIGHT - App.scr.tvSafeGraphicsHeight - 9f // +9 to align to quickslot and watch UI
|
val offY = App.scr.height - HEIGHT - App.scr.tvSafeGraphicsHeight - 9f // +9 to align to quickslot and watch UI
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.utils.Disposable
|
import com.badlogic.gdx.utils.Disposable
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
@@ -118,7 +119,7 @@ abstract class UICanvas(
|
|||||||
handler.update(this, delta)
|
handler.update(this, delta)
|
||||||
}
|
}
|
||||||
/** Called by the screen */
|
/** Called by the screen */
|
||||||
fun render(batch: SpriteBatch, camera: Camera, parentOpacity: Float = 1f) {
|
fun render(batch: SpriteBatch, camera: OrthographicCamera, parentOpacity: Float = 1f) {
|
||||||
handler.render(this, batch, camera, parentOpacity)
|
handler.render(this, batch, camera, parentOpacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +155,7 @@ abstract class UICanvas(
|
|||||||
* The transparency of the handler is independent of the draw, you must set the drawing color yourself
|
* The transparency of the handler is independent of the draw, you must set the drawing color yourself
|
||||||
* (use handler.opacity or handler.opacityColour)
|
* (use handler.opacity or handler.opacityColour)
|
||||||
*/
|
*/
|
||||||
abstract fun renderUI(batch: SpriteBatch, camera: Camera)
|
abstract fun renderUI(batch: SpriteBatch, camera: OrthographicCamera)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do not modify ui.handler.openCloseCounter here.
|
* Do not modify ui.handler.openCloseCounter here.
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
|||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.utils.Disposable
|
import com.badlogic.gdx.utils.Disposable
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
@@ -278,7 +279,7 @@ void main() {
|
|||||||
subUIs.forEach { it.update(delta) }
|
subUIs.forEach { it.update(delta) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun render(ui: UICanvas, batch: SpriteBatch, camera: Camera, parentOpacity: Float) {
|
fun render(ui: UICanvas, batch: SpriteBatch, camera: OrthographicCamera, parentOpacity: Float) {
|
||||||
|
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
// camera SHOULD BE CENTERED to HALFX and HALFY (see StateInGame) //
|
// camera SHOULD BE CENTERED to HALFX and HALFY (see StateInGame) //
|
||||||
@@ -390,7 +391,7 @@ void main() {
|
|||||||
return isVisible && !isOpening
|
return isVisible && !isOpening
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
|
fun setCameraPosition(batch: SpriteBatch, camera: OrthographicCamera, newX: Float, newY: Float) {
|
||||||
TerrarumIngame.setCameraPosition(batch, camera, newX, newY)
|
TerrarumIngame.setCameraPosition(batch, camera, newX, newY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.utils.Disposable
|
import com.badlogic.gdx.utils.Disposable
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
@@ -174,7 +175,7 @@ abstract class UIItem(var parentUI: UICanvas, val initialX: Int, val initialY: I
|
|||||||
/**
|
/**
|
||||||
* In this time, you do write like: ```draw(posX + 4, posY + 32)```, unlike UICanvas, because posX/posY comes from the parent UI.
|
* In this time, you do write like: ```draw(posX + 4, posY + 32)```, unlike UICanvas, because posX/posY comes from the parent UI.
|
||||||
*/
|
*/
|
||||||
open fun render(batch: SpriteBatch, camera: Camera) {
|
open fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
if (parentUI.isVisible) {
|
if (parentUI.isVisible) {
|
||||||
// if (isActive) {
|
// if (isActive) {
|
||||||
mouseOverCall?.render(batch, camera)
|
mouseOverCall?.render(batch, camera)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
import net.torvald.terrarum.imagefont.TinyAlphNum
|
import net.torvald.terrarum.imagefont.TinyAlphNum
|
||||||
@@ -39,7 +40,7 @@ class UIItemConfigKeycap(
|
|||||||
super.update(delta)
|
super.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// draw keycap
|
// draw keycap
|
||||||
batch.draw(capTex.get(0, 0), posX.toFloat(), posY.toFloat())
|
batch.draw(capTex.get(0, 0), posX.toFloat(), posY.toFloat())
|
||||||
batch.draw(capTex.get(1, 0), (posX + capTex.tileW).toFloat(), posY.toFloat(),
|
batch.draw(capTex.get(1, 0), (posX + capTex.tileW).toFloat(), posY.toFloat(),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
@@ -94,7 +95,7 @@ class UIItemHorzSlider(
|
|||||||
|
|
||||||
private val renderOrderMouseUp = arrayOf(0,2,3,1).map { renderJobs[it] }
|
private val renderOrderMouseUp = arrayOf(0,2,3,1).map { renderJobs[it] }
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
renderOrderMouseUp.forEach { it(batch) }
|
renderOrderMouseUp.forEach { it(batch) }
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
import net.torvald.terrarum.BlendMode
|
import net.torvald.terrarum.BlendMode
|
||||||
@@ -53,7 +54,7 @@ open class UIItemImageButton(
|
|||||||
var highlighted = false
|
var highlighted = false
|
||||||
var extraDrawOp: (UIItem, SpriteBatch) -> Unit = { _,_ -> }
|
var extraDrawOp: (UIItem, SpriteBatch) -> Unit = { _,_ -> }
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// draw background
|
// draw background
|
||||||
if (highlighted) {
|
if (highlighted) {
|
||||||
BlendMode.resolve(highlightBackBlendMode, batch)
|
BlendMode.resolve(highlightBackBlendMode, batch)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -23,7 +24,7 @@ class UIItemImageGallery(
|
|||||||
override fun update(delta: Float) {
|
override fun update(delta: Float) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
fun column(i: Int) = i % column
|
fun column(i: Int) = i % column
|
||||||
fun row(i: Int) = i / column
|
fun row(i: Int) = i / column
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ class UIItemInlineRadioButtons(
|
|||||||
super.update(delta)
|
super.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
// backgrounds
|
// backgrounds
|
||||||
batch.color = UIItemTextLineInput.TEXTINPUT_COL_BACKGROUND
|
batch.color = UIItemTextLineInput.TEXTINPUT_COL_BACKGROUND
|
||||||
for (i in labelfuns.indices) {
|
for (i in labelfuns.indices) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.BlendMode
|
import net.torvald.terrarum.BlendMode
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
@@ -103,7 +104,7 @@ class UIItemList<Item: UIItem>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.color = backgroundCol
|
batch.color = backgroundCol
|
||||||
BlendMode.resolve(backgroundBlendMode, batch)
|
BlendMode.resolve(backgroundBlendMode, batch)
|
||||||
Toolkit.fillArea(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
Toolkit.fillArea(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
@@ -57,7 +58,7 @@ class UIItemModuleInfoCell(
|
|||||||
private val ccNum2 = App.fontGame.toColorCode(12,11,4)
|
private val ccNum2 = App.fontGame.toColorCode(12,11,4)
|
||||||
private val ccDesc = App.fontGame.toColorCode(13,13,13)
|
private val ccDesc = App.fontGame.toColorCode(13,13,13)
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|
||||||
batch.color = Toolkit.Theme.COL_CELL_FILL
|
batch.color = Toolkit.Theme.COL_CELL_FILL
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
@@ -110,7 +111,7 @@ class UIItemSpinner(
|
|||||||
fboUpdateLatch = true
|
fboUpdateLatch = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.ui
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.roundToFloat
|
import net.torvald.terrarum.roundToFloat
|
||||||
@@ -33,7 +34,7 @@ class UIItemTextArea(
|
|||||||
if (scrollPos < 0) scrollPos = 0
|
if (scrollPos < 0) scrollPos = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
for (i in scrollPos until min(lineCount + scrollPos, entireText.size)) {
|
for (i in scrollPos until min(lineCount + scrollPos, entireText.size)) {
|
||||||
val yPtr = i - scrollPos
|
val yPtr = i - scrollPos
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.BlendMode
|
import net.torvald.terrarum.BlendMode
|
||||||
@@ -74,7 +75,7 @@ open class UIItemTextButton(
|
|||||||
super.update(delta)
|
super.update(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
val textW = font.getWidth(label)
|
val textW = font.getWidth(label)
|
||||||
val fontX = when (alignment) {
|
val fontX = when (alignment) {
|
||||||
Alignment.CENTRE -> posX + width.minus(textW).div(2) + (paddingLeft - paddingRight).div(2)
|
Alignment.CENTRE -> posX + width.minus(textW).div(2) + (paddingLeft - paddingRight).div(2)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.BlendMode
|
import net.torvald.terrarum.BlendMode
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
@@ -223,7 +224,7 @@ class UIItemTextButtonList(
|
|||||||
oldPosX = posX
|
oldPosX = posX
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
|
||||||
/*if (kinematic) {
|
/*if (kinematic) {
|
||||||
batch.color = backgroundCol
|
batch.color = backgroundCol
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ class UIItemTextLineInput(
|
|||||||
|
|
||||||
private var textDrawOffset = 0
|
private var textDrawOffset = 0
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
|
||||||
val posXDelta = posX - oldPosX
|
val posXDelta = posX - oldPosX
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class UIItemTextSelector(
|
|||||||
private val leftIcon = if (useSpinnerButtons) labels.get(9,2) else labels.get(16,0)
|
private val leftIcon = if (useSpinnerButtons) labels.get(9,2) else labels.get(16,0)
|
||||||
private val rightIcon = if (useSpinnerButtons) labels.get(10,2) else labels.get(17,0)
|
private val rightIcon = if (useSpinnerButtons) labels.get(10,2) else labels.get(17,0)
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
labelCache = labelfuns.map { it() }
|
labelCache = labelfuns.map { it() }
|
||||||
|
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.ui
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
@@ -134,7 +135,7 @@ class UIItemToggleButton(
|
|||||||
Color(0x00E800FF)
|
Color(0x00E800FF)
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.torvald.terrarum.ui
|
|||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.App.printdbg
|
import net.torvald.terrarum.App.printdbg
|
||||||
@@ -54,7 +55,7 @@ open class UIItemTransitionContainer(
|
|||||||
|
|
||||||
open fun onTransition(currentPosition: Float, uis: List<UICanvas>) {}
|
open fun onTransition(currentPosition: Float, uis: List<UICanvas>) {}
|
||||||
|
|
||||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
override fun render(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
super.render(batch, camera)
|
super.render(batch, camera)
|
||||||
|
|
||||||
if (transitionRequested && !transitionOngoing) {
|
if (transitionRequested && !transitionOngoing) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.graphics.Camera
|
import com.badlogic.gdx.graphics.Camera
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
@@ -167,7 +168,7 @@ class UINSMenu(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
listStack.forEach {
|
listStack.forEach {
|
||||||
// draw title bar
|
// draw title bar
|
||||||
batch.color = titleBackCol
|
batch.color = titleBackCol
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.io.File
|
|||||||
import java.io.FileFilter
|
import java.io.FileFilter
|
||||||
import java.lang.Double.doubleToLongBits
|
import java.lang.Double.doubleToLongBits
|
||||||
import java.lang.Math.toDegrees
|
import java.lang.Math.toDegrees
|
||||||
|
import java.lang.Math.toRadians
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
import kotlin.collections.HashMap
|
import kotlin.collections.HashMap
|
||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
@@ -89,9 +90,13 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
private var astrumOffX = 0f
|
private var astrumOffX = 0f
|
||||||
private var astrumOffY = 0f
|
private var astrumOffY = 0f
|
||||||
|
|
||||||
private val clouds = SortedArrayList<WeatherObjectCloud>()
|
|
||||||
|
|
||||||
// val weatherbox: Weatherbox
|
var weatherbox = Weatherbox()
|
||||||
|
|
||||||
|
|
||||||
|
// Clouds are merely a response to the current Weatherbox status //
|
||||||
|
|
||||||
|
private val clouds = SortedArrayList<WeatherObjectCloud>()
|
||||||
|
|
||||||
var cloudsSpawned = 0; private set
|
var cloudsSpawned = 0; private set
|
||||||
private var windVector = Vector3(-1f, 0f, 0.1f) // this is a direction vector
|
private var windVector = Vector3(-1f, 0f, 0.1f) // this is a direction vector
|
||||||
@@ -124,10 +129,22 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
cloudsSpawned = 0
|
cloudsSpawned = 0
|
||||||
windVector = Vector3(-0.98f, 0f, 0.21f)
|
windVector = Vector3(-0.98f, 0f, 0.21f)
|
||||||
|
|
||||||
windDirWindow = null
|
|
||||||
windSpeedWindow = null
|
|
||||||
|
|
||||||
oldCamPos.set(WorldCamera.camVector)
|
oldCamPos.set(WorldCamera.camVector)
|
||||||
|
|
||||||
|
weatherbox = Weatherbox()
|
||||||
|
// TEST FILL WITH RANDOM VALUES
|
||||||
|
(0..3).map { takeUniformRand(0f..1f) }.let {
|
||||||
|
weatherbox.windDir.p0 = it[0]
|
||||||
|
weatherbox.windDir.p1 = it[1]
|
||||||
|
weatherbox.windDir.p2 = it[2]
|
||||||
|
weatherbox.windDir.p3 = it[3]
|
||||||
|
}
|
||||||
|
(0..3).map { takeUniformRand(-1f..1f) }.let {
|
||||||
|
weatherbox.windSpeed.p0 = currentWeather.getRandomWindSpeed(it[0])
|
||||||
|
weatherbox.windSpeed.p1 = currentWeather.getRandomWindSpeed(it[1])
|
||||||
|
weatherbox.windSpeed.p2 = currentWeather.getRandomWindSpeed(it[2])
|
||||||
|
weatherbox.windSpeed.p3 = currentWeather.getRandomWindSpeed(it[3])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -213,12 +230,8 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
private val TWO_PI = 6.2831855f
|
private val TWO_PI = 6.2831855f
|
||||||
private val THREE_PI = 9.424778f
|
private val THREE_PI = 9.424778f
|
||||||
|
|
||||||
private var windDirWindow: FloatArray? = null
|
private val WIND_DIR_TIME_UNIT = 14400f // every 4hr
|
||||||
private var windSpeedWindow: FloatArray? = null
|
private val WIND_SPEED_TIME_UNIT = 3600f // every 1hr
|
||||||
private val WIND_DIR_TIME_UNIT = 14400 // every 4hr
|
|
||||||
private val WIND_SPEED_TIME_UNIT = 3600 // every 1hr
|
|
||||||
private var windDirAkku = 0 // only needed if timeDelta is not divisible by WIND_TIME_UNIT
|
|
||||||
private var windSpeedAkku = 0
|
|
||||||
|
|
||||||
// see: https://stackoverflow.com/questions/2708476/rotation-interpolation/14498790#14498790
|
// see: https://stackoverflow.com/questions/2708476/rotation-interpolation/14498790#14498790
|
||||||
private fun getShortestAngle(start: Float, end: Float) =
|
private fun getShortestAngle(start: Float, end: Float) =
|
||||||
@@ -227,54 +240,23 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateWind(delta: Float, world: GameWorld) {
|
private fun updateWind(delta: Float, world: GameWorld) {
|
||||||
if (windDirWindow == null) {
|
|
||||||
windDirWindow = FloatArray(4) { takeUniformRand(-PI..PI) } // completely random regardless of the seed
|
val currentWindSpeed = weatherbox.windSpeed.getAndUpdate( world.worldTime.timeDelta / WIND_SPEED_TIME_UNIT) {
|
||||||
}
|
currentWeather.getRandomWindSpeed(takeUniformRand(-1f..1f))
|
||||||
if (windSpeedWindow == null) {
|
|
||||||
windSpeedWindow = FloatArray(4) { currentWeather.getRandomWindSpeed(takeTriangularRand(-1f..1f)) } // completely random regardless of the seed
|
|
||||||
}
|
}
|
||||||
|
val currentWindDir = weatherbox.windDir.getAndUpdate( world.worldTime.timeDelta / WIND_DIR_TIME_UNIT) { RNG.nextFloat() } * 2.0 * Math.PI
|
||||||
|
|
||||||
val windDirStep = windDirAkku / WIND_DIR_TIME_UNIT.toFloat()
|
|
||||||
val windSpeedStep = windSpeedAkku / WIND_SPEED_TIME_UNIT.toFloat()
|
|
||||||
|
|
||||||
// val angle0 = windDirWindow[0]
|
|
||||||
// val angle1 = getShortestAngle(angle0, windDirWindow[1])
|
|
||||||
// val angle2 = getShortestAngle(angle1, windDirWindow[2])
|
|
||||||
// val angle3 = getShortestAngle(angle2, windDirWindow[3])
|
|
||||||
// val fixedAngles = floatArrayOf(angle0, angle1, angle2, angle3)
|
|
||||||
|
|
||||||
val currentWindDir = FastMath.interpolateCatmullRom(windDirStep, windDirWindow)
|
|
||||||
val currentWindSpeed = FastMath.interpolateCatmullRom(windSpeedStep, windSpeedWindow)
|
|
||||||
/*
|
|
||||||
printdbg(this,
|
|
||||||
"dir ${Math.toDegrees(currentWindDir.toDouble()).roundToInt()}\t" +
|
|
||||||
"spd ${currentWindSpeed.times(10f).roundToInt().div(10f)}\t " +
|
|
||||||
"dirs ${windDirWindow!!.map { Math.toDegrees(it.toDouble()).roundToInt() }} ${windDirStep.times(100).roundToInt()}\t" +
|
|
||||||
"spds ${windSpeedWindow!!.map { it.times(10f).roundToInt().div(10f) }} ${windSpeedStep.times(100).roundToInt()}"
|
|
||||||
)*/
|
|
||||||
|
|
||||||
if (currentWeather.forceWindVec != null) {
|
if (currentWeather.forceWindVec != null) {
|
||||||
windVector.set(currentWeather.forceWindVec)
|
windVector.set(currentWeather.forceWindVec)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
windVector.set(
|
windVector.set(
|
||||||
cos(currentWindDir) * currentWindSpeed,
|
(cos(currentWindDir) * currentWindSpeed).toFloat(),
|
||||||
0f,
|
0f,
|
||||||
sin(currentWindDir) * currentWindSpeed
|
(sin(currentWindDir) * currentWindSpeed).toFloat()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (windDirAkku >= WIND_DIR_TIME_UNIT) {
|
|
||||||
windDirAkku -= WIND_DIR_TIME_UNIT
|
|
||||||
windDirWindow!!.shiftAndPut(takeUniformRand(-PI..PI))
|
|
||||||
}
|
|
||||||
while (windSpeedAkku >= WIND_SPEED_TIME_UNIT) {
|
|
||||||
windSpeedAkku -= WIND_SPEED_TIME_UNIT
|
|
||||||
windSpeedWindow!!.shiftAndPut(currentWeather.getRandomWindSpeed(takeTriangularRand(-1f..1f)))
|
|
||||||
}
|
|
||||||
|
|
||||||
windDirAkku += world.worldTime.timeDelta
|
|
||||||
windSpeedAkku += world.worldTime.timeDelta
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private val cloudParallaxMultY = -0.035f
|
private val cloudParallaxMultY = -0.035f
|
||||||
@@ -537,7 +519,7 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
/**
|
/**
|
||||||
* Sub-portion of IngameRenderer. You are not supposed to directly deal with this.
|
* Sub-portion of IngameRenderer. You are not supposed to directly deal with this.
|
||||||
*/
|
*/
|
||||||
internal fun render(camera: Camera, batch: FlippingSpriteBatch, world: GameWorld) {
|
internal fun render(camera: OrthographicCamera, batch: FlippingSpriteBatch, world: GameWorld) {
|
||||||
drawSkybox(camera, batch, world)
|
drawSkybox(camera, batch, world)
|
||||||
drawClouds(batch)
|
drawClouds(batch)
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
@@ -559,7 +541,7 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
private val parallaxDomainSize = 400f
|
private val parallaxDomainSize = 400f
|
||||||
private val turbidityDomainSize = 533.3333f
|
private val turbidityDomainSize = 533.3333f
|
||||||
|
|
||||||
private fun drawSkybox(camera: Camera, batch: FlippingSpriteBatch, world: GameWorld) {
|
private fun drawSkybox(camera: OrthographicCamera, batch: FlippingSpriteBatch, world: GameWorld) {
|
||||||
val parallaxZeroPos = (world.height / 3f)
|
val parallaxZeroPos = (world.height / 3f)
|
||||||
|
|
||||||
// we will not care for nextSkybox for now
|
// we will not care for nextSkybox for now
|
||||||
|
|||||||
@@ -1,33 +1,28 @@
|
|||||||
package net.torvald.terrarum.weather
|
package net.torvald.terrarum.weather
|
||||||
|
|
||||||
import com.jme3.math.FastMath
|
|
||||||
import net.torvald.random.HQRNG
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class Weatherbox {
|
class Weatherbox {
|
||||||
|
|
||||||
val RNG: HQRNG
|
val windDir = WeatherStateBox() // 0 .. 1.0
|
||||||
get() = WeatherMixer.RNG
|
val windSpeed = WeatherStateBox() // 0 .. arbitrarily large number
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data class WeatherStateBox(var x: Double, var p0: Double, var p1: Double, var p2: Double, var p3: Double) {
|
data class WeatherStateBox(var x: Float = 0f, var p0: Float = 0f, var p1: Float = 0f, var p2: Float = 0f, var p3: Float = 0f) {
|
||||||
|
|
||||||
fun get() = interpolateCatmullRom(x, p0, p1, p2, p3)
|
fun get() = interpolateCatmullRom(x, p0, p1, p2, p3)
|
||||||
|
|
||||||
fun getAndUpdate(xdelta: Double, RNG: Random): Double {
|
fun getAndUpdate(xdelta: Float, next: () -> Float): Float {
|
||||||
synchronized(RNG) {
|
synchronized(WeatherMixer.RNG) {
|
||||||
val y = get()
|
val y = get()
|
||||||
x += xdelta
|
x += xdelta
|
||||||
while (x >= 1.0) {
|
while (x >= 1.0) {
|
||||||
x -= 1.0
|
x -= 1.0f
|
||||||
p0 = p1
|
p0 = p1
|
||||||
p1 = p2
|
p1 = p2
|
||||||
p2 = p3
|
p2 = p3
|
||||||
p3 = RNG.nextDouble()
|
p3 = next()
|
||||||
}
|
}
|
||||||
return y
|
return y
|
||||||
}
|
}
|
||||||
@@ -35,11 +30,11 @@ data class WeatherStateBox(var x: Double, var p0: Double, var p1: Double, var p2
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
// fixed with T=0.5
|
// fixed with T=0.5
|
||||||
fun interpolateCatmullRom(u: Double, p0: Double, p1: Double, p2: Double, p3: Double): Double {
|
fun interpolateCatmullRom(u: Float, p0: Float, p1: Float, p2: Float, p3: Float): Float {
|
||||||
val c1: Double = p1
|
val c1: Float = p1
|
||||||
val c2: Double = -0.5 * p0 + 0.5 * p2
|
val c2: Float = -0.5f * p0 + 0.5f * p2
|
||||||
val c3: Double = p0 - 2.5 * p1 + 2.0 * p2 - 0.5 * p3
|
val c3: Float = p0 - 2.5f * p1 + 2.0f * p2 - 0.5f * p3
|
||||||
val c4: Double = -0.5 * p0 + 1.5 * p1 - 1.5 * p2 + 0.5 * p3
|
val c4: Float = -0.5f * p0 + 1.5f * p1 - 1.5f * p2 + 0.5f * p3
|
||||||
return (((c4 * u + c3) * u + c2) * u + c1)
|
return (((c4 * u + c3) * u + c2) * u + c1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user