explicitly set the max refresh rate

This commit is contained in:
qimiko committed 2024-05-22 18:39:06 -07:00
1 parent b7be446ecd
commit 127fd1bfd1
5 files changed
+29 -2

No files matched your search

@@ -9,7 +9,9 @@ import android.os.Message
import android.util.Log
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.Surface
import android.view.inputmethod.InputMethodManager
import androidx.annotation.RequiresApi
import com.customRobTop.BaseRobTopActivity
import com.geode.launcher.utils.GeodeUtils
@@ -113,6 +115,15 @@ class Cocos2dxGLSurfaceView(context: Context) : GLSurfaceView(context) {
}
}
@RequiresApi(Build.VERSION_CODES.R)
fun updateRefreshRate() {
val maxRefreshRate = display.supportedModes.maxBy { it.refreshRate }
holder.surface.setFrameRate(
maxRefreshRate.refreshRate,
Surface.FRAME_RATE_COMPATIBILITY_DEFAULT
)
}
override fun onPause() {
queueEvent { cocos2dxRenderer.handleOnPause() }
super.onPause()