summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/color.rb7
-rw-r--r--mrblib/core.rb18
-rw-r--r--mrblib/raylib.rb18
3 files changed, 23 insertions, 20 deletions
diff --git a/mrblib/color.rb b/mrblib/color.rb
index 2625f34..c936f0d 100644
--- a/mrblib/color.rb
+++ b/mrblib/color.rb
@@ -58,6 +58,13 @@ module Raylib
end
self.send(result)
end
+
+ def clone
+ Raylib::Color.new(r: self.r,
+ g: self.g,
+ b: self.b,
+ a: self.a)
+ end
end
# Hash of all web colors, RayWhite, and Clear
diff --git a/mrblib/core.rb b/mrblib/core.rb
index 5d27566..8f93772 100644
--- a/mrblib/core.rb
+++ b/mrblib/core.rb
@@ -1,6 +1,20 @@
module Raylib
- class Color
- class << self
+ class << self
+ # The code block version of {Raylib.begin_scissor_mode} and {Raylib.end_scissor_mode}
+ # @overload scissor_mode(x: 0, y: 0, width: 10, height: 10, &block)
+ # @param x [Integer]
+ # @param y [Integer]
+ # @param width [Integer]
+ # @param height [Integer]
+ # @param block [Proc] The code to be executed in the scissor mode
+ def scissor_mode(*args, x: 0, y: 0, width: 10, height: 10, &block)
+ if args.length == 4
+ self.begin_scissor_mode(args[0], args[1], args[2], args[3])
+ else
+ self.begin_scissor_mode(x: x, y: y, width: width, height: height)
+ end
+ yield
+ self.end_scissor_mode
end
end
end
diff --git a/mrblib/raylib.rb b/mrblib/raylib.rb
index e53a15b..0e60abf 100644
--- a/mrblib/raylib.rb
+++ b/mrblib/raylib.rb
@@ -59,7 +59,6 @@ module Raylib
self.defined_loop.call
end
-
def draw_text(text:, x:, y:, font_size:, color: Rl::Color.new(255,255,255,255))
self._draw_text(text, x, y, font_size, color)
end
@@ -89,23 +88,6 @@ module Raylib
self.data_keys_pressed
end
- # The code block version of {Raylib.begin_scissor_mode} and {Raylib.end_scissor_mode}
- # @overload scissor_mode(x: 0, y: 0, width: 10, height: 10, &block)
- # @param x [Integer]
- # @param y [Integer]
- # @param width [Integer]
- # @param height [Integer]
- # @param block [Proc] The code to be executed in the scissor mode
- def scissor_mode(*args, x: 0, y: 0, width: 10, height: 10, &block)
- if args.length == 4
- self.begin_scissor_mode(args[0], args[1], args[2], args[3])
- else
- self.begin_scissor_mode(x, y, width, height)
- end
- yield
- self.end_scissor_mode
- end
-
def draw(clear_color: nil, &block)
self.clear_background(clear_color) if clear_color
self.begin_drawing