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
|
def update_position
|
||||||
if parent
|
if parent
|
||||||
p = parent.not_nil!
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -28,17 +28,15 @@ module Funfriend
|
||||||
LOG = ::Log.for("")
|
LOG = ::Log.for("")
|
||||||
|
|
||||||
@@contexts = [] of WindowContext
|
@@contexts = [] of WindowContext
|
||||||
@@main_context : WindowContext?
|
|
||||||
|
|
||||||
def self.should_close?
|
def self.should_close?
|
||||||
@@main_context && @@main_context.not_nil!.window.should_close?
|
@@contexts.size == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.init_contexts
|
def self.init_contexts
|
||||||
ConfigMan.config["buddies"]["types"].as(String).split(",").each do |buddy_name|
|
ConfigMan.config["buddies"]["types"].as(String).split(",").each do |buddy_name|
|
||||||
add_context(BuddyContext.new(make_buddy(buddy_name)))
|
add_context(BuddyContext.new(make_buddy(buddy_name)))
|
||||||
end
|
end
|
||||||
@@main_context = @@contexts[0]
|
|
||||||
at_exit { contexts.each &.destroy }
|
at_exit { contexts.each &.destroy }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ GLFW_FOCUS_ON_SHOW = 0x0002000C
|
||||||
|
|
||||||
class Funfriend::WindowContext
|
class Funfriend::WindowContext
|
||||||
getter window : CrystGLFW::Window
|
getter window : CrystGLFW::Window
|
||||||
|
property closed : Bool = false
|
||||||
|
|
||||||
DEFAULT_HINTS = {
|
DEFAULT_HINTS = {
|
||||||
# supposedly required on MacOS
|
# supposedly required on MacOS
|
||||||
|
@ -43,6 +44,7 @@ class Funfriend::WindowContext
|
||||||
|
|
||||||
def close
|
def close
|
||||||
window.destroy
|
window.destroy
|
||||||
|
@closed = true
|
||||||
end
|
end
|
||||||
|
|
||||||
def clean_up
|
def clean_up
|
||||||
|
|
Loading…
Reference in New Issue