1 decade ago by sviudes
I'm creating a game with 960x640 resolution (iPhone retina). So background image resolution will be 960x640.
I calculate canvas size in this way:
In both iPhone (retina and no retina) window.innerHeight is 320, so canvasScale is always 0.5 (because devicePixelRatio in retina is 2)
So, my question is... images will display well? (I have no iPhone to test yet) Or will be better to create the game with 480x320 resolution and then use separate images for non-retina and retina (@2x) ?
I calculate canvas size in this way:
var canvasScale = window.innerHeight / 640; var canvas = document.getElementById('canvas'); canvas.style.width = 960 * canvasScale + 'px'; canvas.style.height = 640 * canvasScale + 'px';
In both iPhone (retina and no retina) window.innerHeight is 320, so canvasScale is always 0.5 (because devicePixelRatio in retina is 2)
So, my question is... images will display well? (I have no iPhone to test yet) Or will be better to create the game with 480x320 resolution and then use separate images for non-retina and retina (@2x) ?