17 lines
580 B
Swift
17 lines
580 B
Swift
import UIKit
|
|
|
|
// Render a single frame. The timer calls this directly: an EGL/ANGLE surface
|
|
// presents into the view's layer, so there is no draw(_:) / needsDisplay pass
|
|
// like in the NSOpenGLView on macOS.
|
|
func renderDraw(_ vm: RenderVM) {
|
|
raybri_render()
|
|
}
|
|
|
|
// Backing-pixel size of the view, which is what EGL/ANGLE renders into.
|
|
func renderPixelSize(_ view: UIView) -> [Int32] {
|
|
let scale = view.contentScaleFactor
|
|
let w = Int32(max(1, (view.bounds.width * scale).rounded()))
|
|
let h = Int32(max(1, (view.bounds.height * scale).rounded()))
|
|
return [w, h]
|
|
}
|