diff options
| author | realtradam <[email protected]> | 2021-08-08 02:14:53 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2021-08-08 02:14:53 -0400 |
| commit | cad7a2876013ae52f248d7d3fd35bb6d7a2d36cb (patch) | |
| tree | 7888eb2df8401feaa1426d9ca411a7e7b76cb792 /lib/ruby2d/camera/image.rb | |
| parent | e9a05cecd41b244977c794931b4706015097774f (diff) | |
| download | ruby2d-camera-cad7a2876013ae52f248d7d3fd35bb6d7a2d36cb.tar.gz ruby2d-camera-cad7a2876013ae52f248d7d3fd35bb6d7a2d36cb.zip | |
fixed formatting and file structure
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 |
