diff options
Diffstat (limited to 'lib/ruby2d/camera/square.rb')
| -rw-r--r-- | lib/ruby2d/camera/square.rb | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/lib/ruby2d/camera/square.rb b/lib/ruby2d/camera/square.rb index 584af03..75e1e83 100644 --- a/lib/ruby2d/camera/square.rb +++ b/lib/ruby2d/camera/square.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,16 +26,15 @@ 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) @@ -55,24 +55,17 @@ module Ruby2D def add @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 - |
