summaryrefslogtreecommitdiff
path: root/Camera.lua
diff options
context:
space:
mode:
authorthe lemons <citrons@mondecitronne.com>2022-08-27 02:49:55 -0500
committerthe lemons <citrons@mondecitronne.com>2022-08-27 02:50:27 -0500
commita96780e04d22c916921be996a6b99487efc4e569 (patch)
treec83eec2efa53b4f54b56bc0fd750c0c5ad46c920 /Camera.lua
parent0e89c14698023c50001fb820c82f2f59b0730b03 (diff)
store the current camera as an attribute of the world
Diffstat (limited to 'Camera.lua')
-rw-r--r--Camera.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/Camera.lua b/Camera.lua
index 3b3f1a3..5a9c87b 100644
--- a/Camera.lua
+++ b/Camera.lua
@@ -5,6 +5,10 @@ local Transform = require 'Transform'
local Camera = component({Transform})
function Camera:use()
+ self.obj.world.camera = self
+end
+
+function Camera:transform()
local trans = self.obj:get(Transform):love()
local cam_trans = love.math.newTransform(1920 / 2, 1080 / 2)
love.graphics.applyTransform(cam_trans * trans:inverse())