Sha256: f13a0445e30fafb652059486450ea8342b0b8ad6c9b6cc01be8f5bbf620a5a0e
Contents?: true
Size: 984 Bytes
Versions: 9
Compression:
Stored size: 984 Bytes
Contents
# # class Background # # attr_reader :window, :draw_function # # def initialize window @window = window @draw_function = functionify window.background_options end def functionify path_or_color return lambda {} unless path_or_color Gosu::Color === path_or_color ? color_draw_function(path_or_color) : image_draw_function(path_or_color) end # # def color_draw_function color lambda do window.draw_quad(0, 0, color, window.width, 0, color, window.width, window.height, color, 0, window.height, color, 0, :default) end end # # def image_draw_function path image = Gosu::Image.new window, File.join(Resources.root, path), true lambda do image.draw 0, 0, Layer::Background, 1.0, 1.0 end end # # def draw draw_function.call end end
Version data entries
9 entries across 9 versions & 1 rubygems