此变量将告诉您运行游戏的操作系统的版本号。例如,如果您在Windows 10上运行它,os_version将等于655360。
下表列出了为不同操作系统的最新版本返回的值:
操作系统 | 版本名称 (版本号) | 返回值(示例) |
---|---|---|
Android | Nougat (7.0 - 7.11) Oreo (8.0 - 8.11) Pie (9.0) Android X (10.0) | 24 - 25 26 - 27 28 29 |
iOS The return value is calculated as: (major_version * 16777216) + (minor_version * 4096) + build_number | iOS 10 (10.3) iOS 11 (11.4) iOS 12 (12.0) iOS 13 (13.0) iPhone iOS 13 (13.5) iPhone/Ipad | 167784448 184565760 201326592 218103808 218124288 |
macOS X The return value is calculated as: (major_version * 16777216) + (minor_version * 4096) + build_number | El Capitan (10.11) Sierra (10.12) High Sierra (10.13) Mojave (10.14) Catalina (10.15) | 167817216 167821312 167825408 167829504 167833600 |
Windows (the return value is calculated as: majorVersion * 65536 + minorVersion) | Windows 7 (6.1) Windows 8 (6.2) Windows 8.1 (6.3) Windows 10 (10.0) | 393217 393218 393219 655360 |
注意:如果您需要有关Windows操作系统的更多信息,可以使用 environment_get_variable()。
os_version
if (os_type == os_android) && (os_version > 10)
{
global.GFX = 1;
}
上面的代码检查操作系统类型和版本号,它们都是正确的,然后全局变量设置为1。