TwoPointFive icon indicating copy to clipboard operation
TwoPointFive copied to clipboard

Fixed HUD aspect ratio on mobile devices

Open nicklockwood opened this issue 8 years ago • 0 comments

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):

simulator screen shot 30 may 2016 15 19 00

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:

simulator screen shot 30 may 2016 15 20 35

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:

simulator screen shot 30 may 2016 15 21 46

simulator screen shot 30 may 2016 15 42 44

nicklockwood avatar May 30 '16 15:05 nicklockwood