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
|
- **examples:** Add missing translations
|
||||||
|
|
||||||
|
- **camera:** Fix onscreen coordinates by using new core.screen func
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- **actor:** Remove all function related to XGravity
|
- **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)
|
viewx = (basex) + view.pos.onScreen.x - (self.views.width / 2)
|
||||||
viewy = (basey) + view.pos.onScreen.y - (self.views.height / 2)
|
viewy = (basey) + view.pos.onScreen.y - (self.views.height / 2)
|
||||||
|
|
||||||
vieww = self.views.width
|
viewx, viewy = core.screen:getScreenCoordinate(viewx, viewy)
|
||||||
viewh = self.views.height
|
|
||||||
|
vieww = self.views.width * core.screen:getScale()
|
||||||
|
viewh = self.views.height * core.screen:getScale()
|
||||||
return viewx, viewy, vieww, viewh
|
return viewx, viewy, vieww, viewh
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -245,7 +247,7 @@ function CameraSystem:getOnScreenViewRelativePosition(id)
|
||||||
viewx = view.pos.onScreen.x
|
viewx = view.pos.onScreen.x
|
||||||
viewy = view.pos.onScreen.y
|
viewy = view.pos.onScreen.y
|
||||||
|
|
||||||
return viewx, viewy
|
return core.screen:getScreenCoordinate(viewx, viewy)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CameraSystem:getOnScreenViewCenter(id)
|
function CameraSystem:getOnScreenViewCenter(id)
|
||||||
|
@ -256,13 +258,13 @@ function CameraSystem:getOnScreenViewCenter(id)
|
||||||
viewx = (basex) + view.pos.onScreen.x
|
viewx = (basex) + view.pos.onScreen.x
|
||||||
viewy = (basey) + view.pos.onScreen.y
|
viewy = (basey) + view.pos.onScreen.y
|
||||||
|
|
||||||
return viewx, viewy
|
return core.screen:getScreenCoordinate(viewx, viewy)
|
||||||
end
|
end
|
||||||
|
|
||||||
function CameraSystem:getViewScale(id)
|
function CameraSystem:getViewScale(id)
|
||||||
local cam = self:getViewCam(id)
|
local cam = self:getViewCam(id)
|
||||||
|
|
||||||
return cam.scale
|
return cam.scale * core.screen:getScale()
|
||||||
end
|
end
|
||||||
|
|
||||||
function CameraSystem:limitView(id)
|
function CameraSystem:limitView(id)
|
||||||
|
|
Loading…
Reference in a new issue