Skip to content

Commit a180897

Browse files
authored
Minor update for Mouse/Keyboard header (#638)
1 parent 5a8f5d0 commit a180897

9 files changed

Lines changed: 744 additions & 35 deletions

‎.github/copilot-instructions.md‎

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ These instructions define how GitHub Copilot should assist with this project. Th
2222
- **Code Style**: The project uses an .editorconfig file to enforce coding standards. Follow the rules defined in `.editorconfig` for indentation, line endings, and other formatting. Additional information can be found on the wiki at [Implementation](https://github.com/microsoft/DirectXTK/wiki/Implementation). The library's public API requires C++11, and the project builds with C++17 (`CMAKE_CXX_STANDARD 17`). The command-line tools also use C++17, including `<filesystem>` for long file path support. This code is designed to build with Visual Studio 2022, Visual Studio 2026, clang for Windows v12 or later, or MinGW 12.2.
2323
> Notable `.editorconfig` rules: C/C++ and HLSL files use 4-space indentation, `crlf` line endings, and `latin1` charset — avoid non-ASCII characters in source files. HLSL files have separate indent/spacing rules defined in `.editorconfig`.
2424
- **Documentation**: The project provides documentation in the form of wiki pages available at [Documentation](https://github.com/microsoft/DirectXTK/wiki/).
25-
- **Error Handling**: Use C++ exceptions for error handling and uses RAII smart pointers to ensure resources are properly managed. For some functions that return HRESULT error codes, they are marked `noexcept`, use `std::nothrow` for memory allocation, and should not throw exceptions.
25+
- **Error Handling**: Use C++ exceptions for error handling and use RAII smart pointers to ensure resources are properly managed. For some functions that return HRESULT error codes, they are marked `noexcept`, use `std::nothrow` for memory allocation, and should not throw exceptions.
2626
- **Testing**: Unit tests for this project are implemented in this repository [Test Suite](https://github.com/walbourn/directxtktest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxtktest/wiki). See [test copilot instructions](https://github.com/walbourn/directxtktest/blob/main/.github/copilot-instructions.md) for additional information on the tests.
2727
- **Security**: This project uses secure coding practices from the Microsoft Secure Coding Guidelines, and is subject to the `SECURITY.md` file in the root of the repository. Functions that read input from image files, geometry files, and audio files are subject to OneFuzz fuzz testing to ensure they are secure against malformed files.
2828
- **Dependencies**: The project uses CMake and VCPKG for managing dependencies, making optional use of DirectXMath, GameInput, and XAudio2Redist. The project can be built without these dependencies, relying on the Windows SDK for core functionality. CMake build options include `BUILD_GAMEINPUT`, `BUILD_WGI`, and `BUILD_XINPUT` for alternative input backends.
@@ -58,7 +58,7 @@ wiki/ # Local clone of the GitHub wiki documentation repository.
5858
- Make use of `assert` for debugging checks, but be sure to validate input parameters in release builds.
5959
- Make use of the `DebugTrace` helper to log diagnostic messages, particularly at the point of throwing an exception.
6060
- Explicitly `= delete` copy constructors and copy-assignment operators on all classes that use the pImpl idiom.
61-
- Explicitly utilize `= default` or `=delete` for copy constructors, assignment operators, move constructors and move-assignment operators where appropriate.
61+
- Explicitly utilize `= default` or `= delete` for copy constructors, assignment operators, move constructors and move-assignment operators where appropriate.
6262
- Use 16-byte alignment (`_aligned_malloc` / `_aligned_free`) to support SIMD operations in the implementation, but do not expose this requirement in public APIs.
6363
- All implementation `.cpp` files include `pch.h` as their first include (precompiled header). MinGW builds skip precompiled headers.
6464
- `Model` and related classes require RTTI (`/GR` on MSVC, `__GXX_RTTI` on GCC/Clang). The CMake build enables `/GR` automatically; do not disable RTTI when using `Model`.
@@ -163,7 +163,7 @@ Headers that trigger Clang warnings use paired `#pragma clang diagnostic push`/`
163163
### Patterns to Avoid
164164

165165
- Don’t use raw pointers for ownership.
166-
- Avoid macros for constants—prefer `constexpr` or `inline` `const`.
166+
- Avoid macros for constants—prefer `constexpr` or `inline const`.
167167
- Don’t put implementation logic in header files unless using templates, although the SimpleMath library does use an .inl file for performance.
168168
- Avoid using `using namespace` in header files to prevent polluting the global namespace.
169169
- Don't use `[[deprecated]]` or `__declspec(deprecated)` attributes. Feature retirement is communicated via `CHANGELOG.md` notes, not in-source deprecation markers.
@@ -199,7 +199,7 @@ Every source file (`.cpp`, `.h`, `.hlsl`, `.fx`, etc.) must begin with this bloc
199199

200200
Section separators within files use:
201201
- Major sections: `//--------------------------------------------------------------------------------------`
202-
- Subsections: `//--------------------------------------------------------------------------------------`
202+
- Subsections: `//----------------------------------------------------------------------------------`
203203

204204
The project does **not** use Doxygen. API documentation is maintained exclusively on the GitHub wiki.
205205

@@ -225,9 +225,9 @@ Shaders in `Src/Shaders/` are compiled with **FXC**, producing embedded C++ head
225225
- [Games for Windows and the DirectX SDK blog - December 2013](https://walbourn.github.io/directx-tool-kit-for-audio/)
226226
- [Games for Windows and the DirectX SDK blog - September 2014](https://walbourn.github.io/directx-tool-kit-now-with-gamepads/)
227227
- [Games for Windows and the DirectX SDK blog - August 2015](https://walbourn.github.io/directx-tool-kit-keyboard-and-mouse-support/)
228-
- [Games for Windows and the DirectX SDK blog - October 2021](https://walbourn.github.io/directx-tool-kit-vertex-skinning-update/)
229-
- [Games for Windows and the DirectX SDK blog - September 2021](https://walbourn.github.io/latest-news-on-directx-tool-kit/)
230228
- [Games for Windows and the DirectX SDK blog - May 2020](https://walbourn.github.io/directx-tool-kit-for-audio-updates-and-a-direct3d-9-footnote/)
229+
- [Games for Windows and the DirectX SDK blog - September 2021](https://walbourn.github.io/latest-news-on-directx-tool-kit/)
230+
- [Games for Windows and the DirectX SDK blog - October 2021](https://walbourn.github.io/directx-tool-kit-vertex-skinning-update/)
231231

232232
## No speculation
233233

@@ -260,11 +260,11 @@ When creating documentation:
260260
## Cross-platform Support Notes
261261

262262
- The code targets Win32 desktop applications for Windows 8.1 or later, legacy Xbox One XDK, and Universal Windows Platform (UWP) apps for Windows 10 and Windows 11.
263-
- Portability and conformance of the code is validated by building with Visual C++, clang/LLVM for Windows, and MinGW.
263+
- Portability and conformance of the code are validated by building with Visual C++, clang/LLVM for Windows, and MinGW.
264264
- For PC development using the *Microsoft GDK*, the project provides MSBuild solution `DirectXTK_GDKW_2022.sln` for the x64 or ARM64 architectures.
265265
- The MSBuild solution `DirectXTK_GDK_2022.sln` is for *Microsoft GDK with Xbox Extensions* development for PC using the legacy Gaming.Desktop.x64 custom platform. There is no support for the Gaming.Xbox.*.x64 custom platforms since they do not support DirectX 11.
266266
- The project ships MSBuild projects for Visual Studio 2022 (`.sln` / `.vcxproj`) and Visual Studio 2026 (`.slnx` / `.vcxproj`). VS 2019 projects have been retired.
267-
- The CMake build supports legacy Xbox One XDK via the `XBOX_CONSOLE_TARGET` variable (`durango`). Xbox Series X|S (`scarlett`) and Xbox One (`xboxone`) via the *Microsoft GDK with Xbox Extensions* only supports DirectX 12, so this version of the library cannot support those platforms.
267+
- The CMake build supports legacy Xbox One XDK via the `XBOX_CONSOLE_TARGET` variable (`durango`). Xbox Series X|S (`scarlett`) and Xbox One (`xboxone`) via the *Microsoft GDK with Xbox Extensions* only support DirectX 12, so this version of the library cannot support those platforms.
268268

269269
### Platform and Compiler `#ifdef` Guards
270270

@@ -291,7 +291,7 @@ Use these established guards — do not invent new ones:
291291
| `USING_COREWINDOW` | CoreWindow-based input (UWP) for Keyboard, Mouse |
292292
| `GAMEINPUT_API_VERSION` | GameInput SDK version detection for API-level feature checks |
293293

294-
> `_M_ARM`/ `__arm__` is legacy 32-bit ARM which is deprecated.
294+
> `_M_ARM` / `__arm__` is legacy 32-bit ARM which is deprecated.
295295
296296
## Code Review Instructions
297297

@@ -317,3 +317,33 @@ When reviewing documentation, do the following:
317317
- Review the public interface defined in the `Inc` folder.
318318
- Read the documentation on the wiki located in [this git repository](https://github.com/microsoft/DirectXTK.wiki.git).
319319
- Report any specific gaps in the documentation compared to the public interface.
320+
321+
## Release Process
322+
323+
1. Ensure all changes are merged into the `main` branch and that all tests pass.
324+
2. Git pull the local repository to ensure it is up to date with the `main` branch.
325+
3. Run the PowerShell script `build\preparerelease.ps1` which will generate a topic branch for the release, update the version number in `CMakeLists.txt`, the `README.md` file, the release notes in the nuspec files, and create a stub in the `CHANGELOG.md` file for the new release.
326+
4. Edit the `CHANGELOG.md` file to update it with a summary of changes.
327+
5. Submit the topic branch for review and merge into `main` once approved. Allow the GitHub Actions workflows and the Azure DevOps pipelines to complete successfully before proceeding.
328+
6. Run the PowerShell script `build\completerelease.ps1` which will set a tag on the project repo and the test repo, and create a release on GitHub with the release notes from `CHANGELOG.md`. Ensure you have set up GPG signing for your GitHub account so that the tags will be verified.
329+
7. Git pull the local repository to ensure it is up to date with the `main` branch. Be sure to include `--tags`.
330+
8. Push the `main` branch to the MSCodeHub mirror repository. Be sure to include `--tags`.
331+
9. Create a PR on MSCodeHub from the `main` branch to the `release` branch.
332+
10. Merge the PR on MSCodeHub to update the release branch, which will trigger the Azure DevOps pipeline to build signed binaries and the NuGet packages.
333+
11. Run the PowerShell script `build\downloadartifacts.ps1` to download the signed binaries from the Azure DevOps pipeline artifacts.
334+
12. Edit the GitHub release and upload the signed binaries to the release assets.
335+
13. Download the GitHub source .zip archive from the release. Unzip and compare to the local repo to ensure it matches — keep in mind there may be some CR/LF differences. Run minisign on the .zip to generate a signature file, and upload the signature file to the release assets.
336+
14. Validate the NuGet packages with <https://github.com/walbourn/directxtk-tutorials> by pushing the NuGet packages to a local Packages Source folder, and refreshing the NuGet packages from that folder. Then build using BuildAllSolutions.targets.
337+
15. Run the PowerShell script `build\promotenuget.ps1` with the `-Release` parameter to promote the version to the Release view on the project-scoped ADO feed.
338+
16. Run the MSCodeHub pipeline to publish the NuGet packages to nuget.org. The pipeline will automatically push the most recent package promoted to the Release view to nuget.org.
339+
17. Git pull a local repository of VCPKG to `d:\vcpkg` in sync with the `main` branch of the VCPKG repository.
340+
18. Run the PowerShell script `build\updatevcpkg.ps1` to update the DirectXTK port in VCPKG with the new release version. This will edit the files in `ports\directxtk`.
341+
19. Test the VCPKG port using all appropriate triplets and features.
342+
20. Run `.\vcpkg --x-add-version directxtk` to update the VCPKG versioning history.
343+
21. Submit a PR to the VCPKG repository to update the DirectXTK port back to the main GitHub repo. The PR will be reviewed and merged by the VCPKG maintainers.
344+
22. If relevant changes were made to the `xwbtool` or `MakeSpriteFont` tools, update the winget manifests for those tools in the `winget` repository.
345+
- Git pull a local repository to `D:\winget-pkgs` in sync with the `master` branch of the WinGet repository.
346+
- Run the PowerShell script `build\updatewinget.ps1` to update the winget manifests for the tools with the new release version.
347+
- Submit a PR to the `winget` repository to update the manifests for each tool — they must be done as distinct PRs. The PRs will be reviewed and merged by the winget maintainers.
348+
349+
> When fully completed, be sure to update the GitHub release with links to the matching NuGet packages, the VCPKG port, and the winget manifests for the tools.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# PSScriptAnalyzerSettings.psd1
22
@{
33
Severity=@('Error','Warning')
4-
ExcludeRules=@('PSAvoidUsingWriteHost')
4+
ExcludeRules=@('PSAvoidUsingWriteHost', 'PSUseShouldProcessForStateChangingFunctions')
55
}

‎Inc/Keyboard.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,14 +520,14 @@ namespace DirectX
520520
#ifdef USING_COREWINDOW
521521
DIRECTX_TOOLKIT_API void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window);
522522
#ifdef __cplusplus_winrt
523-
DIRECTX_TOOLKIT_API inline void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
523+
inline void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
524524
{
525525
// See https://msdn.microsoft.com/en-us/library/hh755802.aspx
526526
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
527527
}
528528
#endif
529529
#ifdef CPPWINRT_VERSION
530-
DIRECTX_TOOLKIT_API inline void __cdecl SetWindow(winrt::Windows::UI::Core::CoreWindow window)
530+
inline void __cdecl SetWindow(winrt::Windows::UI::Core::CoreWindow window)
531531
{
532532
// See https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/interop-winrt-abi
533533
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(winrt::get_abi(window)));

‎Inc/Mouse.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ namespace DirectX
154154
#ifdef USING_COREWINDOW
155155
DIRECTX_TOOLKIT_API void __cdecl SetWindow(ABI::Windows::UI::Core::ICoreWindow* window);
156156
#ifdef __cplusplus_winrt
157-
DIRECTX_TOOLKIT_API inline void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
157+
inline void __cdecl SetWindow(Windows::UI::Core::CoreWindow^ window)
158158
{
159159
// See https://msdn.microsoft.com/en-us/library/hh755802.aspx
160160
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
161161
}
162162
#endif
163163
#ifdef CPPWINRT_VERSION
164-
DIRECTX_TOOLKIT_API inline void __cdecl SetWindow(winrt::Windows::UI::Core::CoreWindow window)
164+
inline void __cdecl SetWindow(winrt::Windows::UI::Core::CoreWindow window)
165165
{
166166
// See https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/interop-winrt-abi
167167
SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(winrt::get_abi(window)));

0 commit comments

Comments
 (0)