This function will return one of two constant GameMaker: Studio has to tell you whether the device running the game is being held in landscape or portrait mode:
|display_landscape||The device is being held horizontally ie: The longest edge is from left to right, and the menu button is on the right.|
|display_landscape_flipped||As above, only now the menu button is on the left.|
|display_portrait||The device is being held vertically ie: The longest edge is from top to bottom, and the menu button is at the bottom.|
|display_portrait_flipped||As above, only now the menu button is at the top.|
Please note that this function may not correctly detect the orientation of the device when used in the HTML5 target module. However this is easily mimicked by the use of the following script:
return (browser_width < browser_height);
It will return true for portrait and false for landscape.
if display_get_orientation() =
global.Config = 0;
global.Config = 1;
The above code checks the orientation of the device and sets a global variable depending on the value returned.