Draw sync reset actions

This commit is contained in:
downthecrop 2024-10-21 21:09:22 -07:00
parent d779f65db4
commit f09de70a30
3 changed files with 53 additions and 35 deletions

View file

@ -90,6 +90,13 @@ class plugin : Plugin() {
private var initialized = false;
private var lastClickTime = 0L
private var lastUIOffset = 0
private val drawActions = mutableListOf<() -> Unit>()
fun registerDrawAction(action: () -> Unit) {
synchronized(drawActions) {
drawActions.add(action)
}
}
}
fun allSpritesLoaded() : Boolean {
@ -259,6 +266,17 @@ class plugin : Plugin() {
accumulatedTime = 0L
}
// Draw synced actions (that require to be done between glBegin and glEnd)
if (drawActions.isNotEmpty()) {
synchronized(drawActions) {
val actionsCopy = drawActions.toList()
drawActions.clear()
for (action in actionsCopy) {
action()
}
}
}
// Init in the draw call so we know we are between glBegin and glEnd for HD
if(!initialized && mainLoadState >= loginScreen) {
initKondoUI()