mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2025-12-16 21:22:33 +00:00
Monkeypatch Gosu::Color to add <=> to support color ranges in Background
This commit is contained in:
@@ -158,9 +158,20 @@ module CyberarmEngine
|
|||||||
@top_right = background[:top_right]
|
@top_right = background[:top_right]
|
||||||
@bottom_left = background[:bottom_left]
|
@bottom_left = background[:bottom_left]
|
||||||
@bottom_right = background[:bottom_right]
|
@bottom_right = background[:bottom_right]
|
||||||
|
elsif background.is_a?(Range)
|
||||||
|
set([background.begin, background.begin, background.end, background.end])
|
||||||
else
|
else
|
||||||
raise ArgumentError, "background '#{background}' of type '#{background.class}' was not able to be processed"
|
raise ArgumentError, "background '#{background}' of type '#{background.class}' was not able to be processed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Add <=> method to support Range based gradients
|
||||||
|
module Gosu
|
||||||
|
class Color
|
||||||
|
def <=>(other)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user