Skip to content

Commit

Permalink
June 15, 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jun 16, 2022
1 parent b958ca3 commit 15e386a
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .nuget/directxtk12_desktop_2019.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DescriptorHeap - helper for managing DX12 descriptor heaps
DirectXHelpers - misc C++ helpers for D3D programming
Effects - set of built-in shaders for common rendering tasks
EffectPipelineStateDescription - helper for creating PSOs
GamePad - gamepad controller helper using XInput
GamePad - gamepad controller helper using Windows.Gaming.Input
GeometricPrimitive - draws basic shapes such as cubes and spheres
GraphicsMemory - helper for managing graphics memory allocation
Keyboard - keyboard state tracking helper
Expand All @@ -34,7 +34,7 @@ SpriteBatch - simple & efficient 2D sprite rendering
SpriteFont - bitmap based text rendering
VertexTypes - structures for commonly used vertex data formats
WICTextureLoader - WIC-based image file texture loader</description>
<releaseNotes>Matches the May 9, 2022 release on GitHub.</releaseNotes>
<releaseNotes>Matches the June 15, 2022 release on GitHub.</releaseNotes>
<projectUrl>http://go.microsoft.com/fwlink/?LinkID=615561</projectUrl>
<repository type="git" url="https://github.com/microsoft/DirectXTK12.git" />
<icon>images\icon.jpg</icon>
Expand Down
4 changes: 2 additions & 2 deletions .nuget/directxtk12_uwp.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ DescriptorHeap - helper for managing DX12 descriptor heaps
DirectXHelpers - misc C++ helpers for D3D programming
Effects - set of built-in shaders for common rendering tasks
EffectPipelineStateDescription - helper for creating PSOs
GamePad - gamepad controller helper using XInput
GamePad - gamepad controller helper using Windows.Gaming.Input
GeometricPrimitive - draws basic shapes such as cubes and spheres
GraphicsMemory - helper for managing graphics memory allocation
Keyboard - keyboard state tracking helper
Expand All @@ -34,7 +34,7 @@ SpriteBatch - simple &amp; efficient 2D sprite rendering
SpriteFont - bitmap based text rendering
VertexTypes - structures for commonly used vertex data formats
WICTextureLoader - WIC-based image file texture loader</description>
<releaseNotes>Matches the May 9, 2022 release on GitHub.</releaseNotes>
<releaseNotes>Matches the June 15, 2022 release on GitHub.</releaseNotes>
<projectUrl>http://go.microsoft.com/fwlink/?LinkID=615561</projectUrl>
<repository type="git" url="https://github.com/microsoft/DirectXTK12.git" />
<icon>images\icon.jpg</icon>
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Release available for download on [GitHub](https://github.com/microsoft/DirectXT

## Release History

### June 15, 2022
* GamePad, Keyboard, and Mouse updated to use GameInput on PC for the Gaming.Desktop.x64 platform
* CMake project updates
* Minor code review

### May 9, 2022
* C++20 spaceship operator updates for SimpleMath
* Fixed missing VertexPositionNormal::InputLayout
Expand Down
6 changes: 5 additions & 1 deletion Inc/GamePad.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@

#pragma once

#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
#ifdef _GAMING_DESKTOP
#include <grdk.h>
#endif

#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))
#ifndef USING_GAMEINPUT
#define USING_GAMEINPUT
#endif
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ http://go.microsoft.com/fwlink/?LinkID=615561

Copyright (c) Microsoft Corporation.

**May 9, 2022**
**June 15, 2022**

This package contains the "DirectX Tool Kit", a collection of helper classes for writing Direct3D 12 C++ code for Universal Windows Platform (UWP) apps for Windows 11 / Windows 10, game titles for Xbox Series X\|S / Xbox One, and Win32 desktop applications for Windows 11 / Windows 10.

Expand All @@ -28,7 +28,7 @@ These components are designed to work without requiring any content from the leg
* DirectXHelpers.h - misc C++ helpers for D3D programming
* EffectPipelineStateDescription.h - helper for creating PSOs
* Effects.h - set of built-in shaders for common rendering tasks
* GamePad.h - gamepad controller helper using XInput
* GamePad.h - gamepad controller helper using Windows.Gaming.Input or GameInput
* GeometricPrimitive.h - draws basic shapes such as cubes and spheres
* GraphicsMemory.h - helper for managing dynamic graphics memory allocation
* Keyboard.h - keyboard state tracking helper
Expand Down
2 changes: 1 addition & 1 deletion Src/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace


#pragma region Implementations
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))

#include <GameInput.h>

Expand Down
52 changes: 50 additions & 2 deletions Src/Mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ using namespace DirectX;
using Microsoft::WRL::ComPtr;

#pragma region Implementations
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)
#if (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES)) || (defined(_GAMING_DESKTOP) && (_GRDK_EDITION >= 220600))

#include <GameInput.h>

Expand Down Expand Up @@ -184,7 +184,18 @@ class Mouse::Impl
mRelativeY = INT64_MAX;
mRelativeWheelY = INT64_MAX;

ShowCursor((mode == MODE_ABSOLUTE) ? TRUE : FALSE);
if (mode == MODE_RELATIVE)
{
ShowCursor(FALSE);
ClipToWindow();
}
else
{
ShowCursor(TRUE);
#ifndef _GAMING_XBOX
ClipCursor(nullptr);
#endif
}
}

bool IsConnected() const noexcept
Expand Down Expand Up @@ -263,6 +274,35 @@ class Mouse::Impl
--impl->mConnected;
}
}

void ClipToWindow() noexcept
{
#ifndef _GAMING_XBOX
assert(mWindow != nullptr);

RECT rect;
GetClientRect(mWindow, &rect);

POINT ul;
ul.x = rect.left;
ul.y = rect.top;

POINT lr;
lr.x = rect.right;
lr.y = rect.bottom;

std::ignore = MapWindowPoints(mWindow, nullptr, &ul, 1);
std::ignore = MapWindowPoints(mWindow, nullptr, &lr, 1);

rect.left = ul.x;
rect.top = ul.y;

rect.right = lr.x;
rect.bottom = lr.y;

ClipCursor(&rect);
#endif
}
};


Expand Down Expand Up @@ -297,6 +337,14 @@ void Mouse::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam)
pImpl->mRelativeY = INT64_MAX;

ShowCursor(FALSE);

pImpl->ClipToWindow();
}
else
{
#ifndef _GAMING_XBOX
ClipCursor(nullptr);
#endif
}
}
else
Expand Down

0 comments on commit 15e386a

Please sign in to comment.