mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 13:12:34 +00:00
Added support for passing flags to get_image, aliased Vector#weight/= to Vector#w/=
This commit is contained in:
@@ -54,7 +54,7 @@ module CyberarmEngine
|
||||
return Gosu::Color.rgba(color.red, color.green, color.blue, alpha)
|
||||
end
|
||||
|
||||
def get_asset(path, hash, klass)
|
||||
def get_asset(path, hash, klass, retro = false, tileable = false)
|
||||
asset = nil
|
||||
hash.detect do |_asset, instance|
|
||||
if _asset == path
|
||||
@@ -64,7 +64,12 @@ module CyberarmEngine
|
||||
end
|
||||
|
||||
unless asset
|
||||
instance = klass.new(path)
|
||||
instance = nil
|
||||
if klass == Gosu::Image
|
||||
instance = klass.new(path, retro: retro, tileable: tileable)
|
||||
else
|
||||
instance = klass.new(path)
|
||||
end
|
||||
hash[path] = instance
|
||||
asset = instance
|
||||
end
|
||||
@@ -72,8 +77,8 @@ module CyberarmEngine
|
||||
return asset
|
||||
end
|
||||
|
||||
def get_image(path)
|
||||
get_asset(path, Engine::IMAGES, Gosu::Image)
|
||||
def get_image(path, retro: false, tileable: false)
|
||||
get_asset(path, Engine::IMAGES, Gosu::Image, retro, tileable)
|
||||
end
|
||||
|
||||
def get_sample(path)
|
||||
|
||||
@@ -7,11 +7,6 @@ module CyberarmEngine
|
||||
raise "Transform is wrong size! Got #{@elements.size}, expected 16" if 16 != @elements.size
|
||||
end
|
||||
|
||||
def error(pos)
|
||||
p @elements
|
||||
Vector.new(@elements[3], @elements[7]) - pos
|
||||
end
|
||||
|
||||
def self.rotate(angle, rotate_around = nil)
|
||||
double c = Math.cos(angle).degrees_to_radians
|
||||
double s = Math.sin(angle).degrees_to_radians
|
||||
|
||||
@@ -40,6 +40,9 @@ module CyberarmEngine
|
||||
def weight; @weight; end
|
||||
def weight=(n); @weight = n; end
|
||||
|
||||
alias w weight
|
||||
alias w= weight=
|
||||
|
||||
def ==(other)
|
||||
if other.is_a?(Numeric)
|
||||
@x == other &&
|
||||
|
||||
Reference in New Issue
Block a user