From ce9047d61e9514cbb38bfc0f8dcdb7dac4afa840 Mon Sep 17 00:00:00 2001 From: realtradam Date: Thu, 22 Apr 2021 23:07:11 -0400 Subject: . --- camera.rb | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'camera.rb') diff --git a/camera.rb b/camera.rb index 67a537f..2f521cc 100644 --- a/camera.rb +++ b/camera.rb @@ -21,18 +21,19 @@ module Camera end def self.center_x=(center_x) - @x = center_x - ((Window.width / 2) * (1/zoom)) + @x = center_x - ((Window.width / 2) )#* (1/zoom)) objects.each(&:_update) end def self.center_y - y + ((Window.height / 2) * (1/zoom)) + y + ((Window.height / 2) )#* (1/zoom)) end def self.center_y=(center_y) - @y = center_y - ((Window.height / 2) * (1/zoom)) + @y = center_y - ((Window.height / 2) )#* (1/zoom)) objects.each(&:_update) end +=begin def self.center(center_x, center_y) self.center_y = center_y self.center_x = center_y @@ -48,6 +49,17 @@ module Camera #@y = y + ((pivot_x - x) * Math.sin(angle)) + ((pivot_y - y) * Math.cos(angle)) objects.each(&:_update) end +=end + def self._x(x) + @x += x + objects.each(&:_update) + end + + def self._y(y) + @y += y + objects.each(&:_update) + end + def self.x @x ||= 0 end @@ -76,7 +88,9 @@ module Camera def self.zoom=(zoom) if zoom != self.zoom - temp = [center_x, center_y] + shift = (Window.width - Window.height) / 2 + #temp = [center_x, center_y] + temp = [0, center_y] @zoom = zoom self.center_x = temp[0] self.center_y = temp[1] -- cgit v1.2.3