Get client aspect ratio or screen resolution

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Get client aspect ratio or screen resolution

Postby iPlayer » Mon Dec 21, 2015 8:24 am

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?
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Postby Kami » Mon Dec 21, 2015 3:40 pm

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?^^
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Mon Dec 21, 2015 4:20 pm

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.
User avatar
iPlayer
Developer
Posts: 590
Joined: Sat Nov 14, 2015 8:37 am
Location: Moscow
Contact:

Postby iPlayer » Mon Dec 21, 2015 5:26 pm

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 132 guests