sym
This commit is contained in:
1 parent
4d639fc6b5
commit
36392764f7
5 files changed
+5
-2
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import Foundation
|
||||
import RaylibBridge
|
||||
import QuartzCore
|
||||
|
||||
func renderDeinit(_ vm: RenderVM) {
|
||||
print("ИГР renderD")
|
||||
vm.timer?.invalidate()
|
||||
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)
|
||||
|
||||
raybriInit(nil)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in new issue
Block a user