lib/dedalus/elements.rb in dedalus-0.1.2 vs lib/dedalus/elements.rb in dedalus-0.2.0
- old
+ new
@@ -5,10 +5,18 @@
def self.active_view
@active_view ||= nil
end
+ class FontRepository
+ def self.get_font(size: 20)
+ @fonts ||= {}
+ @fonts[size] ||= Gosu::Font.new(size)
+ @fonts[size]
+ end
+ end
+
class Element
attr_accessor :position
# in % as 0.0-1.0 (hint to compositing engine for elements in columns/rows respectively)
attr_accessor :width_percent, :height_percent
@@ -39,10 +47,18 @@
def view
Dedalus.active_view
end
def font
- view.font
+ FontRepository.get_font(size: 20)
+ end
+
+ def big_font
+ FontRepository.get_font(size: 36)
+ end
+
+ def huge_font
+ FontRepository.get_font(size: 120)
end
def window
view.window
end