class Smalruby3::Costume
Attributes
asset_id[R]
bitmap_resolution[R]
data_format[R]
name[R]
rotation_center_x[R]
rotation_center_y[R]
Public Class Methods
new(asset)
click to toggle source
# File lib/smalruby3/costume.rb, line 10 def initialize(asset) @asset_id = asset[:asset_id] @name = asset[:name] @bitmap_resolution = asset[:bitmap_resolution] || 1 @data_format = asset[:data_format] @rotation_center_x = asset[:rotation_center_x] @rotation_center_y = asset[:rotation_center_y] end
Public Instance Methods
height()
click to toggle source
# File lib/smalruby3/costume.rb, line 27 def height @height ||= image.height * height_scale end
height_scale()
click to toggle source
# File lib/smalruby3/costume.rb, line 35 def height_scale @height_scale ||= World.instance.s2dx.scale / bitmap_resolution end
image()
click to toggle source
# File lib/smalruby3/costume.rb, line 19 def image @image ||= DXRuby::Image.load(asset_path) end
width()
click to toggle source
# File lib/smalruby3/costume.rb, line 23 def width @width ||= image.width * width_scale end
width_scale()
click to toggle source
# File lib/smalruby3/costume.rb, line 31 def width_scale @width_scale ||= World.instance.s2dx.scale / bitmap_resolution end
Private Instance Methods
asset_path()
click to toggle source
# File lib/smalruby3/costume.rb, line 41 def asset_path World.instance.asset_path(asset_id, data_format) end