craidencool Posted June 20, 2016 Share Posted June 20, 2016 Hi guys! can you determine the aspect ratio of a device using phaser js? Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted June 20, 2016 Share Posted June 20, 2016 var canvas_width = window.screen.availWidth * window.devicePixelRatio; var canvas_height = window.screen.availHeight * window.devicePixelRatio; var aspect_ratio = canvas_width / canvas_height; drhayes 1 Link to comment Share on other sites More sharing options...
craidencool Posted June 21, 2016 Author Share Posted June 21, 2016 18 hours ago, VitaZheltyakov said: var canvas_width = window.screen.availWidth * window.devicePixelRatio; var canvas_height = window.screen.availHeight * window.devicePixelRatio; var aspect_ratio = canvas_width / canvas_height; Im sorry sir im really new with game development, the aspect_ration variable results to (E.G 1.88) but isnt aspect ratio is like (16:9, 5:4) thank you again. I am still very unfamiliar. Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted June 21, 2016 Share Posted June 21, 2016 49 minutes ago, Newbie_HelpMe said: Im sorry sir im really new with game development, the aspect_ration variable results to (E.G 1.88) but isnt aspect ratio is like (16:9, 5:4) thank you again. I am still very unfamiliar. You forget, that there is OS statusbar. We have not the aspect ratio of the screen. Link to comment Share on other sites More sharing options...
DevJ Posted June 21, 2016 Share Posted June 21, 2016 1 hour ago, VitaZheltyakov said: You forget, that there is OS statusbar. We have not the aspect ratio of the screen. Not if you compile it into a fullscreen app with PhoneGap or such? Correct me if I'm wrong. Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted June 21, 2016 Share Posted June 21, 2016 6 hours ago, DevJ said: Not if you compile it into a fullscreen app with PhoneGap or such? Correct me if I'm wrong. I have not worked with Phonegap. Cordova does not allow Link to comment Share on other sites More sharing options...
Recommended Posts