turns out trying to access the position of a closed window results in an x error
who could've known
This commit is contained in:
parent
7fcf926426
commit
49ce6885ea
|
@ -40,7 +40,9 @@ class Funfriend::ChatterContext < Funfriend::WindowContext
|
|||
def update_position
|
||||
if parent
|
||||
p = parent.not_nil!
|
||||
window.position = (Vec2.new(p.window.position) + Vec2.new(p.window.size) / 2 + parent_relative_pos - window_size / 2).xy_i
|
||||
if !p.closed
|
||||
window.position = (Vec2.new(p.window.position) + Vec2.new(p.window.size) / 2 + parent_relative_pos - window_size / 2).xy_i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ GLFW_FOCUS_ON_SHOW = 0x0002000C
|
|||
|
||||
class Funfriend::WindowContext
|
||||
getter window : CrystGLFW::Window
|
||||
property closed : Bool = false
|
||||
|
||||
DEFAULT_HINTS = {
|
||||
# supposedly required on MacOS
|
||||
|
@ -43,6 +44,7 @@ class Funfriend::WindowContext
|
|||
|
||||
def close
|
||||
window.destroy
|
||||
@closed = true
|
||||
end
|
||||
|
||||
def clean_up
|
||||
|
|
Loading…
Reference in New Issue