mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
load screen adj, faster gravity response for standard
This commit is contained in:
@@ -1913,7 +1913,7 @@
|
||||
},
|
||||
{
|
||||
"n": "MENU_IO_LOADING",
|
||||
"s": "불러오는 중"
|
||||
"s": "불러오는 중..."
|
||||
},
|
||||
{
|
||||
"n": "MENU_IO_PLEASE_WAIT",
|
||||
|
||||
Binary file not shown.
@@ -51,7 +51,7 @@ object ColorLimiterTest : ApplicationAdapter() {
|
||||
override fun render() {
|
||||
Gdx.graphics.setTitle("TestTestTest — F: ${Gdx.graphics.framesPerSecond}")
|
||||
|
||||
Gdx.gl.glClearColor(.157f, .157f, .157f, 0f)
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
|
||||
|
||||
@@ -82,12 +82,12 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
private val worldFBOformat = if (Terrarum.environment == RunningEnvironment.MOBILE) Pixmap.Format.RGBA4444 else Pixmap.Format.RGBA8888
|
||||
private val lightFBOformat = Pixmap.Format.RGB888
|
||||
|
||||
var worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true)
|
||||
var worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true)
|
||||
var worldBlendFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true)
|
||||
var worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||
var worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||
var worldBlendFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||
// RGB elements of Lightmap for Color Vec4(R, G, B, 1.0) 24-bit
|
||||
var lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true)
|
||||
var lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true)
|
||||
var lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
||||
var lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
||||
|
||||
|
||||
init {
|
||||
@@ -406,7 +406,9 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
if (!postInitDone) { // Q&D solution for LoadScreen and Ingame, where while LoadScreen is working, Ingame now no longer has GL Context
|
||||
// Q&D solution for LoadScreen and Ingame, where while LoadScreen is working, Ingame now no longer has GL Context
|
||||
// there's still things to load which needs GL context to be present
|
||||
if (!postInitDone) {
|
||||
|
||||
if (gameLoadMode == GameLoadMode.CREATE_NEW) {
|
||||
playableActorDelegate = PlayableActorDelegate(PlayerBuilderSigrid())
|
||||
@@ -529,7 +531,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
private var blurReadBuffer = lightmapFboB
|
||||
|
||||
private fun renderGame(batch: SpriteBatch) {
|
||||
Gdx.gl.glClearColor(.157f, .157f, .157f, 0f)
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
//camera.position.set(-WorldCamera.x.toFloat(), -WorldCamera.y.toFloat(), 0f) // make camara work
|
||||
@@ -1515,15 +1517,15 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
*/
|
||||
override fun resize(width: Int, height: Int) {
|
||||
worldDrawFrameBuffer.dispose()
|
||||
worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true)
|
||||
worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||
worldGlowFrameBuffer.dispose()
|
||||
worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true)
|
||||
worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||
worldBlendFrameBuffer.dispose()
|
||||
worldBlendFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, true)
|
||||
worldBlendFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||
lightmapFboA.dispose()
|
||||
lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true)
|
||||
lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
||||
lightmapFboB.dispose()
|
||||
lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), true)
|
||||
lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
||||
|
||||
|
||||
// Set up viewport when window is resized
|
||||
|
||||
@@ -43,7 +43,7 @@ object LoadScreen : ScreenAdapter() {
|
||||
private lateinit var textOverlayTex: Texture
|
||||
private lateinit var textFbo: FrameBuffer
|
||||
|
||||
private val ghostMaxZoomX = 1.3f
|
||||
private val ghostMaxZoomX = 1.25f
|
||||
private val ghostAlphaMax = 1f
|
||||
|
||||
var camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
|
||||
@@ -63,6 +63,8 @@ object LoadScreen : ScreenAdapter() {
|
||||
|
||||
override fun show() {
|
||||
messages.clear()
|
||||
doContextChange = false
|
||||
glideTimer = 0f
|
||||
|
||||
|
||||
if (screenToLoad == null) {
|
||||
@@ -99,33 +101,40 @@ object LoadScreen : ScreenAdapter() {
|
||||
val textX: Float; get() = (Terrarum.WIDTH * 0.75f).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 doContextChange = false
|
||||
|
||||
private var messageBackgroundColour = Color(0x404040ff)
|
||||
private var messageForegroundColour = Color.WHITE
|
||||
|
||||
override fun render(delta: Float) {
|
||||
// if loading is done, escape and set screen of the Game to the target
|
||||
if (screenToLoad?.gameFullyLoaded ?: false) {
|
||||
Terrarum.changeScreen(screenToLoad!!)
|
||||
}
|
||||
else {
|
||||
glideDispY = Terrarum.HEIGHT - 100f - Terrarum.fontGame.lineHeight
|
||||
arrowObjGlideSize = arrowObjTex.width + 2f * Terrarum.WIDTH
|
||||
glideDispY = Terrarum.HEIGHT - 100f - Terrarum.fontGame.lineHeight
|
||||
arrowObjGlideSize = arrowObjTex.width + 2f * Terrarum.WIDTH
|
||||
|
||||
|
||||
|
||||
Gdx.gl.glClearColor(.157f, .157f, .157f, 0f)
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
textFbo.inAction(null, null) {
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
}
|
||||
|
||||
textFbo.inAction(null, null) {
|
||||
Gdx.gl.glClearColor(0f, 0f, 0f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
glideTimer += delta
|
||||
// reset timer
|
||||
if (glideTimer >= arrowObjGlideSize / arrowGlideSpeed) {
|
||||
glideTimer -= arrowObjGlideSize / arrowGlideSpeed
|
||||
|
||||
// change screen WHEN the timer is reset.
|
||||
// In other words, the arrow must hit the goal BEFORE context change take place
|
||||
if (screenToLoad?.gameFullyLoaded ?: false) {
|
||||
doContextChange = true
|
||||
}
|
||||
|
||||
glideTimer += delta
|
||||
if (glideTimer >= arrowObjGlideSize / arrowGlideSpeed) {
|
||||
glideTimer -= arrowObjGlideSize / arrowGlideSpeed
|
||||
}
|
||||
arrowObjPos = glideTimer * arrowGlideSpeed
|
||||
}
|
||||
arrowObjPos = glideTimer * arrowGlideSpeed
|
||||
|
||||
|
||||
if (!doContextChange) {
|
||||
// draw text to FBO
|
||||
textFbo.inAction(camera, Terrarum.batch) {
|
||||
Terrarum.batch.inUse {
|
||||
@@ -184,8 +193,39 @@ object LoadScreen : ScreenAdapter() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// message backgrounds
|
||||
it.color = messageBackgroundColour
|
||||
it.fillRect(0f, 60f, Terrarum.WIDTH.toFloat(), 40f + (messages.size) * Terrarum.fontGame.lineHeight)
|
||||
|
||||
// log messages
|
||||
it.color = Color.LIGHT_GRAY
|
||||
it.color = messageForegroundColour
|
||||
for (i in 0 until messages.elemCount) {
|
||||
Terrarum.fontGame.draw(it,
|
||||
messages[i] ?: "",
|
||||
40f,
|
||||
80f + (messages.size - i - 1) * Terrarum.fontGame.lineHeight
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Terrarum.batch.inUse {
|
||||
// recycling part of the draw code //
|
||||
|
||||
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT) // dunno, no render without this
|
||||
it.projectionMatrix = camera.combined
|
||||
blendNormal()
|
||||
|
||||
|
||||
|
||||
// message backgrounds
|
||||
it.color = messageBackgroundColour
|
||||
it.fillRect(0f, 60f, Terrarum.WIDTH.toFloat(), 40f + (messages.size) * Terrarum.fontGame.lineHeight)
|
||||
|
||||
// log messages
|
||||
it.color = messageForegroundColour
|
||||
for (i in 0 until messages.elemCount) {
|
||||
Terrarum.fontGame.draw(it,
|
||||
messages[i] ?: "",
|
||||
@@ -195,6 +235,11 @@ object LoadScreen : ScreenAdapter() {
|
||||
}
|
||||
}
|
||||
|
||||
Terrarum.batch.flush()
|
||||
|
||||
Thread.sleep(80)
|
||||
|
||||
Terrarum.changeScreen(screenToLoad!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ object Terrarum : Game() {
|
||||
/**
|
||||
* To be used with physics simulator
|
||||
*/
|
||||
val TARGET_FPS: Double = 33.33333333333333333333333 // higher value == faster gravity responce
|
||||
val TARGET_FPS: Double = 26.6666666666666666666666666 // lower value == faster gravity responce (IT WON'T HOTSWAP!!)
|
||||
|
||||
/**
|
||||
* To be used with render, to achieve smooth frame drawing
|
||||
@@ -536,6 +536,8 @@ object Terrarum : Game() {
|
||||
private val defaultConfig = DefaultConfig.fetch()
|
||||
|
||||
private fun getConfigMaster(key: String): Any {
|
||||
val key = key.toLowerCase()
|
||||
|
||||
val config = try {
|
||||
gameConfig[key]
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class TestTestTest(val batch: SpriteBatch) : Screen {
|
||||
val radius = 4f
|
||||
|
||||
|
||||
Gdx.gl.glClearColor(.157f, .157f, .157f, 0f)
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ object PlayerBuilderSigrid {
|
||||
p.actorValue[AVKey.SPEEDBUFF] = 1.0
|
||||
p.actorValue[AVKey.ACCEL] = ActorHumanoid.WALK_ACCEL_BASE
|
||||
p.actorValue[AVKey.ACCELBUFF] = 1.0
|
||||
p.actorValue[AVKey.JUMPPOWER] = 8.0
|
||||
p.actorValue[AVKey.JUMPPOWER] = 10.0
|
||||
|
||||
p.actorValue[AVKey.BASEMASS] = 80.0
|
||||
p.actorValue[AVKey.SCALEBUFF] = 1.0 // Constant 1.0 for player, meant to be used by random mobs
|
||||
@@ -52,7 +52,7 @@ object PlayerBuilderSigrid {
|
||||
//p.actorValue[AVKey.LUMR] = 0.84
|
||||
//p.actorValue[AVKey.LUMG] = 0.93
|
||||
//p.actorValue[AVKey.LUMB] = 1.37
|
||||
//p.actorValue[AVKey.LUMA] = 1.93
|
||||
p.actorValue[AVKey.LUMA] = 1.93
|
||||
|
||||
p.actorValue[AVKey.BASEDEFENCE] = 141
|
||||
|
||||
|
||||
@@ -144,10 +144,10 @@ object GameController : InputAdapter() {
|
||||
val itemOnGrip = ingame.player!!.inventory.itemEquipped[GameItem.EquipPosition.HAND_GRIP]
|
||||
|
||||
if (itemOnGrip != null) {
|
||||
if (button == Terrarum.getConfigInt("mousePrimary")) {
|
||||
if (button == Terrarum.getConfigInt("mouseprimary")) {
|
||||
itemOnGrip.endPrimaryUse(Gdx.graphics.deltaTime)
|
||||
}
|
||||
if (button == Terrarum.getConfigInt("mouseSecondary")) {
|
||||
if (button == Terrarum.getConfigInt("mousesecondary")) {
|
||||
itemOnGrip.endSecondaryUse(Gdx.graphics.deltaTime)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user