aduros / flambe

Rapidly cook up games for HTML5, Flash, Android, and iOS.
https://github.com/aduros/flambe/wiki
MIT License
744 stars 118 forks source link

Incorrect stage width and height on iPads when in Landscape WebView #70

Open accidentalrebel opened 11 years ago

accidentalrebel commented 11 years ago

The stage width and height is incorrect when running HTML5 in landscape view in webview mode.

In portrait orientation it detects the correct sizes: 768x1024. But when the game is booted in landscape orientation it gets 1024x1024 when it should be 1024x768.

Also, it is important to note that there are no problems when the game is run inside Safari on iPad.

accidentalrebel commented 11 years ago

Tested using the MiHTool. Bug still there.

aduros commented 11 years ago

Just a heads up that I've confirmed this. It's not immediately obvious to me what the problem is though, please send a patch if you can!

grantbi commented 11 years ago

You could try using this idea: Change flambe.platform.html.HtmlStage.hx line 34: //scaleFactor = computeScaleFactor(); (Comment this out) scaleFactor = 1; (This fixes the high DPI resolution problems on iOS 4+ Retina.)

You'll have to manage the scale factor in your webpage.

jmp909 commented 10 years ago

this may be relevant... http://stackoverflow.com/questions/2242086/how-to-detect-the-screen-resolution-with-javascript

when you rotate the device availHeight and availWidth don't actually change, so you may need to swap around the reported values if it's in landscape. (although i noticed you're not using availWidth/availHeight)