Class: Image
Constant Summary collapse
- @@images =
{}
Class Method Summary collapse
Instance Method Summary collapse
- #draw(x:, y:, scale: 1) ⇒ Object
- #height ⇒ Object
-
#initialize(image_name) ⇒ Image
constructor
A new instance of Image.
- #width ⇒ Object
Methods included from Log
Constructor Details
Class Method Details
.load(image_name) ⇒ Object
25 26 27 |
# File 'lib/fantasy/image.rb', line 25 def load(image_name) locate_image(image_name) end |
.preload_images ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/fantasy/image.rb', line 29 def preload_images return unless Dir.exist?(base_path) Dir.each_child(base_path) do |file_name| locate_image(file_name) unless file_name.start_with?(".") end end |
Instance Method Details
#draw(x:, y:, scale: 1) ⇒ Object
8 9 10 |
# File 'lib/fantasy/image.rb', line 8 def draw(x:, y:, scale: 1) @image.draw(x, y, 0, scale, scale) end |
#height ⇒ Object
16 17 18 |
# File 'lib/fantasy/image.rb', line 16 def height @image.height end |
#width ⇒ Object
12 13 14 |
# File 'lib/fantasy/image.rb', line 12 def width @image.width end |