mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 16:46:07 +09:00
backend stuffs in the Terrarum moved to the AppLoader
This commit is contained in:
@@ -236,6 +236,8 @@ public class AppLoader implements ApplicationListener {
|
|||||||
private static Screen currenScreen;
|
private static Screen currenScreen;
|
||||||
public static int screenW = 0;
|
public static int screenW = 0;
|
||||||
public static int screenH = 0;
|
public static int screenH = 0;
|
||||||
|
public static int halfScreenW = 0;
|
||||||
|
public static int halfScreenH = 0;
|
||||||
|
|
||||||
public static Texture textureWhiteSquare;
|
public static Texture textureWhiteSquare;
|
||||||
public static Texture textureWhiteCircle;
|
public static Texture textureWhiteCircle;
|
||||||
@@ -582,6 +584,9 @@ public class AppLoader implements ApplicationListener {
|
|||||||
appConfig.width = screenW;
|
appConfig.width = screenW;
|
||||||
appConfig.height = screenH;
|
appConfig.height = screenH;
|
||||||
|
|
||||||
|
halfScreenW = screenW / 2;
|
||||||
|
halfScreenH = screenH / 2;
|
||||||
|
|
||||||
updateFullscreenQuad(screenW, screenH);
|
updateFullscreenQuad(screenW, screenH);
|
||||||
|
|
||||||
printdbg(this, "Resize end");
|
printdbg(this, "Resize end");
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
/** 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: Camera, newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + Terrarum.HALFW).round(), (-newY + Terrarum.HALFH).round(), 0f)
|
camera.position.set((-newX + AppLoader.halfScreenW).round(), (-newY + AppLoader.halfScreenH).round(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
}
|
}
|
||||||
@@ -131,9 +131,9 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
private val worldFBOformat = if (Terrarum.environment == RunningEnvironment.MOBILE) Pixmap.Format.RGBA4444 else Pixmap.Format.RGBA8888
|
private val worldFBOformat = if (Terrarum.environment == RunningEnvironment.MOBILE) Pixmap.Format.RGBA4444 else Pixmap.Format.RGBA8888
|
||||||
private val lightFBOformat = Pixmap.Format.RGB888
|
private val lightFBOformat = Pixmap.Format.RGB888
|
||||||
|
|
||||||
var worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
var worldDrawFrameBuffer = FrameBuffer(worldFBOformat, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
var worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
var worldGlowFrameBuffer = FrameBuffer(worldFBOformat, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
var worldBlendFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
var worldBlendFrameBuffer = FrameBuffer(worldFBOformat, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
// RGB elements of Lightmap for Color Vec4(R, G, B, 1.0) 24-bit
|
// RGB elements of Lightmap for Color Vec4(R, G, B, 1.0) 24-bit
|
||||||
private lateinit var lightmapFboA: FrameBuffer
|
private lateinit var lightmapFboA: FrameBuffer
|
||||||
private lateinit var lightmapFboB: FrameBuffer
|
private lateinit var lightmapFboB: FrameBuffer
|
||||||
@@ -228,7 +228,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
//initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
//initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
// gameLoadMode and gameLoadInfoPayload must be set beforehand!!
|
// gameLoadMode and gameLoadInfoPayload must be set beforehand!!
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
Gdx.input.inputProcessor = ingameController
|
Gdx.input.inputProcessor = ingameController
|
||||||
|
|
||||||
|
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
|
|
||||||
// init console window
|
// init console window
|
||||||
@@ -351,7 +351,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// init notifier
|
// init notifier
|
||||||
notifier = Notification()
|
notifier = Notification()
|
||||||
notifier.setPosition(
|
notifier.setPosition(
|
||||||
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// inventory
|
// inventory
|
||||||
/*uiInventoryPlayer = UIInventory(player,
|
/*uiInventoryPlayer = UIInventory(player,
|
||||||
width = 900,
|
width = 900,
|
||||||
height = Terrarum.HEIGHT - 160,
|
height = AppLoader.screenH - 160,
|
||||||
categoryWidth = 210,
|
categoryWidth = 210,
|
||||||
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory")
|
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory")
|
||||||
)*/
|
)*/
|
||||||
@@ -377,11 +377,11 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// quick bar
|
// quick bar
|
||||||
uiQuickBar = UIQuickBar()
|
uiQuickBar = UIQuickBar()
|
||||||
uiQuickBar.isVisible = true
|
uiQuickBar.isVisible = true
|
||||||
uiQuickBar.setPosition((Terrarum.WIDTH - uiQuickBar.width) / 2 + 12, -10)
|
uiQuickBar.setPosition((AppLoader.screenW - uiQuickBar.width) / 2 + 12, -10)
|
||||||
|
|
||||||
// pie menu
|
// pie menu
|
||||||
uiPieMenu = UIPieMenu()
|
uiPieMenu = UIPieMenu()
|
||||||
uiPieMenu.setPosition(Terrarum.HALFW, Terrarum.HALFH)
|
uiPieMenu.setPosition(AppLoader.halfScreenW, AppLoader.halfScreenH)
|
||||||
|
|
||||||
// vital metre
|
// vital metre
|
||||||
// fill in getter functions by
|
// fill in getter functions by
|
||||||
@@ -396,11 +396,11 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// basic watch-style notification bar (temperature, new mail)
|
// basic watch-style notification bar (temperature, new mail)
|
||||||
uiWatchBasic = UIBasicNotifier(player)
|
uiWatchBasic = UIBasicNotifier(player)
|
||||||
uiWatchBasic.setAsAlwaysVisible()
|
uiWatchBasic.setAsAlwaysVisible()
|
||||||
uiWatchBasic.setPosition(Terrarum.WIDTH - uiWatchBasic.width, 0)
|
uiWatchBasic.setPosition(AppLoader.screenW - uiWatchBasic.width, 0)
|
||||||
|
|
||||||
uiWatchTierOne = UITierOneWatch(player)
|
uiWatchTierOne = UITierOneWatch(player)
|
||||||
uiWatchTierOne.setAsAlwaysVisible()
|
uiWatchTierOne.setAsAlwaysVisible()
|
||||||
uiWatchTierOne.setPosition(Terrarum.WIDTH - uiWatchTierOne.width, uiWatchBasic.height - 2)
|
uiWatchTierOne.setPosition(AppLoader.screenW - uiWatchTierOne.width, uiWatchBasic.height - 2)
|
||||||
|
|
||||||
|
|
||||||
uiTooltip = UITooltip()
|
uiTooltip = UITooltip()
|
||||||
@@ -865,7 +865,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
/////////////////////////
|
/////////////////////////
|
||||||
// draw to main screen //
|
// draw to main screen //
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
camera.setToOrtho(true, Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
camera.setToOrtho(true, AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
batch.inUse {
|
batch.inUse {
|
||||||
|
|
||||||
@@ -1232,9 +1232,9 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
/** whether the actor is within screen */
|
/** whether the actor is within screen */
|
||||||
private fun ActorWithBody.inScreen() =
|
private fun ActorWithBody.inScreen() =
|
||||||
distToCameraSqr(this) <=
|
distToCameraSqr(this) <=
|
||||||
(Terrarum.WIDTH.plus(this.hitbox.width.div(2)).
|
(AppLoader.screenW.plus(this.hitbox.width.div(2)).
|
||||||
times(1 / screenZoom).sqr() +
|
times(1 / screenZoom).sqr() +
|
||||||
Terrarum.HEIGHT.plus(this.hitbox.height.div(2)).
|
AppLoader.screenH.plus(this.hitbox.height.div(2)).
|
||||||
times(1 / screenZoom).sqr())
|
times(1 / screenZoom).sqr())
|
||||||
|
|
||||||
|
|
||||||
@@ -1398,22 +1398,22 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
private var lightmapInitialised = false // to avoid nullability of lightmapFBO
|
private var lightmapInitialised = false // to avoid nullability of lightmapFBO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param width same as Terrarum.WIDTH
|
* @param width same as AppLoader.screenW
|
||||||
* @param height same as Terrarum.HEIGHT
|
* @param height same as AppLoader.screenH
|
||||||
* @see net.torvald.terrarum.Terrarum
|
* @see net.torvald.terrarum.Terrarum
|
||||||
*/
|
*/
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
|
|
||||||
BlocksDrawer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
BlocksDrawer.resize(AppLoader.screenW, AppLoader.screenH)
|
||||||
LightmapRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
LightmapRenderer.resize(AppLoader.screenW, AppLoader.screenH)
|
||||||
MegaRainGovernor.resize()
|
MegaRainGovernor.resize()
|
||||||
|
|
||||||
worldDrawFrameBuffer.dispose()
|
worldDrawFrameBuffer.dispose()
|
||||||
worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
worldDrawFrameBuffer = FrameBuffer(worldFBOformat, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
worldGlowFrameBuffer.dispose()
|
worldGlowFrameBuffer.dispose()
|
||||||
worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
worldGlowFrameBuffer = FrameBuffer(worldFBOformat, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
worldBlendFrameBuffer.dispose()
|
worldBlendFrameBuffer.dispose()
|
||||||
worldBlendFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
worldBlendFrameBuffer = FrameBuffer(worldFBOformat, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
|
|
||||||
if (lightmapInitialised) {
|
if (lightmapInitialised) {
|
||||||
lightmapFboA.dispose()
|
lightmapFboA.dispose()
|
||||||
@@ -1435,7 +1435,7 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
|
|
||||||
// Set up viewport when window is resized
|
// Set up viewport when window is resized
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1448,20 +1448,20 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// resize UIs
|
// resize UIs
|
||||||
|
|
||||||
notifier.setPosition(
|
notifier.setPosition(
|
||||||
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
|
||||||
|
|
||||||
// inventory
|
// inventory
|
||||||
/*uiInventoryPlayer =
|
/*uiInventoryPlayer =
|
||||||
UIInventory(player,
|
UIInventory(player,
|
||||||
width = 840,
|
width = 840,
|
||||||
height = Terrarum.HEIGHT - 160,
|
height = AppLoader.screenH - 160,
|
||||||
categoryWidth = 210
|
categoryWidth = 210
|
||||||
)*/
|
)*/
|
||||||
|
|
||||||
|
|
||||||
// basic watch-style notification bar (temperature, new mail)
|
// basic watch-style notification bar (temperature, new mail)
|
||||||
uiWatchBasic.setPosition(Terrarum.WIDTH - uiWatchBasic.width, 0)
|
uiWatchBasic.setPosition(AppLoader.screenW - uiWatchBasic.width, 0)
|
||||||
uiWatchTierOne.setPosition(Terrarum.WIDTH - uiWatchTierOne.width, uiWatchBasic.height - 2)
|
uiWatchTierOne.setPosition(AppLoader.screenW - uiWatchTierOne.width, uiWatchBasic.height - 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
private var arrowObjPos = 0f // 0 means at starting position, regardless of screen position
|
private var arrowObjPos = 0f // 0 means at starting position, regardless of screen position
|
||||||
private var arrowObjGlideOffsetX = 0f
|
private var arrowObjGlideOffsetX = 0f
|
||||||
private var arrowObjGlideSize = 0f
|
private var arrowObjGlideSize = 0f
|
||||||
private val arrowGlideSpeed: Float; get() = Terrarum.WIDTH * 2f // pixels per sec
|
private val arrowGlideSpeed: Float; get() = AppLoader.screenW * 2f // pixels per sec
|
||||||
private lateinit var arrowObjTex: Texture
|
private lateinit var arrowObjTex: Texture
|
||||||
private var glideTimer = 0f
|
private var glideTimer = 0f
|
||||||
private var glideDispY = 0f
|
private var glideDispY = 0f
|
||||||
@@ -47,7 +47,7 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
private val ghostMaxZoomX = 1.25f
|
private val ghostMaxZoomX = 1.25f
|
||||||
private val ghostAlphaMax = 1f
|
private val ghostAlphaMax = 1f
|
||||||
|
|
||||||
var camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
var camera = OrthographicCamera(AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
|
|
||||||
fun initViewPort(width: Int, height: Int) {
|
fun initViewPort(width: Int, height: Int) {
|
||||||
// Set Y to point downwards
|
// Set Y to point downwards
|
||||||
@@ -92,7 +92,7 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
textFbo = FrameBuffer(
|
textFbo = FrameBuffer(
|
||||||
Pixmap.Format.RGBA4444,
|
Pixmap.Format.RGBA4444,
|
||||||
@@ -111,7 +111,7 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val textX: Float; get() = (Terrarum.WIDTH * 0.72f).floor()
|
val textX: Float; get() = (AppLoader.screenW * 0.72f).floor()
|
||||||
|
|
||||||
private var genuineSonic = false // the "NOW LOADING..." won't appear unless the arrow first run passes it (it's totally not a GenuineIntel tho)
|
private var genuineSonic = false // the "NOW LOADING..." won't appear unless the arrow first run passes it (it's totally not a GenuineIntel tho)
|
||||||
private var doContextChange = false
|
private var doContextChange = false
|
||||||
@@ -122,8 +122,8 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
val delta = Gdx.graphics.rawDeltaTime
|
val delta = Gdx.graphics.rawDeltaTime
|
||||||
|
|
||||||
glideDispY = Terrarum.HEIGHT - 100f - AppLoader.fontGame.lineHeight
|
glideDispY = AppLoader.screenH - 100f - AppLoader.fontGame.lineHeight
|
||||||
arrowObjGlideSize = arrowObjTex.width + 2f * Terrarum.WIDTH
|
arrowObjGlideSize = arrowObjTex.width + 2f * AppLoader.screenW
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -159,11 +159,11 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
|
|
||||||
if (!doContextChange) {
|
if (!doContextChange) {
|
||||||
// draw text to FBO
|
// draw text to FBO
|
||||||
textFbo.inAction(camera, Terrarum.batch) {
|
textFbo.inAction(camera, AppLoader.batch) {
|
||||||
Terrarum.batch.inUse {
|
AppLoader.batch.inUse {
|
||||||
|
|
||||||
|
|
||||||
blendNormal(Terrarum.batch)
|
blendNormal(AppLoader.batch)
|
||||||
AppLoader.fontGame
|
AppLoader.fontGame
|
||||||
it.color = Color.WHITE
|
it.color = Color.WHITE
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
AppLoader.fontGame.draw(it, textToPrint, ((textFbo.width - textWidth) / 2).toInt().toFloat(), 0f)
|
AppLoader.fontGame.draw(it, textToPrint, ((textFbo.width - textWidth) / 2).toInt().toFloat(), 0f)
|
||||||
|
|
||||||
|
|
||||||
blendMul(Terrarum.batch)
|
blendMul(AppLoader.batch)
|
||||||
// draw colour overlay, flipped
|
// draw colour overlay, flipped
|
||||||
it.draw(textOverlayTex,
|
it.draw(textOverlayTex,
|
||||||
(textFbo.width - textWidth) / 2f,
|
(textFbo.width - textWidth) / 2f,
|
||||||
@@ -183,15 +183,15 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Terrarum.batch.inUse {
|
AppLoader.batch.inUse {
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT) // dunno, no render without this
|
initViewPort(AppLoader.screenW, AppLoader.screenH) // dunno, no render without this
|
||||||
it.projectionMatrix = camera.combined
|
it.projectionMatrix = camera.combined
|
||||||
blendNormal(Terrarum.batch)
|
blendNormal(AppLoader.batch)
|
||||||
|
|
||||||
|
|
||||||
// almost black background
|
// almost black background
|
||||||
it.color = Color(0x181818ff)
|
it.color = Color(0x181818ff)
|
||||||
it.fillRect(0f, 0f, Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
it.fillRect(0f, 0f, AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
|
|
||||||
|
|
||||||
it.color = Color.WHITE
|
it.color = Color.WHITE
|
||||||
@@ -234,7 +234,7 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
|
|
||||||
// message backgrounds
|
// message backgrounds
|
||||||
it.color = messageBackgroundColour
|
it.color = messageBackgroundColour
|
||||||
it.fillRect(0f, 60f, Terrarum.WIDTH.toFloat(), 40f + (messages.size) * AppLoader.fontGame.lineHeight)
|
it.fillRect(0f, 60f, AppLoader.screenW.toFloat(), 40f + (messages.size) * AppLoader.fontGame.lineHeight)
|
||||||
|
|
||||||
// log messages
|
// log messages
|
||||||
it.color = messageForegroundColour
|
it.color = messageForegroundColour
|
||||||
@@ -248,18 +248,18 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Terrarum.batch.inUse {
|
AppLoader.batch.inUse {
|
||||||
// recycling part of the draw code //
|
// recycling part of the draw code //
|
||||||
|
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT) // dunno, no render without this
|
initViewPort(AppLoader.screenW, AppLoader.screenH) // dunno, no render without this
|
||||||
it.projectionMatrix = camera.combined
|
it.projectionMatrix = camera.combined
|
||||||
blendNormal(Terrarum.batch)
|
blendNormal(AppLoader.batch)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// message backgrounds
|
// message backgrounds
|
||||||
it.color = messageBackgroundColour
|
it.color = messageBackgroundColour
|
||||||
it.fillRect(0f, 60f, Terrarum.WIDTH.toFloat(), 40f + (messages.size) * AppLoader.fontGame.lineHeight)
|
it.fillRect(0f, 60f, AppLoader.screenW.toFloat(), 40f + (messages.size) * AppLoader.fontGame.lineHeight)
|
||||||
|
|
||||||
// log messages
|
// log messages
|
||||||
it.color = messageForegroundColour
|
it.color = messageForegroundColour
|
||||||
@@ -272,7 +272,7 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Terrarum.batch.flush()
|
AppLoader.batch.flush()
|
||||||
|
|
||||||
Thread.sleep(80)
|
Thread.sleep(80)
|
||||||
|
|
||||||
@@ -318,6 +318,6 @@ object LoadScreen : ScreenAdapter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ object PostProcessor : Disposable {
|
|||||||
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
|
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
|
||||||
*/
|
*/
|
||||||
/*private fun setCameraPosition(newX: Float, newY: Float) {
|
/*private fun setCameraPosition(newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + Terrarum.HALFW).round(), (-newY + Terrarum.HALFH).round(), 0f)
|
camera.position.set((-newX + AppLoader.halfScreenW).round(), (-newY + AppLoader.halfScreenH).round(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
}*/
|
}*/
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ object Terrarum : Disposable {
|
|||||||
*/
|
*/
|
||||||
const val PLAYER_REF_ID: Int = 0x91A7E2
|
const val PLAYER_REF_ID: Int = 0x91A7E2
|
||||||
|
|
||||||
var batch: SpriteBatch = AppLoader.batch
|
|
||||||
var shapeRender: ShapeRenderer = AppLoader.shapeRender // DO NOT USE!! for very limited applications e.g. WeatherMixer
|
|
||||||
inline fun inShapeRenderer(shapeRendererType: ShapeRenderer.ShapeType = ShapeRenderer.ShapeType.Filled, action: (ShapeRenderer) -> Unit) {
|
inline fun inShapeRenderer(shapeRendererType: ShapeRenderer.ShapeType = ShapeRenderer.ShapeType.Filled, action: (ShapeRenderer) -> Unit) {
|
||||||
shapeRender.begin(shapeRendererType)
|
shapeRender.begin(shapeRendererType)
|
||||||
action(shapeRender)
|
action(shapeRender)
|
||||||
@@ -54,19 +52,6 @@ object Terrarum : Disposable {
|
|||||||
// GLOBAL IMMUTABLE CONFIGS //
|
// GLOBAL IMMUTABLE CONFIGS //
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|
||||||
val WIDTH: Int
|
|
||||||
get() = AppLoader.screenW
|
|
||||||
val HEIGHT: Int
|
|
||||||
get() = AppLoader.screenH
|
|
||||||
|
|
||||||
//val WIDTH_MIN = 800
|
|
||||||
//val HEIGHT_MIN = 600
|
|
||||||
|
|
||||||
inline val HALFW: Int
|
|
||||||
get() = WIDTH.ushr(1)
|
|
||||||
inline val HALFH: Int
|
|
||||||
get() = HEIGHT.ushr(1)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be used with physics simulator. This is a magic number.
|
* To be used with physics simulator. This is a magic number.
|
||||||
*/
|
*/
|
||||||
@@ -114,36 +99,8 @@ object Terrarum : Disposable {
|
|||||||
return String.format("%.2f", acc)
|
return String.format("%.2f", acc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 0x0 - 0xF: Game-related
|
|
||||||
// 0x10 - 0x1F: Config
|
|
||||||
// 0x100 and onward: unit tests for dev
|
|
||||||
val STATE_ID_SPLASH = 0x0
|
|
||||||
val STATE_ID_HOME = 0x1
|
|
||||||
val STATE_ID_GAME = 0x3
|
|
||||||
val STATE_ID_CONFIG_CALIBRATE = 0x11
|
|
||||||
|
|
||||||
val STATE_ID_TEST_FONT = 0x100
|
|
||||||
val STATE_ID_TEST_GFX = 0x101
|
|
||||||
val STATE_ID_TEST_TTY = 0x102
|
|
||||||
val STATE_ID_TEST_BLUR = 0x103
|
|
||||||
val STATE_ID_TEST_SHADER = 0x104
|
|
||||||
val STATE_ID_TEST_REFRESHRATE = 0x105
|
|
||||||
val STATE_ID_TEST_INPUT = 0x106
|
|
||||||
|
|
||||||
val STATE_ID_TEST_UI1 = 0x110
|
|
||||||
|
|
||||||
val STATE_ID_TOOL_NOISEGEN = 0x200
|
|
||||||
val STATE_ID_TOOL_RUMBLE_DIAGNOSIS = 0x201
|
|
||||||
|
|
||||||
lateinit var testTexture: Texture
|
lateinit var testTexture: Texture
|
||||||
|
|
||||||
|
|
||||||
/** Actually just a mesh of four vertices, two triangles -- not a literal glQuad */
|
|
||||||
val fullscreenQuad = AppLoader.fullscreenQuad
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
println("[Terrarum] init called by:")
|
println("[Terrarum] init called by:")
|
||||||
Thread.currentThread().stackTrace.forEach { println("... $it") }
|
Thread.currentThread().stackTrace.forEach { println("... $it") }
|
||||||
@@ -356,7 +313,7 @@ inline fun FrameBuffer.inAction(camera: OrthographicCamera?, batch: SpriteBatch?
|
|||||||
//this.end()
|
//this.end()
|
||||||
FrameBufferManager.end()
|
FrameBufferManager.end()
|
||||||
|
|
||||||
camera?.setToOrtho(true, Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
camera?.setToOrtho(true, AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
camera?.update()
|
camera?.update()
|
||||||
batch?.projectionMatrix = camera?.combined
|
batch?.projectionMatrix = camera?.combined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
|||||||
|
|
||||||
fun enter() {
|
fun enter() {
|
||||||
// init view port
|
// init view port
|
||||||
camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
camera = OrthographicCamera(AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
|
|
||||||
|
|
||||||
img = Texture("assets/test_texture.tga")
|
img = Texture("assets/test_texture.tga")
|
||||||
@@ -56,14 +56,14 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
|||||||
blurFboA = FrameBuffer(Pixmap.Format.RGBA8888, img.width, img.height, false)
|
blurFboA = FrameBuffer(Pixmap.Format.RGBA8888, img.width, img.height, false)
|
||||||
blurFboB = FrameBuffer(Pixmap.Format.RGBA8888, img.width, img.height, false)
|
blurFboB = FrameBuffer(Pixmap.Format.RGBA8888, img.width, img.height, false)
|
||||||
|
|
||||||
worldFbo = FrameBuffer(Pixmap.Format.RGBA8888, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
worldFbo = FrameBuffer(Pixmap.Format.RGBA8888, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
|
|
||||||
//blurShader.begin()
|
//blurShader.begin()
|
||||||
//blurShader.setUniformf("iResolution", img.width.toFloat(), img.height.toFloat(), 0f)
|
//blurShader.setUniformf("iResolution", img.width.toFloat(), img.height.toFloat(), 0f)
|
||||||
//blurShader.end()
|
//blurShader.end()
|
||||||
|
|
||||||
|
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun render(delta: Float) {
|
override fun render(delta: Float) {
|
||||||
@@ -134,7 +134,7 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
|||||||
batch.inUse {
|
batch.inUse {
|
||||||
batch.shader = null
|
batch.shader = null
|
||||||
|
|
||||||
camera.position.set(Terrarum.WIDTH / 2f - 50f, Terrarum.HEIGHT / 2f - 50f, 0f)
|
camera.position.set(AppLoader.screenW / 2f - 50f, AppLoader.screenH / 2f - 50f, 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
|
|
||||||
@@ -146,11 +146,11 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
camera.setToOrtho(true, Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
camera.setToOrtho(true, AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
batch.inUse {
|
batch.inUse {
|
||||||
|
|
||||||
camera.position.set(Terrarum.WIDTH / 2f, Terrarum.HEIGHT / 2f, 0f)
|
camera.position.set(AppLoader.screenW / 2f, AppLoader.screenH / 2f, 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pause() {
|
override fun pause() {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
// todo register titlescreen as the ingame, similar in a way that the buildingmaker did
|
// todo register titlescreen as the ingame, similar in a way that the buildingmaker did
|
||||||
|
|
||||||
var camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
var camera = OrthographicCamera(AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
|
|
||||||
|
|
||||||
// invert Y
|
// invert Y
|
||||||
@@ -172,7 +172,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
override fun show() {
|
override fun show() {
|
||||||
printdbg(this, "show() called")
|
printdbg(this, "show() called")
|
||||||
|
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
logo = TextureRegion(Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga")))
|
logo = TextureRegion(Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga")))
|
||||||
logo.flip(false, true)
|
logo.flip(false, true)
|
||||||
@@ -181,7 +181,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
Gdx.input.inputProcessor = TitleScreenController(this)
|
Gdx.input.inputProcessor = TitleScreenController(this)
|
||||||
|
|
||||||
|
|
||||||
worldFBO = FrameBuffer(Pixmap.Format.RGBA8888, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
worldFBO = FrameBuffer(Pixmap.Format.RGBA8888, AppLoader.screenW, AppLoader.screenH, false)
|
||||||
|
|
||||||
loadThingsWhileIntroIsVisible()
|
loadThingsWhileIntroIsVisible()
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
|
Gdx.graphics.setTitle(TerrarumIngame.getCanonicalTitle())
|
||||||
|
|
||||||
|
|
||||||
//camera.setToOrtho(true, Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
//camera.setToOrtho(true, AppLoader.screenW.toFloat(), AppLoader.screenH.toFloat())
|
||||||
|
|
||||||
// render world
|
// render world
|
||||||
gdxClearAndSetBlend(.64f, .754f, .84f, 1f)
|
gdxClearAndSetBlend(.64f, .754f, .84f, 1f)
|
||||||
@@ -270,14 +270,14 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
COPYTING.forEachIndexed { index, s ->
|
COPYTING.forEachIndexed { index, s ->
|
||||||
val textWidth = AppLoader.fontGame.getWidth(s)
|
val textWidth = AppLoader.fontGame.getWidth(s)
|
||||||
AppLoader.fontGame.draw(batch, s,
|
AppLoader.fontGame.draw(batch, s,
|
||||||
(Terrarum.WIDTH - textWidth - 1f).toInt().toFloat(),
|
(AppLoader.screenW - textWidth - 1f).toInt().toFloat(),
|
||||||
(Terrarum.HEIGHT - AppLoader.fontGame.lineHeight * (COPYTING.size - index) - 1f).toInt().toFloat()
|
(AppLoader.screenH - AppLoader.fontGame.lineHeight * (COPYTING.size - index) - 1f).toInt().toFloat()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoader.fontGame.draw(batch, "${AppLoader.GAME_NAME} ${AppLoader.getVERSION_STRING()}",
|
AppLoader.fontGame.draw(batch, "${AppLoader.GAME_NAME} ${AppLoader.getVERSION_STRING()}",
|
||||||
1f.toInt().toFloat(),
|
1f.toInt().toFloat(),
|
||||||
(Terrarum.HEIGHT - AppLoader.fontGame.lineHeight - 1f).toInt().toFloat()
|
(AppLoader.screenH - AppLoader.fontGame.lineHeight - 1f).toInt().toFloat()
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -292,11 +292,11 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
printdbg(this, "resize() called")
|
printdbg(this, "resize() called")
|
||||||
|
|
||||||
// Set up viewport when window is resized
|
// Set up viewport when window is resized
|
||||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
|
|
||||||
// resize UI by re-creating it (!!)
|
// resize UI by re-creating it (!!)
|
||||||
uiMenu.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
uiMenu.resize(AppLoader.screenW, AppLoader.screenH)
|
||||||
// TODO I forgot what the fuck kind of hack I was talking about
|
// TODO I forgot what the fuck kind of hack I was talking about
|
||||||
//uiMenu.setPosition(0, UITitleRemoConRoot.menubarOffY)
|
//uiMenu.setPosition(0, UITitleRemoConRoot.menubarOffY)
|
||||||
uiMenu.setPosition(0, 0) // shitty hack. Could be:
|
uiMenu.setPosition(0, 0) // shitty hack. Could be:
|
||||||
@@ -304,7 +304,7 @@ class TitleScreen(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// 2: The UI is coded shit
|
// 2: The UI is coded shit
|
||||||
|
|
||||||
|
|
||||||
IngameRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
IngameRenderer.resize(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
printdbg(this, "resize() exit")
|
printdbg(this, "resize() exit")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.blockstats
|
package net.torvald.terrarum.blockstats
|
||||||
|
|
||||||
import com.jme3.math.FastMath
|
import com.jme3.math.FastMath
|
||||||
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
@@ -29,13 +30,13 @@ object BlockStats {
|
|||||||
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
|
||||||
if (player == null) return
|
if (player == null) return
|
||||||
|
|
||||||
val renderWidth = FastMath.ceil(Terrarum.WIDTH.toFloat())
|
val renderWidth = FastMath.ceil(AppLoader.screenW.toFloat())
|
||||||
val renderHeight = FastMath.ceil(Terrarum.HEIGHT.toFloat())
|
val renderHeight = FastMath.ceil(AppLoader.screenH.toFloat())
|
||||||
|
|
||||||
val noZoomCameraX = Math.round(FastMath.clamp(
|
val noZoomCameraX = Math.round(FastMath.clamp(
|
||||||
(player.hitbox?.centeredX?.toFloat() ?: 0f) - renderWidth / 2, TSIZE.toFloat(), map.width * TSIZE - renderWidth - TSIZE.toFloat()))
|
player.hitbox.centeredX.toFloat() - renderWidth / 2, TSIZE.toFloat(), map.width * TSIZE - renderWidth - TSIZE.toFloat()))
|
||||||
val noZoomCameraY = Math.round(FastMath.clamp(
|
val noZoomCameraY = Math.round(FastMath.clamp(
|
||||||
(player.hitbox?.centeredY?.toFloat() ?: 0f) - renderHeight / 2, TSIZE.toFloat(), map.width * TSIZE - renderHeight - TSIZE.toFloat()))
|
player.hitbox.centeredY.toFloat() - renderHeight / 2, TSIZE.toFloat(), map.width * TSIZE - renderHeight - TSIZE.toFloat()))
|
||||||
|
|
||||||
val for_x_start = noZoomCameraX / TSIZE
|
val for_x_start = noZoomCameraX / TSIZE
|
||||||
val for_y_start = noZoomCameraY / TSIZE
|
val for_y_start = noZoomCameraY / TSIZE
|
||||||
|
|||||||
@@ -1328,7 +1328,7 @@ open class ActorWBMovable(renderOrder: RenderOrder, val immobileBody: Boolean =
|
|||||||
|
|
||||||
|
|
||||||
// wrap around for X-axis
|
// wrap around for X-axis
|
||||||
//val actorMinimumX = Terrarum.HALFW // to make camera's X stay positive
|
//val actorMinimumX = AppLoader.halfScreenW // to make camera's X stay positive
|
||||||
//val actorMaximumX = worldsizePxl + actorMinimumX // to make camera's X stay positive
|
//val actorMaximumX = worldsizePxl + actorMinimumX // to make camera's X stay positive
|
||||||
|
|
||||||
hitbox.setPositionFromPointed(
|
hitbox.setPositionFromPointed(
|
||||||
|
|||||||
@@ -294,11 +294,11 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
uiToolbox.isVisible = true
|
uiToolbox.isVisible = true
|
||||||
uiToolbox.invocationArgument = arrayOf(this)
|
uiToolbox.invocationArgument = arrayOf(this)
|
||||||
|
|
||||||
uiPaletteSelector.setPosition(Terrarum.WIDTH - uiPaletteSelector.width, 0)
|
uiPaletteSelector.setPosition(AppLoader.screenW - uiPaletteSelector.width, 0)
|
||||||
uiPaletteSelector.isVisible = true
|
uiPaletteSelector.isVisible = true
|
||||||
|
|
||||||
notifier.setPosition(
|
notifier.setPosition(
|
||||||
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
|
||||||
|
|
||||||
|
|
||||||
actorNowPlaying?.setPosition(512 * 16.0, 149 * 16.0)
|
actorNowPlaying?.setPosition(512 * 16.0, 149 * 16.0)
|
||||||
@@ -378,8 +378,8 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// position the menu to where the cursor is
|
// position the menu to where the cursor is
|
||||||
uiPenMenu.posX = Terrarum.mouseScreenX - uiPenMenu.width / 2
|
uiPenMenu.posX = Terrarum.mouseScreenX - uiPenMenu.width / 2
|
||||||
uiPenMenu.posY = Terrarum.mouseScreenY - uiPenMenu.height / 2
|
uiPenMenu.posY = Terrarum.mouseScreenY - uiPenMenu.height / 2
|
||||||
uiPenMenu.posX = uiPenMenu.posX.coerceIn(0, Terrarum.WIDTH - uiPenMenu.width)
|
uiPenMenu.posX = uiPenMenu.posX.coerceIn(0, AppLoader.screenW - uiPenMenu.width)
|
||||||
uiPenMenu.posY = uiPenMenu.posY.coerceIn(0, Terrarum.HEIGHT - uiPenMenu.height)
|
uiPenMenu.posY = uiPenMenu.posY.coerceIn(0, AppLoader.screenH - uiPenMenu.height)
|
||||||
|
|
||||||
// actually open
|
// actually open
|
||||||
uiPenMenu.setAsOpen()
|
uiPenMenu.setAsOpen()
|
||||||
@@ -397,10 +397,10 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
IngameRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
IngameRenderer.resize(AppLoader.screenW, AppLoader.screenH)
|
||||||
uiToolbox.setPosition(0, 0)
|
uiToolbox.setPosition(0, 0)
|
||||||
notifier.setPosition(
|
notifier.setPosition(
|
||||||
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
|
||||||
|
|
||||||
println("[BuildingMaker] Resize event")
|
println("[BuildingMaker] Resize event")
|
||||||
}
|
}
|
||||||
@@ -562,12 +562,12 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, usePhysic
|
|||||||
|
|
||||||
// TODO resize-aware
|
// TODO resize-aware
|
||||||
private var coerceInStart = Point2d(
|
private var coerceInStart = Point2d(
|
||||||
(Terrarum.WIDTH - hitbox.width) / 2.0,
|
(AppLoader.screenW - hitbox.width) / 2.0,
|
||||||
(Terrarum.HEIGHT - hitbox.height) / 2.0
|
(AppLoader.screenH - hitbox.height) / 2.0
|
||||||
)
|
)
|
||||||
private var coerceInEnd = Point2d(
|
private var coerceInEnd = Point2d(
|
||||||
parent.world.width * TILE_SIZE - (Terrarum.WIDTH - hitbox.width) / 2.0,
|
parent.world.width * TILE_SIZE - (AppLoader.screenW - hitbox.width) / 2.0,
|
||||||
parent.world.height * TILE_SIZE - (Terrarum.HEIGHT - hitbox.height) / 2.0
|
parent.world.height * TILE_SIZE - (AppLoader.screenH - hitbox.height) / 2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun update(delta: Float) {
|
override fun update(delta: Float) {
|
||||||
@@ -590,7 +590,7 @@ class MovableWorldCamera(val parent: BuildingMaker) : ActorHumanoid(0, usePhysic
|
|||||||
|
|
||||||
class YamlCommandExit : YamlInvokable {
|
class YamlCommandExit : YamlInvokable {
|
||||||
override fun invoke(args: Array<Any>) {
|
override fun invoke(args: Array<Any>) {
|
||||||
AppLoader.setScreen(TitleScreen(Terrarum.batch))
|
AppLoader.setScreen(TitleScreen(AppLoader.batch))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ object IngameRenderer : Disposable {
|
|||||||
val shaderAtoGrey: ShaderProgram
|
val shaderAtoGrey: ShaderProgram
|
||||||
val shaderPassthru = SpriteBatch.createDefaultShader()
|
val shaderPassthru = SpriteBatch.createDefaultShader()
|
||||||
|
|
||||||
private val width = Terrarum.WIDTH
|
private val width = AppLoader.screenW
|
||||||
private val height = Terrarum.HEIGHT
|
private val height = AppLoader.screenH
|
||||||
private val widthf = width.toFloat()
|
private val widthf = width.toFloat()
|
||||||
private val heightf = height.toFloat()
|
private val heightf = height.toFloat()
|
||||||
|
|
||||||
@@ -608,7 +608,7 @@ object IngameRenderer : Disposable {
|
|||||||
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
|
* Camera will be moved so that (newX, newY) would be sit on the top-left edge.
|
||||||
*/
|
*/
|
||||||
private fun setCameraPosition(newX: Float, newY: Float) {
|
private fun setCameraPosition(newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + Terrarum.HALFW).round(), (-newY + Terrarum.HALFH).round(), 0f)
|
camera.position.set((-newX + AppLoader.halfScreenW).round(), (-newY + AppLoader.halfScreenH).round(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ open class TerrarumIngame(batch: SpriteBatch) : 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: Camera, newX: Float, newY: Float) {
|
||||||
camera.position.set((-newX + Terrarum.HALFW).round(), (-newY + Terrarum.HALFH).round(), 0f)
|
camera.position.set((-newX + AppLoader.halfScreenW).round(), (-newY + AppLoader.halfScreenH).round(), 0f)
|
||||||
camera.update()
|
camera.update()
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
//initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
|
//initViewPort(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
// gameLoadMode and gameLoadInfoPayload must be set beforehand!!
|
// gameLoadMode and gameLoadInfoPayload must be set beforehand!!
|
||||||
|
|
||||||
@@ -292,8 +292,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// init notifier
|
// init notifier
|
||||||
notifier = Notification()
|
notifier = Notification()
|
||||||
notifier.setPosition(
|
notifier.setPosition(
|
||||||
(Terrarum.WIDTH - notifier.width) / 2,
|
(AppLoader.screenW - notifier.width) / 2,
|
||||||
Terrarum.HEIGHT - notifier.height - AppLoader.getTvSafeGraphicsHeight()
|
AppLoader.screenH - notifier.height - AppLoader.getTvSafeGraphicsHeight()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -310,11 +310,11 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// quick bar
|
// quick bar
|
||||||
uiQuickBar = UIQuickslotBar()
|
uiQuickBar = UIQuickslotBar()
|
||||||
uiQuickBar.isVisible = true
|
uiQuickBar.isVisible = true
|
||||||
uiQuickBar.setPosition((Terrarum.WIDTH - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
|
uiQuickBar.setPosition((AppLoader.screenW - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
|
||||||
|
|
||||||
// pie menu
|
// pie menu
|
||||||
uiPieMenu = uiQuickslotPie()
|
uiPieMenu = uiQuickslotPie()
|
||||||
uiPieMenu.setPosition(Terrarum.HALFW, Terrarum.HALFH)
|
uiPieMenu.setPosition(AppLoader.halfScreenW, AppLoader.halfScreenH)
|
||||||
|
|
||||||
// vital metre
|
// vital metre
|
||||||
// fill in getter functions by
|
// fill in getter functions by
|
||||||
@@ -329,7 +329,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
uiWatchTierOne = UITierOneWatch(actorNowPlaying)
|
uiWatchTierOne = UITierOneWatch(actorNowPlaying)
|
||||||
uiWatchTierOne.setAsAlwaysVisible()
|
uiWatchTierOne.setAsAlwaysVisible()
|
||||||
uiWatchTierOne.setPosition(
|
uiWatchTierOne.setPosition(
|
||||||
((Terrarum.WIDTH - AppLoader.getTvSafeActionWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
((AppLoader.screenW - AppLoader.getTvSafeActionWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||||
AppLoader.getTvSafeGraphicsHeight() + 8
|
AppLoader.getTvSafeGraphicsHeight() + 8
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -946,8 +946,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param width same as Terrarum.WIDTH
|
* @param width same as AppLoader.screenW
|
||||||
* @param height same as Terrarum.HEIGHT
|
* @param height same as AppLoader.screenH
|
||||||
* @see net.torvald.terrarum.Terrarum
|
* @see net.torvald.terrarum.Terrarum
|
||||||
*/
|
*/
|
||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
@@ -956,7 +956,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
//MegaRainGovernor.resize()
|
//MegaRainGovernor.resize()
|
||||||
|
|
||||||
|
|
||||||
IngameRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)
|
IngameRenderer.resize(AppLoader.screenW, AppLoader.screenH)
|
||||||
|
|
||||||
|
|
||||||
if (gameInitialised) {
|
if (gameInitialised) {
|
||||||
@@ -968,22 +968,22 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
// resize UIs
|
// resize UIs
|
||||||
|
|
||||||
notifier.setPosition(
|
notifier.setPosition(
|
||||||
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
|
(AppLoader.screenW - notifier.width) / 2, AppLoader.screenH - notifier.height)
|
||||||
uiQuickBar.setPosition((Terrarum.WIDTH - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
|
uiQuickBar.setPosition((AppLoader.screenW - uiQuickBar.width) / 2, AppLoader.getTvSafeGraphicsHeight())
|
||||||
|
|
||||||
// inventory
|
// inventory
|
||||||
/*uiInventoryPlayer =
|
/*uiInventoryPlayer =
|
||||||
UIInventory(player,
|
UIInventory(player,
|
||||||
width = 840,
|
width = 840,
|
||||||
height = Terrarum.HEIGHT - 160,
|
height = AppLoader.screenH - 160,
|
||||||
categoryWidth = 210
|
categoryWidth = 210
|
||||||
)*/
|
)*/
|
||||||
|
|
||||||
|
|
||||||
// basic watch-style notification bar (temperature, new mail)
|
// basic watch-style notification bar (temperature, new mail)
|
||||||
uiBasicInfo.setPosition(Terrarum.WIDTH - uiBasicInfo.width, 0)
|
uiBasicInfo.setPosition(AppLoader.screenW - uiBasicInfo.width, 0)
|
||||||
uiWatchTierOne.setPosition(
|
uiWatchTierOne.setPosition(
|
||||||
((Terrarum.WIDTH - AppLoader.getTvSafeGraphicsWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
((AppLoader.screenW - AppLoader.getTvSafeGraphicsWidth()) - (uiQuickBar.posX + uiQuickBar.width) - uiWatchTierOne.width) / 2 + (uiQuickBar.posX + uiQuickBar.width),
|
||||||
AppLoader.getTvSafeGraphicsHeight() + 8
|
AppLoader.getTvSafeGraphicsHeight() + 8
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
|||||||
{
|
{
|
||||||
parent.uiPalette.isVisible = true
|
parent.uiPalette.isVisible = true
|
||||||
parent.uiPalette.setPosition(Gdx.input.x - parent.uiPalette.width / 2, Gdx.input.y - parent.uiPalette.height / 2)
|
parent.uiPalette.setPosition(Gdx.input.x - parent.uiPalette.width / 2, Gdx.input.y - parent.uiPalette.height / 2)
|
||||||
parent.uiPalette.posX = parent.uiPalette.posX.coerceIn(0, Terrarum.WIDTH - parent.uiPalette.width)
|
parent.uiPalette.posX = parent.uiPalette.posX.coerceIn(0, AppLoader.screenW - parent.uiPalette.width)
|
||||||
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, Terrarum.HEIGHT - parent.uiPalette.height)
|
parent.uiPalette.posY = parent.uiPalette.posY.coerceIn(0, AppLoader.screenH - parent.uiPalette.height)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
parent.currentPenMode = BuildingMaker.PENMODE_PENCIL_ERASE
|
parent.currentPenMode = BuildingMaker.PENMODE_PENCIL_ERASE
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ object MegaRainGovernor {
|
|||||||
val h = body.height
|
val h = body.height
|
||||||
|
|
||||||
bodies = Array(1024) {
|
bodies = Array(1024) {
|
||||||
//val pixmap = Pixmap(Terrarum.WIDTH * 2, Terrarum.HEIGHT / 4, Pixmap.Format.RGBA8888)
|
//val pixmap = Pixmap(AppLoader.screenW * 2, AppLoader.screenH / 4, Pixmap.Format.RGBA8888)
|
||||||
val pixmap = Pixmap(64, 64, Pixmap.Format.RGBA8888)
|
val pixmap = Pixmap(64, 64, Pixmap.Format.RGBA8888)
|
||||||
|
|
||||||
val rng = HQRNG()
|
val rng = HQRNG()
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class Notification : UICanvas() {
|
|||||||
val displayedTextWidth = maxOf(240, realTextWidth)
|
val displayedTextWidth = maxOf(240, realTextWidth)
|
||||||
|
|
||||||
// force the UI to the centre of the screen
|
// force the UI to the centre of the screen
|
||||||
this.posX = (Terrarum.WIDTH - displayedTextWidth) / 2
|
this.posX = (AppLoader.screenW - displayedTextWidth) / 2
|
||||||
|
|
||||||
val textHeight = message.size * AppLoader.fontGame.lineHeight
|
val textHeight = message.size * AppLoader.fontGame.lineHeight
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ import net.torvald.terrarum.ui.UICanvas
|
|||||||
class UICheatDetected : UICanvas() {
|
class UICheatDetected : UICanvas() {
|
||||||
|
|
||||||
override var width: Int
|
override var width: Int
|
||||||
get() = Terrarum.WIDTH
|
get() = AppLoader.screenW
|
||||||
set(value) { throw UnsupportedOperationException() }
|
set(value) { throw UnsupportedOperationException() }
|
||||||
|
|
||||||
override var height: Int
|
override var height: Int
|
||||||
get() = Terrarum.HEIGHT
|
get() = AppLoader.screenH
|
||||||
set(value) { throw UnsupportedOperationException() }
|
set(value) { throw UnsupportedOperationException() }
|
||||||
|
|
||||||
override var openCloseTime: Second = 0f
|
override var openCloseTime: Second = 0f
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
private val debugvals = false
|
private val debugvals = false
|
||||||
|
|
||||||
override var width: Int = Terrarum.WIDTH
|
override var width: Int = AppLoader.screenW
|
||||||
override var height: Int = Terrarum.HEIGHT
|
override var height: Int = AppLoader.screenH
|
||||||
|
|
||||||
private val itemListToEquipViewGap = 24
|
private val itemListToEquipViewGap = 24
|
||||||
|
|
||||||
@@ -86,8 +86,8 @@ class UIInventoryFull(
|
|||||||
val catBarWidth = 330
|
val catBarWidth = 330
|
||||||
val categoryBar = UIItemInventoryCatBar(
|
val categoryBar = UIItemInventoryCatBar(
|
||||||
this,
|
this,
|
||||||
(Terrarum.WIDTH - catBarWidth) / 2,
|
(AppLoader.screenW - catBarWidth) / 2,
|
||||||
42 + (Terrarum.HEIGHT - internalHeight) / 2,
|
42 + (AppLoader.screenH - internalHeight) / 2,
|
||||||
catBarWidth
|
catBarWidth
|
||||||
)
|
)
|
||||||
val catSelection: Int
|
val catSelection: Int
|
||||||
@@ -102,8 +102,8 @@ class UIInventoryFull(
|
|||||||
UIItemInventoryDynamicList(
|
UIItemInventoryDynamicList(
|
||||||
this,
|
this,
|
||||||
actor.inventory,
|
actor.inventory,
|
||||||
0 + (Terrarum.WIDTH - internalWidth) / 2,
|
0 + (AppLoader.screenW - internalWidth) / 2,
|
||||||
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
109 + (AppLoader.screenH - internalHeight) / 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -112,15 +112,15 @@ class UIInventoryFull(
|
|||||||
this,
|
this,
|
||||||
actor.inventory,
|
actor.inventory,
|
||||||
actor as ActorWBMovable,
|
actor as ActorWBMovable,
|
||||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (Terrarum.WIDTH - internalWidth) / 2,
|
internalWidth - UIItemInventoryEquippedView.WIDTH + (AppLoader.screenW - internalWidth) / 2,
|
||||||
109 + (Terrarum.HEIGHT - internalHeight) / 2
|
109 + (AppLoader.screenH - internalHeight) / 2
|
||||||
)
|
)
|
||||||
private val gameMenu = arrayOf("MENU_LABEL_MAINMENU", "MENU_LABEL_DESKTOP", "MENU_OPTIONS_CONTROLS", "MENU_OPTIONS_SOUND", "MENU_LABEL_GRAPHICS")
|
private val gameMenu = arrayOf("MENU_LABEL_MAINMENU", "MENU_LABEL_DESKTOP", "MENU_OPTIONS_CONTROLS", "MENU_OPTIONS_SOUND", "MENU_LABEL_GRAPHICS")
|
||||||
private val gameMenuListHeight = DEFAULT_LINE_HEIGHT * gameMenu.size
|
private val gameMenuListHeight = DEFAULT_LINE_HEIGHT * gameMenu.size
|
||||||
private val gameMenuListWidth = 400
|
private val gameMenuListWidth = 400
|
||||||
private val gameMenuButtons = UIItemTextButtonList(
|
private val gameMenuButtons = UIItemTextButtonList(
|
||||||
this, gameMenu,
|
this, gameMenu,
|
||||||
Terrarum.WIDTH + (Terrarum.WIDTH - gameMenuListWidth) / 2,
|
AppLoader.screenW + (AppLoader.screenW - gameMenuListWidth) / 2,
|
||||||
(itemList.height - gameMenuListHeight) / 2 + itemList.posY,
|
(itemList.height - gameMenuListHeight) / 2 + itemList.posY,
|
||||||
gameMenuListWidth, gameMenuListHeight,
|
gameMenuListWidth, gameMenuListHeight,
|
||||||
readFromLang = true,
|
readFromLang = true,
|
||||||
@@ -184,7 +184,7 @@ class UIInventoryFull(
|
|||||||
// make gameMenuButtons work
|
// make gameMenuButtons work
|
||||||
gameMenuButtons.selectionChangeListener = { old, new ->
|
gameMenuButtons.selectionChangeListener = { old, new ->
|
||||||
if (new == 0) {
|
if (new == 0) {
|
||||||
AppLoader.setScreen(TitleScreen(Terrarum.batch))
|
AppLoader.setScreen(TitleScreen(AppLoader.batch))
|
||||||
}
|
}
|
||||||
else if (new == 1) {
|
else if (new == 1) {
|
||||||
Gdx.app.exit()
|
Gdx.app.exit()
|
||||||
@@ -193,8 +193,8 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
|
private var offsetX = ((AppLoader.screenW - internalWidth) / 2).toFloat()
|
||||||
private var offsetY = ((Terrarum.HEIGHT - internalHeight) / 2).toFloat()
|
private var offsetY = ((AppLoader.screenH - internalHeight) / 2).toFloat()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -223,8 +223,8 @@ class UIInventoryFull(
|
|||||||
|
|
||||||
private val weightBarWidth = 64f
|
private val weightBarWidth = 64f
|
||||||
|
|
||||||
private var xEnd = (Terrarum.WIDTH + internalWidth).div(2).toFloat()
|
private var xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
||||||
private var yEnd = (Terrarum.HEIGHT + internalHeight).div(2).toFloat()
|
private var yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
||||||
|
|
||||||
private var minimapRerenderTimer = 0f
|
private var minimapRerenderTimer = 0f
|
||||||
private val minimapRerenderInterval = .5f
|
private val minimapRerenderInterval = .5f
|
||||||
@@ -272,17 +272,17 @@ class UIInventoryFull(
|
|||||||
gdxSetBlendNormal()
|
gdxSetBlendNormal()
|
||||||
|
|
||||||
|
|
||||||
val gradTopStart = (Terrarum.HEIGHT - internalHeight).div(2).toFloat()
|
val gradTopStart = (AppLoader.screenH - internalHeight).div(2).toFloat()
|
||||||
val gradBottomEnd = Terrarum.HEIGHT - gradTopStart
|
val gradBottomEnd = AppLoader.screenH - gradTopStart
|
||||||
|
|
||||||
shapeRenderer.inUse {
|
shapeRenderer.inUse {
|
||||||
shapeRenderer.rect(0f, gradTopStart, Terrarum.WIDTH.toFloat(), gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
shapeRenderer.rect(0f, gradTopStart, AppLoader.screenW.toFloat(), gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||||
shapeRenderer.rect(0f, gradBottomEnd, Terrarum.WIDTH.toFloat(), -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
shapeRenderer.rect(0f, gradBottomEnd, AppLoader.screenW.toFloat(), -gradHeight, gradStartCol, gradStartCol, gradEndCol, gradEndCol)
|
||||||
|
|
||||||
shapeRenderer.rect(0f, gradTopStart + gradHeight, Terrarum.WIDTH.toFloat(), internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
shapeRenderer.rect(0f, gradTopStart + gradHeight, AppLoader.screenW.toFloat(), internalHeight - (2 * gradHeight), gradEndCol, gradEndCol, gradEndCol, gradEndCol)
|
||||||
|
|
||||||
shapeRenderer.rect(0f, 0f, Terrarum.WIDTH.toFloat(), gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
shapeRenderer.rect(0f, 0f, AppLoader.screenW.toFloat(), gradTopStart, gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||||
shapeRenderer.rect(0f, Terrarum.HEIGHT.toFloat(), Terrarum.WIDTH.toFloat(), -(Terrarum.HEIGHT.toFloat() - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
shapeRenderer.rect(0f, AppLoader.screenH.toFloat(), AppLoader.screenW.toFloat(), -(AppLoader.screenH.toFloat() - gradBottomEnd), gradStartCol, gradStartCol, gradStartCol, gradStartCol)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -330,16 +330,16 @@ class UIInventoryFull(
|
|||||||
private val epsilon = 0.001f
|
private val epsilon = 0.001f
|
||||||
|
|
||||||
private val minimapScrOffX: Float
|
private val minimapScrOffX: Float
|
||||||
get() = (currentScreen - 2f) * Terrarum.WIDTH
|
get() = (currentScreen - 2f) * AppLoader.screenW
|
||||||
/**
|
/**
|
||||||
* - 0 on inventory screen
|
* - 0 on inventory screen
|
||||||
* - +WIDTH on minimap screen
|
* - +WIDTH on minimap screen
|
||||||
* - -WIDTH on gamemenu screen
|
* - -WIDTH on gamemenu screen
|
||||||
*/
|
*/
|
||||||
private val inventoryScrOffX: Float
|
private val inventoryScrOffX: Float
|
||||||
get() = (currentScreen - 1f) * Terrarum.WIDTH
|
get() = (currentScreen - 1f) * AppLoader.screenW
|
||||||
private val menuScrOffX: Float
|
private val menuScrOffX: Float
|
||||||
get() = (currentScreen) * Terrarum.WIDTH
|
get() = (currentScreen) * AppLoader.screenW
|
||||||
|
|
||||||
private val MINIMAP_WIDTH = 800f
|
private val MINIMAP_WIDTH = 800f
|
||||||
private val MINIMAP_HEIGHT = UIItemInventoryDynamicList.HEIGHT.toFloat()
|
private val MINIMAP_HEIGHT = UIItemInventoryDynamicList.HEIGHT.toFloat()
|
||||||
@@ -431,20 +431,20 @@ class UIInventoryFull(
|
|||||||
batch.begin()
|
batch.begin()
|
||||||
|
|
||||||
|
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", minimapScrOffX + (Terrarum.WIDTH - MINIMAP_WIDTH) / 2, -10f + itemList.posY)
|
AppLoader.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", minimapScrOffX + (AppLoader.screenW - MINIMAP_WIDTH) / 2, -10f + itemList.posY)
|
||||||
|
|
||||||
|
|
||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
// 1px stroke
|
// 1px stroke
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
batch.fillRect(-1 + minimapScrOffX + (Terrarum.WIDTH - MINIMAP_WIDTH) / 2, -1 + itemList.posY.toFloat(), 2 + MINIMAP_WIDTH, 2 + MINIMAP_HEIGHT)
|
batch.fillRect(-1 + minimapScrOffX + (AppLoader.screenW - MINIMAP_WIDTH) / 2, -1 + itemList.posY.toFloat(), 2 + MINIMAP_WIDTH, 2 + MINIMAP_HEIGHT)
|
||||||
|
|
||||||
// control hints
|
// control hints
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
AppLoader.fontGame.draw(batch, minimapControlHelp, offsetX + minimapScrOffX, yEnd - 20)
|
AppLoader.fontGame.draw(batch, minimapControlHelp, offsetX + minimapScrOffX, yEnd - 20)
|
||||||
|
|
||||||
// the minimap
|
// the minimap
|
||||||
batch.draw(minimapFBO.colorBufferTexture, minimapScrOffX + (Terrarum.WIDTH - MINIMAP_WIDTH) / 2, itemList.posY.toFloat())
|
batch.draw(minimapFBO.colorBufferTexture, minimapScrOffX + (AppLoader.screenW - MINIMAP_WIDTH) / 2, itemList.posY.toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun renderScreenGamemenu(batch: SpriteBatch, camera: Camera) {
|
private fun renderScreenGamemenu(batch: SpriteBatch, camera: Camera) {
|
||||||
@@ -565,11 +565,11 @@ class UIInventoryFull(
|
|||||||
override fun resize(width: Int, height: Int) {
|
override fun resize(width: Int, height: Int) {
|
||||||
super.resize(width, height)
|
super.resize(width, height)
|
||||||
|
|
||||||
offsetX = ((Terrarum.WIDTH - internalWidth) / 2).toFloat()
|
offsetX = ((AppLoader.screenW - internalWidth) / 2).toFloat()
|
||||||
offsetY = ((Terrarum.HEIGHT - internalHeight) / 2).toFloat()
|
offsetY = ((AppLoader.screenH - internalHeight) / 2).toFloat()
|
||||||
|
|
||||||
xEnd = (Terrarum.WIDTH + internalWidth).div(2).toFloat()
|
xEnd = (AppLoader.screenW + internalWidth).div(2).toFloat()
|
||||||
yEnd = (Terrarum.HEIGHT + internalHeight).div(2).toFloat()
|
yEnd = (AppLoader.screenH + internalHeight).div(2).toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class UIProxyNewBuildingMaker : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun endOpening(delta: Float) {
|
override fun endOpening(delta: Float) {
|
||||||
val ingame = BuildingMaker(Terrarum.batch)
|
val ingame = BuildingMaker(AppLoader.batch)
|
||||||
|
|
||||||
Terrarum.setCurrentIngameInstance(ingame)
|
Terrarum.setCurrentIngameInstance(ingame)
|
||||||
LoadScreen.screenToLoad = ingame
|
LoadScreen.screenToLoad = ingame
|
||||||
|
|||||||
@@ -300,6 +300,6 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
|
|||||||
val remoConWidth = 304
|
val remoConWidth = 304
|
||||||
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||||
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||||
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
val menubarOffY: Int; get() = AppLoader.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,8 @@ 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.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
|
||||||
import net.torvald.terrarum.blendNormal
|
import net.torvald.terrarum.blendNormal
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.ui.UIItemList
|
import net.torvald.terrarum.ui.UIItemList
|
||||||
@@ -19,8 +19,8 @@ class UITitleCharactersList : UICanvas() {
|
|||||||
private val moduleAreaHMargin = 48
|
private val moduleAreaHMargin = 48
|
||||||
private val moduleAreaBorder = 8
|
private val moduleAreaBorder = 8
|
||||||
|
|
||||||
override var width = Terrarum.WIDTH - UIRemoCon.remoConWidth - moduleAreaHMargin
|
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||||
override var height = Terrarum.HEIGHT - moduleAreaHMargin * 2
|
override var height = AppLoader.screenH - moduleAreaHMargin * 2
|
||||||
|
|
||||||
private val moduleInfoCells = ArrayList<UIItemSavegameInfoCell>()
|
private val moduleInfoCells = ArrayList<UIItemSavegameInfoCell>()
|
||||||
// build characters list
|
// build characters list
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ class UITitleLanguage : UICanvas() {
|
|||||||
|
|
||||||
|
|
||||||
private val textAreaHMargin = 48
|
private val textAreaHMargin = 48
|
||||||
override var width = (Terrarum.WIDTH * 0.75).toInt()
|
override var width = (AppLoader.screenW * 0.75).toInt()
|
||||||
override var height = Terrarum.HEIGHT - textAreaHMargin * 2
|
override var height = AppLoader.screenH - textAreaHMargin * 2
|
||||||
|
|
||||||
private val localeList = Lang.languageList.toList().sorted()
|
private val localeList = Lang.languageList.toList().sorted()
|
||||||
private val textArea = UIItemTextButtonList(this,
|
private val textArea = UIItemTextButtonList(this,
|
||||||
localeList.map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }.toTypedArray(),
|
localeList.map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }.toTypedArray(),
|
||||||
Terrarum.WIDTH - width, textAreaHMargin,
|
AppLoader.screenW - width, textAreaHMargin,
|
||||||
width, height,
|
width, height,
|
||||||
textAreaWidth = width,
|
textAreaWidth = width,
|
||||||
readFromLang = false,
|
readFromLang = false,
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ 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.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.ModMgr
|
import net.torvald.terrarum.ModMgr
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
|
||||||
import net.torvald.terrarum.blendNormal
|
import net.torvald.terrarum.blendNormal
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.ui.UIItemList
|
import net.torvald.terrarum.ui.UIItemList
|
||||||
@@ -21,8 +21,8 @@ class UITitleModules : UICanvas() {
|
|||||||
private val moduleAreaHMargin = 48
|
private val moduleAreaHMargin = 48
|
||||||
private val moduleAreaBorder = 8
|
private val moduleAreaBorder = 8
|
||||||
|
|
||||||
override var width = Terrarum.WIDTH - UIRemoCon.remoConWidth - moduleAreaHMargin
|
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - moduleAreaHMargin
|
||||||
override var height = Terrarum.HEIGHT - moduleAreaHMargin * 2
|
override var height = AppLoader.screenH - moduleAreaHMargin * 2
|
||||||
|
|
||||||
|
|
||||||
private val moduleInfoCells = ArrayList<UIItemModuleInfoCell>()
|
private val moduleInfoCells = ArrayList<UIItemModuleInfoCell>()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
val remoConWidth = 240
|
val remoConWidth = 240
|
||||||
fun getRemoConHeight(menu: ArrayList<String>) = 36 * menu.size.plus(1)
|
fun getRemoConHeight(menu: ArrayList<String>) = 36 * menu.size.plus(1)
|
||||||
fun getRemoConHeight(menu: Array<String>) = 36 * menu.size.plus(1)
|
fun getRemoConHeight(menu: Array<String>) = 36 * menu.size.plus(1)
|
||||||
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
val menubarOffY: Int; get() = AppLoader.screenH / 2 - (AppLoader.fontGame.lineHeight * 1.5).toInt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ 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.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.CreditSingleton
|
import net.torvald.terrarum.CreditSingleton
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
import net.torvald.terrarum.ui.UIItemTextArea
|
import net.torvald.terrarum.ui.UIItemTextArea
|
||||||
|
|
||||||
@@ -15,8 +15,8 @@ open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
|
|||||||
|
|
||||||
|
|
||||||
private val textAreaHMargin = 48
|
private val textAreaHMargin = 48
|
||||||
override var width = Terrarum.WIDTH - UIRemoCon.remoConWidth - textAreaHMargin
|
override var width = AppLoader.screenW - UIRemoCon.remoConWidth - textAreaHMargin
|
||||||
override var height = Terrarum.HEIGHT - textAreaHMargin * 2
|
override var height = AppLoader.screenH - textAreaHMargin * 2
|
||||||
private val textArea = UIItemTextArea(this,
|
private val textArea = UIItemTextArea(this,
|
||||||
UIRemoCon.remoConWidth, textAreaHMargin,
|
UIRemoCon.remoConWidth, textAreaHMargin,
|
||||||
width, height
|
width, height
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import com.badlogic.gdx.graphics.Color
|
|||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.jme3.math.FastMath
|
import com.jme3.math.FastMath
|
||||||
import net.torvald.colourutil.CIELabUtil.darkerLab
|
import net.torvald.colourutil.CIELabUtil.darkerLab
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,8 +50,8 @@ class UIVitalMetre(
|
|||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
handler.setPosition(
|
handler.setPosition(
|
||||||
Terrarum.HALFW,
|
AppLoader.halfScreenW,
|
||||||
Terrarum.HALFH
|
AppLoader.halfScreenH
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Camera
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.jme3.math.FastMath
|
import com.jme3.math.FastMath
|
||||||
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.gameactors.AVKey
|
import net.torvald.terrarum.gameactors.AVKey
|
||||||
@@ -48,7 +49,7 @@ class uiQuickslotPie : UICanvas() {
|
|||||||
// update controls
|
// update controls
|
||||||
if (handler.isOpened || handler.isOpening) {
|
if (handler.isOpened || handler.isOpening) {
|
||||||
val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble())
|
val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble())
|
||||||
val centre = Vector2(Terrarum.HALFW.toDouble(), Terrarum.HALFH.toDouble())
|
val centre = Vector2(AppLoader.halfScreenW.toDouble(), AppLoader.halfScreenH.toDouble())
|
||||||
val deg = -(centre - cursorPos).direction.toFloat()
|
val deg = -(centre - cursorPos).direction.toFloat()
|
||||||
|
|
||||||
selection = Math.round(deg * slotCount / FastMath.TWO_PI)
|
selection = Math.round(deg * slotCount / FastMath.TWO_PI)
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
val playerPosY = player.hitbox.centeredY
|
val playerPosY = player.hitbox.centeredY
|
||||||
kotlin.repeat(7) {
|
kotlin.repeat(7) {
|
||||||
val rainParticle = ParticleMegaRain(
|
val rainParticle = ParticleMegaRain(
|
||||||
playerPosX + HQRNG().nextInt(Terrarum.WIDTH) - Terrarum.HALFW,
|
playerPosX + HQRNG().nextInt(AppLoader.screenW) - AppLoader.halfScreenW,
|
||||||
playerPosY - Terrarum.HEIGHT
|
playerPosY - AppLoader.screenH
|
||||||
)
|
)
|
||||||
(Terrarum.ingame!! as TerrarumIngame).addParticle(rainParticle)
|
(Terrarum.ingame!! as TerrarumIngame).addParticle(rainParticle)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*drawHistogram(batch, LightmapRenderer.histogram,
|
/*drawHistogram(batch, LightmapRenderer.histogram,
|
||||||
Terrarum.WIDTH - histogramW - TinyAlphNum.W * 2,
|
AppLoader.screenW - histogramW - TinyAlphNum.W * 2,
|
||||||
Terrarum.HEIGHT - histogramH - TinyAlphNum.H * 4
|
AppLoader.screenH - histogramH - TinyAlphNum.H * 4
|
||||||
)*/ // histogram building is currently bugged
|
)*/ // histogram building is currently bugged
|
||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
@@ -201,7 +201,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
drawGamepadAxis(gamepad, batch,
|
drawGamepadAxis(gamepad, batch,
|
||||||
gamepad.getAxis(AppLoader.getConfigInt("gamepadaxislx")),
|
gamepad.getAxis(AppLoader.getConfigInt("gamepadaxislx")),
|
||||||
gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisly")),
|
gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisly")),
|
||||||
Terrarum.WIDTH - 128 - TinyAlphNum.W * 2,
|
AppLoader.screenW - 128 - TinyAlphNum.W * 2,
|
||||||
line(3).toInt()
|
line(3).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -211,21 +211,21 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// memory pressure
|
// memory pressure
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}MEM ", (Terrarum.WIDTH - 23 * TinyAlphNum.W - 2).toFloat(), line(1))
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}MEM ", (AppLoader.screenW - 23 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||||
// thread count
|
// thread count
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (AppLoader.MULTITHREAD) ccG else ccR}${AppLoader.THREADS.toString().padStart(2, ' ')}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (AppLoader.MULTITHREAD) ccG else ccR}${AppLoader.THREADS.toString().padStart(2, ' ')}",
|
||||||
(Terrarum.WIDTH - 2 - 8 * TinyAlphNum.W).toFloat(), line(2))
|
(AppLoader.screenW - 2 - 8 * TinyAlphNum.W).toFloat(), line(2))
|
||||||
|
|
||||||
// memory texts
|
// memory texts
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memJavaHeap}M",
|
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memJavaHeap}M",
|
||||||
(Terrarum.WIDTH - 19 * TinyAlphNum.W - 2).toFloat(), line(1))
|
(AppLoader.screenW - 19 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "/${Terrarum.memNativeHeap}M/",
|
AppLoader.fontSmallNumbers.draw(batch, "/${Terrarum.memNativeHeap}M/",
|
||||||
(Terrarum.WIDTH - 14 * TinyAlphNum.W - 2).toFloat(), line(1))
|
(AppLoader.screenW - 14 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memXmx}M",
|
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memXmx}M",
|
||||||
(Terrarum.WIDTH - 7 * TinyAlphNum.W - 2).toFloat(), line(1))
|
(AppLoader.screenW - 7 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||||
// FPS count
|
// FPS count
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}FPS${ccG}${Gdx.graphics.framesPerSecond.toString().padStart(3, ' ')}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}FPS${ccG}${Gdx.graphics.framesPerSecond.toString().padStart(3, ' ')}",
|
||||||
(Terrarum.WIDTH - 3 - 15 * TinyAlphNum.W).toFloat(), line(2))
|
(AppLoader.screenW - 3 - 15 * TinyAlphNum.W).toFloat(), line(2))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bottom left
|
* Bottom left
|
||||||
@@ -233,21 +233,21 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
|
|
||||||
if (ingame != null) {
|
if (ingame != null) {
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${ingame!!.actorContainerActive.size + ingame!!.actorContainerInactive.size}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${ingame!!.actorContainerActive.size + ingame!!.actorContainerInactive.size}",
|
||||||
TinyAlphNum.W * 2f, Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
TinyAlphNum.W * 2f, AppLoader.screenH - TinyAlphNum.H * 2f)
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${ingame!!.actorContainerActive.size}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${ingame!!.actorContainerActive.size}",
|
||||||
(TinyAlphNum.W * 2 + 17 * 8).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
(TinyAlphNum.W * 2 + 17 * 8).toFloat(), AppLoader.screenH - TinyAlphNum.H * 2f)
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${ingame!!.actorContainerInactive.size}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${ingame!!.actorContainerInactive.size}",
|
||||||
(TinyAlphNum.W * 2 + 28 * 8).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
(TinyAlphNum.W * 2 + 28 * 8).toFloat(), AppLoader.screenH - TinyAlphNum.H * 2f)
|
||||||
if (ingame is TerrarumIngame) {
|
if (ingame is TerrarumIngame) {
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}",
|
||||||
(TinyAlphNum.W * 2 + 41 * 8).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
(TinyAlphNum.W * 2 + 41 * 8).toFloat(), AppLoader.screenH - TinyAlphNum.H * 2f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
||||||
TinyAlphNum.W * 2f, Terrarum.HEIGHT - TinyAlphNum.H * 3f)
|
TinyAlphNum.W * 2f, AppLoader.screenH - TinyAlphNum.H * 3f)
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}UIs rendering $ccG${IngameRenderer.renderingUIsCount}",
|
AppLoader.fontSmallNumbers.draw(batch, "${ccY}UIs rendering $ccG${IngameRenderer.renderingUIsCount}",
|
||||||
TinyAlphNum.W * 2f + (21 * 8), Terrarum.HEIGHT - TinyAlphNum.H * 3f)
|
TinyAlphNum.W * 2f + (21 * 8), AppLoader.screenH - TinyAlphNum.H * 3f)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bottom right
|
* Bottom right
|
||||||
@@ -255,7 +255,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
|
|
||||||
// processor and renderer
|
// processor and renderer
|
||||||
AppLoader.fontSmallNumbers.draw(batch, "$ccY$totalHardwareName",
|
AppLoader.fontSmallNumbers.draw(batch, "$ccY$totalHardwareName",
|
||||||
(Terrarum.WIDTH - (totalHardwareName.length + 2) * TinyAlphNum.W).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
(AppLoader.screenW - (totalHardwareName.length + 2) * TinyAlphNum.W).toFloat(), AppLoader.screenH - TinyAlphNum.H * 2f)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val processorName = AppLoader.processor.replace(Regex(""" Processor|( CPU)? @ [0-9.]+GHz"""), "") + if (AppLoader.is32BitJVM) " (32-bit)" else ""
|
private val processorName = AppLoader.processor.replace(Regex(""" Processor|( CPU)? @ [0-9.]+GHz"""), "") + if (AppLoader.is32BitJVM) " (32-bit)" else ""
|
||||||
@@ -335,14 +335,14 @@ class BasicDebugInfoWindow : UICanvas() {
|
|||||||
gdxSetBlendNormal()
|
gdxSetBlendNormal()
|
||||||
Terrarum.inShapeRenderer {
|
Terrarum.inShapeRenderer {
|
||||||
it.color = uiColour
|
it.color = uiColour
|
||||||
it.rect(uiX.toFloat(), Terrarum.HEIGHT - uiY.toFloat(), w, -h)
|
it.rect(uiX.toFloat(), AppLoader.screenH - uiY.toFloat(), w, -h)
|
||||||
it.color = Color.WHITE
|
it.color = Color.WHITE
|
||||||
it.line(uiX + halfW, Terrarum.HEIGHT - (uiY + halfH), uiX + halfW + pointDX, Terrarum.HEIGHT - (uiY + halfH + pointDY))
|
it.line(uiX + halfW, AppLoader.screenH - (uiY + halfH), uiX + halfW + pointDX, AppLoader.screenH - (uiY + halfH + pointDY))
|
||||||
it.color = Color.GRAY
|
it.color = Color.GRAY
|
||||||
}
|
}
|
||||||
batch.begin()
|
batch.begin()
|
||||||
|
|
||||||
AppLoader.fontSmallNumbers.draw(batch, gamepad.getName(), Terrarum.WIDTH - (gamepad.getName().length + 2f) * TinyAlphNum.W, uiY.toFloat() + h + 2)
|
AppLoader.fontSmallNumbers.draw(batch, gamepad.getName(), AppLoader.screenW - (gamepad.getName().length + 2f) * TinyAlphNum.W, uiY.toFloat() + h + 2)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class ConsoleWindow : UICanvas() {
|
|||||||
private val LINE_HEIGHT = 20
|
private val LINE_HEIGHT = 20
|
||||||
private val MESSAGES_DISPLAY_COUNT = 11
|
private val MESSAGES_DISPLAY_COUNT = 11
|
||||||
|
|
||||||
override var width: Int = Terrarum.WIDTH
|
override var width: Int = AppLoader.screenW
|
||||||
override var height: Int = LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT + 1)
|
override var height: Int = LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT + 1)
|
||||||
|
|
||||||
override var openCloseTime = 0f
|
override var openCloseTime = 0f
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.ui
|
|||||||
|
|
||||||
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.Terrarum
|
import net.torvald.terrarum.AppLoader
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.Terrarum
|
|||||||
object DrawUtil {
|
object DrawUtil {
|
||||||
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
|
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
|
||||||
val imageW = image.width
|
val imageW = image.width
|
||||||
val targetW = if (ui == null) Terrarum.WIDTH else ui.width
|
val targetW = if (ui == null) AppLoader.screenW else ui.width
|
||||||
|
|
||||||
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
|
batch.draw(image, targetW.minus(imageW).ushr(1).toFloat(), screenPosY.toFloat())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,13 +307,13 @@ abstract class UICanvas(
|
|||||||
).roundInt()
|
).roundInt()
|
||||||
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
||||||
ui.handler.openCloseCounter / openCloseTime,
|
ui.handler.openCloseCounter / openCloseTime,
|
||||||
Terrarum.WIDTH.toFloat(),
|
AppLoader.screenW.toFloat(),
|
||||||
Terrarum.WIDTH - ui.width.toFloat()
|
AppLoader.screenW - ui.width.toFloat()
|
||||||
).roundInt()
|
).roundInt()
|
||||||
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
||||||
ui.handler.openCloseCounter / openCloseTime,
|
ui.handler.openCloseCounter / openCloseTime,
|
||||||
Terrarum.HEIGHT.toFloat(),
|
AppLoader.screenH.toFloat(),
|
||||||
Terrarum.HEIGHT - ui.height.toFloat()
|
AppLoader.screenH - ui.height.toFloat()
|
||||||
).roundInt()
|
).roundInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -331,13 +331,13 @@ abstract class UICanvas(
|
|||||||
).roundInt()
|
).roundInt()
|
||||||
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
Position.RIGHT -> ui.handler.posX = Movement.fastPullOut(
|
||||||
ui.handler.openCloseCounter / openCloseTime,
|
ui.handler.openCloseCounter / openCloseTime,
|
||||||
Terrarum.WIDTH - ui.width.toFloat(),
|
AppLoader.screenW - ui.width.toFloat(),
|
||||||
Terrarum.WIDTH.toFloat()
|
AppLoader.screenW.toFloat()
|
||||||
).roundInt()
|
).roundInt()
|
||||||
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
Position.BOTTOM -> ui.handler.posY = Movement.fastPullOut(
|
||||||
ui.handler.openCloseCounter / openCloseTime,
|
ui.handler.openCloseCounter / openCloseTime,
|
||||||
Terrarum.HEIGHT - ui.height.toFloat(),
|
AppLoader.screenH - ui.height.toFloat(),
|
||||||
Terrarum.HEIGHT.toFloat()
|
AppLoader.screenH.toFloat()
|
||||||
).roundInt()
|
).roundInt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,16 +345,16 @@ abstract class UICanvas(
|
|||||||
when (position) {
|
when (position) {
|
||||||
Position.LEFT -> ui.handler.posX = 0
|
Position.LEFT -> ui.handler.posX = 0
|
||||||
Position.TOP -> ui.handler.posY = 0
|
Position.TOP -> ui.handler.posY = 0
|
||||||
Position.RIGHT -> ui.handler.posX = Terrarum.WIDTH - ui.width
|
Position.RIGHT -> ui.handler.posX = AppLoader.screenW - ui.width
|
||||||
Position.BOTTOM -> ui.handler.posY = Terrarum.HEIGHT - ui.height
|
Position.BOTTOM -> ui.handler.posY = AppLoader.screenH - ui.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fun endClosingPopOut(ui: UICanvas, position: Position) {
|
fun endClosingPopOut(ui: UICanvas, position: Position) {
|
||||||
when (position) {
|
when (position) {
|
||||||
Position.LEFT -> ui.handler.posX = -ui.width
|
Position.LEFT -> ui.handler.posX = -ui.width
|
||||||
Position.TOP -> ui.handler.posY = -ui.height
|
Position.TOP -> ui.handler.posY = -ui.height
|
||||||
Position.RIGHT -> ui.handler.posX = Terrarum.WIDTH
|
Position.RIGHT -> ui.handler.posX = AppLoader.screenW
|
||||||
Position.BOTTOM -> ui.handler.posY = Terrarum.HEIGHT
|
Position.BOTTOM -> ui.handler.posY = AppLoader.screenH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,9 @@ package net.torvald.terrarum.worlddrawer
|
|||||||
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.ColourTemp
|
import net.torvald.colourutil.ColourTemp
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.blendMul
|
|
||||||
import net.torvald.terrarum.blendNormal
|
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.blockstats.BlockStats
|
import net.torvald.terrarum.blockstats.BlockStats
|
||||||
import net.torvald.terrarum.fillRect
|
|
||||||
import net.torvald.terrarum.gameworld.GameWorld
|
import net.torvald.terrarum.gameworld.GameWorld
|
||||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
|
import net.torvald.terrarum.worlddrawer.CreateTileAtlas.TILE_SIZE
|
||||||
|
|
||||||
@@ -46,7 +43,7 @@ object FeaturesDrawer {
|
|||||||
* usually targeted for the environmental temperature (desert/winterland), hence the name.
|
* usually targeted for the environmental temperature (desert/winterland), hence the name.
|
||||||
*/
|
*/
|
||||||
fun drawEnvOverlay(batch: SpriteBatch) {
|
fun drawEnvOverlay(batch: SpriteBatch) {
|
||||||
val onscreen_tiles_max = FastMath.ceil(Terrarum.HEIGHT * Terrarum.WIDTH / FastMath.sqr (TILE_SIZE.toFloat())) * 2
|
val onscreen_tiles_max = FastMath.ceil(AppLoader.screenH * AppLoader.screenW / FastMath.sqr (TILE_SIZE.toFloat())) * 2
|
||||||
val onscreen_tiles_cap = onscreen_tiles_max / 4f
|
val onscreen_tiles_cap = onscreen_tiles_max / 4f
|
||||||
val onscreen_cold_tiles = BlockStats.getCount(*TILES_COLD).toFloat()
|
val onscreen_cold_tiles = BlockStats.getCount(*TILES_COLD).toFloat()
|
||||||
val onscreen_warm_tiles = BlockStats.getCount(*TILES_WARM).toFloat()
|
val onscreen_warm_tiles = BlockStats.getCount(*TILES_WARM).toFloat()
|
||||||
@@ -60,8 +57,8 @@ object FeaturesDrawer {
|
|||||||
|
|
||||||
batch.color = ColourTemp(colTemp)
|
batch.color = ColourTemp(colTemp)
|
||||||
batch.fillRect(0f, 0f,
|
batch.fillRect(0f, 0f,
|
||||||
Terrarum.WIDTH * if (zoom < 1) 1f / zoom else zoom,
|
AppLoader.screenW * if (zoom < 1) 1f / zoom else zoom,
|
||||||
Terrarum.HEIGHT * if (zoom < 1) 1f / zoom else zoom
|
AppLoader.screenH * if (zoom < 1) 1f / zoom else zoom
|
||||||
)
|
)
|
||||||
|
|
||||||
blendNormal(batch)
|
blendNormal(batch)
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ object LightmapRenderer {
|
|||||||
|
|
||||||
// TODO resize(int, int) -aware
|
// TODO resize(int, int) -aware
|
||||||
|
|
||||||
var LIGHTMAP_WIDTH = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(Terrarum.WIDTH).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
var LIGHTMAP_WIDTH = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenW).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
||||||
var LIGHTMAP_HEIGHT = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(Terrarum.HEIGHT).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
var LIGHTMAP_HEIGHT = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenH).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
||||||
|
|
||||||
private val noopMask = HashSet<Point2i>((LIGHTMAP_WIDTH + LIGHTMAP_HEIGHT) * 2)
|
private val noopMask = HashSet<Point2i>((LIGHTMAP_WIDTH + LIGHTMAP_HEIGHT) * 2)
|
||||||
|
|
||||||
@@ -754,8 +754,8 @@ object LightmapRenderer {
|
|||||||
val tilesInHorizontal = (screenW.toFloat() / TILE_SIZE).ceilInt() + 1
|
val tilesInHorizontal = (screenW.toFloat() / TILE_SIZE).ceilInt() + 1
|
||||||
val tilesInVertical = (screenH.toFloat() / TILE_SIZE).ceilInt() + 1
|
val tilesInVertical = (screenH.toFloat() / TILE_SIZE).ceilInt() + 1
|
||||||
|
|
||||||
LIGHTMAP_WIDTH = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(Terrarum.WIDTH).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
LIGHTMAP_WIDTH = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenW).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
||||||
LIGHTMAP_HEIGHT = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(Terrarum.HEIGHT).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
LIGHTMAP_HEIGHT = (Terrarum.ingame?.ZOOM_MINIMUM ?: 1f).inv().times(AppLoader.screenH).div(TILE_SIZE).ceil() + overscan_open * 2 + 3
|
||||||
|
|
||||||
if (_init) {
|
if (_init) {
|
||||||
lightBuffer.dispose()
|
lightBuffer.dispose()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.worlddrawer
|
package net.torvald.terrarum.worlddrawer
|
||||||
|
|
||||||
import com.jme3.math.FastMath
|
import com.jme3.math.FastMath
|
||||||
|
import net.torvald.terrarum.AppLoader
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
import net.torvald.terrarum.floorInt
|
import net.torvald.terrarum.floorInt
|
||||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||||
@@ -39,8 +40,8 @@ object WorldCamera {
|
|||||||
fun update(world: GameWorld, player: ActorWithBody?) {
|
fun update(world: GameWorld, player: ActorWithBody?) {
|
||||||
if (player == null) return
|
if (player == null) return
|
||||||
|
|
||||||
width = FastMath.ceil(Terrarum.WIDTH / (Terrarum.ingame?.screenZoom ?: 1f)) // div, not mul
|
width = FastMath.ceil(AppLoader.screenW / (Terrarum.ingame?.screenZoom ?: 1f)) // div, not mul
|
||||||
height = FastMath.ceil(Terrarum.HEIGHT / (Terrarum.ingame?.screenZoom ?: 1f))
|
height = FastMath.ceil(AppLoader.screenH / (Terrarum.ingame?.screenZoom ?: 1f))
|
||||||
|
|
||||||
// TOP-LEFT position of camera border
|
// TOP-LEFT position of camera border
|
||||||
|
|
||||||
@@ -64,8 +65,8 @@ object WorldCamera {
|
|||||||
private fun Int.clampCameraY(world: GameWorld): Int {
|
private fun Int.clampCameraY(world: GameWorld): Int {
|
||||||
return if (this < 0)
|
return if (this < 0)
|
||||||
0
|
0
|
||||||
else if (this > world.height.times(TILE_SIZE) - Terrarum.HEIGHT)
|
else if (this > world.height.times(TILE_SIZE) - AppLoader.screenH)
|
||||||
world.height.times(TILE_SIZE) - Terrarum.HEIGHT
|
world.height.times(TILE_SIZE) - AppLoader.screenH
|
||||||
else
|
else
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user