4 ms·
To be honest, a lot of what you're saying doesn't make sense. But yes you can have "bonkers" devicePixelRatio. Namely, when the browser is zoomed. Logical pix
by paulddraper 1y ago
To be honest, a lot of what you're saying doesn't make sense.
But yes you can have "bonkers" devicePixelRatio. Namely, when the browser is zoomed.
Logical pixels measure UI "size." And Physical pixels (logical pixels * devicePixelRatio) is the number of dots.
Your game layout should target logical pixels. And rasterization, textures, etc should target physical pixels.
If weird devicePixelRatio causes problems with a lot of pixel-exact UI, you may choose to use your own logical pixels that has a rounded devicePixelRatio.
---
I have a MacBook with a retina display. Versus a non-retina display, I would not expect that everything is 2x smaller, but rather 2x more detailed (or, if not that, the same level of detail but same size). That important distinction is reason for two different constants.
- FrostKiwi 1y ago> If weird devicePixelRatio causes problems with a lot of pixel-exact UI, you may choose to use your own logical pixels that has a rounded devicePixelRatio. Exactly that is unfortunately not possible, you may or may not get off by one resolution. > I would not expect that everything is 2x smaller Of course. > but rather 2x more detailed That's specifically the thing you cannot guarantee, as sometimes due to lack of standarization, it maybe 2.01x size, leading to those UI elements being the right size, but slightly blurry due to pixel grid mismatches.