Posted 08 August 2016 - 11:05 PM
Hello,
I have some problems trying to calculate the monitor resolution using some math…
Esample
So, there is any function or API that can help me?
Thank you :)/>/>
EDIT: Solved problem
I solved the problem using a big table that involve x and y values and also scales.
To help future users here is the full table:
Usage:
I have some problems trying to calculate the monitor resolution using some math…
Esample
Input: 3x2 monitor
Resolution = ?
I thought that it follows some simple math rules like "screenResolution_x = nMonitor_x*7-(nMonitor_x-1)*4" but it's not so straight forward. :(/>/>So, there is any function or API that can help me?
Thank you :)/>/>
EDIT: Solved problem
I solved the problem using a big table that involve x and y values and also scales.
To help future users here is the full table:
screenResolution = {
["0.5"] = {{15,36,57,79,100,121,143,164},{10,24,38,52,67,81}},
["1"] = {{7,18,29,39,50,61,71,82},{5,12,19,26,33,40}},
["1.5"] = {{5,12,19,26,33,40,48,55},{3,8,13,17,22,27}},
["2"] = {{4,9,14,20,25,30,36,41},{2,6,10,13,17,20}},
["2.5"] = {{3,7,11,16,20,24,29,33},{2,5,8,10,13,16}},
["3"] = {{2,6,10,13,17,20,24,27},{2,4,6,9,11,13}},
["3.5"] = {{2,5,8,11,14,17,20,23},{1,3,5,7,10,12}},
["4"] = {{2,5,7,10,13,15,18,21},{1,3,5,7,8,10}},
["4.5"] = {{2,4,6,9,11,13,16,18},{1,3,4,6,7,9}},
["5"] = {{1,4,6,8,10,12,14,16},{1,2,4,5,7,8}},
}
Usage:
local function getMonSize(x,y,scale)
return screenResolution[scale][1][x],screenResolution[scale][2][y]
end
xValue, yValue = getMonSize(5,3,"1.5")
--Note: remember to put the quote on the scale value
Edited on 06 September 2016 - 12:43 PM