diff options
Diffstat (limited to 'lib/ruby2d/camera/image.rb')
| -rw-r--r-- | lib/ruby2d/camera/image.rb | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/ruby2d/camera/image.rb b/lib/ruby2d/camera/image.rb index fe777b3..dccbec9 100644 --- a/lib/ruby2d/camera/image.rb +++ b/lib/ruby2d/camera/image.rb @@ -8,6 +8,7 @@ module Camera # Use after changing variables def _draw return if @hide + temp_angle = Camera.angle * (Math::PI / 180) half_width = Window.width * 0.5 half_height = Window.height * 0.5 @@ -17,27 +18,28 @@ module Camera * Camera.zoom + half_width - (width * Camera.zoom / 2) temp_y = (((offset_x - Camera.x) * Math.sin(temp_angle)) + ((offset_y - Camera.y) * Math.cos(temp_angle))) \ * Camera.zoom + half_height - (height * Camera.zoom / 2) - temp_rotate = self.rotate + Camera.angle - temp_width = self.width * Camera.zoom - temp_height = self.height * Camera.zoom - self.draw(x: temp_x, y: temp_y, - width: temp_width, - height: temp_height, - rotate: temp_rotate, - color: [self.color.r, self.color.g, self.color.b, self.color.a]) + temp_rotate = rotate + Camera.angle + temp_width = width * Camera.zoom + temp_height = height * Camera.zoom + draw(x: temp_x, y: temp_y, + width: temp_width, + height: temp_height, + rotate: temp_rotate, + color: [color.r, color.g, color.b, color.a]) end - def initialize(path, opts= {}) + def initialize(path, opts = {}) super(path, opts) Ruby2D::Camera << self Window.remove(self) end - def remove - @hide = true - end - def add - @hide = false - end + def remove + @hide = true + end + + def add + @hide = false + end end end |
