Page 1 of 1

Get client aspect ratio or screen resolution

Posted: Mon Dec 21, 2015 8:24 am
by iPlayer
I want to send them a screen overlay but the problem is that the overlay contains a square picture. So I prepared two overlays - for widescreen and for 4:3. Is there any way to determine client's aspect ratio?

Posted: Mon Dec 21, 2015 3:40 pm
by Kami
Not sure if this helps, but wouldn't a certain aspect ratio mean the player has a certain FOV? So maybe you could get the FOV of the player and translate that to aspect ratio?^^

Posted: Mon Dec 21, 2015 4:20 pm
by iPlayer
Thanks, Kami, I will try to track FOVs on different aspect ratios. Will write back.

Edit: Nope, didn't work. m_iFOV is always 0, m_iDefaultFOV is always 90.

Posted: Mon Dec 21, 2015 5:26 pm
by iPlayer
Tried to get screen resolution via this page

Syntax: Select all

<!doctype html>
<html>
<head>
<title>Screen Resolution Detector</title>
<style type="text/css">
html, body
{
background-color: #fff;
}
</style>
</head>
<body>
<script>
document.write(''+screen.width+' '+screen.height);
</script>
</body>
</html>


It only shows widht/height of the motd HTML area.