All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.huskerdev.grapl.gl.platforms.macos.MacGLWindowPeer.kt Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package com.huskerdev.grapl.gl.platforms.macos

import com.huskerdev.grapl.core.window.impl.MacWindowPeer
import com.huskerdev.grapl.gl.GLProfile
import com.huskerdev.grapl.gl.GLWindowPeer

class MacGLWindowPeer(
    profile: GLProfile,
    shareWith: Long,
    majorVersion: Int,
    minorVersion: Int
): MacWindowPeer(), GLWindowPeer {
    override val context = NSGLContext.createAttached(this, profile, shareWith, majorVersion, minorVersion)

    init {
        sizeProperty.listeners += {
            context.setBackingSize(
                sizeProperty.value.width.toInt(),
                sizeProperty.value.height.toInt())
        }
    }

    override fun dispatchUpdate() {
        context.makeCurrent()
        context.lock()
        super.dispatchUpdate()
        context.unlock()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy