getResolution: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(example)
m (Text replacement - "\{\{Feature *\| *Informative *\| ([^↵]+) *\}\}" to "{{Feature|informative|$1}}")
 
(50 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2oa |= Game name
|game1= arma2oa
|version1= 1.55


|1.55|= Game version
|game2= tkoh
____________________________________________________________________________________________
|version2= 1.00


| Returns an array containing all information about resolution.
|game3= arma3
<br>
|version3= 0.50
The returned [[Array]] is as follow: [width, height, 2D viewport width, 2D viewport height, aspect ratio, UI scale]
<br>
Note: <em>aspect ratio and UI scale are returned as coefficients and not 16:9 for example.</em>|= Description
____________________________________________________________________________________________


| '''getResolution''' |= Syntax
|gr1= System


| [[Array]] |= Return value
|gr2= GUI Control - Positioning
____________________________________________________________________________________________


|x1= <code>_res = [[getResolution]]; //some single monitor setup</code>
|descr= Returns an array containing all information about current client screen resolution.
<code>[
1360, //width
768, //height
867, //2D viewport width
653, //2D viewport height
1.77778, //aspect ratio
0.85 //UI scale
]</code> |= |=
|x2= <code>_res = [[getResolution]];  //dedicated server</code>
<code>[
160, //width
120, //height
136, //2D viewport width
102, //2D viewport height
1.33333, //aspect ratio
0.85 //UI scale
]</code> |=
|x3= <code>_res = [[getResolution]]; //some triple monitor setup</code>
<code>[
5760, //width
1080, //height
792, //2D viewport width
594, //2D viewport height
5.33333, //aspect ratio
0.55 //UI scale
]</code> |=
____________________________________________________________________________________________


| [[worldToScreen]], [[screenToWorld]] |= See also
{{Feature|arma3|
'''Render resolution''' is not returned by this command.<br>
A sampling setting of '''50%''' means half of native width ''and'' half of native height, resulting in a render resolution of '''''25%''''' the original resolution.}}
{{Feature | important | The engine default value for {{hl|fovTop}} is '''0.75''' in case it is needed to calculate difference with custom FOV.}}
{{Feature|informative|The {{hl|aspectRatio}} is calculated as {{hl|fovLeft&nbsp;/&nbsp;fovTop}} and should be the same as {{hl|screenW&nbsp;/&nbsp;screenH}} for undistorted image if the FOV is custom. Some of the common values:
{{{!}} class{{=}}"wikitable"
! 16/9 !! 16/10 !! 5/4 !! 4/3 !! 16/9 triple screen
{{!}}-
{{!}} 1.777777(…) {{!}}{{!}} 1.6 {{!}}{{!}} 1.25 {{!}}{{!}} 1.333333(…) {{!}}{{!}} 5.333333(…)
{{!}}}
}}
}}


<h3 style="display:none">Notes</h3>
|s1= [[getResolution]]
<dl class="command_description">
<!-- Note Section BEGIN -->
<dd class="notedate">Posted on  05:38, 20 December 2010</dd>
<dt class="note">[[User:Tom 48 97|tom_48_97]]</dt>
<dd class="note">This command can be usefull to play a video (see this function [[BIS_fnc_playVideo]]) in the given format if you've compiled it for different UI scale.</dd>
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|r1= [[Array]] - {{hl|[screenW, screenH, viewPortW, viewPortH, aspectRatio, uiScale, fovTop, fovLeft, tripleHead, textureQuality]}}
* {{hl|screenW}}: [[Number]] - width of the screen in pixels
* {{hl|screenH}}: [[Number]] - height of the screen in pixels
* {{hl|viewPortW}}: [[Number]] - width of the '''4:3''' view port in pixels
* {{hl|viewPortH}}: [[Number]] - height of the '''4:3''' view port in pixels
* {{hl|aspectRatio}}: [[Number]] - screen aspect ratio
* {{hl|uiScale}}: [[Number]] - the scale of the UI, which affects view port size:
: {{{!}} class="wikitable" style="margin-top: -0.5em"
{{!}}+ {{arma3}}
! Very Small !! Small !! Normal !! Large !! Very Large
{{!}}-
{{!}} 0.47 {{!}}{{!}} 0.55 {{!}}{{!}} 0.7 {{!}}{{!}} 0.85 {{!}}{{!}} 1
{{!}}}
* {{GVI|arma3|1.94|size= 0.75}} {{hl|fovTop}}: [[Number]] - vertical FOV in [[rad]]ians, the same as {{hl|fovTop}} value from the user profile
* {{GVI|arma3|1.94|size= 0.75}} {{hl|fovLeft}}: [[Number]] - horizontal FOV in [[rad]]ians, the same as{{hl|fovLeft}} value from the user profile
* {{GVI|arma3|1.94|size= 0.75}} {{hl|tripleHead}}: [[Boolean]] - [[true]] if user has triple head screen (see also [[safeZoneXAbs]], [[safeZoneWAbs]])
* {{GVI|arma3|2.10|size= 0.75}} {{hl|textureQuality}}: [[Number]] - current texture quality set in user preferences in 0..1 range, where 0 is lowest, 1 is highest


[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
|x1= <sqf>private _res = getResolution;</sqf>
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
Example result with a single 16:9 monitor:
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
<sqf>
[[Category:ArmA 2 OA: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[
1920, // width
1080, // height
792, // 2D viewport width
594, // 2D viewport height
1.77778, // aspect ratio
0.55, // UI scale
0.75, // fovTop
1.33333, // fovLeft
false // tripleHead
]
</sqf>
Example result with a triple 16:9 monitor setup:
<sqf>
[
5760, // width
1080, // height
792, // 2D viewport width
594, // 2D viewport height
5.33333, // aspect ratio
0.55 // UI scale
]
</sqf>
Example result on a dedicated server:
<sqf>
[
160, // width
120, // height
136, // 2D viewport width
102, // 2D viewport height
1.33333, // aspect ratio
0.85 // UI scale
]
</sqf>
 
|seealso= [[getObjectFOV]] [[worldToScreen]] [[screenToWorld]] [[safeZoneX]] [[safeZoneY]] [[safeZoneW]] [[safeZoneH]]
}}
 
{{Note
|user= Tom_48_97
|timestamp= 20101220053800
|text= This command can be useful to play a video (see this function [[BIS_fnc_playVideo]]) in the given format if you have compiled it for different UI scale.
}}

Latest revision as of 19:11, 15 March 2024

Hover & click on the images for description

Description

Description:
Returns an array containing all information about current client screen resolution.
Arma 3
Render resolution is not returned by this command.
A sampling setting of 50% means half of native width and half of native height, resulting in a render resolution of 25% the original resolution.
The engine default value for fovTop is 0.75 in case it is needed to calculate difference with custom FOV.
The aspectRatio is calculated as fovLeft / fovTop and should be the same as screenW / screenH for undistorted image if the FOV is custom. Some of the common values:
16/9 16/10 5/4 4/3 16/9 triple screen
1.777777(…) 1.6 1.25 1.333333(…) 5.333333(…)
Groups:
SystemGUI Control - Positioning

Syntax

Syntax:
getResolution
Return Value:
Array - [screenW, screenH, viewPortW, viewPortH, aspectRatio, uiScale, fovTop, fovLeft, tripleHead, textureQuality]
  • screenW: Number - width of the screen in pixels
  • screenH: Number - height of the screen in pixels
  • viewPortW: Number - width of the 4:3 view port in pixels
  • viewPortH: Number - height of the 4:3 view port in pixels
  • aspectRatio: Number - screen aspect ratio
  • uiScale: Number - the scale of the UI, which affects view port size:
Arma 3
Very Small Small Normal Large Very Large
0.47 0.55 0.7 0.85 1
  • Arma 3 logo black.png1.94 fovTop: Number - vertical FOV in radians, the same as fovTop value from the user profile
  • Arma 3 logo black.png1.94 fovLeft: Number - horizontal FOV in radians, the same asfovLeft value from the user profile
  • Arma 3 logo black.png1.94 tripleHead: Boolean - true if user has triple head screen (see also safeZoneXAbs, safeZoneWAbs)
  • Arma 3 logo black.png2.10 textureQuality: Number - current texture quality set in user preferences in 0..1 range, where 0 is lowest, 1 is highest

Examples

Example 1:
private _res = getResolution;
Example result with a single 16:9 monitor:
[ 1920, // width 1080, // height 792, // 2D viewport width 594, // 2D viewport height 1.77778, // aspect ratio 0.55, // UI scale 0.75, // fovTop 1.33333, // fovLeft false // tripleHead ]
Example result with a triple 16:9 monitor setup:
[ 5760, // width 1080, // height 792, // 2D viewport width 594, // 2D viewport height 5.33333, // aspect ratio 0.55 // UI scale ]
Example result on a dedicated server:
[ 160, // width 120, // height 136, // 2D viewport width 102, // 2D viewport height 1.33333, // aspect ratio 0.85 // UI scale ]

Additional Information

See also:
getObjectFOV worldToScreen screenToWorld safeZoneX safeZoneY safeZoneW safeZoneH

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Tom_48_97 - c
Posted on Dec 20, 2010 - 05:38 (UTC)
This command can be useful to play a video (see this function BIS_fnc_playVideo) in the given format if you have compiled it for different UI scale.