Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować się zalogować lub zmienić katalog.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
This topic lists the preprocessor definitions that are specific to the Microsoft Game Development Kit (GDK) on Xbox.
|
Preprocessor define |
Description |
|---|---|
| _GAMING_XBOX | The following is the official define for Xbox One. #ifdef _GAMING_XBOX
// Microsoft Game Development Kit (GDK) on Xbox.
...
|
| _GAMING_XBOX_XBOXONE | The define indicates building on the GDK on Xbox One. |
| _GAMING_XBOX_SCARLETT | The define indicates building on the GDK on Xbox Series X/S. |
| _GAMING_DESKTOP | The define indicate building on PC with the GDK. |
| _M_X64, _M_IX86, _M_ARM64 and _M_ARM | When writing code that's specific to the processor architecture rather than the platform, you should make use of these defines. For Xbox 360, the equivalent would be _M_PPCBE. _M_AMD64 is an alias for _M_X64 and was the original name. It's being phased out in favor of _M_X64. Don't use the Windows legacy defines, such as _X86_ and _AMD64_. |
| WINAPI_FAMILY | The Microsoft platform headers make extensive use of the Windows family and partition macros that are defined in winapifamily.h. It's important to remember that the partitions can (and in fact do between Windows 8.0 SDK and Windows 8.1 SDK) change. There are also new PARTITION and FAMILY values added over time. Client code should never make direct use of the PARTITION values, the WINAPI_FAMILY_PARTITION macro, or the WINAPI_FAMILY_ONE_PARTITION macro. It's reasonable for client code to look for specific values of WINAPI_FAMILY. Note that the Windows 8.1 SDK version of winapifamily.h has an expanded comment block that covers this usage. |
It's best practice to use the following for Microsoft Game Development Kit (GDK) on Xbox code.
#ifdef _GAMING_XBOX
// GDK on Xbox
#ifdef _GAMING_XBOX_SCARLETT
// Xbox Series X/S hardware
#elif _GAMING_XBOX_ONE
// Xbox One hardware
When building with the Microsoft Game Development Kit (GDK), the Visual Studio integrated development environment (IDE) Microsoft Build rules automatically define _GAMING_XBOX and WINAPI_FAMILY=WINAPI_FAMILY_GAMES. Developers who don't use the Visual Studio IDE to build against the Microsoft Game Development Kit (GDK) have to supply these values on the compiler command-line.
Gaming.Xbox.XboxOne.x64
/D_GAMING_XBOX /D_GAMING_XBOX_XBOXONE /DWINAPI_FAMILY=WINAPI_FAMILY_GAMES
Gaming.Xbox.Scarlett.x64
/D_GAMING_XBOX /D_GAMING_XBOX_SCARLETT /DWINAPI_FAMILY=WINAPI_FAMILY_GAMES
Gaming.Desktop.x64
/D_GAMING_DESKTOP /DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP
These defines are also used for 'stock' x64 platforms when using the Microsoft Game Development Kit.
When writing Microsoft cross-platform code, the following construction is also generally applicable.
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
// This code is for Win32 desktop apps.
#elif WINAPI_FAMILY == WINAPI_FAMILY_GAMES
// This code is for the Microsoft Game Development Kit (GDK) (could also use _GAMING_XBOX if only targeting Xbox).
#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
// This code is for Windows phone 8.x.
#elif WINAPI_FAMILY == WINAPI_FAMILY_APP
// This code is for Microsoft Store apps for 8.x.
#elif WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE
// This code is for Xbox One Game OS/XDK.
#elif WINAPI_FAMILY == WINAPI_FAMILY_TV_APP
// This code is for Xbox One System OS/ADK.
#else
#error Unknown WINAPI_FAMILY value
#endif