Skip to content

Fixed HUD aspect ratio on mobile devices#5

Open
nicklockwood wants to merge 1 commit intophoboslab:masterfrom
nicklockwood:fix-aspect-ratio
Open

Fixed HUD aspect ratio on mobile devices#5
nicklockwood wants to merge 1 commit intophoboslab:masterfrom
nicklockwood:fix-aspect-ratio

Conversation

@nicklockwood
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant