os_type


描述

This variable holds one of various constant GameMaker Studio 2 has to tell you which operating system the game has been created for. Note that this is not necessarily the same as the OS of the device running it, since - for example - your game could be running on an Amazon Fire OS, but will have been built for the Android platform (in which case os_type will be os_android).

The following constants can be returned:

常量 描述
os_windows Windows OS
os_uwp Windows 10 Universal Windows Platform
os_linux Linux
os_macosx Mac OS X 模块
os_ios iOS (iPhone, iPad, iPod Touch)
os_android Android
os_ps4 Sony PlayStation 4
os_xboxone Microsoft XBox One
os_unknown unknown OS


语法:

os_type;


返回:

常量


例如:

switch (os_type)
   {
   case os_windows: global.Config = 0; break;
   case os_android: global.Config = 1; break;
   case os_linux: global.Config = 2; break;
   case os_macosx: global.Config = 3; break;
   case os_ios: global.Config = 4; break;
   case os_winphone: global.Config = 5; break;
   }

The above code checks the OS running the game and sets a global variable accordingly.