From cad7a2876013ae52f248d7d3fd35bb6d7a2d36cb Mon Sep 17 00:00:00 2001 From: realtradam Date: Sun, 8 Aug 2021 02:14:53 -0400 Subject: fixed formatting and file structure --- lib/ruby2d/camera/line.rb | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'lib/ruby2d/camera/line.rb') diff --git a/lib/ruby2d/camera/line.rb b/lib/ruby2d/camera/line.rb index 9113b92..f6d8f03 100644 --- a/lib/ruby2d/camera/line.rb +++ b/lib/ruby2d/camera/line.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 @@ -18,22 +19,23 @@ module Ruby2D temp_y2 = (((x + @x2 - Camera.x) * Math.sin(angle)) + ((y + @y2 - Camera.y) * Math.cos(angle))) * Camera.zoom + half_height temp_width = width * Camera.zoom Ruby2D::Line.draw(x1: temp_x1, y1: temp_y1, - x2: temp_x2, y2: temp_y2, - width: temp_width, - color: [ - [self.color.r, self.color.g, self.color.b, self.color.a], - [self.color.r, self.color.g, self.color.b, self.color.a], - [self.color.r, self.color.g, self.color.b, self.color.a], - [self.color.r, self.color.g, self.color.b, self.color.a] - ], - z: self.z) + x2: temp_x2, y2: temp_y2, + width: temp_width, + color: [ + [color.r, color.g, color.b, color.a], + [color.r, color.g, color.b, color.a], + [color.r, color.g, color.b, color.a], + [color.r, color.g, color.b, color.a] + ], + z: z) end - def initialize(opts= {}) + def initialize(opts = {}) super(opts) Ruby2D::Camera << self Window.remove(self) end + def remove @hide = true end @@ -42,22 +44,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 -- cgit v1.2.3