mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-09 13:21:51 +09:00
some sort of error screen impl
This commit is contained in:
@@ -304,6 +304,27 @@ final public class FastMath {
|
||||
}
|
||||
|
||||
|
||||
public static float interpolateHermite(float scale, float p0, float p1, float p2, float p3) {
|
||||
return interpolateHermite(scale, p0, p1, p2, p3, 1f, 0f);
|
||||
}
|
||||
public static float interpolateHermite(float scale, float p0, float p1, float p2, float p3, float tension, float bias) {
|
||||
float mu2 = scale * scale;
|
||||
float mu3 = mu2 * scale;
|
||||
|
||||
float m0 = (p1 - p0) * (1f + bias) * (1f - tension) / 2f;
|
||||
m0 += (p2 - p1) * (1f + bias) * (1f - tension) / 2f;
|
||||
float m1 = (p2 - p1) * (1f + bias) * (1f - tension) / 2f;
|
||||
m1 += (p3 - p2) * (1f + bias) * (1f - tension) / 2f;
|
||||
|
||||
float a0 = 2 * mu3 - 3 * mu2 + 1;
|
||||
float a1 = mu3 - 2 * mu2 + scale;
|
||||
float a2 = mu3 - mu2;
|
||||
float a3 = -2 * mu3 + 3 * mu2;
|
||||
|
||||
return a0 * p1 + a1 * m0 + a2 * m1 + a3 * p2;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the arc cosine of an angle given in radians.<br>
|
||||
* Special cases:
|
||||
|
||||
@@ -6,13 +6,14 @@ object CreditSingleton {
|
||||
|
||||
val credit: List<String>; get() =
|
||||
("${Lang["CREDITS_PROGRAMMER"]}\n\nTorvald (minjaesong)\n\n" +
|
||||
"${Lang["CREDITS_ARTIST_PLURAL"]}\n\nTorvald (minjaesong)\nRoundworld (leedonggeun)" +
|
||||
"${Lang["CREDITS_ARTIST_PLURAL"]}\n\nTorvald (minjaesong)\nRoundworld (leedonggeun)\n\n" +
|
||||
"${Lang["CREDITS_POLYGLOT"]}" +
|
||||
"""
|
||||
|
||||
|
||||
|
||||
|
||||
Copyright Informations
|
||||
Copyright Information
|
||||
|
||||
|
||||
|
||||
|
||||
102
src/net/torvald/terrarum/ErrorDisp.kt
Normal file
102
src/net/torvald/terrarum/ErrorDisp.kt
Normal file
@@ -0,0 +1,102 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.Screen
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
object ErrorDisp : Screen {
|
||||
|
||||
val logoTex = TerrarumAppLoader.logo
|
||||
val font = TerrarumAppLoader.fontGame
|
||||
|
||||
|
||||
var title = Lang["ERROR_GENERIC_TEXT"]
|
||||
var text = arrayListOf<String>("")
|
||||
|
||||
lateinit var batch: SpriteBatch
|
||||
|
||||
|
||||
val textPosX = 45f
|
||||
|
||||
lateinit var camera: OrthographicCamera
|
||||
|
||||
|
||||
val titleTextLeftMargin = 8
|
||||
val titleText = "${TerrarumAppLoader.GAME_NAME} ${TerrarumAppLoader.getVERSION_STRING()}"
|
||||
|
||||
|
||||
override fun show() {
|
||||
batch = SpriteBatch()
|
||||
|
||||
|
||||
camera = OrthographicCamera(Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
|
||||
camera.setToOrtho(true)
|
||||
camera.update()
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
|
||||
|
||||
// draw background
|
||||
|
||||
|
||||
// draw logo
|
||||
batch.inUse {
|
||||
batch.projectionMatrix = camera.combined
|
||||
|
||||
val headerLogoW = (logoTex.texture.width / 4f).toInt()
|
||||
val headerLogoH = (logoTex.texture.height / 4f).toInt()
|
||||
val headerTextWidth = font.getWidth(titleText)
|
||||
val headerTotalWidth = headerLogoW + titleTextLeftMargin + headerTextWidth
|
||||
val headerLogoXPos = (Gdx.graphics.width - headerTotalWidth).div(2)
|
||||
val headerLogoYPos = 25 + headerLogoH
|
||||
batch.color = Color.WHITE
|
||||
batch.draw(logoTex.texture, headerLogoXPos.toFloat(), headerLogoYPos.toFloat(), headerLogoW.toFloat(), -headerLogoH.toFloat())
|
||||
font.draw(batch, titleText, headerLogoXPos + headerLogoW.toFloat() + titleTextLeftMargin, headerLogoYPos -(headerLogoH / 2f) - font.lineHeight + 4)
|
||||
|
||||
|
||||
// draw error text
|
||||
batch.color = Color(0xff8080ff.toInt())
|
||||
font.draw(batch, title, textPosX, logoTex.texture.height / 4f * 2 + 50f)
|
||||
|
||||
batch.color = Color.WHITE
|
||||
text.forEachIndexed { index, s ->
|
||||
font.draw(batch, s, textPosX, logoTex.texture.height / 4f * 2 + 130f + index * font.lineHeight)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun hide() {
|
||||
}
|
||||
|
||||
override fun pause() {
|
||||
}
|
||||
|
||||
override fun resume() {
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class TerrarumRuntimeException(messageTitle: String, message: List<String>? = null) : RuntimeException() {
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -244,7 +244,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
||||
println("[Ingame] loaded successfully.")
|
||||
}
|
||||
else {
|
||||
LoadScreen.addMessage("${Terrarum.NAME} version ${Terrarum.VERSION_STRING}")
|
||||
LoadScreen.addMessage("${Terrarum.NAME} version ${TerrarumAppLoader.getVERSION_STRING()}")
|
||||
LoadScreen.addMessage("Creating new world")
|
||||
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ object LoadScreen : ScreenAdapter() {
|
||||
|
||||
Thread.sleep(80)
|
||||
|
||||
Terrarum.changeScreen(screenToLoad!!)
|
||||
Terrarum.setScreen(screenToLoad!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,33 +72,38 @@ object ModMgr {
|
||||
val moduleName = it[0]
|
||||
println("[ModMgr] Loading module $moduleName")
|
||||
|
||||
val modMetadata = Properties()
|
||||
modMetadata.load(FileInputStream("$modDir/$moduleName/metadata.properties"))
|
||||
try {
|
||||
val modMetadata = Properties()
|
||||
modMetadata.load(FileInputStream("$modDir/$moduleName/metadata.properties"))
|
||||
|
||||
val properName = modMetadata.getProperty("propername")
|
||||
val description = modMetadata.getProperty("description")
|
||||
val author = modMetadata.getProperty("author")
|
||||
val entryPoint = modMetadata.getProperty("entrypoint")
|
||||
val releaseDate = modMetadata.getProperty("releasedate")
|
||||
val version = modMetadata.getProperty("version")
|
||||
val libs = modMetadata.getProperty("libraries").split(';').toTypedArray()
|
||||
val isDir = FileSystems.getDefault().getPath("$modDir/$moduleName").toFile().isDirectory
|
||||
moduleInfo[moduleName] = ModuleMetadata(index, isDir, properName, description, author, entryPoint, releaseDate, version, libs)
|
||||
val properName = modMetadata.getProperty("propername")
|
||||
val description = modMetadata.getProperty("description")
|
||||
val author = modMetadata.getProperty("author")
|
||||
val entryPoint = modMetadata.getProperty("entrypoint")
|
||||
val releaseDate = modMetadata.getProperty("releasedate")
|
||||
val version = modMetadata.getProperty("version")
|
||||
val libs = modMetadata.getProperty("libraries").split(';').toTypedArray()
|
||||
val isDir = FileSystems.getDefault().getPath("$modDir/$moduleName").toFile().isDirectory
|
||||
moduleInfo[moduleName] = ModuleMetadata(index, isDir, properName, description, author, entryPoint, releaseDate, version, libs)
|
||||
|
||||
println(moduleInfo[moduleName])
|
||||
println(moduleInfo[moduleName])
|
||||
|
||||
|
||||
// run entry script in entry point
|
||||
if (entryPoint.isNotBlank()) {
|
||||
val extension = entryPoint.split('.').last()
|
||||
val engine = ScriptEngineManager().getEngineByExtension(extension)!!
|
||||
val invocable = engine as Invocable
|
||||
engine.eval(FileReader(getFile(moduleName, entryPoint)))
|
||||
invocable.invokeFunction("invoke", moduleName)
|
||||
// run entry script in entry point
|
||||
if (entryPoint.isNotBlank()) {
|
||||
val extension = entryPoint.split('.').last()
|
||||
val engine = ScriptEngineManager().getEngineByExtension(extension)!!
|
||||
val invocable = engine as Invocable
|
||||
engine.eval(FileReader(getFile(moduleName, entryPoint)))
|
||||
invocable.invokeFunction("invoke", moduleName)
|
||||
}
|
||||
|
||||
|
||||
println("[ModMgr] $moduleName loaded successfully")
|
||||
}
|
||||
catch (noSuchModule: FileNotFoundException) {
|
||||
System.err.println("[ModMgr] No such module: $moduleName, skipping...")
|
||||
}
|
||||
|
||||
|
||||
println("[ModMgr] $moduleName loaded successfully")
|
||||
}
|
||||
|
||||
|
||||
|
||||
119
src/net/torvald/terrarum/ShitOnGlsl.kt
Normal file
119
src/net/torvald/terrarum/ShitOnGlsl.kt
Normal file
@@ -0,0 +1,119 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.ApplicationAdapter
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
|
||||
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
|
||||
import com.badlogic.gdx.graphics.*
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-08-11.
|
||||
*/
|
||||
fun main(args: Array<String>) { // LWJGL 3 won't work? java.lang.VerifyError
|
||||
val config = LwjglApplicationConfiguration()
|
||||
//config.useGL30 = true
|
||||
config.vSyncEnabled = false
|
||||
config.resizable = false
|
||||
config.width = 1072
|
||||
config.height = 742
|
||||
config.foregroundFPS = 9999
|
||||
LwjglApplication(ShitOnGlsl, config)
|
||||
}
|
||||
|
||||
object ShitOnGlsl : ApplicationAdapter() {
|
||||
|
||||
lateinit var shader: ShaderProgram
|
||||
lateinit var font: GameFontBase
|
||||
|
||||
lateinit var fullscreenQuad: Mesh
|
||||
|
||||
lateinit var camera: OrthographicCamera
|
||||
|
||||
lateinit var batch: SpriteBatch
|
||||
|
||||
lateinit var fucktex: Texture
|
||||
|
||||
override fun create() {
|
||||
ShaderProgram.pedantic = false
|
||||
|
||||
shader = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/loadingCircle.frag"))
|
||||
|
||||
|
||||
font = GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", flipY = false)
|
||||
|
||||
|
||||
if (!shader.isCompiled) {
|
||||
Gdx.app.log("Shader", shader.log)
|
||||
System.exit(1)
|
||||
}
|
||||
|
||||
|
||||
|
||||
fullscreenQuad = Mesh(
|
||||
true, 4, 6,
|
||||
VertexAttribute.Position(),
|
||||
VertexAttribute.ColorUnpacked(),
|
||||
VertexAttribute.TexCoords(0)
|
||||
)
|
||||
|
||||
fullscreenQuad.setVertices(floatArrayOf(
|
||||
0f, 0f, 0f, 1f, 1f, 1f, 1f, 0f, 1f,
|
||||
Gdx.graphics.width.toFloat(), 0f, 0f, 1f, 1f, 1f, 1f, 1f, 1f,
|
||||
Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat(), 0f, 1f, 1f, 1f, 1f, 1f, 0f,
|
||||
0f, Gdx.graphics.height.toFloat(), 0f, 1f, 1f, 1f, 1f, 0f, 0f
|
||||
))
|
||||
fullscreenQuad.setIndices(shortArrayOf(0, 1, 2, 2, 3, 0))
|
||||
|
||||
|
||||
camera = OrthographicCamera(Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
|
||||
camera.setToOrtho(true, Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
|
||||
camera.update()
|
||||
|
||||
|
||||
batch = SpriteBatch()
|
||||
|
||||
fucktex = Texture(Gdx.files.internal("assets/graphics/ortho_line_tex_2px.tga"))
|
||||
}
|
||||
|
||||
|
||||
override fun render() {
|
||||
Gdx.graphics.setTitle("ShitOnGlsl — F: ${Gdx.graphics.framesPerSecond}")
|
||||
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
|
||||
|
||||
batch.inUse {
|
||||
|
||||
batch.shader = shader
|
||||
|
||||
shader.setUniformMatrix("u_projTrans", camera.combined)
|
||||
shader.setUniformi("u_texture", 0)
|
||||
shader.setUniformf("circleCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
|
||||
shader.setUniformf("colorCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
|
||||
shader.setUniformf("circleSize", 200f)
|
||||
//fullscreenQuad.render(shader, GL20.GL_TRIANGLES)
|
||||
|
||||
batch.draw(fucktex, 0f, 0f, Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*shader.begin()
|
||||
shader.setUniformMatrix("u_projTrans", batch.projectionMatrix)
|
||||
shader.setUniformi("u_texture", 0)
|
||||
shader.setUniformf("circleCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
|
||||
shader.setUniformf("colorCentrePoint", Gdx.graphics.width / 2f, Gdx.graphics.height / 2f)
|
||||
shader.setUniformf("circleSize", 200f)
|
||||
fullscreenQuad.render(shader, GL20.GL_TRIANGLES)
|
||||
shader.end()*/
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
shader.dispose()
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram
|
||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonPrimitive
|
||||
import net.torvald.random.HQRNG
|
||||
@@ -30,10 +31,12 @@ import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import org.lwjgl.BufferUtils
|
||||
import org.lwjgl.input.Controllers
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.lang.management.ManagementFactory
|
||||
import java.nio.IntBuffer
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -73,8 +76,8 @@ object Terrarum : Screen {
|
||||
|
||||
lateinit var appLoader: TerrarumAppLoader
|
||||
|
||||
internal var screenW: Int? = null
|
||||
internal var screenH: Int? = null
|
||||
var screenW = 0
|
||||
var screenH = 0
|
||||
|
||||
lateinit var batch: SpriteBatch
|
||||
lateinit var shapeRender: ShapeRenderer // DO NOT USE!! for very limited applications e.g. WeatherMixer
|
||||
@@ -90,12 +93,12 @@ object Terrarum : Screen {
|
||||
//////////////////////////////
|
||||
|
||||
val WIDTH: Int
|
||||
get() = if ((screenW ?: Gdx.graphics.width) % 2 == 0) (screenW ?: Gdx.graphics.width) else (screenW ?: Gdx.graphics.width) - 1
|
||||
get() = if (screenW % 2 == 0) screenW else screenW - 1
|
||||
val HEIGHT: Int
|
||||
get() = if ((screenH ?: Gdx.graphics.height) % 2 == 0) (screenH ?: Gdx.graphics.height) else (screenH ?: Gdx.graphics.height) - 1
|
||||
get() = if (screenH % 2 == 0) screenH else screenH - 1
|
||||
|
||||
val WIDTH_MIN = 800
|
||||
val HEIGHT_MIN = 600
|
||||
//val WIDTH_MIN = 800
|
||||
//val HEIGHT_MIN = 600
|
||||
|
||||
inline val HALFW: Int
|
||||
get() = WIDTH.ushr(1)
|
||||
@@ -153,7 +156,8 @@ object Terrarum : Screen {
|
||||
val memXmx: Long
|
||||
get() = Runtime.getRuntime().maxMemory() shr 20
|
||||
|
||||
val environment: RunningEnvironment
|
||||
var environment: RunningEnvironment
|
||||
private set
|
||||
|
||||
private val localeSimple = arrayOf("de", "en", "es", "it")
|
||||
var gameLocale = "lateinit"
|
||||
@@ -179,7 +183,7 @@ object Terrarum : Screen {
|
||||
|
||||
|
||||
|
||||
lateinit var fontGame: GameFontBase
|
||||
val fontGame: GameFontBase = TerrarumAppLoader.fontGame
|
||||
lateinit var fontSmallNumbers: TinyAlphNum
|
||||
|
||||
var joypadLabelStart: Char = 0xE000.toChar() // lateinit
|
||||
@@ -236,18 +240,7 @@ object Terrarum : Screen {
|
||||
|
||||
private lateinit var configDir: String
|
||||
|
||||
/**
|
||||
* 0xAA_BB_XXXX
|
||||
* AA: Major version
|
||||
* BB: Minor version
|
||||
* XXXX: Revision (Repository commits)
|
||||
*
|
||||
* e.g. 0x02010034 can be translated as 2.1.52
|
||||
*/
|
||||
const val VERSION_RAW = 0x00_02_0226
|
||||
const val VERSION_STRING: String =
|
||||
"${VERSION_RAW.ushr(24)}.${VERSION_RAW.and(0xFF0000).ushr(16)}.${VERSION_RAW.and(0xFFFF)}"
|
||||
const val NAME = "Terrarum"
|
||||
const val NAME = TerrarumAppLoader.GAME_NAME
|
||||
|
||||
|
||||
val systemArch = System.getProperty("os.arch")
|
||||
@@ -256,8 +249,6 @@ object Terrarum : Screen {
|
||||
|
||||
|
||||
lateinit var shaderBlur: ShaderProgram
|
||||
lateinit var shaderRGBOnly: ShaderProgram
|
||||
lateinit var shaderAOnly: ShaderProgram
|
||||
lateinit var shaderBayer: ShaderProgram
|
||||
lateinit var shaderBayerSkyboxFill: ShaderProgram
|
||||
lateinit var shaderBlendGlow: ShaderProgram
|
||||
@@ -274,7 +265,7 @@ object Terrarum : Screen {
|
||||
|
||||
|
||||
init {
|
||||
println("$NAME version $VERSION_STRING")
|
||||
println("$NAME version ${TerrarumAppLoader.getVERSION_STRING()}")
|
||||
|
||||
|
||||
getDefaultDirectory()
|
||||
@@ -331,6 +322,16 @@ object Terrarum : Screen {
|
||||
Gdx.graphics.glVersion.minorVersion * 10 +
|
||||
Gdx.graphics.glVersion.releaseVersion
|
||||
val MINIMAL_GL_VERSION = 210
|
||||
val GL_MAX_TEXTURE_SIZE: Int
|
||||
get() {
|
||||
val intBuffer = BufferUtils.createIntBuffer(16) // size must be at least 16, or else LWJGL complains
|
||||
Gdx.gl.glGetIntegerv(GL20.GL_MAX_TEXTURE_SIZE, intBuffer)
|
||||
|
||||
intBuffer.rewind()
|
||||
|
||||
return intBuffer.get()
|
||||
}
|
||||
val MINIMAL_GL_MAX_TEXTURE_SIZE = 4096
|
||||
|
||||
|
||||
override fun show() {
|
||||
@@ -341,12 +342,13 @@ object Terrarum : Screen {
|
||||
|
||||
|
||||
println("[Terrarum] GL_VERSION = $GL_VERSION")
|
||||
println("[Terrarum] GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE")
|
||||
println("[Terrarum] GL info:\n${Gdx.graphics.glVersion.debugVersionString}") // debug info
|
||||
|
||||
|
||||
if (GL_VERSION < MINIMAL_GL_VERSION) {
|
||||
if (GL_VERSION < MINIMAL_GL_VERSION || GL_MAX_TEXTURE_SIZE < MINIMAL_GL_MAX_TEXTURE_SIZE) {
|
||||
// TODO notify properly
|
||||
throw Error("Graphics device not capable -- device's GL_VERSION: $GL_VERSION, required: $MINIMAL_GL_VERSION")
|
||||
throw GdxRuntimeException("Graphics device not capable -- device's GL_VERSION: $GL_VERSION, required: $MINIMAL_GL_VERSION; GL_MAX_TEXTURE_SIZE: $GL_MAX_TEXTURE_SIZE, required: $MINIMAL_GL_MAX_TEXTURE_SIZE")
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +379,7 @@ object Terrarum : Screen {
|
||||
shapeRender = ShapeRenderer()
|
||||
|
||||
|
||||
fontGame = GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", flipY = true)
|
||||
//fontGame = GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", flipY = true)
|
||||
fontSmallNumbers = TinyAlphNum
|
||||
|
||||
|
||||
@@ -398,9 +400,6 @@ object Terrarum : Screen {
|
||||
shaderBayerSkyboxFill = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/4096_bayer_skyboxfill.frag"))
|
||||
|
||||
|
||||
shaderRGBOnly = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/rgbonly.frag"))
|
||||
shaderAOnly = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/aonly.frag"))
|
||||
|
||||
shaderBlendGlow = ShaderProgram(Gdx.files.internal("assets/blendGlow.vert"), Gdx.files.internal("assets/blendGlow.frag"))
|
||||
|
||||
if (!shaderBlendGlow.isCompiled) {
|
||||
@@ -444,7 +443,7 @@ object Terrarum : Screen {
|
||||
appLoader.setScreen(TitleScreen(batch))
|
||||
}
|
||||
|
||||
internal fun changeScreen(screen: Screen) {
|
||||
internal fun setScreen(screen: Screen) {
|
||||
appLoader.setScreen(screen)
|
||||
}
|
||||
|
||||
@@ -475,6 +474,12 @@ object Terrarum : Screen {
|
||||
MessageWindow.SEGMENT_BLACK.dispose()
|
||||
MessageWindow.SEGMENT_WHITE.dispose()
|
||||
//dispose any other resources used in this level
|
||||
|
||||
|
||||
shaderBayer.dispose()
|
||||
shaderBayerSkyboxFill.dispose()
|
||||
shaderBlur.dispose()
|
||||
shaderBlendGlow.dispose()
|
||||
}
|
||||
|
||||
override fun hide() {
|
||||
@@ -482,11 +487,14 @@ object Terrarum : Screen {
|
||||
}
|
||||
|
||||
override fun resize(width: Int, height: Int) {
|
||||
var width = maxOf(width, WIDTH_MIN)
|
||||
var height = maxOf(height, HEIGHT_MIN)
|
||||
//var width = maxOf(width, WIDTH_MIN)
|
||||
//var height = maxOf(height, HEIGHT_MIN)
|
||||
|
||||
if (width % 2 == 1) width += 1
|
||||
if (height % 2 == 1) height += 1
|
||||
var width = width
|
||||
var height = height
|
||||
|
||||
if (width % 2 == 1) width -= 1
|
||||
if (height % 2 == 1) height -= 1
|
||||
|
||||
screenW = width
|
||||
screenH = height
|
||||
@@ -521,7 +529,7 @@ object Terrarum : Screen {
|
||||
OperationSystem = "OSX"
|
||||
defaultDir = System.getProperty("user.home") + "/Library/Application Support/Terrarum"
|
||||
}
|
||||
else if (OS.contains("NUX") || OS.contains("NIX")) {
|
||||
else if (OS.contains("NUX") || OS.contains("NIX") || OS.contains("BSD")) {
|
||||
OperationSystem = "LINUX"
|
||||
defaultDir = System.getProperty("user.home") + "/.Terrarum"
|
||||
}
|
||||
@@ -529,6 +537,11 @@ object Terrarum : Screen {
|
||||
OperationSystem = "SOLARIS"
|
||||
defaultDir = System.getProperty("user.home") + "/.Terrarum"
|
||||
}
|
||||
else if (System.getProperty("java.runtime.name").toUpperCase().contains("ANDROID")) {
|
||||
OperationSystem = "ANDROID"
|
||||
defaultDir = System.getProperty("user.home") + "/.Terrarum"
|
||||
environment = RunningEnvironment.MOBILE
|
||||
}
|
||||
else {
|
||||
OperationSystem = "UNKNOWN"
|
||||
defaultDir = System.getProperty("user.home") + "/.Terrarum"
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.badlogic.gdx.graphics.*;
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase;
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-08-01.
|
||||
@@ -18,8 +20,23 @@ public class TerrarumAppLoader implements ApplicationListener {
|
||||
public static final String GAME_NAME = "Terrarum";
|
||||
public static final String COPYRIGHT_DATE_NAME = "Copyright 2013-2017 Torvald (minjaesong)";
|
||||
|
||||
/**
|
||||
* 0xAA_BB_XXXX
|
||||
* AA: Major version
|
||||
* BB: Minor version
|
||||
* XXXX: Revision (Repository commits)
|
||||
*
|
||||
* e.g. 0x02010034 can be translated as 2.1.52
|
||||
*/
|
||||
public static final int VERSION_RAW = 0x00_02_0226;
|
||||
public static final String getVERSION_STRING() {
|
||||
return String.format("%d.%d.%d", VERSION_RAW >>> 24, (VERSION_RAW & 0xff0000) >>> 16, VERSION_RAW & 0xFFFF);
|
||||
}
|
||||
|
||||
private static LwjglApplicationConfiguration appConfig;
|
||||
|
||||
public static GameFontBase fontGame;
|
||||
|
||||
public static void main(String[] args) {
|
||||
appConfig = new LwjglApplicationConfiguration();
|
||||
appConfig.vSyncEnabled = false;
|
||||
@@ -38,7 +55,7 @@ public class TerrarumAppLoader implements ApplicationListener {
|
||||
private Mesh fullscreenQuad;
|
||||
private OrthographicCamera camera;
|
||||
private SpriteBatch batch;
|
||||
private TextureRegion logo;
|
||||
public static TextureRegion logo;
|
||||
|
||||
private Color gradWhiteTop = new Color(0xf8f8f8ff);
|
||||
private Color gradWhiteBottom = new Color(0xd8d8d8ff);
|
||||
@@ -92,6 +109,10 @@ public class TerrarumAppLoader implements ApplicationListener {
|
||||
|
||||
logo = new TextureRegion(new Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga")));
|
||||
logo.flip(false, true);
|
||||
|
||||
|
||||
TextureRegionPack.Companion.setGlobalFlipY(true);
|
||||
fontGame = new GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", false, true, Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,6 +120,7 @@ public class TerrarumAppLoader implements ApplicationListener {
|
||||
if (screen == null) {
|
||||
shaderBayerSkyboxFill.begin();
|
||||
shaderBayerSkyboxFill.setUniformMatrix("u_projTrans", camera.combined);
|
||||
shaderBayerSkyboxFill.setUniformf("parallax_size", 0f);
|
||||
shaderBayerSkyboxFill.setUniformf("topColor", gradWhiteTop.r, gradWhiteTop.g, gradWhiteTop.b);
|
||||
shaderBayerSkyboxFill.setUniformf("bottomColor", gradWhiteBottom.r, gradWhiteBottom.g, gradWhiteBottom.b);
|
||||
fullscreenQuad.render(shaderBayerSkyboxFill, GL20.GL_TRIANGLES);
|
||||
@@ -121,7 +143,10 @@ public class TerrarumAppLoader implements ApplicationListener {
|
||||
|
||||
if (loadTimer >= showupTime) {
|
||||
Terrarum.INSTANCE.setAppLoader(this);
|
||||
setScreen(Terrarum.INSTANCE);
|
||||
Terrarum.INSTANCE.setScreenW(appConfig.width);
|
||||
Terrarum.INSTANCE.setScreenH(appConfig.height);
|
||||
//setScreen(Terrarum.INSTANCE);
|
||||
setScreen(ErrorDisp.INSTANCE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -131,7 +156,9 @@ public class TerrarumAppLoader implements ApplicationListener {
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
initViewPort(width, height);
|
||||
//initViewPort(width, height);
|
||||
|
||||
if (screen != null) screen.resize(width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -171,41 +171,20 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
||||
private var blurWriteBuffer = lightmapFboA
|
||||
private var blurReadBuffer = lightmapFboB
|
||||
|
||||
private val minimumIntroTime: Second = 2.0f
|
||||
private val introUncoverTime: Second = 0.3f
|
||||
private var showIntroDeltaCounter = 0f
|
||||
private var introUncoverDeltaCounter = 0f
|
||||
private var updateDeltaCounter = 0.0
|
||||
protected val updateRate = 1.0 / Terrarum.TARGET_INTERNAL_FPS
|
||||
|
||||
override fun render(delta: Float) {
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
if (!loadDone || showIntroDeltaCounter < minimumIntroTime) {
|
||||
// draw load screen
|
||||
Terrarum.shaderBayerSkyboxFill.begin()
|
||||
Terrarum.shaderBayerSkyboxFill.setUniformMatrix("u_projTrans", camera.combined)
|
||||
Terrarum.shaderBayerSkyboxFill.setUniformf("topColor", gradWhiteTop.r, gradWhiteTop.g, gradWhiteTop.b)
|
||||
Terrarum.shaderBayerSkyboxFill.setUniformf("bottomColor", gradWhiteBottom.r, gradWhiteBottom.g, gradWhiteBottom.b)
|
||||
Terrarum.fullscreenQuad.render(Terrarum.shaderBayerSkyboxFill, GL20.GL_TRIANGLES)
|
||||
Terrarum.shaderBayerSkyboxFill.end()
|
||||
|
||||
batch.inUse {
|
||||
batch.color = Color.WHITE
|
||||
blendNormal()
|
||||
batch.shader = null
|
||||
|
||||
|
||||
setCameraPosition(0f, 0f)
|
||||
batch.draw(logo, (Terrarum.WIDTH - logo.regionWidth) / 2f, (Terrarum.HEIGHT - logo.regionHeight) / 2f)
|
||||
}
|
||||
|
||||
if (!loadDone) {
|
||||
loadThingsWhileIntroIsVisible()
|
||||
}
|
||||
if (!loadDone) {
|
||||
loadThingsWhileIntroIsVisible()
|
||||
}
|
||||
else {
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f)
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
|
||||
|
||||
|
||||
// async update
|
||||
updateDeltaCounter += delta
|
||||
while (updateDeltaCounter >= updateRate) {
|
||||
@@ -215,11 +194,8 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
||||
|
||||
// render? just do it anyway
|
||||
renderScreen()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
showIntroDeltaCounter += delta
|
||||
}
|
||||
|
||||
fun updateScreen(delta: Float) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.console
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppLoader
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
/**
|
||||
@@ -10,7 +11,7 @@ import net.torvald.terrarum.langpack.Lang
|
||||
internal object Version : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
|
||||
Echo("${Terrarum.NAME} ${Terrarum.VERSION_STRING}")
|
||||
Echo("${Terrarum.NAME} ${TerrarumAppLoader.getVERSION_STRING()}")
|
||||
Echo("Polyglot language pack version ${Lang.POLYGLOT_VERSION}")
|
||||
Echo("GL_VERSION: ${Terrarum.GL_VERSION}")
|
||||
Echo("Renderer: ${Gdx.graphics.glVersion.rendererString}, ${Gdx.graphics.glVersion.vendorString}")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.gameactors.ai
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppLoader
|
||||
import net.torvald.terrarum.gameactors.AIControlled
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.ActorWithPhysics
|
||||
@@ -380,13 +381,13 @@ internal class AILuaAPI(g: Globals, actor: ActorWithPhysics) {
|
||||
|
||||
class GameVersion : ZeroArgFunction() {
|
||||
override fun call(): LuaValue {
|
||||
return Terrarum.VERSION_STRING.toLua()
|
||||
return TerrarumAppLoader.getVERSION_STRING().toLua()
|
||||
}
|
||||
}
|
||||
|
||||
class GameVersionRaw : ZeroArgFunction() {
|
||||
override fun call(): LuaValue {
|
||||
return Terrarum.VERSION_RAW.toLua()
|
||||
return TerrarumAppLoader.VERSION_RAW.toLua()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.dataclass.HistoryArray
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.TerrarumAppLoader
|
||||
import net.torvald.terrarum.console.Authenticator
|
||||
import net.torvald.terrarum.console.CommandInterpreter
|
||||
import net.torvald.terrarum.fillRect
|
||||
@@ -180,7 +181,7 @@ class ConsoleWindow : UICanvas() {
|
||||
commandInputPool = StringBuilder()
|
||||
|
||||
if (Authenticator.b()) {
|
||||
sendMessage("${Terrarum.NAME} ${Terrarum.VERSION_STRING}")
|
||||
sendMessage("${Terrarum.NAME} ${TerrarumAppLoader.getVERSION_STRING()}")
|
||||
sendMessage(Lang["DEV_MESSAGE_CONSOLE_CODEX"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class UIItemList<Item: UIItem>(
|
||||
init {
|
||||
itemList.forEachIndexed { index, item ->
|
||||
item.posX = this.posX
|
||||
item.posY = if (index == 0) this.posY else itemList[index - 1].posY + itemList[index - 1].height + this.posY
|
||||
item.posY = if (index == 0) this.posY else itemList[index - 1].posY + itemList[index - 1].height
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.gameactors.floor
|
||||
|
||||
class UIItemModuleInfoCell(
|
||||
@@ -19,47 +20,49 @@ class UIItemModuleInfoCell(
|
||||
private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4
|
||||
|
||||
override fun render(batch: SpriteBatch) {
|
||||
blendNormal()
|
||||
|
||||
if (ModMgr.moduleInfo.containsKey(moduleName)) {
|
||||
val modInfo = ModMgr.moduleInfo[moduleName]!!
|
||||
|
||||
// print load order index
|
||||
batch.color = Color(0x7f7f7fff)
|
||||
batch.color = Color(0xccccccff.toInt())
|
||||
var strlen = Terrarum.fontSmallNumbers.getWidth(modInfo.order.toString())
|
||||
Terrarum.fontSmallNumbers.draw(batch,
|
||||
modInfo.order.toString(),
|
||||
(numberAreaWidth - strlen).div(2f).floor(),
|
||||
(height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
posX + (numberAreaWidth - strlen).div(2f).floor(),
|
||||
posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
)
|
||||
|
||||
// print module name
|
||||
batch.color = Color.WHITE
|
||||
Terrarum.fontGame.draw(batch,
|
||||
"${modInfo.properName} (${modInfo.version})",
|
||||
numberAreaWidth.toFloat(),
|
||||
0f
|
||||
posX + numberAreaWidth.toFloat(),
|
||||
posY.toFloat()
|
||||
)
|
||||
|
||||
// print author name
|
||||
strlen = Terrarum.fontGame.getWidth(modInfo.author)
|
||||
Terrarum.fontGame.draw(batch,
|
||||
modInfo.author,
|
||||
width - strlen.toFloat(),
|
||||
0f
|
||||
posX + width - strlen.toFloat(),
|
||||
posY.toFloat()
|
||||
)
|
||||
|
||||
// print description
|
||||
Terrarum.fontGame.draw(batch,
|
||||
modInfo.description,
|
||||
numberAreaWidth.toFloat(),
|
||||
Terrarum.fontGame.lineHeight
|
||||
posX + numberAreaWidth.toFloat(),
|
||||
posY + Terrarum.fontGame.lineHeight
|
||||
)
|
||||
|
||||
// print releasedate
|
||||
strlen = Terrarum.fontGame.getWidth(modInfo.releaseDate)
|
||||
Terrarum.fontGame.draw(batch,
|
||||
modInfo.releaseDate,
|
||||
width - strlen.toFloat(),
|
||||
Terrarum.fontGame.lineHeight
|
||||
posX + width - strlen.toFloat(),
|
||||
posY + Terrarum.fontGame.lineHeight
|
||||
)
|
||||
|
||||
}
|
||||
@@ -69,8 +72,8 @@ class UIItemModuleInfoCell(
|
||||
val strlen = Terrarum.fontSmallNumbers.getWidth(str)
|
||||
Terrarum.fontSmallNumbers.draw(batch,
|
||||
str,
|
||||
(width - numberAreaWidth - strlen).div(2f).floor() + numberAreaWidth,
|
||||
(height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
posX + (width - numberAreaWidth - strlen).div(2f).floor() + numberAreaWidth,
|
||||
posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,16 @@ package net.torvald.terrarum.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.gameactors.Second
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2017-08-01.
|
||||
*/
|
||||
/*class UITitleRemoConModules(val superMenu: UICanvas) : UICanvas() {
|
||||
class UITitleRemoConModules(val superMenu: UICanvas) : UICanvas() {
|
||||
|
||||
val menuLabels = arrayOf(
|
||||
"MENU_LABEL_RETURN"
|
||||
@@ -22,9 +24,7 @@ import net.torvald.terrarum.langpack.Lang
|
||||
override var openCloseTime: Second = 0f
|
||||
|
||||
|
||||
private val moduleListWidth = Terrarum.WIDTH / 2
|
||||
|
||||
private val moduleList = UIItemList<UIItemModuleInfoCell>(
|
||||
private val menubar = UIItemTextButtonList(
|
||||
this,
|
||||
menuLabels,
|
||||
0, UITitleRemoConRoot.menubarOffY,
|
||||
@@ -39,44 +39,44 @@ import net.torvald.terrarum.langpack.Lang
|
||||
)
|
||||
|
||||
|
||||
private val textAreaHMargin = 48
|
||||
private val textAreaWidth = (Terrarum.WIDTH * 0.75).toInt()
|
||||
private val textAreaHeight = Terrarum.HEIGHT - textAreaHMargin * 2
|
||||
/*private val textArea = UIItemTextArea(this,
|
||||
Terrarum.WIDTH - textAreaWidth, textAreaHMargin,
|
||||
textAreaWidth, textAreaHeight,
|
||||
align = UIItemTextArea.Align.CENTRE
|
||||
)*/
|
||||
private val localeList = Lang.languageList.toList().sorted()
|
||||
private val textArea = UIItemTextButtonList(this,
|
||||
localeList.map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }.toTypedArray(),
|
||||
Terrarum.WIDTH - textAreaWidth, textAreaHMargin,
|
||||
textAreaWidth, textAreaHeight,
|
||||
textAreaWidth = textAreaWidth,
|
||||
readFromLang = false,
|
||||
activeBackCol = Color(0),
|
||||
highlightBackCol = Color(0),
|
||||
backgroundCol = Color(0),
|
||||
inactiveCol = Color.WHITE,
|
||||
defaultSelection = null
|
||||
private val moduleAreaHMargin = 48
|
||||
private val moduleAreaWidth = (Terrarum.WIDTH * 0.75).toInt() - moduleAreaHMargin
|
||||
private val moduleAreaHeight = Terrarum.HEIGHT - moduleAreaHMargin * 2
|
||||
|
||||
private val moduleInfoCells = ArrayList<UIItemModuleInfoCell>()
|
||||
// build module list
|
||||
init {
|
||||
ModMgr.moduleInfo.toList().sortedBy { it.second.order }.forEachIndexed { index, it ->
|
||||
moduleInfoCells.add(UIItemModuleInfoCell(
|
||||
this,
|
||||
it.first,
|
||||
moduleAreaWidth,
|
||||
0, 0 // placeholder
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
private val mouduleArea = UIItemList<UIItemModuleInfoCell>(
|
||||
this,
|
||||
moduleInfoCells,
|
||||
(Terrarum.WIDTH * 0.25f).toInt(), moduleAreaHMargin,
|
||||
moduleAreaWidth,
|
||||
moduleAreaHeight,
|
||||
inactiveCol = Color.WHITE
|
||||
)
|
||||
|
||||
|
||||
init {
|
||||
uiItems.add(menubar)
|
||||
uiItems.add(mouduleArea)
|
||||
|
||||
|
||||
//textArea.entireText = Lang.languageList.toList().sorted().map { Lang.langpack["MENU_LANGUAGE_THIS_$it"] ?: "!ERR: $it" }
|
||||
|
||||
////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
// attach listeners
|
||||
textArea.selectionChangeListener = { _, newSelectionIndex ->
|
||||
Terrarum.gameLocale = localeList[newSelectionIndex]
|
||||
}
|
||||
|
||||
menubar.buttons[menuLabels.indexOf("MENU_LABEL_RETURN")].clickOnceListener = { _, _, _ ->
|
||||
this.setAsClose()
|
||||
@@ -88,14 +88,15 @@ import net.torvald.terrarum.langpack.Lang
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
menubar.update(delta)
|
||||
textArea.update(delta)
|
||||
mouduleArea.update(delta)
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
menubar.render(batch)
|
||||
|
||||
batch.color = Color.WHITE
|
||||
textArea.render(batch)
|
||||
blendNormal()
|
||||
mouduleArea.render(batch)
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
@@ -113,4 +114,4 @@ import net.torvald.terrarum.langpack.Lang
|
||||
override fun dispose() {
|
||||
}
|
||||
|
||||
}*/
|
||||
}
|
||||
@@ -3,6 +3,9 @@ package net.torvald.terrarum.ui
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.Ingame
|
||||
import net.torvald.terrarum.LoadScreen
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
class UITitleRemoConRoot : UICanvas() {
|
||||
@@ -45,20 +48,20 @@ class UITitleRemoConRoot : UICanvas() {
|
||||
)
|
||||
|
||||
|
||||
//private val paneCredits = UIHandler()
|
||||
private val remoConCredits = UITitleRemoConCredits(this)
|
||||
|
||||
private val remoConLanguage = UITitleRemoConLanguage(this)
|
||||
|
||||
private val remoConModules = UITitleRemoConModules(this)
|
||||
|
||||
init {
|
||||
remoConLanguage.setPosition(0, 0)
|
||||
remoConCredits.setPosition(0, 0)
|
||||
remoConModules.setPosition(0, 0)
|
||||
|
||||
|
||||
|
||||
addSubUI(remoConLanguage)
|
||||
addSubUI(remoConCredits)
|
||||
addSubUI(remoConModules)
|
||||
|
||||
|
||||
////////////////////////////
|
||||
@@ -68,6 +71,26 @@ class UITitleRemoConRoot : UICanvas() {
|
||||
|
||||
|
||||
// attach listeners
|
||||
|
||||
// TEST TEST TEST
|
||||
menubar.buttons[menuLabels.indexOf("MENU_MODE_SINGLEPLAYER")].clickOnceListener = { _, _, _ ->
|
||||
this.setAsClose()
|
||||
Thread.sleep(50)
|
||||
|
||||
Terrarum.ingame = Ingame(Terrarum.batch)
|
||||
Terrarum.ingame!!.gameLoadInfoPayload = Ingame.NewWorldParameters(2400, 800, HQRNG().nextLong())
|
||||
Terrarum.ingame!!.gameLoadMode = Ingame.GameLoadMode.CREATE_NEW
|
||||
LoadScreen.screenToLoad = Terrarum.ingame!!
|
||||
Terrarum.setScreen(LoadScreen)
|
||||
}
|
||||
|
||||
|
||||
|
||||
menubar.buttons[menuLabels.indexOf("MENU_MODULES")].clickOnceListener = { _, _, _ ->
|
||||
this.setAsClose()
|
||||
Thread.sleep(50)
|
||||
remoConModules.setAsOpen()
|
||||
}
|
||||
menubar.buttons[menuLabels.indexOf("MENU_LABEL_LANGUAGE")].clickOnceListener = { _, _, _ ->
|
||||
this.setAsClose()
|
||||
Thread.sleep(50)
|
||||
|
||||
@@ -637,9 +637,8 @@ object WorldGenerator {
|
||||
val splineP3 = splineControlPoints[ clamp(x_1 + 2, 0, dirtStoneLine.size / POINTS_GAP) ].second.toFloat()
|
||||
|
||||
if (x in POINTS_GAP - 1..WIDTH - 2 * POINTS_GAP) {
|
||||
dirtStoneLine[x] = Math.round(FastMath.interpolateCatmullRom(
|
||||
dirtStoneLine[x] = Math.round(FastMath.interpolateHermite(
|
||||
(x - splineX1) / POINTS_GAP.toFloat(),
|
||||
-0.3f,//0.01f,
|
||||
splineP0,
|
||||
splineP1,
|
||||
splineP2,
|
||||
@@ -647,9 +646,8 @@ object WorldGenerator {
|
||||
))
|
||||
}
|
||||
else {
|
||||
dirtStoneLine[x] = Math.round(FastMath.interpolateCatmullRom(
|
||||
dirtStoneLine[x] = Math.round(FastMath.interpolateHermite(
|
||||
(x - splineX1) / POINTS_GAP.toFloat(),
|
||||
-0.3f,//0.01f,
|
||||
splineP0,
|
||||
splineP1,
|
||||
splineP2,
|
||||
|
||||
Reference in New Issue
Block a user