Closed MathieuLoutre closed 8 years ago
Can't you already use Sup.Input.getScreenSize()
and camera.getViewport()
to do this computation?
But maybe we can still add a method to make it easier. Not completly sure.
Ah! I was expecting the "getScreenSize()" method to be on the Camera for some reason. It wasn't entirely intuitive. However, I'll give that a go and report if I can get the same results. No need for a dedicated method if the data is already available.
Looks exactly like what I was after. I wish there was a better way to find out what the engine has in store. The API search isn't always the best way to find methods (if the keywords don't match). Something for the future maybe?
Yeah the search API can definitly be improved... Sorry for not being very convenient right now
When working on a responsive game (no set width/height), I'd like some GUI elements to cover a particular percentage of the screen (for instance, always cover 50% of the screen whatever the resolution). Currently, as far as I'm aware, there's no way to do that easily.
I've tried something as detailed here: https://itch.io/t/38027/asset-scaling-to-match-camera-size#post-49255 and ended up monkey patching the game system to add:
which then allows me to do something like
I can go on to use that ratio to scale any assets regardless of their own pixel per unit ratio etc. It's incredibly useful. I was wondering if there's any interest in adding these methods or maybe a
getPixelPerUnit()
method on the camera. I could prepare a PR for it if so.Let me know.