You are not logged in.
This simple script returns the diagonal screen size of the device the game is running on, in inches. I wrote and use it as an easy way to detect if the mobile device the game is running on is a tablet.
/// get_diagonal_screen_size()
//
// Returns the diagonal screen size in inches
//
/// GMLscripts.com/license
function get_diagonal_screen_size(){
return sqrt(sqr(display_get_width()) + sqr(display_get_height())) / display_get_dpi_x();
}
Last edited by gkri (2020-08-31 04:59:32)
Offline
This returns size of first screen attached to current device in fact, as to get current screen you need to use combination of window_get_visible_rects + window_get_x/y to find on which screen game runs (except fullscreen - it's always on screen 1 from what I remember).
Offline
Thank you for your feedback. Does it make sense to detect multiple monitors if the device is mobile?
Offline
Of course not. I was rather thinking about covering all possibilities, but then script will be much bigger.
Offline
Thanks again. Even from this brief conversation I learnt something new!
I would like to attempt to write a more advanced variation for multiple screens, but I only have one screen and I will not be able to test it...
Offline