title remocon: menu UI with no child should be displayed now

This commit is contained in:
minjaesong
2018-09-15 01:08:10 +09:00
parent 79f3e8e28d
commit 7069528714
17 changed files with 146 additions and 96 deletions

View File

@@ -24,6 +24,20 @@ import java.util.Random;
*/
public class AppLoader implements ApplicationListener {
/**
* 0xAA_BB_XXXX
* AA: Major version
* BB: Minor version
* XXXX: Revision (Repository commits, or something arbitrary)
*
* e.g. 0x02010034 can be translated as 2.1.52
*/
public static final int VERSION_RAW = 0x00_02_027C;
public static final boolean IS_DEVELOPMENT_BUILD = true;
private static AppLoader INSTANCE = null;
private AppLoader() { }
@@ -66,16 +80,6 @@ public class AppLoader implements ApplicationListener {
}
}
/**
* 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_0270;
public static final String getVERSION_STRING() {
return String.format("%d.%d.%d", VERSION_RAW >>> 24, (VERSION_RAW & 0xff0000) >>> 16, VERSION_RAW & 0xFFFF);
}
@@ -261,7 +265,7 @@ public class AppLoader implements ApplicationListener {
appConfig.width = Terrarum.INSTANCE.getWIDTH();
appConfig.height = Terrarum.INSTANCE.getHEIGHT();
System.out.println("[AppLoader] Resize event");
printdbg(this, "Resize event");
}
@Override
@@ -280,7 +284,7 @@ public class AppLoader implements ApplicationListener {
}
public void setScreen(Screen screen) {
System.out.println("[AppLoader] Changing screen to " + screen.getClass().getCanonicalName());
printdbg(this, "Changing screen to " + screen.getClass().getCanonicalName());
if (this.screen != null) this.screen.hide();
this.screen = screen;
@@ -289,7 +293,7 @@ public class AppLoader implements ApplicationListener {
this.screen.resize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
}
System.out.println("[AppLoader] Screen transisiton complete: " + this.screen.getClass().getCanonicalName());
printdbg(this, "Screen transisiton complete: " + this.screen.getClass().getCanonicalName());
}
private void setCameraPosition(float newX, float newY) {
@@ -307,4 +311,16 @@ public class AppLoader implements ApplicationListener {
});
fullscreenQuad.setIndices(new short[]{0, 1, 2, 2, 3, 0});
}
public static final void printdbg(Object obj, Object message) {
if (IS_DEVELOPMENT_BUILD) {
System.out.println("["+obj.getClass().getSimpleName()+"] "+message.toString());
}
}
public static final void printdbgerr(Object obj, Object message) {
if (IS_DEVELOPMENT_BUILD) {
System.err.println("["+obj.getClass().getSimpleName()+"] "+message.toString());
}
}
}

View File

@@ -22,7 +22,7 @@ class GdxColorMap {
})
println("[GdxColorMap] Loading colormap from ${imageFile.name()}; PixmapFormat: ${pixmap.format}; Dimension: $width x $height")
AppLoader.printdbg(this, "Loading colormap from ${imageFile.name()}; PixmapFormat: ${pixmap.format}; Dimension: $width x $height")
pixmap.dispose()

View File

@@ -2,6 +2,8 @@ package net.torvald.terrarum
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.AppLoader.printdbgerr
import net.torvald.terrarum.utils.CSVFetcher
import net.torvald.terrarum.itemproperties.GameItem
import net.torvald.terrarum.itemproperties.ItemCodex
@@ -74,7 +76,7 @@ object ModMgr {
loadOrder.forEachIndexed { index, it ->
val moduleName = it[0]
println("[ModMgr] Loading module $moduleName")
printdbg(this, "Loading module $moduleName")
try {
val modMetadata = Properties()
@@ -100,7 +102,7 @@ object ModMgr {
val isDir = FileSystems.getDefault().getPath("$modDir/$moduleName").toFile().isDirectory
moduleInfo[moduleName] = ModuleMetadata(index, isDir, properName, description, author, entryPoint, releaseDate, version, libs, dependency)
println(moduleInfo[moduleName])
printdbg(this, moduleInfo[moduleName])
// run entry script in entry point
@@ -114,13 +116,13 @@ object ModMgr {
}
println("[ModMgr] $moduleName loaded successfully")
printdbg(this, "$moduleName loaded successfully")
}
catch (noSuchModule: FileNotFoundException) {
System.err.println("[ModMgr] No such module: $moduleName, skipping...")
printdbgerr(this, "No such module: $moduleName, skipping...")
}
catch (e: ClassNotFoundException) {
System.err.println("[ModMgr] $moduleName has nonexisting entry point, skipping...")
printdbgerr(this, "$moduleName has nonexisting entry point, skipping...")
}
}

View File

@@ -14,6 +14,8 @@ import com.google.gson.JsonPrimitive
import com.jme3.math.FastMath
import net.torvald.dataclass.ArrayListMap
import net.torvald.random.HQRNG
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.AppLoader.printdbgerr
import net.torvald.terrarum.gameactors.Actor
import net.torvald.terrarum.gameactors.ActorID
import net.torvald.terrarum.gameworld.GameWorld
@@ -236,10 +238,10 @@ object Terrarum : Screen {
println("[Terrarum] os.arch = $systemArch") // debug info
printdbg(this, "os.arch = $systemArch") // debug info
if (is32BitJVM) {
System.err.println("[Terrarum] 32 Bit JVM detected")
printdbgerr(this, "32 Bit JVM detected")
}
joypadLabelStart = when (getConfigString("joypadlabelstyle")) {
@@ -303,9 +305,9 @@ object Terrarum : Screen {
testTexture = Texture(Gdx.files.internal("./assets/test_texture.tga"))
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
printdbg(this, "GL_VERSION = $GL_VERSION")
printdbg(this, "GL_MAX_TEXTURE_SIZE = $GL_MAX_TEXTURE_SIZE")
printdbg(this, "GL info:\n${Gdx.graphics.glVersion.debugVersionString}") // debug info
if (GL_VERSION < MINIMAL_GL_VERSION || GL_MAX_TEXTURE_SIZE < MINIMAL_GL_MAX_TEXTURE_SIZE) {
@@ -385,7 +387,7 @@ object Terrarum : Screen {
AppLoader.GAME_LOCALE = getConfigString("language")
println("[Terrarum] locale = ${AppLoader.GAME_LOCALE}")
printdbg(this, "locale = ${AppLoader.GAME_LOCALE}")
@@ -393,7 +395,7 @@ object Terrarum : Screen {
println("[Terrarum] all modules loaded successfully")
printdbg(this, "all modules loaded successfully")
@@ -479,7 +481,7 @@ object Terrarum : Screen {
//appLoader.resize(width, height)
//Gdx.graphics.setWindowedMode(width, height)
println("[Terrarum] newsize: ${Gdx.graphics.width}x${Gdx.graphics.height} | internal: ${width}x$height")
printdbg(this, "newsize: ${Gdx.graphics.width}x${Gdx.graphics.height} | internal: ${width}x$height")
}
@@ -516,9 +518,9 @@ object Terrarum : Screen {
defaultSaveDir = defaultDir + "/Saves"
configDir = defaultDir + "/config.json"
println("[Terrarum] os.name = $OSName (with identifier $OperationSystem)")
println("[Terrarum] os.version = $OSVersion")
println("[Terrarum] default directory: $defaultDir")
printdbg(this, "os.name = $OSName (with identifier $OperationSystem)")
printdbg(this, "os.version = $OSVersion")
printdbg(this, "default directory: $defaultDir")
}
private fun createDirs() {

View File

@@ -9,6 +9,7 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.jme3.math.FastMath
import net.torvald.random.HQRNG
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.gameactors.Actor
@@ -120,7 +121,7 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
private val TILE_SIZEF = TILE_SIZE.toFloat()
private fun loadThingsWhileIntroIsVisible() {
println("[TitleScreen] Intro pre-load")
printdbg(this, "Intro pre-load")
demoWorld = ReadLayerData(FileInputStream(ModMgr.getFile("basegame", "demoworld")))
@@ -172,7 +173,7 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
}
override fun show() {
println("[TitleScreen] atrniartsientsarinoetsar")
printdbg(this, "atrniartsientsarinoetsar")
initViewPort(Terrarum.WIDTH, Terrarum.HEIGHT)
@@ -216,7 +217,7 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
}
fun updateScreen(delta: Float) {
Gdx.graphics.setTitle("WorldRenderTest" +
Gdx.graphics.setTitle(AppLoader.GAME_NAME +
" — F: ${Gdx.graphics.framesPerSecond} (${Terrarum.TARGET_INTERNAL_FPS})" +
" — M: ${Terrarum.memInUse}M / ${Terrarum.memTotal}M / ${Terrarum.memXmx}M"
)
@@ -273,10 +274,16 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
COPYTING.forEachIndexed { index, s ->
val textWidth = Terrarum.fontGame.getWidth(s)
Terrarum.fontGame.draw(batch, s,
Terrarum.WIDTH - textWidth - 1f - 0.2f,
Terrarum.HEIGHT - Terrarum.fontGame.lineHeight * (COPYTING.size - index) - 1f
(Terrarum.WIDTH - textWidth - 1f).toInt().toFloat(),
(Terrarum.HEIGHT - Terrarum.fontGame.lineHeight * (COPYTING.size - index) - 1f).toInt().toFloat()
)
}
Terrarum.fontGame.draw(batch, "${AppLoader.GAME_NAME} ${AppLoader.getVERSION_STRING()}",
1f.toInt().toFloat(),
(Terrarum.HEIGHT - Terrarum.fontGame.lineHeight - 1f).toInt().toFloat()
)
}
override fun pause() {

View File

@@ -1,5 +1,6 @@
package net.torvald.terrarum.blockproperties
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.utils.CSVFetcher
import net.torvald.terrarum.gameworld.MapLayer
import net.torvald.terrarum.gameworld.PairedMapLayer
@@ -27,7 +28,7 @@ object BlockCodex {
try {
val records = CSVFetcher.readFromModule(module, path)
println("[BlockCodex] Building block properties table")
AppLoader.printdbg(this, "Building block properties table")
records.forEach {
if (intVal(it, "id") == -1) {

View File

@@ -9,6 +9,7 @@ import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.spriteanimation.SpriteAnimation
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.worlddrawer.WorldCamera
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockProp
@@ -117,7 +118,7 @@ open class ActorWBMovable(val world: GameWorld, renderOrder: RenderOrder, val im
if (value <= 0)
throw IllegalArgumentException("mass cannot be less than or equal to zero.")
else if (value < MASS_LOWEST) {
println("[ActorWBMovable] input too small; using $MASS_LOWEST instead.")
printdbg(this, "input too small; using $MASS_LOWEST instead.")
actorValue[AVKey.BASEMASS] = MASS_LOWEST
}
@@ -130,7 +131,7 @@ open class ActorWBMovable(val world: GameWorld, renderOrder: RenderOrder, val im
if (value < 0)
throw IllegalArgumentException("invalid elasticity value $value; valid elasticity value is [0, 1].")
else if (value >= ELASTICITY_MAX) {
println("[ActorWBMovable] Elasticity were capped to $ELASTICITY_MAX.")
printdbg(this, "Elasticity were capped to $ELASTICITY_MAX.")
field = ELASTICITY_MAX
}
else
@@ -1292,9 +1293,9 @@ open class ActorWBMovable(val world: GameWorld, renderOrder: RenderOrder, val im
// warnings
if (sprite == null && isVisible)
println("[ActorWBMovable] Caution: actor ${this.javaClass.simpleName} is visible but the sprite was not set.")
printdbg(this, "Caution: actor ${this.javaClass.simpleName} is visible but the sprite was not set.")
else if (sprite != null && !isVisible)
println("[ActorWBMovable] Caution: actor ${this.javaClass.simpleName} is invisible but the sprite was given.")
printdbg(this, "Caution: actor ${this.javaClass.simpleName} is invisible but the sprite was given.")
assertPrinted = true
}

View File

@@ -3,6 +3,7 @@ package net.torvald.terrarum.langpack
import net.torvald.terrarum.utils.JsonFetcher
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.AppLoader.printdbg
import java.io.*
import java.util.*
@@ -44,7 +45,7 @@ object Lang {
}
fun load(localesDir: String) {
println("[Lang] Loading languages from $localesDir")
printdbg(this, "Loading languages from $localesDir")
val localesDir = File(localesDir)
@@ -119,14 +120,16 @@ object Lang {
if (key.startsWith("MENU_LABEL_PRESS_START_SYMBOL"))
return ret2.replace('>', Terrarum.joypadLabelStart).capitalize()
return if (AppLoader.GAME_LOCALE.contains("bg"))
"${AppLoader.fontGame.charsetOverrideBulgarian}${ret2.capitalize()}${AppLoader.fontGame.charsetOverrideNormal}"
else if (AppLoader.GAME_LOCALE.contains("sr"))
return if (key.getEndTag().contains("bg"))
"${AppLoader.fontGame.charsetOverrideBulgarian}${ret2.capitalize()}${AppLoader.fontGame.charsetOverrideNormal}"
else if (key.getEndTag().contains("sr"))
"${AppLoader.fontGame.charsetOverrideSerbian}${ret2.capitalize()}${AppLoader.fontGame.charsetOverrideNormal}"
else
ret2.capitalize()
}
private fun String.getEndTag() = this.split("_").last()
fun pluraliseLang(key: String, count: Int): String {
return if (count > 1) get(key + "_PLURAL") else get(key)
}

View File

@@ -1,5 +1,7 @@
package net.torvald.terrarum.modulebasegame
import net.torvald.terrarum.AppLoader.IS_DEVELOPMENT_BUILD
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.Point2d
import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.ModuleEntryPoint
@@ -26,7 +28,7 @@ class EntryPoint : ModuleEntryPoint() {
// load customised item loader //
/////////////////////////////////
println("[ModuleBaseGame.EntryPoint] recording item ID ")
printdbg(this, "recording item ID ")
// blocks.csvs are loaded by ModMgr beforehand
// block items (blocks and walls are the same thing basically)
@@ -45,7 +47,8 @@ class EntryPoint : ModuleEntryPoint() {
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
init {
print("$originalID ")
if (IS_DEVELOPMENT_BUILD)
print("$originalID ")
}
override fun primaryUse(delta: Float): Boolean {

View File

@@ -26,6 +26,7 @@ import java.util.concurrent.locks.ReentrantLock
import net.torvald.random.HQRNG
import net.torvald.terrarum.*
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.modulebasegame.console.AVTracker
import net.torvald.terrarum.modulebasegame.console.ActorsList
import net.torvald.terrarum.console.Authenticator
@@ -193,7 +194,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
*/
private fun enter(gameSaveData: GameSaveData) {
if (gameInitialised) {
println("[Ingame] loaded successfully.")
printdbg(this, "loaded successfully.")
}
else {
LoadScreen.addMessage("Loading world from save")
@@ -221,7 +222,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
*/
private fun enter(worldParams: NewWorldParameters) {
if (gameInitialised) {
println("[Ingame] loaded successfully.")
printdbg(this, "loaded successfully.")
}
else {
LoadScreen.addMessage("${Terrarum.NAME} version ${AppLoader.getVERSION_STRING()}")

View File

@@ -5,6 +5,8 @@ import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.AppLoader.printdbgerr
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.ui.UICanvas
@@ -22,6 +24,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
private var remoConTray: UIRemoConElement // this remocon is dynamically generated
private var currentRemoConContents = treeRepresentation
private var currentlySelectedRemoConItem = treeRepresentation.data
override var width: Int
get() = remoConWidth // somehow NOT making this constant causes a weird issue
@@ -41,12 +44,17 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
val splittedNodeName = node.data?.split(yamlSep)
if (splittedNodeName?.size == 2) {
val attachedClass = loadClass(splittedNodeName[1])
try {
val attachedClass = loadClass(splittedNodeName[1])
attachedClass.posX = 0
attachedClass.posY = 0
attachedClass.posX = 0
attachedClass.posY = 0
screens.add((node.data ?: "(null)") to attachedClass)
screens.add((node.data ?: "(null)") to attachedClass)
}
catch (e: java.lang.ClassNotFoundException) {
printdbgerr(this, "class '${splittedNodeName[1]}' was not found, skipping")
}
}
}
}
@@ -85,6 +93,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
remoConTray.consume()
currentRemoConContents = currentRemoConContents.parent!!
currentlySelectedRemoConItem = currentRemoConContents.data
remoConTray = generateNewRemoCon(currentRemoConContents)
}
else {
@@ -98,12 +107,17 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
if (currentRemoConContents.children.size > selectedIndex ?: 0x7FFFFFFF) {
val newCurrentRemoConContents = currentRemoConContents.children[selectedIndex!!]
// only go deeper if that node has child to navigate
if (currentRemoConContents.children[selectedIndex!!].children.size != 0) {
remoConTray.consume()
currentRemoConContents = currentRemoConContents.children[selectedIndex!!]
remoConTray = generateNewRemoCon(currentRemoConContents)
remoConTray = generateNewRemoCon(newCurrentRemoConContents)
currentRemoConContents = newCurrentRemoConContents
}
currentlySelectedRemoConItem = newCurrentRemoConContents.data
}
else {
throw RuntimeException("Index: $selectedIndex, Size: ${currentRemoConContents.children.size}")
@@ -112,23 +126,32 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
// do something with the actual selection
println(currentRemoConContents.data)
//printdbg(this, "$currentlySelectedRemoConItem")
screens.forEach {
if (currentRemoConContents.data == it.first) {
//printdbg(this, "> ${it.first}")
if (currentlySelectedRemoConItem == it.first) {
it.second.setAsOpen()
//printdbg(this, ">> ding - ${it.second.javaClass.canonicalName}")
}
else {
it.second.setAsClose()
}
it.second.update(delta) // update is required anyway
// but this is not updateUI, so whenever the UI is completely hidden,
// underlying handler will block any update until the UI is open again
}
}
screens.forEach {
it.second.update(delta) // update is required anyway
// but this is not updateUI, so whenever the UI is completely hidden,
// underlying handler will block any update until the UI is open again
}
if (!Gdx.input.isButtonPressed(Input.Buttons.LEFT)) {
mouseActionAvailable = true
}
@@ -138,9 +161,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
remoConTray.render(batch, camera)
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.render(batch, camera) // again, underlying handler will block unnecessary renders
}
it.second.render(batch, camera) // again, underlying handler will block unnecessary renders
}
}
@@ -166,9 +187,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.mouseMoved(screenX, screenY) // again, underlying handler will block unnecessary renders
}
it.second.mouseMoved(screenX, screenY) // again, underlying handler will block unnecessary renders
}
return true
@@ -176,9 +195,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.touchDragged(screenX, screenY, pointer) // again, underlying handler will block unnecessary renders
}
it.second.touchDragged(screenX, screenY, pointer) // again, underlying handler will block unnecessary renders
}
return true
@@ -186,9 +203,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.touchDown(screenX, screenY, pointer, button) // again, underlying handler will block unnecessary renders
}
it.second.touchDown(screenX, screenY, pointer, button) // again, underlying handler will block unnecessary renders
}
return true
@@ -196,9 +211,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.touchUp(screenX, screenY, pointer, button) // again, underlying handler will block unnecessary renders
}
it.second.touchUp(screenX, screenY, pointer, button) // again, underlying handler will block unnecessary renders
}
return true
@@ -206,9 +219,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun scrolled(amount: Int): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.scrolled(amount) // again, underlying handler will block unnecessary renders
}
it.second.scrolled(amount) // again, underlying handler will block unnecessary renders
}
return true
@@ -216,9 +227,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun keyDown(keycode: Int): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.keyDown(keycode) // again, underlying handler will block unnecessary renders
}
it.second.keyDown(keycode) // again, underlying handler will block unnecessary renders
}
return true
@@ -226,9 +235,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun keyUp(keycode: Int): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.keyUp(keycode) // again, underlying handler will block unnecessary renders
}
it.second.keyUp(keycode) // again, underlying handler will block unnecessary renders
}
return true
@@ -236,9 +243,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
override fun keyTyped(character: Char): Boolean {
screens.forEach {
if (currentRemoConContents.data == it.first) {
it.second.keyTyped(character) // again, underlying handler will block unnecessary renders
}
it.second.keyTyped(character) // again, underlying handler will block unnecessary renders
}
return true

View File

@@ -59,7 +59,8 @@ class UITitleLanguage : UICanvas() {
override fun updateUI(delta: Float) {
textArea.update(delta)
println("should be printing indefinitely")
//AppLoader.printdbg(this, "should be printing indefinitely")
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {

View File

@@ -3,6 +3,7 @@ package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.CreditSingleton
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.Second
@@ -10,7 +11,7 @@ import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemTextArea
import net.torvald.terrarum.ui.UIItemTextButtonList
open class UITitleWallOfText(text: List<String>) : UICanvas() {
open class UITitleWallOfText(private val text: List<String>) : UICanvas() {
override var openCloseTime: Second = 0f
@@ -37,6 +38,8 @@ open class UITitleWallOfText(text: List<String>) : UICanvas() {
override fun renderUI(batch: SpriteBatch, camera: Camera) {
batch.color = Color.WHITE
textArea.render(batch, camera)
//AppLoader.printdbg(this, "Rendering texts of length ${text.size}")
}
override fun doOpening(delta: Float) {

View File

@@ -1,5 +1,7 @@
package net.torvald.terrarum.utils
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.ModMgr
import org.apache.commons.csv.CSVFormat
import org.apache.commons.csv.CSVParser
@@ -21,7 +23,7 @@ object CSVFetcher {
net.torvald.terrarum.utils.CSVFetcher.csvString = StringBuffer() // reset buffer every time it called
net.torvald.terrarum.utils.CSVFetcher.readCSVasString(csvFilePath)
println("[CSVFetcher] Reading CSV $csvFilePath")
printdbg(this, "Reading CSV $csvFilePath")
val csvParser = org.apache.commons.csv.CSVParser.parse(
net.torvald.terrarum.utils.CSVFetcher.csvString!!.toString(),

View File

@@ -2,6 +2,7 @@ package net.torvald.terrarum.utils
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import net.torvald.terrarum.AppLoader.printdbg
import java.io.File
import java.io.IOException
@@ -22,7 +23,7 @@ object JsonFetcher {
jsonString = StringBuffer() // reset buffer every time it called
readJsonFileAsString(jsonFilePath)
println("[JsonFetcher] Reading JSON $jsonFilePath")
printdbg(this, "Reading JSON $jsonFilePath")
if (jsonString == null) {
throw Error("[JsonFetcher] jsonString is null!")
@@ -39,7 +40,7 @@ object JsonFetcher {
jsonString = StringBuffer() // reset buffer every time it called
readJsonFileAsString(jsonFile.canonicalPath)
println("[JsonFetcher] Reading JSON ${jsonFile.path}")
printdbg(this, "Reading JSON ${jsonFile.path}")
if (jsonString == null) {
throw Error("[JsonFetcher] jsonString is null!")
@@ -58,7 +59,7 @@ object JsonFetcher {
) // JSON does not require line break
}
catch (e: IOException) {
System.err.println("An error occurred while reading $path")
System.err.println("[JsonFetcher] An error occurred while reading $path")
e.printStackTrace()
}
}

View File

@@ -10,6 +10,7 @@ import net.torvald.terrarum.gameworld.PairedMapLayer
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.*
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.ceilInt
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarum.itemproperties.ItemCodex.ITEM_TILES
@@ -780,7 +781,7 @@ internal object BlocksDrawer {
oldScreenH = screenH
println("[BlocksDrawerNew] Resize event")
printdbg(this, "Resize event")
}

View File

@@ -8,6 +8,7 @@ import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.blockproperties.BlockCodex
import com.jme3.math.FastMath
import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.blockproperties.Block
@@ -56,7 +57,7 @@ internal object LightmapRenderer {
val overscan_opaque: Int = 8
init {
println("[LightmapRenderer] Overscan open: $overscan_open; opaque: $overscan_opaque")
printdbg(this, "Overscan open: $overscan_open; opaque: $overscan_opaque")
}
// TODO resize(int, int) -aware
@@ -607,7 +608,7 @@ internal object LightmapRenderer {
println("[LightmapRendererNew] Resize event")
printdbg(this, "Resize event")
}