Is there any elegant way of calculating velocities, sizes and distances so that they end up the same on every screen size?
I tried a lot of things, including scaling factors etc. but it didn't work. Everything ended up having super weird sizes as soon as the screen size wasn't 1920x1080 anymore.
EDIT:
I fixed it. I now create the objects using fractions of the screen width for the sizes.
I divide every hard-coded velocity I use by 1080 / screenWidth
or 1920 / screenHeight
, respectively, so that they are the same on every screen size.
So I still use scaling factors, but I use them way less frequently, and I think I sometimes used them in wrong places.
Now the question is: Now that everything is scaled with the screen width, how can I support devices with other ratios than 16:9? I tried to find out which of the sides is closer to the 16:9 frame and then use that one to scale everything properly, but that cannot work as I found out. How do games handle different screen ratios?