Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Diagonal and PPI
#1
Question 
Long sought how to calculate PPI (Pixels Per Inch) to more accurately place elements on the screen individually for each player, and that's it. Post here, maybe someone will need.

Code:
 
local a = 1366; // Width of the screen
local b = 768; // Height of the screen
local pix = 37.79527559055; //Pixels per cm
local inc = 0.39; // Inchs per cm
local dia = sqrt(a*a + b*b); // Calculate diagonal of the screen in pixels
local dia_to_cm = (dia/pix); // Calculate diagonal of the screen in cm
local cm_to_inc = (dia_to_cm.tointeger() * inc); // Calculate diagonal of the screen in inchs
local ppi = dia/cm_to_inc; // Calculate PPI
print(ppi.tointeger()); // Print PPI

Checked the accuracy on a special website
Discord: I'm not a spy...#9943.
GG: 60474243.

[Image: OsmithREV.gif]
[Image: 76561198181768479.png]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  items and items.xml Utautai 2 2,432 12.09.2020, 21:51
Last Post: Utautai
  addEvent and function of class Xardas0327 4 4,050 23.05.2016, 10:22
Last Post: Xardas0327
  callClientFunc and giveItem Osmith 4 4,393 18.02.2016, 13:04
Last Post: Bimbol
  Database and other Question (new team) Kemi 18 12,196 09.02.2016, 22:23
Last Post: Kemi

Forum Jump:


Users browsing this thread: 1 Guest(s)