Support iOS for ogs-blue (#7)

This commit was merged in pull request #7.
This commit is contained in:
kornerr committed 2026-10-30 15:17:24 +01:00
1 parent 37c4e6f442
commit 2b556a4a58
58 files changed
+710 -300

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
import Foundation
import RaylibBridge
import QuartzCore
func renderDeinit(_ vm: RenderVM) {
vm.timer?.invalidate()
vm.timer = nil
vm.glView.openGLContext?.makeCurrentContext()
raybriShutdown()
}
func renderInit(_ vm: RenderVM) {
vm.glView.openGLContext?.makeCurrentContext()
// Enable VSync
var swapInterval: Int32 = 1
vm.glView.openGLContext?.setValues(&swapInterval, for: .swapInterval)
raybriLoadExtensions()
raybriInit()
}
func renderStartTimer(_ vm: RenderVM) {
// Make a time mark for calculating time delta
vm.startTime = CACurrentMediaTime()
// Schedule repaints every once in FPS seconds
let timer = Timer(timeInterval: 1.0 / RENDER_FPS, repeats: true) { [weak vm] _ in
vm?.glView.needsDisplay = true
}
vm.timer = timer
// .common means holding buttons in UI does not pause this rendering timer
RunLoop.main.add(timer, forMode: .common)
}