Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed Jun 24, 2024
1 parent 9767780 commit 9d5fd9a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 8 additions & 4 deletions korge-core/src/korlibs/render/GameWindow.kt
Original file line number Diff line number Diff line change
Expand Up @@ -403,16 +403,20 @@ open class GameWindow :
}
val available = fastCounterTimePerFrame - elapsed
//val available = fastCounterTimePerFrame - realElapsed
//if (available > FastDuration.ZERO) {
if (available > FastDuration.ZERO) {
//println("delay=$available, elapsed=$elapsed, realElapsed=$realElapsed, fastCounterTimePerFrame=$fastCounterTimePerFrame")
//delay(available)
loopDelay(available)
//NativeThread.sleepExact(available)
NativeThread.sleepExact(available)
//}
//NativeThread.sleepExact(available)
}
}
//}
}

open suspend fun loopDelay(time: FastDuration) {
delay(time)
}

// Referenced from korge-plugins repo
var renderTime = 0.milliseconds
var updateTime = 0.milliseconds
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package korlibs.render.awt

import korlibs.concurrent.thread.*
import korlibs.graphics.gl.*
import korlibs.kgl.*
import korlibs.math.geom.*
import korlibs.render.*
import korlibs.time.*

class AwtOffscreenGameWindow(
var size: Size = Size(640, 480),
Expand Down Expand Up @@ -46,6 +48,10 @@ class AwtOffscreenGameWindow(
dispatchReshapeEvent(0, 0, rwidth, rheight)
}

override suspend fun loopDelay(time: FastDuration) {
NativeThread.sleepExact(time)
}

//override val ag: AG = if (draw) AGSoftware(width, height) else DummyAG(width, height)
//override val ag: AG = AGDummy(width, height)
}

0 comments on commit 9d5fd9a

Please sign in to comment.