summaryrefslogtreecommitdiffhomepage
path: root/lib/ruby2d/camera/quad.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ruby2d/camera/quad.rb')
-rw-r--r--lib/ruby2d/camera/quad.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/ruby2d/camera/quad.rb b/lib/ruby2d/camera/quad.rb
index 5dc52e1..92d858a 100644
--- a/lib/ruby2d/camera/quad.rb
+++ b/lib/ruby2d/camera/quad.rb
@@ -7,7 +7,8 @@ module Ruby2D
class Quad < Ruby2D::Quad
# Recalculates real coordiantes
# Use after changing variables
- def redraw
+ def _draw
+ return if @hide
angle = Camera.angle * (Math::PI / 180)
half_width = Window.width * 0.5
half_height = Window.height * 0.5
@@ -21,8 +22,8 @@ module Ruby2D
temp_y4 = (((x + x4 - Camera.x) * Math.sin(angle)) + ((y + y4 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height
Ruby2D::Quad.draw(x1: temp_x1, y1: temp_y1,
x2: temp_x2, y2: temp_y2,
- x3: temp_x3, x3: temp_x3,
- x4: temp_x4, x4: temp_x4,
+ x3: temp_x3, y3: temp_y3,
+ x4: temp_x4, y4: temp_y4,
color: [
[self.c1.r, self.c1.g, self.c1.b, self.c1.a],
[self.c2.r, self.c2.g, self.c2.b, self.c2.a],
@@ -36,7 +37,14 @@ module Ruby2D
def initialize(opts= {})
super(opts)
Ruby2D::Camera << self
- self.remove
+ Window.remove(self)
+ end
+ def remove
+ @hide = true
+ end
+
+ def add
+ @hide = false
end