From f68a8383af4824a3ae514fd9f7aa74f6eb6890b6 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 23 Jun 2019 14:54:30 -0500 Subject: [PATCH] Monkeypatch Gosu::Color to add <=> to support color ranges in Background --- lib/cyberarm_engine/background.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/cyberarm_engine/background.rb b/lib/cyberarm_engine/background.rb index bbddc50..b15c6c1 100644 --- a/lib/cyberarm_engine/background.rb +++ b/lib/cyberarm_engine/background.rb @@ -158,9 +158,20 @@ module CyberarmEngine @top_right = background[:top_right] @bottom_left = background[:bottom_left] @bottom_right = background[:bottom_right] + elsif background.is_a?(Range) + set([background.begin, background.begin, background.end, background.end]) else raise ArgumentError, "background '#{background}' of type '#{background.class}' was not able to be processed" end end end -end \ No newline at end of file +end + +# Add <=> method to support Range based gradients +module Gosu + class Color + def <=>(other) + self + end + end +end