class Dedalus::Element

Attributes

background_color[RW]
color[RW]
height[RW]

raw width/height

height_percent[RW]

in % as 0.0-1.0 (hint to compositing engine for elements in columns/rows respectively)

margin[RW]
offset[RW]
padding[RW]
position[RW]
shown[RW]
width[RW]

raw width/height

width_percent[RW]

in % as 0.0-1.0 (hint to compositing engine for elements in columns/rows respectively)

z_order[RW]

Public Class Methods

new(attrs={}) click to toggle source
# File lib/dedalus/elements.rb, line 24
def initialize(attrs={})
  attrs.each { |(k,v)| instance_variable_set(:"@#{k}",v) } unless attrs.nil?
end

Public Instance Methods

big_font() click to toggle source
# File lib/dedalus/elements.rb, line 66
def big_font
  FontRepository.get_font(size: 24)
end
code_font() click to toggle source
# File lib/dedalus/elements.rb, line 58
def code_font
  FontRepository.get_font('courier new', size: 20)
end
draw_bounding_box(origin:, dimensions:, color: Palette.gray) click to toggle source
# File lib/dedalus/elements.rb, line 37
def draw_bounding_box(origin:, dimensions:, color: Palette.gray)
  x,y = *origin
  w,h = *dimensions

  raise "Invalid color #{color} given to #{self.class.name} for bounding box" unless color.is_a?(Dedalus::Color)

  c = color.to_gosu
  window.draw_quad(x,   y,   c,
                   x,   y+h, c,
                   x+w, y,   c,
                   x+w, y+h, c, ZOrder::Background)
end
font() click to toggle source
# File lib/dedalus/elements.rb, line 62
def font
  FontRepository.get_font(size: 20)
end
huge_font() click to toggle source
# File lib/dedalus/elements.rb, line 70
def huge_font
  FontRepository.get_font(size: 120)
end
record?() click to toggle source
# File lib/dedalus/elements.rb, line 33
def record?
  false
end
tiny_font() click to toggle source
# File lib/dedalus/elements.rb, line 54
def tiny_font
  FontRepository.get_font(size: 14)
end
view() click to toggle source
# File lib/dedalus/elements.rb, line 50
def view
  Dedalus.active_view
end
window() click to toggle source
# File lib/dedalus/elements.rb, line 74
def window
  view.window
end