fix(camera): fix onscreen coordinates by using new core.screen func
This commit is contained in:
parent
fb428b45c3
commit
6947d2f3f2
2 changed files with 9 additions and 5 deletions
|
@ -55,6 +55,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- **examples:** Add missing translations
|
||||
|
||||
- **camera:** Fix onscreen coordinates by using new core.screen func
|
||||
|
||||
### Removed
|
||||
|
||||
- **actor:** Remove all function related to XGravity
|
||||
|
|
|
@ -232,8 +232,10 @@ function CameraSystem:getOnScreenViewCoordinate(id)
|
|||
viewx = (basex) + view.pos.onScreen.x - (self.views.width / 2)
|
||||
viewy = (basey) + view.pos.onScreen.y - (self.views.height / 2)
|
||||
|
||||
vieww = self.views.width
|
||||
viewh = self.views.height
|
||||
viewx, viewy = core.screen:getScreenCoordinate(viewx, viewy)
|
||||
|
||||
vieww = self.views.width * core.screen:getScale()
|
||||
viewh = self.views.height * core.screen:getScale()
|
||||
return viewx, viewy, vieww, viewh
|
||||
end
|
||||
|
||||
|
@ -245,7 +247,7 @@ function CameraSystem:getOnScreenViewRelativePosition(id)
|
|||
viewx = view.pos.onScreen.x
|
||||
viewy = view.pos.onScreen.y
|
||||
|
||||
return viewx, viewy
|
||||
return core.screen:getScreenCoordinate(viewx, viewy)
|
||||
end
|
||||
|
||||
function CameraSystem:getOnScreenViewCenter(id)
|
||||
|
@ -256,13 +258,13 @@ function CameraSystem:getOnScreenViewCenter(id)
|
|||
viewx = (basex) + view.pos.onScreen.x
|
||||
viewy = (basey) + view.pos.onScreen.y
|
||||
|
||||
return viewx, viewy
|
||||
return core.screen:getScreenCoordinate(viewx, viewy)
|
||||
end
|
||||
|
||||
function CameraSystem:getViewScale(id)
|
||||
local cam = self:getViewCam(id)
|
||||
|
||||
return cam.scale
|
||||
return cam.scale * core.screen:getScale()
|
||||
end
|
||||
|
||||
function CameraSystem:limitView(id)
|
||||
|
|
Loading…
Reference in a new issue