New snipper for calculating the 4:3 resolution of the client's display

pull/19/head
Pat Hartl 2023-03-15 17:45:50 -05:00
parent 42da3b6c81
commit 42db70e3f5
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
function Get-43Resolution([int]$Width, [int]$Height) {
$ratio = 4 / 3
if (($Width -gt $Height) -or ($Width -eq $Height)) {
return @{ Width = [math]::Round($ratio * $Height); Height = $Height }
}
if ($Width -lt $Height) {
return @{ Width = $Width; Height = [math]::Round($Width / $ratio) }
}
}
# Accessible via $Resolution.Height, $Resolution.Width
$Resolution = Get-43Resolution -Width 1280 -Height 800