# GLFW_TRANSPARENT_FRAMEBUFFER, seems to be unsupported by LibGLFW GLFW_TRANSPARENT_FRAMEBUFFER = 0x0002000A # GLFW_FOCUS_ON_SHOW, also unsupported by LibGLFW GLFW_FOCUS_ON_SHOW = 0x0002000C class Funfriend::WindowContext getter window : CrystGLFW::Window property closed : Bool = false DEFAULT_HINTS = { # supposedly required on MacOS Window::HintLabel::ContextVersionMajor => 3, Window::HintLabel::ContextVersionMinor => 3, Window::HintLabel::OpenGLForwardCompat => true, Window::HintLabel::OpenGLProfile => OpenGLProfile::Core, Window::HintLabel::ClientAPI => ClientAPI::OpenGL, Window::HintLabel::Resizable => false, Window::HintLabel::Decorated => false, Window::HintLabel::Floating => true, Window::HintLabel::Focused => false, } def initialize(title : String, width : Int32, height : Int32, transparent : Bool, hints = DEFAULT_HINTS) if transparent LibGLFW.window_hint(GLFW_TRANSPARENT_FRAMEBUFFER, 1) end LibGLFW.window_hint(GLFW_FOCUS_ON_SHOW, 0) @window = Window.new title: title, width: width, height: height, hints: hints LOG.info { "creating context #{self}" } end def update(dt : Float64) # let OpenGL draw to it window.make_context_current # nothing to draw; dummy out # idk why you need to do this but oh well window.swap_buffers end def close window.destroy @closed = true end def clean_up end def destroy close clean_up end end