summaryrefslogtreecommitdiffhomepage
path: root/lib/ruby2d/camera/quad.rb
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2021-08-08 02:14:53 -0400
committerrealtradam <[email protected]>2021-08-08 02:14:53 -0400
commitcad7a2876013ae52f248d7d3fd35bb6d7a2d36cb (patch)
tree7888eb2df8401feaa1426d9ca411a7e7b76cb792 /lib/ruby2d/camera/quad.rb
parente9a05cecd41b244977c794931b4706015097774f (diff)
downloadruby2d-camera-cad7a2876013ae52f248d7d3fd35bb6d7a2d36cb.tar.gz
ruby2d-camera-cad7a2876013ae52f248d7d3fd35bb6d7a2d36cb.zip
fixed formatting and file structure
Diffstat (limited to 'lib/ruby2d/camera/quad.rb')
-rw-r--r--lib/ruby2d/camera/quad.rb26
1 files changed, 10 insertions, 16 deletions
diff --git a/lib/ruby2d/camera/quad.rb b/lib/ruby2d/camera/quad.rb
index 92d858a..5b778b9 100644
--- a/lib/ruby2d/camera/quad.rb
+++ b/lib/ruby2d/camera/quad.rb
@@ -9,6 +9,7 @@ module Ruby2D
# Use after changing variables
def _draw
return if @hide
+
angle = Camera.angle * (Math::PI / 180)
half_width = Window.width * 0.5
half_height = Window.height * 0.5
@@ -25,20 +26,20 @@ module Ruby2D
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],
- [self.c3.r, self.c3.g, self.c3.b, self.c3.a],
- [self.c4.r, self.c4.g, self.c4.b, self.c4.a]
+ [c1.r, c1.g, c1.b, c1.a],
+ [c2.r, c2.g, c2.b, c2.a],
+ [c3.r, c3.g, c3.b, c3.a],
+ [c4.r, c4.g, c4.b, c4.a]
],
- z: self.z
- )
+ z: z)
end
- def initialize(opts= {})
+ def initialize(opts = {})
super(opts)
Ruby2D::Camera << self
Window.remove(self)
end
+
def remove
@hide = true
end
@@ -47,23 +48,16 @@ module Ruby2D
@hide = false
end
-
- #Methods for moving the shape
+ # Methods for moving the shape
def x
@x ||= 0
end
- def x=(x)
- @x = x
- end
+ attr_writer :x, :y
def y
@y ||= 0
end
-
- def y=(y)
- @y = y
- end
end
end
end