Closed obiot closed 10 years ago
:+1:
sweet! Thanks Olivier. I'll get this merged in ASAP, hopefully tonight.
Hey guys. It looks like on retina screens the playfield ends up half the size it should be. I see in game.js
there is me.video.init('screen', 320, 416 ...)
, but the resulting canvas ends up being set up as <canvas width="320" height="416" style="width: 160px; height: 208px;">
, so the playfield is about half the size it should be. This is happening to me on OSX 10.9 in Chrome, FF and Safari.
If I change the scale from undefined
to 2.0
in the call to me.video.init
, then I get the correct size on a retina display, and double the correct size on a standard display.
Unfortunately I don't have a retina display, so I cannot really help fixing this ... Is the change still make the rest to work as well ? (non retina display, and iOS ?)
Yeah other than that it's looking good. I will look into the retina issue and see if I can fix it. It should just be something like if(window.devicePixelRatio > 1) scale *= 2
, or maybe even scale *= window.devicePixelRatio
. I'll see if I can find a good spot inside melon to do that and send you guys a pull request for it
actually we do,
detection is made here : https://github.com/melonjs/melonJS/blob/1.0.0-dev/src/system/device.js#L345
and then used here : https://github.com/melonjs/melonJS/blob/1.0.0-dev/src/video/video.js#L117 https://github.com/melonjs/melonJS/blob/1.0.0-dev/src/video/video.js#L347 https://github.com/melonjs/melonJS/blob/1.0.0-dev/src/video/video.js#L382
and is working nicely on high-DPI devices like iphone/iPad
@parasyte you do have a retina MBP, right ?
For mobile the scale is set to "auto". I just added this (scale variable being the only change)
var scale = window.devicePixelRatio || 1;
if (!me.video.init('screen', 320, 416, me.device.isMobile ? true : false, me.device.isMobile ? "auto" : scale)) {
and now it's working well on all devices I have (iPhone 5s, standard laptop, MBP retina).
I won't deploy this out until @parasyte chimes in.
that's a smart fix ;)
I do not have retina MBP, sorry. I have retina iPhone only. :cry:
@city41 you can go for it then !
tonight I will do the fix for Breakouts. This weekend I'll take a gander at melon and see if I can find a permanent solution.
:+1:
alright, live on the site: http://jsbreakouts.org
great, thanks !
I think that maybe it's mostly an issue with the HTML/CSS, I can of course be wrong, but i'm pretty sure that out internal way of handling this correct.
Now uses the last dev branch of melonJS. The most noticeable change when playing breakouts is probably the audio support on mobile devices (as melonJS now relies on the web audio API), the rest are mostly internal improvements to the framework, API changes, and bug fixing