From 065a67a915501172dedb9c647882b435de404462 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Thu, 2 May 2019 16:19:59 +0200 Subject: [PATCH] modules/world: add a function to get view relative position --- gamecore/modules/world/camera.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gamecore/modules/world/camera.lua b/gamecore/modules/world/camera.lua index 7df4622..2d889f2 100644 --- a/gamecore/modules/world/camera.lua +++ b/gamecore/modules/world/camera.lua @@ -218,6 +218,17 @@ function CameraSystem:getOnScreenViewCoordinate(id) return viewx, viewy, vieww, viewh end +function CameraSystem:getOnScreenViewRelativePosition(id) + local view = self:getView(id) + + local viewx, viewy + local basex, basey = (self.views.basewidth / 2), (self.views.baseheight / 2) + viewx = view.pos.onScreen.x + viewy = view.pos.onScreen.y + + return viewx, viewy +end + function CameraSystem:getOnScreenViewCenter(id) local view = self:getView(id)