Last active
March 8, 2023 15:21
-
-
Save harpwood/8ac37640c0cc359c8d8db6318967257f to your computer and use it in GitHub Desktop.
Returns the diagonal screen size in inches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculates the diagonal length of the display in inches based on the display's width, height, and DPI values. | |
* | |
* @returns {number} The diagonal length of the display in inches. | |
*/ | |
function display_get_diagonal_inches() | |
{ | |
return sqrt(sqr(display_get_width()) + sqr(display_get_height())) / max(display_get_dpi_x(), display_get_dpi_y()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment