大多数类(class)都说我们需要directX SDK。然而,它们是在 2012 年初,Windows 7 的时代。
而且我看到一些 DirectX 的头文件和 lib 文件已经包含在 windows 工具包中 (C:\Program Files (x86)\Windows Kits)
.并且某些名称已更改(XNAmath.h 为 DirectXMath.h)。
所以我想知道是否需要SDK?
我可以只使用 Windows 工具包编写代码吗?
最佳答案
作为将 DirectX SDK 合并到 Windows SDK 中的工作人员,我已经在这里和其他地方多次解决了这个问题。
If you have Visual Studio 2012, 2013, or 2015 then you already have the Windows 8.x SDK which supports development for DirectX 11. With VS 2015, you can optionally install the Windows 10 SDK which is needed to develop for DirectX 12.
Visual Studio 2017 and later come with Windows 10 SDK which supports both DirectX 11 & DirectX 12 development.
旧版 DirectX SDK 的官方状态在 Microsoft Docs 上得到解决。 .
这篇博文涵盖了更多细节:Where is the DirectX SDK (2021 Edition)? .
随着向 Windows SDK 的过渡,有些东西被“抛在了后面”,我已经将很多东西转移到了各种 GitHub 项目中。有关最终结果的完整调查,请参阅这些博客文章:
目前,旧版 DirectX SDK 只有两种用途,如 The Zombie DirectX SDK 所述。 :
D3DX
中的旧版 DirectX SDK 之外,任何地方都没有真正的 Direct3D 9 实用程序代码。图书馆。Direct3D 11 的旧教程和书籍使用
D3DX11
实用程序库和 xnamath 或 D3DXmath。您可以将旧版 DirectX SDK 与 Windows 8.x SDK 或 Windows 10 SDK 一起使用,但由于颠倒的 include/lib 路径顺序,这很棘手。有关详细信息,请参阅 Microsoft Docs。相反,我建议使用上面列出的 D3DX 替代品,例如 DirectX Tool Kit for DX11和 DirectXMath .UPDATE: While it is still a good idea to stop using legacy D3DX9/D3DX10/D3DX11 in projects, there is now an easy option for using these in modern versions of Visual Studio that does not require the legacy DirectX SDK, does not require the use of the legacy DirectX End-User Runtime installer, and does not require fiddling around with VC++ Directories project settings. Instead, you can just use this NuGet package. See this post for more details.
If you are using Direct3D 10.x, then you should upgrade to Direct3D 11. The API is extremely similar, Direct3D 11 is supported on a broader set of platforms and hardware, and you can use the replacements for
D3DX11
to remove any lingering legacy DirectX dependency.
从 Windows 8.x 到 Windows 10 w.r.t. 的主要变化DirectX 开发是您获得“开发人员运行时”的方式。不是从 SDK 获取它,而是启用名为“图形工具”的 Windows 可选功能。值得注意的是,Windows 8.0、Windows 8.1 或 Windows 10 不支持 Direct3D 9 调试设备。请参阅 Visual Studio 2015 and Graphics Tools for Windows 10 .
关于windows-10 - 在windows10中开发dx应用还需要DirectX SDK吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38156330/