TwoPointFive
TwoPointFive copied to clipboard
Fixed HUD aspect ratio on mobile devices
The HUD size was hard-coded to 640x480, which causes it to look stretched on iPhone (especially noticeable with the grenade launcher), which has a different aspect ratio (see screenshot):
I originally tried just using the canvas width/height instead of a hard-coded value, which fixes the problem on iPhone, but causes the grenade launcher to look too small on an iPad relative to the size of the grenades:
So instead, I've kept 640 for the width, but set the height proportional to the canvas size. This means that the HUD always maintains the same scale relative to the screen width (and the grenades that it fires), but doesn't get distorted for screens with different aspect ratios: