GenuineSonic

This commit is contained in:
minjaesong
2017-07-13 18:07:12 +09:00
parent d241e5cbb0
commit d9a3318768

View File

@@ -4,14 +4,11 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Screen import com.badlogic.gdx.Screen
import com.badlogic.gdx.ScreenAdapter import com.badlogic.gdx.ScreenAdapter
import com.badlogic.gdx.graphics.* import com.badlogic.gdx.graphics.*
import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.graphics.glutils.FrameBuffer import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.jme3.math.FastMath import com.jme3.math.FastMath
import net.torvald.dataclass.CircularArray
import net.torvald.dataclass.HistoryArray import net.torvald.dataclass.HistoryArray
import net.torvald.terrarum.gameactors.floor import net.torvald.terrarum.gameactors.floor
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
/** /**
* Created by minjaesong on 2017-07-13. * Created by minjaesong on 2017-07-13.
@@ -46,7 +43,7 @@ object LoadScreen : ScreenAdapter() {
private lateinit var textOverlayTex: Texture private lateinit var textOverlayTex: Texture
private lateinit var textFbo: FrameBuffer private lateinit var textFbo: FrameBuffer
private val ghostMaxZoom = 1.3f private val ghostMaxZoomX = 1.3f
private val ghostAlphaMax = 1f private val ghostAlphaMax = 1f
var camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat()) var camera = OrthographicCamera(Terrarum.WIDTH.toFloat(), Terrarum.HEIGHT.toFloat())
@@ -90,6 +87,8 @@ object LoadScreen : ScreenAdapter() {
val textX: Float; get() = (Terrarum.WIDTH * 0.75f).floor() 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)
override fun render(delta: Float) { override fun render(delta: Float) {
glideDispY = Terrarum.HEIGHT - 100f - Terrarum.fontGame.lineHeight glideDispY = Terrarum.HEIGHT - 100f - Terrarum.fontGame.lineHeight
arrowObjGlideSize = arrowObjTex.width + 2f * Terrarum.WIDTH arrowObjGlideSize = arrowObjTex.width + 2f * Terrarum.WIDTH
@@ -140,20 +139,26 @@ object LoadScreen : ScreenAdapter() {
// draw text FBO to screen // draw text FBO to screen
val textTex = textFbo.colorBufferTexture val textTex = textFbo.colorBufferTexture
textTex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest) textTex.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
// --> original text // --> original text
it.color = Color.WHITE if (genuineSonic) {
it.draw(textTex, textX, glideDispY - 2f) it.color = Color.WHITE
it.draw(textTex, textX, glideDispY - 2f)
}
// --> ghost // --> ghost
it.color = getPulseEffCol() it.color = getPulseEffCol()
if (it.color.a != 0f) genuineSonic = true
val drawWidth = getPulseEffWidthMul() * textTex.width val drawWidth = getPulseEffWidthMul() * textTex.width
val drawHeight = getPulseEffWidthMul() * textTex.height
it.draw(textTex, it.draw(textTex,
textX - (drawWidth - textTex.width) / 2f, textX - (drawWidth - textTex.width) / 2f,
glideDispY - 2f, glideDispY - 2f - (drawHeight - textTex.height) / 2f,
drawWidth, drawWidth,
textTex.height.toFloat() drawHeight
) )
@@ -202,7 +207,7 @@ object LoadScreen : ScreenAdapter() {
val scaleEnd = arrowObjGlideSize - arrowObjTex.width * 3f val scaleEnd = arrowObjGlideSize - arrowObjTex.width * 3f
val scale = (arrowObjPos - scaleStart) / (scaleEnd - scaleStart) val scale = (arrowObjPos - scaleStart) / (scaleEnd - scaleStart)
return FastMath.interpolateLinear(scale, 1f, ghostMaxZoom) return FastMath.interpolateLinear(scale, 1f, ghostMaxZoomX)
} }
} }