From a96780e04d22c916921be996a6b99487efc4e569 Mon Sep 17 00:00:00 2001 From: the lemons Date: Sat, 27 Aug 2022 02:49:55 -0500 Subject: store the current camera as an attribute of the world --- Camera.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Camera.lua') 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()) -- cgit v1.2.3