Jump to content

Device aspect ratio


craidencool
 Share

Recommended Posts

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...