os_device

This variable holds a different constant depending on the device the game is currently being run in.

Syntax:

os_device


Returns: Constant


Description

This variable holds one of various constant GameMaker: Studio has to tell you which device you are currently running the game on. The following constants can be returned:

Constant Description
device_ios_ipad iPad
device_ios_ipad_retina Newer iPad with Retina display size of 2048 x 1536
device_ios_iphone6 iPhone6 with display size 1334 x 750
device_ios_iphone6plus Larger iPhone 6 with display 1920 x 1080
device_ios_iphone5 iPhone5 with display size 640 x 1136)
device_ios_iphone Older iPhone/iPod Touch (480 x 320 screen) or Android phone
device_ios_iphone_retina Newer iPhone/iPod Touch with Retina display of 960 x 640
device_emulator The device is actually an emulator (Windows Phone or Android)
device_tablet Android tablet
device_ios_unknown Unknown or not iOS

Example:

if os_browser = browser_not_a_browser
   {
   switch (os_device)
      {
      case device_ios_ipad: global.Config = 2; break;
      case device_ios_iphone: global.Config = 3; break;
      case device_ios_iphone_retina: global.Config = 4; break;
      case device_ios_unknown: global.Config = 5; break;
      }
   }
else
   {
   global.Config = 1;
   }

The above code checks to see if the game is running in a browser or not and sets a global variable to a value depending on the result of the check.


Back: Operating Systems
Next: os_type
© Copyright YoYo Games Ltd. 2018 All Rights Reserved