gl view done
This commit is contained in:
1 parent
137188e618
commit
ff4613d8e6
6 files changed
+54
-45
No files matched your search
@@ -1,5 +1,13 @@
|
||||
import Foundation
|
||||
import RaylibBridge
|
||||
import QuartzCore
|
||||
|
||||
func renderDeinit(_ vm: RenderVM) {
|
||||
print("ИГР renderD")
|
||||
vm.timer?.invalidate()
|
||||
vm.glView.openGLContext?.makeCurrentContext()
|
||||
sr_shutdown()
|
||||
}
|
||||
|
||||
func renderInit(_ vm: RenderVM) {
|
||||
vm.glView.openGLContext?.makeCurrentContext()
|
||||
@@ -27,11 +35,14 @@ func renderLoadCubeModel(_ vm: RenderVM) {
|
||||
}
|
||||
|
||||
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
|
||||
// Use .common so that holding buttons in UI does not pause this rendering 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