mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 00:26:07 +09:00
trying to optimise the rendering, this is BEFORE job
This commit is contained in:
@@ -26,7 +26,7 @@ class EntryPoint : ModuleEntryPoint() {
|
||||
// load customised item loader //
|
||||
/////////////////////////////////
|
||||
|
||||
println("[ItemCodex] recording item ID ")
|
||||
println("[ModuleBaseGame.EntryPoint] recording item ID ")
|
||||
|
||||
// blocks.csvs are loaded by ModMgr beforehand
|
||||
// block items (blocks and walls are the same thing basically)
|
||||
|
||||
@@ -527,7 +527,10 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
else {
|
||||
var updateTries = 0
|
||||
while (updateDeltaCounter >= updateRate) {
|
||||
updateGame(delta)
|
||||
|
||||
//updateGame(delta)
|
||||
measureRuntime({ updateGame(delta) }, prependMsg = "Update Game: ")
|
||||
|
||||
updateDeltaCounter -= updateRate
|
||||
updateTries++
|
||||
|
||||
@@ -540,7 +543,15 @@ class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
|
||||
/** RENDER CODE GOES HERE */
|
||||
renderGame(batch)
|
||||
//renderGame(batch)
|
||||
measureRuntime({ renderGame(batch) }, prependMsg = "Render Game: ")
|
||||
}
|
||||
|
||||
private fun measureRuntime(function: (() -> Unit), out: PrintStream = System.err, prependMsg: String = "", appendMsg: String = "") {
|
||||
val startTime = System.nanoTime()
|
||||
function.invoke()
|
||||
val endTime = System.nanoTime()
|
||||
println("$prependMsg${endTime - startTime} ns$appendMsg")
|
||||
}
|
||||
|
||||
protected fun updateGame(delta: Float) {
|
||||
|
||||
Reference in New Issue
Block a user