Compare commits
2 Commits
ebc98715be
...
49ce6885ea
Author | SHA1 | Date |
---|---|---|
Jill | 49ce6885ea | |
Jill | 7fcf926426 |
|
@ -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
|
||||
|
||||
|
|
|
@ -28,17 +28,15 @@ module Funfriend
|
|||
LOG = ::Log.for("")
|
||||
|
||||
@@contexts = [] of WindowContext
|
||||
@@main_context : WindowContext?
|
||||
|
||||
def self.should_close?
|
||||
@@main_context && @@main_context.not_nil!.window.should_close?
|
||||
@@contexts.size == 0
|
||||
end
|
||||
|
||||
def self.init_contexts
|
||||
ConfigMan.config["buddies"]["types"].as(String).split(",").each do |buddy_name|
|
||||
add_context(BuddyContext.new(make_buddy(buddy_name)))
|
||||
end
|
||||
@@main_context = @@contexts[0]
|
||||
at_exit { contexts.each &.destroy }
|
||||
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