Refreshed March 2016 samples
This commit is contained in:
Родитель
c76f57c03e
Коммит
b5967481c7
|
@ -0,0 +1,44 @@
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
// File: ATGColors.h
|
||||||
|
//
|
||||||
|
// Definitions of the standard ATG color palette.
|
||||||
|
//
|
||||||
|
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
// PARTICULAR PURPOSE.
|
||||||
|
//
|
||||||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <DirectXMath.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace ATG
|
||||||
|
{
|
||||||
|
namespace Colors
|
||||||
|
{
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Background = { 0.254901975f, 0.254901975f, 0.254901975f, 1.f }; // #414141
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Green = { 0.062745102f, 0.486274511f, 0.062745102f, 1.f }; // #107c10
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Blue = { 0.019607844f, 0.372549027f, 0.803921580f, 1.f }; // #055fcd
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Orange = { 0.764705896f, 0.176470593f, 0.019607844f, 1.f }; // #c32d05
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 DarkGrey = { 0.200000003f, 0.200000003f, 0.200000003f, 1.f }; // #333333
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 LightGrey = { 0.478431374f, 0.478431374f, 0.478431374f, 1.f }; // #7a7a7a
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 OffWhite = { 0.635294139f, 0.635294139f, 0.635294139f, 1.f }; // #a2a2a2
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 White = { 0.980392158f, 0.980392158f, 0.980392158f, 1.f }; // #fafafa
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace ColorsLinear
|
||||||
|
{
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Background = { 0.052860655f, 0.052860655f, 0.052860655f, 1.f };
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Green = { 0.005181516f, 0.201556236f, 0.005181516f, 1.f };
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Blue = { 0.001517635f, 0.114435382f, 0.610495627f, 1.f };
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 Orange = { 0.545724571f, 0.026241219f, 0.001517635f, 1.f };
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 DarkGrey = { 0.033104762f, 0.033104762f, 0.033104762f, 1.f };
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 LightGrey = { 0.194617808f, 0.194617808f, 0.194617808f, 1.f };
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 OffWhite = { 0.361306787f, 0.361306787f, 0.361306787f, 1.f };
|
||||||
|
XMGLOBALCONST DirectX::XMVECTORF32 White = { 0.955973506f, 0.955973506f, 0.955973506f, 1.f };
|
||||||
|
};
|
||||||
|
}
|
|
@ -25,12 +25,12 @@ namespace DX
|
||||||
DPad = L'!',
|
DPad = L'!',
|
||||||
RightThumb = L'\"',
|
RightThumb = L'\"',
|
||||||
View = L'#',
|
View = L'#',
|
||||||
Guide = L'$',
|
Nexus = L'$',
|
||||||
Menu = L'%',
|
Menu = L'%',
|
||||||
XButton = L'&',
|
XButton = L'&',
|
||||||
YButton = L'\'',
|
AButton = L'\'',
|
||||||
BButton = L'(',
|
YButton = L'(',
|
||||||
AButton = L')',
|
BButton = L')',
|
||||||
RightShoulder = L'*',
|
RightShoulder = L'*',
|
||||||
RightTrigger = L'+',
|
RightTrigger = L'+',
|
||||||
LeftTrigger = L',',
|
LeftTrigger = L',',
|
||||||
|
@ -97,9 +97,9 @@ namespace DX
|
||||||
{
|
{
|
||||||
*button = static_cast<wchar_t>(ControllerFont::Menu);
|
*button = static_cast<wchar_t>(ControllerFont::Menu);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(strBuffer, L"[Guide]") == 0)
|
else if (_wcsicmp(strBuffer, L"[Nexus]") == 0)
|
||||||
{
|
{
|
||||||
*button = static_cast<wchar_t>(ControllerFont::Guide);
|
*button = static_cast<wchar_t>(ControllerFont::Nexus);
|
||||||
}
|
}
|
||||||
else if (_wcsicmp(strBuffer, L"[RThumb]") == 0)
|
else if (_wcsicmp(strBuffer, L"[RThumb]") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
namespace DX
|
namespace DX
|
||||||
{
|
{
|
||||||
inline std::vector<uint8_t> ReadData(_In_z_ const wchar_t* name)
|
inline std::vector<uint8_t> ReadData(_In_z_ const wchar_t* name)
|
||||||
|
|
|
@ -15,11 +15,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mmreg.h>
|
#include <mmreg.h>
|
||||||
|
|
|
@ -1098,8 +1098,6 @@ HRESULT WaveBankReader::Impl::GetWaveData( uint32_t index, const uint8_t** pData
|
||||||
#else
|
#else
|
||||||
const uint8_t* waveData = m_waveData.get();
|
const uint8_t* waveData = m_waveData.get();
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !waveData )
|
if ( !waveData )
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
|
|
@ -15,11 +15,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include <objbase.h>
|
#include <objbase.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mmreg.h>
|
#include <mmreg.h>
|
||||||
|
@ -31,6 +27,10 @@ namespace DirectX
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WaveBankReader();
|
WaveBankReader();
|
||||||
|
|
||||||
|
WaveBankReader(WaveBankReader const&) = delete;
|
||||||
|
WaveBankReader& operator= (WaveBankReader const&) = delete;
|
||||||
|
|
||||||
~WaveBankReader();
|
~WaveBankReader();
|
||||||
|
|
||||||
HRESULT Open( _In_z_ const wchar_t* szFileName );
|
HRESULT Open( _In_z_ const wchar_t* szFileName );
|
||||||
|
@ -76,9 +76,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
WaveBankReader(WaveBankReader const&) DIRECTX_CTOR_DELETE
|
|
||||||
WaveBankReader& operator= (WaveBankReader const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,48 +57,14 @@
|
||||||
|
|
||||||
#include <DirectXMath.h>
|
#include <DirectXMath.h>
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// VS 2010 doesn't support explicit calling convention for std::function
|
|
||||||
#ifndef DIRECTX_STD_CALLCONV
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
|
||||||
#define DIRECTX_STD_CALLCONV
|
|
||||||
#else
|
|
||||||
#define DIRECTX_STD_CALLCONV __cdecl
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4481)
|
|
||||||
// VS 2010 considers 'override' to be a extension, but it's part of C++11 as of VS 2012
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
|
||||||
#define XM_CALLCONV __fastcall
|
|
||||||
typedef const XMVECTOR& HXMVECTOR;
|
|
||||||
typedef const XMMATRIX& FXMMATRIX;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class SoundEffectInstance;
|
class SoundEffectInstance;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -227,6 +193,10 @@ namespace DirectX
|
||||||
|
|
||||||
AudioEngine(AudioEngine&& moveFrom);
|
AudioEngine(AudioEngine&& moveFrom);
|
||||||
AudioEngine& operator= (AudioEngine&& moveFrom);
|
AudioEngine& operator= (AudioEngine&& moveFrom);
|
||||||
|
|
||||||
|
AudioEngine(AudioEngine const&) = delete;
|
||||||
|
AudioEngine& operator= (AudioEngine const&) = delete;
|
||||||
|
|
||||||
virtual ~AudioEngine();
|
virtual ~AudioEngine();
|
||||||
|
|
||||||
bool __cdecl Update();
|
bool __cdecl Update();
|
||||||
|
@ -310,10 +280,6 @@ namespace DirectX
|
||||||
// Private implementation.
|
// Private implementation.
|
||||||
class Impl;
|
class Impl;
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
AudioEngine(AudioEngine const&) DIRECTX_CTOR_DELETE
|
|
||||||
AudioEngine& operator= (AudioEngine const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,6 +291,10 @@ namespace DirectX
|
||||||
|
|
||||||
WaveBank(WaveBank&& moveFrom);
|
WaveBank(WaveBank&& moveFrom);
|
||||||
WaveBank& operator= (WaveBank&& moveFrom);
|
WaveBank& operator= (WaveBank&& moveFrom);
|
||||||
|
|
||||||
|
WaveBank(WaveBank const&) = delete;
|
||||||
|
WaveBank& operator= (WaveBank const&) = delete;
|
||||||
|
|
||||||
virtual ~WaveBank();
|
virtual ~WaveBank();
|
||||||
|
|
||||||
void __cdecl Play( int index );
|
void __cdecl Play( int index );
|
||||||
|
@ -365,10 +335,6 @@ namespace DirectX
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
WaveBank(WaveBank const&) DIRECTX_CTOR_DELETE
|
|
||||||
WaveBank& operator= (WaveBank const&) DIRECTX_CTOR_DELETE
|
|
||||||
|
|
||||||
// Private interface
|
// Private interface
|
||||||
void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance );
|
void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance );
|
||||||
|
|
||||||
|
@ -399,6 +365,10 @@ namespace DirectX
|
||||||
|
|
||||||
SoundEffect(SoundEffect&& moveFrom);
|
SoundEffect(SoundEffect&& moveFrom);
|
||||||
SoundEffect& operator= (SoundEffect&& moveFrom);
|
SoundEffect& operator= (SoundEffect&& moveFrom);
|
||||||
|
|
||||||
|
SoundEffect(SoundEffect const&) = delete;
|
||||||
|
SoundEffect& operator= (SoundEffect const&) = delete;
|
||||||
|
|
||||||
virtual ~SoundEffect();
|
virtual ~SoundEffect();
|
||||||
|
|
||||||
void __cdecl Play();
|
void __cdecl Play();
|
||||||
|
@ -431,10 +401,6 @@ namespace DirectX
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
SoundEffect(SoundEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
SoundEffect& operator= (SoundEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
|
|
||||||
// Private interface
|
// Private interface
|
||||||
void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance );
|
void __cdecl UnregisterInstance( _In_ SoundEffectInstance* instance );
|
||||||
|
|
||||||
|
@ -623,6 +589,10 @@ namespace DirectX
|
||||||
public:
|
public:
|
||||||
SoundEffectInstance(SoundEffectInstance&& moveFrom);
|
SoundEffectInstance(SoundEffectInstance&& moveFrom);
|
||||||
SoundEffectInstance& operator= (SoundEffectInstance&& moveFrom);
|
SoundEffectInstance& operator= (SoundEffectInstance&& moveFrom);
|
||||||
|
|
||||||
|
SoundEffectInstance(SoundEffectInstance const&) = delete;
|
||||||
|
SoundEffectInstance& operator= (SoundEffectInstance const&) = delete;
|
||||||
|
|
||||||
virtual ~SoundEffectInstance();
|
virtual ~SoundEffectInstance();
|
||||||
|
|
||||||
void __cdecl Play( bool loop = false );
|
void __cdecl Play( bool loop = false );
|
||||||
|
@ -655,10 +625,6 @@ namespace DirectX
|
||||||
|
|
||||||
friend std::unique_ptr<SoundEffectInstance> __cdecl SoundEffect::CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS );
|
friend std::unique_ptr<SoundEffectInstance> __cdecl SoundEffect::CreateInstance( SOUND_EFFECT_INSTANCE_FLAGS );
|
||||||
friend std::unique_ptr<SoundEffectInstance> __cdecl WaveBank::CreateInstance( int, SOUND_EFFECT_INSTANCE_FLAGS );
|
friend std::unique_ptr<SoundEffectInstance> __cdecl WaveBank::CreateInstance( int, SOUND_EFFECT_INSTANCE_FLAGS );
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
SoundEffectInstance(SoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
|
||||||
SoundEffectInstance& operator= (SoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -667,11 +633,15 @@ namespace DirectX
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DynamicSoundEffectInstance( _In_ AudioEngine* engine,
|
DynamicSoundEffectInstance( _In_ AudioEngine* engine,
|
||||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV(DynamicSoundEffectInstance*)> bufferNeeded,
|
_In_opt_ std::function<void __cdecl(DynamicSoundEffectInstance*)> bufferNeeded,
|
||||||
int sampleRate, int channels, int sampleBits = 16,
|
int sampleRate, int channels, int sampleBits = 16,
|
||||||
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
SOUND_EFFECT_INSTANCE_FLAGS flags = SoundEffectInstance_Default );
|
||||||
DynamicSoundEffectInstance(DynamicSoundEffectInstance&& moveFrom);
|
DynamicSoundEffectInstance(DynamicSoundEffectInstance&& moveFrom);
|
||||||
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance&& moveFrom);
|
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance&& moveFrom);
|
||||||
|
|
||||||
|
DynamicSoundEffectInstance(DynamicSoundEffectInstance const&) = delete;
|
||||||
|
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance const&) = delete;
|
||||||
|
|
||||||
virtual ~DynamicSoundEffectInstance();
|
virtual ~DynamicSoundEffectInstance();
|
||||||
|
|
||||||
void __cdecl Play();
|
void __cdecl Play();
|
||||||
|
@ -708,11 +678,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
DynamicSoundEffectInstance(DynamicSoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
|
||||||
DynamicSoundEffectInstance& operator= (DynamicSoundEffectInstance const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning(pop)
|
|
|
@ -19,17 +19,6 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +30,10 @@ namespace DirectX
|
||||||
explicit CommonStates(_In_ ID3D11Device* device);
|
explicit CommonStates(_In_ ID3D11Device* device);
|
||||||
CommonStates(CommonStates&& moveFrom);
|
CommonStates(CommonStates&& moveFrom);
|
||||||
CommonStates& operator= (CommonStates&& moveFrom);
|
CommonStates& operator= (CommonStates&& moveFrom);
|
||||||
|
|
||||||
|
CommonStates(CommonStates const&) = delete;
|
||||||
|
CommonStates& operator= (CommonStates const&) = delete;
|
||||||
|
|
||||||
virtual ~CommonStates();
|
virtual ~CommonStates();
|
||||||
|
|
||||||
// Blend states.
|
// Blend states.
|
||||||
|
@ -73,9 +66,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::shared_ptr<Impl> pImpl;
|
std::shared_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
CommonStates(CommonStates const&) DIRECTX_CTOR_DELETE
|
|
||||||
CommonStates& operator= (CommonStates const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,8 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <exception>
|
#ifndef IID_GRAPHICS_PPV_ARGS
|
||||||
|
#define IID_GRAPHICS_PPV_ARGS(x) IID_PPV_ARGS(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma warning(push)
|
#include <exception>
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// The core Direct3D headers provide the following helper C++ classes
|
// The core Direct3D headers provide the following helper C++ classes
|
||||||
|
|
|
@ -19,32 +19,12 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <DirectXMath.h>
|
#include <DirectXMath.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4481)
|
|
||||||
// VS 2010 considers 'override' to be a extension, but it's part of C++11 as of VS 2012
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
|
||||||
#define XM_CALLCONV __fastcall
|
|
||||||
typedef const XMVECTOR& HXMVECTOR;
|
|
||||||
typedef const XMMATRIX& FXMMATRIX;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Abstract interface representing any effect which can be applied onto a D3D device context.
|
// Abstract interface representing any effect which can be applied onto a D3D device context.
|
||||||
class IEffect
|
class IEffect
|
||||||
|
@ -126,6 +106,10 @@ namespace DirectX
|
||||||
explicit BasicEffect(_In_ ID3D11Device* device);
|
explicit BasicEffect(_In_ ID3D11Device* device);
|
||||||
BasicEffect(BasicEffect&& moveFrom);
|
BasicEffect(BasicEffect&& moveFrom);
|
||||||
BasicEffect& operator= (BasicEffect&& moveFrom);
|
BasicEffect& operator= (BasicEffect&& moveFrom);
|
||||||
|
|
||||||
|
BasicEffect(BasicEffect const&) = delete;
|
||||||
|
BasicEffect& operator= (BasicEffect const&) = delete;
|
||||||
|
|
||||||
virtual ~BasicEffect();
|
virtual ~BasicEffect();
|
||||||
|
|
||||||
// IEffect methods.
|
// IEffect methods.
|
||||||
|
@ -176,10 +160,6 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
BasicEffect(BasicEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
BasicEffect& operator= (BasicEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,6 +171,10 @@ namespace DirectX
|
||||||
explicit AlphaTestEffect(_In_ ID3D11Device* device);
|
explicit AlphaTestEffect(_In_ ID3D11Device* device);
|
||||||
AlphaTestEffect(AlphaTestEffect&& moveFrom);
|
AlphaTestEffect(AlphaTestEffect&& moveFrom);
|
||||||
AlphaTestEffect& operator= (AlphaTestEffect&& moveFrom);
|
AlphaTestEffect& operator= (AlphaTestEffect&& moveFrom);
|
||||||
|
|
||||||
|
AlphaTestEffect(AlphaTestEffect const&) = delete;
|
||||||
|
AlphaTestEffect& operator= (AlphaTestEffect const&) = delete;
|
||||||
|
|
||||||
virtual ~AlphaTestEffect();
|
virtual ~AlphaTestEffect();
|
||||||
|
|
||||||
// IEffect methods.
|
// IEffect methods.
|
||||||
|
@ -228,10 +212,6 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
AlphaTestEffect(AlphaTestEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
AlphaTestEffect& operator= (AlphaTestEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,6 +223,10 @@ namespace DirectX
|
||||||
explicit DualTextureEffect(_In_ ID3D11Device* device);
|
explicit DualTextureEffect(_In_ ID3D11Device* device);
|
||||||
DualTextureEffect(DualTextureEffect&& moveFrom);
|
DualTextureEffect(DualTextureEffect&& moveFrom);
|
||||||
DualTextureEffect& operator= (DualTextureEffect&& moveFrom);
|
DualTextureEffect& operator= (DualTextureEffect&& moveFrom);
|
||||||
|
|
||||||
|
DualTextureEffect(DualTextureEffect const&) = delete;
|
||||||
|
DualTextureEffect& operator= (DualTextureEffect const&) = delete;
|
||||||
|
|
||||||
~DualTextureEffect();
|
~DualTextureEffect();
|
||||||
|
|
||||||
// IEffect methods.
|
// IEffect methods.
|
||||||
|
@ -277,10 +261,6 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
DualTextureEffect(DualTextureEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
DualTextureEffect& operator= (DualTextureEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -292,6 +272,10 @@ namespace DirectX
|
||||||
explicit EnvironmentMapEffect(_In_ ID3D11Device* device);
|
explicit EnvironmentMapEffect(_In_ ID3D11Device* device);
|
||||||
EnvironmentMapEffect(EnvironmentMapEffect&& moveFrom);
|
EnvironmentMapEffect(EnvironmentMapEffect&& moveFrom);
|
||||||
EnvironmentMapEffect& operator= (EnvironmentMapEffect&& moveFrom);
|
EnvironmentMapEffect& operator= (EnvironmentMapEffect&& moveFrom);
|
||||||
|
|
||||||
|
EnvironmentMapEffect(EnvironmentMapEffect const&) = delete;
|
||||||
|
EnvironmentMapEffect& operator= (EnvironmentMapEffect const&) = delete;
|
||||||
|
|
||||||
virtual ~EnvironmentMapEffect();
|
virtual ~EnvironmentMapEffect();
|
||||||
|
|
||||||
// IEffect methods.
|
// IEffect methods.
|
||||||
|
@ -343,10 +327,6 @@ namespace DirectX
|
||||||
void __cdecl SetLightingEnabled(bool value) override;
|
void __cdecl SetLightingEnabled(bool value) override;
|
||||||
void __cdecl SetPerPixelLighting(bool value) override;
|
void __cdecl SetPerPixelLighting(bool value) override;
|
||||||
void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override;
|
void XM_CALLCONV SetLightSpecularColor(int whichLight, FXMVECTOR value) override;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
EnvironmentMapEffect(EnvironmentMapEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
EnvironmentMapEffect& operator= (EnvironmentMapEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,6 +338,10 @@ namespace DirectX
|
||||||
explicit SkinnedEffect(_In_ ID3D11Device* device);
|
explicit SkinnedEffect(_In_ ID3D11Device* device);
|
||||||
SkinnedEffect(SkinnedEffect&& moveFrom);
|
SkinnedEffect(SkinnedEffect&& moveFrom);
|
||||||
SkinnedEffect& operator= (SkinnedEffect&& moveFrom);
|
SkinnedEffect& operator= (SkinnedEffect&& moveFrom);
|
||||||
|
|
||||||
|
SkinnedEffect(SkinnedEffect const&) = delete;
|
||||||
|
SkinnedEffect& operator= (SkinnedEffect const&) = delete;
|
||||||
|
|
||||||
virtual ~SkinnedEffect();
|
virtual ~SkinnedEffect();
|
||||||
|
|
||||||
// IEffect methods.
|
// IEffect methods.
|
||||||
|
@ -411,10 +395,6 @@ namespace DirectX
|
||||||
|
|
||||||
// Unsupported interface method.
|
// Unsupported interface method.
|
||||||
void __cdecl SetLightingEnabled(bool value) override;
|
void __cdecl SetLightingEnabled(bool value) override;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
SkinnedEffect(SkinnedEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
SkinnedEffect& operator= (SkinnedEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -428,6 +408,10 @@ namespace DirectX
|
||||||
_In_ bool enableSkinning = false );
|
_In_ bool enableSkinning = false );
|
||||||
DGSLEffect(DGSLEffect&& moveFrom);
|
DGSLEffect(DGSLEffect&& moveFrom);
|
||||||
DGSLEffect& operator= (DGSLEffect&& moveFrom);
|
DGSLEffect& operator= (DGSLEffect&& moveFrom);
|
||||||
|
|
||||||
|
DGSLEffect(DGSLEffect const&) = delete;
|
||||||
|
DGSLEffect& operator= (DGSLEffect const&) = delete;
|
||||||
|
|
||||||
virtual ~DGSLEffect();
|
virtual ~DGSLEffect();
|
||||||
|
|
||||||
// IEffect methods.
|
// IEffect methods.
|
||||||
|
@ -492,10 +476,6 @@ namespace DirectX
|
||||||
|
|
||||||
// Unsupported interface methods.
|
// Unsupported interface methods.
|
||||||
void __cdecl SetPerPixelLighting(bool value) override;
|
void __cdecl SetPerPixelLighting(bool value) override;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
DGSLEffect(DGSLEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
DGSLEffect& operator= (DGSLEffect const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -538,6 +518,10 @@ namespace DirectX
|
||||||
explicit EffectFactory(_In_ ID3D11Device* device);
|
explicit EffectFactory(_In_ ID3D11Device* device);
|
||||||
EffectFactory(EffectFactory&& moveFrom);
|
EffectFactory(EffectFactory&& moveFrom);
|
||||||
EffectFactory& operator= (EffectFactory&& moveFrom);
|
EffectFactory& operator= (EffectFactory&& moveFrom);
|
||||||
|
|
||||||
|
EffectFactory(EffectFactory const&) = delete;
|
||||||
|
EffectFactory& operator= (EffectFactory const&) = delete;
|
||||||
|
|
||||||
virtual ~EffectFactory();
|
virtual ~EffectFactory();
|
||||||
|
|
||||||
// IEffectFactory methods.
|
// IEffectFactory methods.
|
||||||
|
@ -556,10 +540,6 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::shared_ptr<Impl> pImpl;
|
std::shared_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
EffectFactory(EffectFactory const&) DIRECTX_CTOR_DELETE
|
|
||||||
EffectFactory& operator= (EffectFactory const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -570,6 +550,10 @@ namespace DirectX
|
||||||
explicit DGSLEffectFactory(_In_ ID3D11Device* device);
|
explicit DGSLEffectFactory(_In_ ID3D11Device* device);
|
||||||
DGSLEffectFactory(DGSLEffectFactory&& moveFrom);
|
DGSLEffectFactory(DGSLEffectFactory&& moveFrom);
|
||||||
DGSLEffectFactory& operator= (DGSLEffectFactory&& moveFrom);
|
DGSLEffectFactory& operator= (DGSLEffectFactory&& moveFrom);
|
||||||
|
|
||||||
|
DGSLEffectFactory(DGSLEffectFactory const&) = delete;
|
||||||
|
DGSLEffectFactory& operator= (DGSLEffectFactory const&) = delete;
|
||||||
|
|
||||||
virtual ~DGSLEffectFactory();
|
virtual ~DGSLEffectFactory();
|
||||||
|
|
||||||
// IEffectFactory methods.
|
// IEffectFactory methods.
|
||||||
|
@ -601,12 +585,6 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::shared_ptr<Impl> pImpl;
|
std::shared_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
DGSLEffectFactory(DGSLEffectFactory const&) DIRECTX_CTOR_DELETE
|
|
||||||
DGSLEffectFactory& operator= (DGSLEffectFactory const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
|
@ -25,24 +25,8 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <intsafe.h>
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
|
@ -53,6 +37,10 @@ namespace DirectX
|
||||||
GamePad();
|
GamePad();
|
||||||
GamePad(GamePad&& moveFrom);
|
GamePad(GamePad&& moveFrom);
|
||||||
GamePad& operator= (GamePad&& moveFrom);
|
GamePad& operator= (GamePad&& moveFrom);
|
||||||
|
|
||||||
|
GamePad(GamePad const&) = delete;
|
||||||
|
GamePad& operator=(GamePad const&) = delete;
|
||||||
|
|
||||||
virtual ~GamePad();
|
virtual ~GamePad();
|
||||||
|
|
||||||
#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ ) || defined(_XBOX_ONE)
|
#if (_WIN32_WINNT >= 0x0A00 /*_WIN32_WINNT_WIN10*/ ) || defined(_XBOX_ONE)
|
||||||
|
@ -197,8 +185,17 @@ namespace DirectX
|
||||||
ButtonState leftShoulder;
|
ButtonState leftShoulder;
|
||||||
ButtonState rightShoulder;
|
ButtonState rightShoulder;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
ButtonState back;
|
ButtonState back;
|
||||||
|
ButtonState view;
|
||||||
|
};
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
ButtonState start;
|
ButtonState start;
|
||||||
|
ButtonState menu;
|
||||||
|
};
|
||||||
|
|
||||||
ButtonState dpadUp;
|
ButtonState dpadUp;
|
||||||
ButtonState dpadDown;
|
ButtonState dpadDown;
|
||||||
|
@ -236,9 +233,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
GamePad(GamePad const&) DIRECTX_CTOR_DELETE
|
|
||||||
GamePad& operator=(GamePad const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,40 +20,17 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// VS 2010 doesn't support explicit calling convention for std::function
|
|
||||||
#ifndef DIRECTX_STD_CALLCONV
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
|
||||||
#define DIRECTX_STD_CALLCONV
|
|
||||||
#else
|
|
||||||
#define DIRECTX_STD_CALLCONV __cdecl
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
|
||||||
#define XM_CALLCONV __fastcall
|
|
||||||
typedef const XMVECTOR& HXMVECTOR;
|
|
||||||
typedef const XMMATRIX& FXMMATRIX;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class IEffect;
|
class IEffect;
|
||||||
|
|
||||||
class GeometricPrimitive
|
class GeometricPrimitive
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
GeometricPrimitive(GeometricPrimitive const&) = delete;
|
||||||
|
GeometricPrimitive& operator= (GeometricPrimitive const&) = delete;
|
||||||
|
|
||||||
virtual ~GeometricPrimitive();
|
virtual ~GeometricPrimitive();
|
||||||
|
|
||||||
// Factory methods.
|
// Factory methods.
|
||||||
|
@ -86,11 +63,11 @@ namespace DirectX
|
||||||
|
|
||||||
// Draw the primitive.
|
// Draw the primitive.
|
||||||
void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, FXMVECTOR color = Colors::White, _In_opt_ ID3D11ShaderResourceView* texture = nullptr, bool wireframe = false,
|
void XM_CALLCONV Draw(FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection, FXMVECTOR color = Colors::White, _In_opt_ ID3D11ShaderResourceView* texture = nullptr, bool wireframe = false,
|
||||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr );
|
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr );
|
||||||
|
|
||||||
// Draw the primitive using a custom effect.
|
// Draw the primitive using a custom effect.
|
||||||
void __cdecl Draw( _In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha = false, bool wireframe = false,
|
void __cdecl Draw( _In_ IEffect* effect, _In_ ID3D11InputLayout* inputLayout, bool alpha = false, bool wireframe = false,
|
||||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr );
|
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr );
|
||||||
|
|
||||||
// Create input layout for drawing with a custom effect.
|
// Create input layout for drawing with a custom effect.
|
||||||
void __cdecl CreateInputLayout( _In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout );
|
void __cdecl CreateInputLayout( _In_ IEffect* effect, _Outptr_ ID3D11InputLayout** inputLayout );
|
||||||
|
@ -102,9 +79,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
GeometricPrimitive(GeometricPrimitive const&) DIRECTX_CTOR_DELETE
|
|
||||||
GeometricPrimitive& operator= (GeometricPrimitive const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,6 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,6 +34,10 @@ namespace DirectX
|
||||||
#endif
|
#endif
|
||||||
GraphicsMemory(GraphicsMemory&& moveFrom);
|
GraphicsMemory(GraphicsMemory&& moveFrom);
|
||||||
GraphicsMemory& operator= (GraphicsMemory&& moveFrom);
|
GraphicsMemory& operator= (GraphicsMemory&& moveFrom);
|
||||||
|
|
||||||
|
GraphicsMemory(GraphicsMemory const&) = delete;
|
||||||
|
GraphicsMemory& operator=(GraphicsMemory const&) = delete;
|
||||||
|
|
||||||
virtual ~GraphicsMemory();
|
virtual ~GraphicsMemory();
|
||||||
|
|
||||||
void* __cdecl Allocate(_In_opt_ ID3D11DeviceContext* context, size_t size, int alignment);
|
void* __cdecl Allocate(_In_opt_ ID3D11DeviceContext* context, size_t size, int alignment);
|
||||||
|
@ -59,9 +52,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
GraphicsMemory(GraphicsMemory const&) DIRECTX_CTOR_DELETE
|
|
||||||
GraphicsMemory& operator=(GraphicsMemory const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,23 +13,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } }
|
namespace ABI { namespace Windows { namespace UI { namespace Core { struct ICoreWindow; } } } }
|
||||||
|
@ -44,6 +29,10 @@ namespace DirectX
|
||||||
Keyboard();
|
Keyboard();
|
||||||
Keyboard(Keyboard&& moveFrom);
|
Keyboard(Keyboard&& moveFrom);
|
||||||
Keyboard& operator= (Keyboard&& moveFrom);
|
Keyboard& operator= (Keyboard&& moveFrom);
|
||||||
|
|
||||||
|
Keyboard(Keyboard const&) = delete;
|
||||||
|
Keyboard& operator=(Keyboard const&) = delete;
|
||||||
|
|
||||||
virtual ~Keyboard();
|
virtual ~Keyboard();
|
||||||
|
|
||||||
enum Keys
|
enum Keys
|
||||||
|
@ -484,9 +473,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
Keyboard(Keyboard const&) DIRECTX_CTOR_DELETE
|
|
||||||
Keyboard& operator=(Keyboard const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,31 +28,13 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <intsafe.h>
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include <wrl\client.h>
|
#include <wrl\client.h>
|
||||||
|
|
||||||
// VS 2010 doesn't support explicit calling convention for std::function
|
|
||||||
#ifndef DIRECTX_STD_CALLCONV
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
|
||||||
#define DIRECTX_STD_CALLCONV
|
|
||||||
#else
|
|
||||||
#define DIRECTX_STD_CALLCONV __cdecl
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
|
||||||
#define XM_CALLCONV __fastcall
|
|
||||||
typedef const XMVECTOR& HXMVECTOR;
|
|
||||||
typedef const XMMATRIX& FXMMATRIX;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class IEffect;
|
class IEffect;
|
||||||
class IEffectFactory;
|
class IEffectFactory;
|
||||||
class CommonStates;
|
class CommonStates;
|
||||||
|
@ -83,7 +65,7 @@ namespace DirectX
|
||||||
|
|
||||||
// Draw mesh part with custom effect
|
// Draw mesh part with custom effect
|
||||||
void __cdecl Draw( _In_ ID3D11DeviceContext* deviceContext, _In_ IEffect* ieffect, _In_ ID3D11InputLayout* iinputLayout,
|
void __cdecl Draw( _In_ ID3D11DeviceContext* deviceContext, _In_ IEffect* ieffect, _In_ ID3D11InputLayout* iinputLayout,
|
||||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr ) const;
|
_In_opt_ std::function<void __cdecl()> setCustomState = nullptr ) const;
|
||||||
|
|
||||||
// Create input layout for drawing with a custom effect.
|
// Create input layout for drawing with a custom effect.
|
||||||
void __cdecl CreateInputLayout( _In_ ID3D11Device* d3dDevice, _In_ IEffect* ieffect, _Outptr_ ID3D11InputLayout** iinputLayout );
|
void __cdecl CreateInputLayout( _In_ ID3D11Device* d3dDevice, _In_ IEffect* ieffect, _Outptr_ ID3D11InputLayout** iinputLayout );
|
||||||
|
@ -115,7 +97,7 @@ namespace DirectX
|
||||||
|
|
||||||
// Draw the mesh
|
// Draw the mesh
|
||||||
void XM_CALLCONV Draw( _In_ ID3D11DeviceContext* deviceContext, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
|
void XM_CALLCONV Draw( _In_ ID3D11DeviceContext* deviceContext, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
|
||||||
bool alpha = false, _In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr ) const;
|
bool alpha = false, _In_opt_ std::function<void __cdecl()> setCustomState = nullptr ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,13 +113,13 @@ namespace DirectX
|
||||||
|
|
||||||
// Draw all the meshes in the model
|
// Draw all the meshes in the model
|
||||||
void XM_CALLCONV Draw( _In_ ID3D11DeviceContext* deviceContext, CommonStates& states, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
|
void XM_CALLCONV Draw( _In_ ID3D11DeviceContext* deviceContext, CommonStates& states, FXMMATRIX world, CXMMATRIX view, CXMMATRIX projection,
|
||||||
bool wireframe = false, _In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomState = nullptr ) const;
|
bool wireframe = false, _In_opt_ std::function<void __cdecl()> setCustomState = nullptr ) const;
|
||||||
|
|
||||||
// Notify model that effects, parts list, or mesh list has changed
|
// Notify model that effects, parts list, or mesh list has changed
|
||||||
void __cdecl Modified() { mEffectCache.clear(); }
|
void __cdecl Modified() { mEffectCache.clear(); }
|
||||||
|
|
||||||
// Update all effects used by the model
|
// Update all effects used by the model
|
||||||
void __cdecl UpdateEffects( _In_ std::function<void DIRECTX_STD_CALLCONV(IEffect*)> setEffect );
|
void __cdecl UpdateEffects( _In_ std::function<void __cdecl(IEffect*)> setEffect );
|
||||||
|
|
||||||
// Loads a model from a Visual Studio Starter Kit .CMO file
|
// Loads a model from a Visual Studio Starter Kit .CMO file
|
||||||
static std::unique_ptr<Model> __cdecl CreateFromCMO( _In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, size_t dataSize,
|
static std::unique_ptr<Model> __cdecl CreateFromCMO( _In_ ID3D11Device* d3dDevice, _In_reads_bytes_(dataSize) const uint8_t* meshData, size_t dataSize,
|
||||||
|
|
|
@ -13,17 +13,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
|
@ -39,6 +28,10 @@ namespace DirectX
|
||||||
Mouse();
|
Mouse();
|
||||||
Mouse(Mouse&& moveFrom);
|
Mouse(Mouse&& moveFrom);
|
||||||
Mouse& operator= (Mouse&& moveFrom);
|
Mouse& operator= (Mouse&& moveFrom);
|
||||||
|
|
||||||
|
Mouse(Mouse const&) = delete;
|
||||||
|
Mouse& operator=(Mouse const&) = delete;
|
||||||
|
|
||||||
virtual ~Mouse();
|
virtual ~Mouse();
|
||||||
|
|
||||||
enum Mode
|
enum Mode
|
||||||
|
@ -121,9 +114,5 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
Mouse(Mouse const&) DIRECTX_CTOR_DELETE
|
|
||||||
Mouse& operator=(Mouse const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,24 +19,9 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
|
@ -50,6 +35,10 @@ namespace DirectX
|
||||||
PrimitiveBatchBase(_In_ ID3D11DeviceContext* deviceContext, size_t maxIndices, size_t maxVertices, size_t vertexSize);
|
PrimitiveBatchBase(_In_ ID3D11DeviceContext* deviceContext, size_t maxIndices, size_t maxVertices, size_t vertexSize);
|
||||||
PrimitiveBatchBase(PrimitiveBatchBase&& moveFrom);
|
PrimitiveBatchBase(PrimitiveBatchBase&& moveFrom);
|
||||||
PrimitiveBatchBase& operator= (PrimitiveBatchBase&& moveFrom);
|
PrimitiveBatchBase& operator= (PrimitiveBatchBase&& moveFrom);
|
||||||
|
|
||||||
|
PrimitiveBatchBase(PrimitiveBatchBase const&) = delete;
|
||||||
|
PrimitiveBatchBase& operator= (PrimitiveBatchBase const&) = delete;
|
||||||
|
|
||||||
virtual ~PrimitiveBatchBase();
|
virtual ~PrimitiveBatchBase();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -66,10 +55,6 @@ namespace DirectX
|
||||||
class Impl;
|
class Impl;
|
||||||
|
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
PrimitiveBatchBase(PrimitiveBatchBase const&) DIRECTX_CTOR_DELETE
|
|
||||||
PrimitiveBatchBase& operator= (PrimitiveBatchBase const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,21 +29,9 @@
|
||||||
|
|
||||||
#include <ocidl.h>
|
#include <ocidl.h>
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
// VS 2010 doesn't support explicit calling convention for std::function
|
|
||||||
#ifndef DIRECTX_STD_CALLCONV
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
|
||||||
#define DIRECTX_STD_CALLCONV
|
|
||||||
#else
|
|
||||||
#define DIRECTX_STD_CALLCONV __cdecl
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
|
@ -58,7 +46,7 @@ namespace DirectX
|
||||||
_In_ REFGUID guidContainerFormat,
|
_In_ REFGUID guidContainerFormat,
|
||||||
_In_z_ LPCWSTR fileName,
|
_In_z_ LPCWSTR fileName,
|
||||||
_In_opt_ const GUID* targetFormat = nullptr,
|
_In_opt_ const GUID* targetFormat = nullptr,
|
||||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV(IPropertyBag2*)> setCustomProps = nullptr );
|
_In_opt_ std::function<void __cdecl(IPropertyBag2*)> setCustomProps = nullptr );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
|
@ -26,17 +26,81 @@
|
||||||
#include <DirectXPackedVector.h>
|
#include <DirectXPackedVector.h>
|
||||||
#include <DirectXCollision.h>
|
#include <DirectXCollision.h>
|
||||||
|
|
||||||
|
#if (defined(_XBOX_ONE) && defined(_TITLE)) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP))
|
||||||
|
#include <Windows.Foundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace SimpleMath
|
namespace SimpleMath
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct Vector2;
|
||||||
struct Vector4;
|
struct Vector4;
|
||||||
struct Matrix;
|
struct Matrix;
|
||||||
struct Quaternion;
|
struct Quaternion;
|
||||||
struct Plane;
|
struct Plane;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// 2D rectangle
|
||||||
|
struct Rectangle
|
||||||
|
{
|
||||||
|
long x;
|
||||||
|
long y;
|
||||||
|
long width;
|
||||||
|
long height;
|
||||||
|
|
||||||
|
// Creators
|
||||||
|
Rectangle() : x(0), y(0), width(0), height(0) {}
|
||||||
|
Rectangle(long ix, long iy, long iw, long ih) : x(ix), y(iy), width(iw), height(ih) {}
|
||||||
|
explicit Rectangle(const RECT& rct) : x(rct.left), y(rct.top), width(rct.right - rct.left), height(rct.bottom - rct.top) {}
|
||||||
|
|
||||||
|
operator RECT() { RECT rct; rct.left = x; rct.top = y; rct.right = (x + width); rct.bottom = (y + height); return rct; }
|
||||||
|
#if (defined(_XBOX_ONE) && defined(_TITLE)) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP))
|
||||||
|
operator ABI::Windows::Foundation::Rect() { ABI::Windows::Foundation::Rect r; r.X = float(x); r.Y = float(y); r.Width = float(width); r.Height = float(height); return r; }
|
||||||
|
#ifdef __cplusplus_winrt
|
||||||
|
operator Windows::Foundation::Rect() { return Windows::Foundation::Rect(float(x), float(y), float(width), float(height)); }
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Comparison operators
|
||||||
|
bool operator == (const Rectangle& r) const { return (x == r.x) && (y == r.y) && (width == r.width) && (height == r.height); }
|
||||||
|
bool operator == (const RECT& rct) const { return (x == rct.left) && (y == rct.top) && (width == (rct.right - rct.left)) && (height == (rct.bottom - rct.top)); }
|
||||||
|
|
||||||
|
bool operator != (const Rectangle& r) const { return (x != r.x) || (y != r.y) || (width != r.width) || (height != r.height); }
|
||||||
|
bool operator != (const RECT& rct) const { return (x != rct.left) || (y != rct.top) || (width != (rct.right - rct.left)) || (height != (rct.bottom - rct.top)); }
|
||||||
|
|
||||||
|
// Assignment operators
|
||||||
|
Rectangle& operator=(_In_ const Rectangle& r) { x = r.x; y = r.y; width = r.width; height = r.height; return *this; }
|
||||||
|
Rectangle& operator=(_In_ const RECT& rct) { x = rct.left; y = rct.top; width = (rct.right - rct.left); height = (rct.bottom - rct.top); return *this; }
|
||||||
|
|
||||||
|
// Rectangle operations
|
||||||
|
Vector2 Location() const;
|
||||||
|
Vector2 Center() const;
|
||||||
|
|
||||||
|
bool IsEmpty() const { return (width == 0 && height == 0 && x == 0 && y == 0); }
|
||||||
|
|
||||||
|
bool Contains(long ix, long iy) const { return (x <= ix) && (ix < (x + width)) && (y <= iy) && (iy < (y + height)); }
|
||||||
|
bool Contains(const Vector2& point) const;
|
||||||
|
bool Contains(const Rectangle& r) const { return (x <= r.x) && ((r.x + r.width) <= (x + width)) && (y <= r.y) && ((r.y + r.height) <= (y + height)); }
|
||||||
|
bool Contains(const RECT& rct) const { return (x <= rct.left) && (rct.right <= (x + width)) && (y <= rct.top) && (rct.bottom <= (y + height)); }
|
||||||
|
|
||||||
|
void Inflate(long horizAmount, long vertAmount);
|
||||||
|
|
||||||
|
bool Intersects(const Rectangle& r) const { return (r.x < (x + width)) && (x < (r.x + r.width)) && (r.y < (y + height)) && (y < (r.y + r.height)); }
|
||||||
|
bool Intersects(const RECT& rct) const { return (rct.left < (x + width)) && (x < rct.right) && (rct.top < (y + height)) && (y < rct.bottom); }
|
||||||
|
|
||||||
|
void Offset(long ox, long oy) { x += ox; y += oy; }
|
||||||
|
|
||||||
|
// Static functions
|
||||||
|
static Rectangle Intersect(const Rectangle& ra, const Rectangle& rb);
|
||||||
|
static RECT Intersect(const RECT& rcta, const RECT& rctb);
|
||||||
|
|
||||||
|
static Rectangle Union(const Rectangle& ra, const Rectangle& rb);
|
||||||
|
static RECT Union(const RECT& rcta, const RECT& rctb);
|
||||||
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// 2D vector
|
// 2D vector
|
||||||
struct Vector2 : public XMFLOAT2
|
struct Vector2 : public XMFLOAT2
|
||||||
|
@ -804,6 +868,17 @@ public:
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template<> struct less<DirectX::SimpleMath::Rectangle>
|
||||||
|
{
|
||||||
|
bool operator()(const DirectX::SimpleMath::Rectangle& r1, const DirectX::SimpleMath::Rectangle& r2) const
|
||||||
|
{
|
||||||
|
return ((r1.x < r2.x)
|
||||||
|
|| ((r1.x == r2.x) && (r1.y < r2.y))
|
||||||
|
|| ((r1.x == r2.x) && (r1.y == r2.y) && (r1.width < r2.width))
|
||||||
|
|| ((r1.x == r2.x) && (r1.y == r2.y) && (r1.width == r2.width) && (r1.height < r2.height)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<> struct less<DirectX::SimpleMath::Vector2>
|
template<> struct less<DirectX::SimpleMath::Vector2>
|
||||||
{
|
{
|
||||||
bool operator()(const DirectX::SimpleMath::Vector2& V1, const DirectX::SimpleMath::Vector2& V2) const
|
bool operator()(const DirectX::SimpleMath::Vector2& V1, const DirectX::SimpleMath::Vector2& V2) const
|
||||||
|
|
|
@ -13,6 +13,137 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
*
|
||||||
|
* Rectangle
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Rectangle operations
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
inline Vector2 Rectangle::Location() const
|
||||||
|
{
|
||||||
|
return Vector2(float(x), float(y));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Vector2 Rectangle::Center() const
|
||||||
|
{
|
||||||
|
return Vector2(float(x) + float(width / 2.f), float(y) + float(height / 2.f));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool Rectangle::Contains(const Vector2& point) const
|
||||||
|
{
|
||||||
|
return (float(x) <= point.x) && (point.x < float(x + width)) && (float(y) <= point.y) && (point.y < float(y + height));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void Rectangle::Inflate(long horizAmount, long vertAmount)
|
||||||
|
{
|
||||||
|
x -= horizAmount;
|
||||||
|
y -= vertAmount;
|
||||||
|
width += horizAmount;
|
||||||
|
height += vertAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Static functions
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
inline Rectangle Rectangle::Intersect(const Rectangle& ra, const Rectangle& rb)
|
||||||
|
{
|
||||||
|
long righta = ra.x + ra.width;
|
||||||
|
long rightb = rb.x + rb.width;
|
||||||
|
|
||||||
|
long bottoma = ra.y + ra.height;
|
||||||
|
long bottomb = rb.y + rb.height;
|
||||||
|
|
||||||
|
long maxX = ra.x > rb.x ? ra.x : rb.x;
|
||||||
|
long maxY = ra.y > rb.y ? ra.y : rb.y;
|
||||||
|
|
||||||
|
long minRight = righta < rightb ? righta : rightb;
|
||||||
|
long minBottom = bottoma < bottomb ? bottoma : bottomb;
|
||||||
|
|
||||||
|
Rectangle result;
|
||||||
|
|
||||||
|
if ((minRight > maxX) && (minBottom > maxY))
|
||||||
|
{
|
||||||
|
result.x = maxX;
|
||||||
|
result.y = maxY;
|
||||||
|
result.width = minRight - maxX;
|
||||||
|
result.height = minBottom - maxY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.x = 0;
|
||||||
|
result.y = 0;
|
||||||
|
result.width = 0;
|
||||||
|
result.height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline RECT Rectangle::Intersect(const RECT& rcta, const RECT& rctb)
|
||||||
|
{
|
||||||
|
long maxX = rcta.left > rctb.left ? rcta.left : rctb.left;
|
||||||
|
long maxY = rcta.top > rctb.top ? rcta.top : rctb.top;
|
||||||
|
|
||||||
|
long minRight = rcta.right < rctb.right ? rcta.right : rctb.right;
|
||||||
|
long minBottom = rcta.bottom < rctb.bottom ? rcta.bottom : rctb.bottom;
|
||||||
|
|
||||||
|
RECT result;
|
||||||
|
|
||||||
|
if ((minRight > maxX) && (minBottom > maxY))
|
||||||
|
{
|
||||||
|
result.left = maxX;
|
||||||
|
result.top = maxY;
|
||||||
|
result.right = minRight;
|
||||||
|
result.bottom = minBottom;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result.left = 0;
|
||||||
|
result.top = 0;
|
||||||
|
result.right = 0;
|
||||||
|
result.bottom = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Rectangle Rectangle::Union(const Rectangle& ra, const Rectangle& rb)
|
||||||
|
{
|
||||||
|
long righta = ra.x + ra.width;
|
||||||
|
long rightb = rb.x + rb.width;
|
||||||
|
|
||||||
|
long bottoma = ra.y + ra.height;
|
||||||
|
long bottomb = rb.y + rb.height;
|
||||||
|
|
||||||
|
int minX = ra.x < rb.x ? ra.x : rb.x;
|
||||||
|
int minY = ra.y < rb.y ? ra.y : rb.y;
|
||||||
|
|
||||||
|
int maxRight = righta > rightb ? righta : rightb;
|
||||||
|
int maxBottom = bottoma > bottomb ? bottoma : bottomb;
|
||||||
|
|
||||||
|
Rectangle result;
|
||||||
|
result.x = minX;
|
||||||
|
result.y = minY;
|
||||||
|
result.width = maxRight - minX;
|
||||||
|
result.height = maxBottom - minY;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline RECT Rectangle::Union(const RECT& rcta, const RECT& rctb)
|
||||||
|
{
|
||||||
|
RECT result;
|
||||||
|
result.left = rcta.left < rctb.left ? rcta.left : rctb.left;
|
||||||
|
result.top = rcta.top < rctb.top ? rcta.top : rctb.top;
|
||||||
|
result.right = rcta.right > rctb.right ? rcta.right : rctb.right;
|
||||||
|
result.bottom = rcta.bottom > rctb.bottom ? rcta.bottom : rctb.bottom;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Vector2
|
* Vector2
|
||||||
|
|
|
@ -19,39 +19,14 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <DirectXMath.h>
|
#include <DirectXMath.h>
|
||||||
#include <DirectXColors.h>
|
#include <DirectXColors.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
// VS 2010 doesn't support explicit calling convention for std::function
|
|
||||||
#ifndef DIRECTX_STD_CALLCONV
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1700)
|
|
||||||
#define DIRECTX_STD_CALLCONV
|
|
||||||
#else
|
|
||||||
#define DIRECTX_STD_CALLCONV __cdecl
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
|
||||||
#define XM_CALLCONV __fastcall
|
|
||||||
typedef const XMVECTOR& HXMVECTOR;
|
|
||||||
typedef const XMMATRIX& FXMMATRIX;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum SpriteSortMode
|
enum SpriteSortMode
|
||||||
{
|
{
|
||||||
SpriteSortMode_Deferred,
|
SpriteSortMode_Deferred,
|
||||||
|
@ -77,11 +52,15 @@ namespace DirectX
|
||||||
explicit SpriteBatch(_In_ ID3D11DeviceContext* deviceContext);
|
explicit SpriteBatch(_In_ ID3D11DeviceContext* deviceContext);
|
||||||
SpriteBatch(SpriteBatch&& moveFrom);
|
SpriteBatch(SpriteBatch&& moveFrom);
|
||||||
SpriteBatch& operator= (SpriteBatch&& moveFrom);
|
SpriteBatch& operator= (SpriteBatch&& moveFrom);
|
||||||
|
|
||||||
|
SpriteBatch(SpriteBatch const&) = delete;
|
||||||
|
SpriteBatch& operator= (SpriteBatch const&) = delete;
|
||||||
|
|
||||||
virtual ~SpriteBatch();
|
virtual ~SpriteBatch();
|
||||||
|
|
||||||
// Begin/End a batch of sprite drawing operations.
|
// Begin/End a batch of sprite drawing operations.
|
||||||
void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred, _In_opt_ ID3D11BlendState* blendState = nullptr, _In_opt_ ID3D11SamplerState* samplerState = nullptr, _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr,
|
void XM_CALLCONV Begin(SpriteSortMode sortMode = SpriteSortMode_Deferred, _In_opt_ ID3D11BlendState* blendState = nullptr, _In_opt_ ID3D11SamplerState* samplerState = nullptr, _In_opt_ ID3D11DepthStencilState* depthStencilState = nullptr, _In_opt_ ID3D11RasterizerState* rasterizerState = nullptr,
|
||||||
_In_opt_ std::function<void DIRECTX_STD_CALLCONV()> setCustomShaders = nullptr, FXMMATRIX transformMatrix = MatrixIdentity);
|
_In_opt_ std::function<void __cdecl()> setCustomShaders = nullptr, FXMMATRIX transformMatrix = MatrixIdentity);
|
||||||
void __cdecl End();
|
void __cdecl End();
|
||||||
|
|
||||||
// Draw overloads specifying position, origin and scale as XMFLOAT2.
|
// Draw overloads specifying position, origin and scale as XMFLOAT2.
|
||||||
|
@ -113,9 +92,5 @@ namespace DirectX
|
||||||
|
|
||||||
static const XMMATRIX MatrixIdentity;
|
static const XMMATRIX MatrixIdentity;
|
||||||
static const XMFLOAT2 Float2Zero;
|
static const XMFLOAT2 Float2Zero;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
SpriteBatch(SpriteBatch const&) DIRECTX_CTOR_DELETE
|
|
||||||
SpriteBatch& operator= (SpriteBatch const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,6 @@
|
||||||
|
|
||||||
#include "SpriteBatch.h"
|
#include "SpriteBatch.h"
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
|
@ -40,6 +29,10 @@ namespace DirectX
|
||||||
|
|
||||||
SpriteFont(SpriteFont&& moveFrom);
|
SpriteFont(SpriteFont&& moveFrom);
|
||||||
SpriteFont& operator= (SpriteFont&& moveFrom);
|
SpriteFont& operator= (SpriteFont&& moveFrom);
|
||||||
|
|
||||||
|
SpriteFont(SpriteFont const&) = delete;
|
||||||
|
SpriteFont& operator= (SpriteFont const&) = delete;
|
||||||
|
|
||||||
virtual ~SpriteFont();
|
virtual ~SpriteFont();
|
||||||
|
|
||||||
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
|
void XM_CALLCONV DrawString(_In_ SpriteBatch* spriteBatch, _In_z_ wchar_t const* text, XMFLOAT2 const& position, FXMVECTOR color = Colors::White, float rotation = 0, XMFLOAT2 const& origin = Float2Zero, float scale = 1, SpriteEffects effects = SpriteEffects_None, float layerDepth = 0) const;
|
||||||
|
@ -81,9 +74,5 @@ namespace DirectX
|
||||||
std::unique_ptr<Impl> pImpl;
|
std::unique_ptr<Impl> pImpl;
|
||||||
|
|
||||||
static const XMFLOAT2 Float2Zero;
|
static const XMFLOAT2 Float2Zero;
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
SpriteFont(SpriteFont const&) DIRECTX_CTOR_DELETE
|
|
||||||
SpriteFont& operator= (SpriteFont const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,32 +19,15 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <DirectXMath.h>
|
#include <DirectXMath.h>
|
||||||
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
|
||||||
#define XM_CALLCONV __fastcall
|
|
||||||
typedef const XMVECTOR& HXMVECTOR;
|
|
||||||
typedef const XMMATRIX& FXMMATRIX;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Vertex struct holding position and color information.
|
// Vertex struct holding position and color information.
|
||||||
struct VertexPositionColor
|
struct VertexPositionColor
|
||||||
{
|
{
|
||||||
VertexPositionColor() DIRECTX_CTOR_DEFAULT
|
VertexPositionColor() = default;
|
||||||
|
|
||||||
VertexPositionColor(XMFLOAT3 const& position, XMFLOAT4 const& color)
|
VertexPositionColor(XMFLOAT3 const& position, XMFLOAT4 const& color)
|
||||||
: position(position),
|
: position(position),
|
||||||
|
@ -68,7 +51,7 @@ namespace DirectX
|
||||||
// Vertex struct holding position and texture mapping information.
|
// Vertex struct holding position and texture mapping information.
|
||||||
struct VertexPositionTexture
|
struct VertexPositionTexture
|
||||||
{
|
{
|
||||||
VertexPositionTexture() DIRECTX_CTOR_DEFAULT
|
VertexPositionTexture() = default;
|
||||||
|
|
||||||
VertexPositionTexture(XMFLOAT3 const& position, XMFLOAT2 const& textureCoordinate)
|
VertexPositionTexture(XMFLOAT3 const& position, XMFLOAT2 const& textureCoordinate)
|
||||||
: position(position),
|
: position(position),
|
||||||
|
@ -92,7 +75,7 @@ namespace DirectX
|
||||||
// Vertex struct holding position and normal vector.
|
// Vertex struct holding position and normal vector.
|
||||||
struct VertexPositionNormal
|
struct VertexPositionNormal
|
||||||
{
|
{
|
||||||
VertexPositionNormal() DIRECTX_CTOR_DEFAULT
|
VertexPositionNormal() = default;
|
||||||
|
|
||||||
VertexPositionNormal(XMFLOAT3 const& position, XMFLOAT3 const& normal)
|
VertexPositionNormal(XMFLOAT3 const& position, XMFLOAT3 const& normal)
|
||||||
: position(position),
|
: position(position),
|
||||||
|
@ -116,7 +99,7 @@ namespace DirectX
|
||||||
// Vertex struct holding position, color, and texture mapping information.
|
// Vertex struct holding position, color, and texture mapping information.
|
||||||
struct VertexPositionColorTexture
|
struct VertexPositionColorTexture
|
||||||
{
|
{
|
||||||
VertexPositionColorTexture() DIRECTX_CTOR_DEFAULT
|
VertexPositionColorTexture() = default;
|
||||||
|
|
||||||
VertexPositionColorTexture(XMFLOAT3 const& position, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate)
|
VertexPositionColorTexture(XMFLOAT3 const& position, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate)
|
||||||
: position(position),
|
: position(position),
|
||||||
|
@ -143,7 +126,7 @@ namespace DirectX
|
||||||
// Vertex struct holding position, normal vector, and color information.
|
// Vertex struct holding position, normal vector, and color information.
|
||||||
struct VertexPositionNormalColor
|
struct VertexPositionNormalColor
|
||||||
{
|
{
|
||||||
VertexPositionNormalColor() DIRECTX_CTOR_DEFAULT
|
VertexPositionNormalColor() = default;
|
||||||
|
|
||||||
VertexPositionNormalColor(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color)
|
VertexPositionNormalColor(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color)
|
||||||
: position(position),
|
: position(position),
|
||||||
|
@ -170,7 +153,7 @@ namespace DirectX
|
||||||
// Vertex struct holding position, normal vector, and texture mapping information.
|
// Vertex struct holding position, normal vector, and texture mapping information.
|
||||||
struct VertexPositionNormalTexture
|
struct VertexPositionNormalTexture
|
||||||
{
|
{
|
||||||
VertexPositionNormalTexture() DIRECTX_CTOR_DEFAULT
|
VertexPositionNormalTexture() = default;
|
||||||
|
|
||||||
VertexPositionNormalTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT2 const& textureCoordinate)
|
VertexPositionNormalTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT2 const& textureCoordinate)
|
||||||
: position(position),
|
: position(position),
|
||||||
|
@ -197,7 +180,7 @@ namespace DirectX
|
||||||
// Vertex struct holding position, normal vector, color, and texture mapping information.
|
// Vertex struct holding position, normal vector, color, and texture mapping information.
|
||||||
struct VertexPositionNormalColorTexture
|
struct VertexPositionNormalColorTexture
|
||||||
{
|
{
|
||||||
VertexPositionNormalColorTexture() DIRECTX_CTOR_DEFAULT
|
VertexPositionNormalColorTexture() = default;
|
||||||
|
|
||||||
VertexPositionNormalColorTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate)
|
VertexPositionNormalColorTexture(XMFLOAT3 const& position, XMFLOAT3 const& normal, XMFLOAT4 const& color, XMFLOAT2 const& textureCoordinate)
|
||||||
: position(position),
|
: position(position),
|
||||||
|
@ -228,7 +211,7 @@ namespace DirectX
|
||||||
// tangent, color (RGBA), and texture mapping information
|
// tangent, color (RGBA), and texture mapping information
|
||||||
struct VertexPositionNormalTangentColorTexture
|
struct VertexPositionNormalTangentColorTexture
|
||||||
{
|
{
|
||||||
VertexPositionNormalTangentColorTexture() DIRECTX_CTOR_DEFAULT
|
VertexPositionNormalTangentColorTexture() = default;
|
||||||
|
|
||||||
XMFLOAT3 position;
|
XMFLOAT3 position;
|
||||||
XMFLOAT3 normal;
|
XMFLOAT3 normal;
|
||||||
|
@ -285,7 +268,7 @@ namespace DirectX
|
||||||
// tangent, color (RGBA), texture mapping information, and skinning weights
|
// tangent, color (RGBA), texture mapping information, and skinning weights
|
||||||
struct VertexPositionNormalTangentColorTextureSkinning : public VertexPositionNormalTangentColorTexture
|
struct VertexPositionNormalTangentColorTextureSkinning : public VertexPositionNormalTangentColorTexture
|
||||||
{
|
{
|
||||||
VertexPositionNormalTangentColorTextureSkinning() DIRECTX_CTOR_DEFAULT
|
VertexPositionNormalTangentColorTextureSkinning() = default;
|
||||||
|
|
||||||
uint32_t indices;
|
uint32_t indices;
|
||||||
uint32_t weights;
|
uint32_t weights;
|
||||||
|
|
|
@ -37,10 +37,8 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,16 +4,16 @@ DirectXTK - the DirectX Tool Kit
|
||||||
|
|
||||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
February 23, 2016
|
April 26, 2016
|
||||||
|
|
||||||
This package contains the "DirectX Tool Kit", a collection of helper classes for
|
This package contains the "DirectX Tool Kit", a collection of helper classes for
|
||||||
writing Direct3D 11 C++ code for universal Windows apps for Windows 10,
|
writing Direct3D 11 C++ code for Universal Windows Platform (UWP) apps for Windows 10,
|
||||||
Windows Store apps, Windows phone 8.x applications, Xbox One exclusive apps,
|
Windows Store apps, Windows phone 8.1 applications, Xbox One exclusive apps,
|
||||||
Xbox One hub apps, Windows 8.x Win32 desktop applications, Windows 7 applications,
|
Windows 8.x Win32 desktop applications, Windows 7 applications, and
|
||||||
and Windows Vista Direct3D 11.0 applications.
|
Windows Vista Direct3D 11.0 applications.
|
||||||
|
|
||||||
This code is designed to build with Visual Studio 2013 or 2015. It is recommended that you
|
This code is designed to build with Visual Studio 2013 or 2015. It is recommended that you
|
||||||
make use of VS 2013 Update 5, VS 2015 Update 1, and Windows 7 Service Pack 1 or later.
|
make use of VS 2013 Update 5, VS 2015 Update 2, and Windows 7 Service Pack 1 or later.
|
||||||
|
|
||||||
These components are designed to work without requiring any content from the DirectX SDK. For details,
|
These components are designed to work without requiring any content from the DirectX SDK. For details,
|
||||||
see "Where is the DirectX SDK?" <http://msdn.microsoft.com/en-us/library/ee663275.aspx>.
|
see "Where is the DirectX SDK?" <http://msdn.microsoft.com/en-us/library/ee663275.aspx>.
|
||||||
|
@ -23,8 +23,8 @@ Inc\
|
||||||
|
|
||||||
Audio.h - low-level audio API using XAudio2 (DirectXTK for Audio public header)
|
Audio.h - low-level audio API using XAudio2 (DirectXTK for Audio public header)
|
||||||
CommonStates.h - factory providing commonly used D3D state objects
|
CommonStates.h - factory providing commonly used D3D state objects
|
||||||
DirectXHelpers.h - misc C++ helpers for D3D programming
|
|
||||||
DDSTextureLoader.h - light-weight DDS file texture loader
|
DDSTextureLoader.h - light-weight DDS file texture loader
|
||||||
|
DirectXHelpers.h - misc C++ helpers for D3D programming
|
||||||
Effects.h - set of built-in shaders for common rendering tasks
|
Effects.h - set of built-in shaders for common rendering tasks
|
||||||
GamePad.h - gamepad controller helper using XInput
|
GamePad.h - gamepad controller helper using XInput
|
||||||
GeometricPrimitive.h - draws basic shapes such as cubes and spheres
|
GeometricPrimitive.h - draws basic shapes such as cubes and spheres
|
||||||
|
@ -74,6 +74,14 @@ Note: Xbox One exclusive apps developers using the Xbox One XDK need to generate
|
||||||
RELEASE HISTORY
|
RELEASE HISTORY
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
April 26, 2016
|
||||||
|
Added Rectangle class to SimpleMath
|
||||||
|
Fix for SDKMESH loader when loading models with 'extra' texture coordinate sets
|
||||||
|
Made SimpleMath's Viewport ComputeTitleSafeArea less conservative
|
||||||
|
Added view/menu alises to GamePad::ButtonStateTracker for Xbox One Controller naming
|
||||||
|
Retired Windows phone 8.0 projects and obsolete adapter code
|
||||||
|
Minor code and project file cleanup
|
||||||
|
|
||||||
February 23, 2016
|
February 23, 2016
|
||||||
Fixed width computation bug in SpriteFont::MeasureString
|
Fixed width computation bug in SpriteFont::MeasureString
|
||||||
Fix to clean up partial or zero-length image files on failed write
|
Fix to clean up partial or zero-length image files on failed write
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
#include <stdexcept>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "PlatformHelpers.h"
|
#include "PlatformHelpers.h"
|
||||||
|
@ -29,6 +30,8 @@ namespace DirectX
|
||||||
explicit BinaryReader(_In_z_ wchar_t const* fileName);
|
explicit BinaryReader(_In_z_ wchar_t const* fileName);
|
||||||
BinaryReader(_In_reads_bytes_(dataSize) uint8_t const* dataBlob, size_t dataSize);
|
BinaryReader(_In_reads_bytes_(dataSize) uint8_t const* dataBlob, size_t dataSize);
|
||||||
|
|
||||||
|
BinaryReader(BinaryReader const&) = delete;
|
||||||
|
BinaryReader& operator= (BinaryReader const&) = delete;
|
||||||
|
|
||||||
// Reads a single value.
|
// Reads a single value.
|
||||||
template<typename T> T const& Read()
|
template<typename T> T const& Read()
|
||||||
|
@ -44,6 +47,9 @@ namespace DirectX
|
||||||
|
|
||||||
uint8_t const* newPos = mPos + sizeof(T) * elementCount;
|
uint8_t const* newPos = mPos + sizeof(T) * elementCount;
|
||||||
|
|
||||||
|
if (newPos < mPos)
|
||||||
|
throw std::overflow_error("ReadArray");
|
||||||
|
|
||||||
if (newPos > mEnd)
|
if (newPos > mEnd)
|
||||||
throw std::exception("End of file");
|
throw std::exception("End of file");
|
||||||
|
|
||||||
|
@ -65,10 +71,5 @@ namespace DirectX
|
||||||
uint8_t const* mEnd;
|
uint8_t const* mEnd;
|
||||||
|
|
||||||
std::unique_ptr<uint8_t[]> mOwnedData;
|
std::unique_ptr<uint8_t[]> mOwnedData;
|
||||||
|
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
BinaryReader(BinaryReader const&) DIRECTX_CTOR_DELETE
|
|
||||||
BinaryReader& operator= (BinaryReader const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,14 @@ namespace DirectX
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Constructor.
|
// Constructor.
|
||||||
ConstantBuffer() DIRECTX_CTOR_DEFAULT
|
ConstantBuffer() = default;
|
||||||
explicit ConstantBuffer(_In_ ID3D11Device* device)
|
explicit ConstantBuffer(_In_ ID3D11Device* device)
|
||||||
{
|
{
|
||||||
Create( device );
|
Create( device );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConstantBuffer(ConstantBuffer const&) = delete;
|
||||||
|
ConstantBuffer& operator= (ConstantBuffer const&) = delete;
|
||||||
|
|
||||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||||
void Create(_In_ ID3D11Device* device)
|
void Create(_In_ ID3D11Device* device)
|
||||||
|
@ -109,10 +111,5 @@ namespace DirectX
|
||||||
private:
|
private:
|
||||||
// The underlying D3D object.
|
// The underlying D3D object.
|
||||||
Microsoft::WRL::ComPtr<ID3D11Buffer> mConstantBuffer;
|
Microsoft::WRL::ComPtr<ID3D11Buffer> mConstantBuffer;
|
||||||
|
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
ConstantBuffer(ConstantBuffer const&) DIRECTX_CTOR_DELETE
|
|
||||||
ConstantBuffer& operator= (ConstantBuffer const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,6 +439,8 @@ void DGSLEffectFactory::Impl::CreatePixelShader( const WCHAR* name, ID3D11PixelS
|
||||||
ThrowIfFailed(
|
ThrowIfFailed(
|
||||||
device->CreatePixelShader( data.get(), dataSize, nullptr, pixelShader ) );
|
device->CreatePixelShader( data.get(), dataSize, nullptr, pixelShader ) );
|
||||||
|
|
||||||
|
_Analysis_assume_(*pixelShader != 0);
|
||||||
|
|
||||||
if ( mSharing && *name && it == mShaderCache.end() )
|
if ( mSharing && *name && it == mShaderCache.end() )
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
|
|
|
@ -100,6 +100,8 @@ namespace
|
||||||
device->CreateBuffer(&bufferDesc, &dataDesc, pBuffer)
|
device->CreateBuffer(&bufferDesc, &dataDesc, pBuffer)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Analysis_assume_(*pBuffer != 0);
|
||||||
|
|
||||||
SetDebugObjectName(*pBuffer, "DirectXTK:GeometricPrimitive");
|
SetDebugObjectName(*pBuffer, "DirectXTK:GeometricPrimitive");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +123,8 @@ namespace
|
||||||
pInputLayout)
|
pInputLayout)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Analysis_assume_(*pInputLayout != 0);
|
||||||
|
|
||||||
SetDebugObjectName(*pInputLayout, "DirectXTK:GeometricPrimitive");
|
SetDebugObjectName(*pInputLayout, "DirectXTK:GeometricPrimitive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,12 +185,12 @@ GeometricPrimitive::Impl::SharedResources::SharedResources(_In_ ID3D11DeviceCont
|
||||||
deviceContext->GetDevice(&device);
|
deviceContext->GetDevice(&device);
|
||||||
|
|
||||||
// Create the BasicEffect.
|
// Create the BasicEffect.
|
||||||
effect.reset(new BasicEffect(device.Get()));
|
effect = std::make_unique<BasicEffect>(device.Get());
|
||||||
|
|
||||||
effect->EnableDefaultLighting();
|
effect->EnableDefaultLighting();
|
||||||
|
|
||||||
// Create state objects.
|
// Create state objects.
|
||||||
stateObjects.reset(new CommonStates(device.Get()));
|
stateObjects = std::make_unique<CommonStates>(device.Get());
|
||||||
|
|
||||||
// Create input layouts.
|
// Create input layouts.
|
||||||
effect->SetTextureEnabled(true);
|
effect->SetTextureEnabled(true);
|
||||||
|
|
|
@ -50,11 +50,11 @@ namespace
|
||||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
|
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
// Windows Store or universal Windows app implementation
|
// Windows Store or Universal Windows Platform (UWP) app implementation
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
|
|
||||||
//
|
//
|
||||||
// For a Windows Store app or universal Windows app, add the following:
|
// For a Windows Store app or Universal Windows Platform (UWP) app, add the following:
|
||||||
//
|
//
|
||||||
// void App::SetWindow(CoreWindow^ window )
|
// void App::SetWindow(CoreWindow^ window )
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -95,6 +95,8 @@ void ModelMeshPart::CreateInputLayout( ID3D11Device* d3dDevice, IEffect* ieffect
|
||||||
shaderByteCode, byteCodeLength,
|
shaderByteCode, byteCodeLength,
|
||||||
iinputLayout )
|
iinputLayout )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Analysis_assume_(*iinputLayout != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -207,6 +207,8 @@ static void CreateInputLayout(_In_ ID3D11Device* device, IEffect* effect, _Out_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_Analysis_assume_(*pInputLayout != 0);
|
||||||
|
|
||||||
SetDebugObjectName(*pInputLayout, "ModelCMO");
|
SetDebugObjectName(*pInputLayout, "ModelCMO");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -389,6 +389,12 @@ static void LoadMaterial( _In_ const DXUT::SDKMESH_MATERIAL& mh,
|
||||||
WCHAR txtName2[ DXUT::MAX_TEXTURE_NAME ];
|
WCHAR txtName2[ DXUT::MAX_TEXTURE_NAME ];
|
||||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, mh.SpecularTexture, -1, txtName2, DXUT::MAX_TEXTURE_NAME );
|
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, mh.SpecularTexture, -1, txtName2, DXUT::MAX_TEXTURE_NAME );
|
||||||
|
|
||||||
|
if ( !mh.SpecularTexture[0] && enableDualTexture )
|
||||||
|
{
|
||||||
|
DebugTrace("WARNING: Material '%s' has multiple texture coords but not multiple textures\n", mh.Name);
|
||||||
|
enableDualTexture = false;
|
||||||
|
}
|
||||||
|
|
||||||
EffectFactory::EffectInfo info;
|
EffectFactory::EffectInfo info;
|
||||||
info.name = matName;
|
info.name = matName;
|
||||||
info.perVertexColor = perVertexColor;
|
info.perVertexColor = perVertexColor;
|
||||||
|
@ -627,6 +633,8 @@ static void CreateInputLayout(_In_ ID3D11Device* device, _In_ IEffect* effect, s
|
||||||
pInputLayout)
|
pInputLayout)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Analysis_assume_(*pInputLayout != 0);
|
||||||
|
|
||||||
SetDebugObjectName(*pInputLayout, "ModelSDKMESH");
|
SetDebugObjectName(*pInputLayout, "ModelSDKMESH");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,11 @@ using Microsoft::WRL::ComPtr;
|
||||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
|
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
// Windows Store or universal Windows app implementation
|
// Windows Store or Universal Windows Platform (UWP) app implementation
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
|
|
||||||
//
|
//
|
||||||
// For a Windows Store app or universal Windows app, add the following to your existing
|
// For a Windows Store app or Universal Windows Platform (UWP) app, add the following to your existing
|
||||||
// application methods:
|
// application methods:
|
||||||
//
|
//
|
||||||
// void App::SetWindow(CoreWindow^ window )
|
// void App::SetWindow(CoreWindow^ window )
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#pragma warning(disable : 4324 4481)
|
#pragma warning(disable : 4324)
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -80,9 +80,9 @@ namespace DirectX
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER < 1610)) || defined(DIRECTX_EMULATE_MUTEX)
|
#ifdef DIRECTX_EMULATE_MUTEX
|
||||||
|
|
||||||
// Emulate the C++0x mutex and lock_guard types when building with Visual Studio versions < 2012.
|
// Emulate the C++0x mutex and lock_guard types when building with Visual Studio CRT versions < 2012.
|
||||||
namespace std
|
namespace std
|
||||||
{
|
{
|
||||||
class mutex
|
class mutex
|
||||||
|
@ -128,8 +128,25 @@ namespace std
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // _MSC_VER < 1610
|
#else
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DIRECTX_EMULATE_MAKE_UNIQUE
|
||||||
|
|
||||||
|
// Emulate make_unique when building with Visual Studio CRT versions < 2012.
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
std::unique_ptr<T> make_unique(Args&&... args)
|
||||||
|
{
|
||||||
|
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -100,6 +100,8 @@ static void CreateBuffer(_In_ ID3D11Device* device, size_t bufferSize, D3D11_BIN
|
||||||
device->CreateBuffer(&desc, nullptr, pBuffer)
|
device->CreateBuffer(&desc, nullptr, pBuffer)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
_Analysis_assume_(*pBuffer != 0);
|
||||||
|
|
||||||
SetDebugObjectName(*pBuffer, "DirectXTK:PrimitiveBatch");
|
SetDebugObjectName(*pBuffer, "DirectXTK:PrimitiveBatch");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,14 +29,11 @@
|
||||||
|
|
||||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8)
|
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8)
|
||||||
|
|
||||||
// VS 2010's stdint.h conflicts with intsafe.h
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <wincodec.h>
|
#include <wincodec.h>
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "ScreenGrab.h"
|
#include "ScreenGrab.h"
|
||||||
|
#include "DirectXHelpers.h"
|
||||||
|
|
||||||
#include "dds.h"
|
#include "dds.h"
|
||||||
#include "PlatformHelpers.h"
|
#include "PlatformHelpers.h"
|
||||||
|
@ -50,6 +47,10 @@ namespace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
auto_delete_file(HANDLE hFile) : m_handle(hFile) {}
|
auto_delete_file(HANDLE hFile) : m_handle(hFile) {}
|
||||||
|
|
||||||
|
auto_delete_file(const auto_delete_file&) = delete;
|
||||||
|
auto_delete_file& operator=(const auto_delete_file&) = delete;
|
||||||
|
|
||||||
~auto_delete_file()
|
~auto_delete_file()
|
||||||
{
|
{
|
||||||
if (m_handle)
|
if (m_handle)
|
||||||
|
@ -64,9 +65,6 @@ namespace
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HANDLE m_handle;
|
HANDLE m_handle;
|
||||||
|
|
||||||
auto_delete_file(const auto_delete_file&) DIRECTX_CTOR_DELETE;
|
|
||||||
auto_delete_file& operator=(const auto_delete_file&) DIRECTX_CTOR_DELETE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8)
|
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (_WIN32_WINNT > _WIN32_WINNT_WIN8)
|
||||||
|
@ -75,6 +73,10 @@ namespace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
auto_delete_file_wic(ComPtr<IWICStream>& hFile, LPCWSTR szFile) : m_handle(hFile), m_filename(szFile) {}
|
auto_delete_file_wic(ComPtr<IWICStream>& hFile, LPCWSTR szFile) : m_handle(hFile), m_filename(szFile) {}
|
||||||
|
|
||||||
|
auto_delete_file_wic(const auto_delete_file_wic&) = delete;
|
||||||
|
auto_delete_file_wic& operator=(const auto_delete_file_wic&) = delete;
|
||||||
|
|
||||||
~auto_delete_file_wic()
|
~auto_delete_file_wic()
|
||||||
{
|
{
|
||||||
if (m_filename)
|
if (m_filename)
|
||||||
|
@ -89,9 +91,6 @@ namespace
|
||||||
private:
|
private:
|
||||||
LPCWSTR m_filename;
|
LPCWSTR m_filename;
|
||||||
ComPtr<IWICStream>& m_handle;
|
ComPtr<IWICStream>& m_handle;
|
||||||
|
|
||||||
auto_delete_file_wic(const auto_delete_file_wic&) DIRECTX_CTOR_DELETE;
|
|
||||||
auto_delete_file_wic& operator=(const auto_delete_file_wic&) DIRECTX_CTOR_DELETE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -489,11 +488,7 @@ static HRESULT CaptureTexture( _In_ ID3D11DeviceContext* pContext,
|
||||||
return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
|
return HRESULT_FROM_WIN32( ERROR_NOT_SUPPORTED );
|
||||||
|
|
||||||
ComPtr<ID3D11Texture2D> pTexture;
|
ComPtr<ID3D11Texture2D> pTexture;
|
||||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
|
||||||
HRESULT hr = pSource->QueryInterface(IID_GRAPHICS_PPV_ARGS(pTexture.GetAddressOf()));
|
HRESULT hr = pSource->QueryInterface(IID_GRAPHICS_PPV_ARGS(pTexture.GetAddressOf()));
|
||||||
#else
|
|
||||||
HRESULT hr = pSource->QueryInterface(IID_PPV_ARGS(pTexture.GetAddressOf()));
|
|
||||||
#endif
|
|
||||||
if ( FAILED(hr) )
|
if ( FAILED(hr) )
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ namespace DirectX
|
||||||
: mResourceMap(std::make_shared<ResourceMap>())
|
: mResourceMap(std::make_shared<ResourceMap>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
SharedResourcePool(SharedResourcePool const&) = delete;
|
||||||
|
SharedResourcePool& operator= (SharedResourcePool const&) = delete;
|
||||||
|
|
||||||
// Allocates or looks up the shared TData instance for the specified key.
|
// Allocates or looks up the shared TData instance for the specified key.
|
||||||
std::shared_ptr<TData> DemandCreate(TKey key)
|
std::shared_ptr<TData> DemandCreate(TKey key)
|
||||||
|
@ -99,10 +101,5 @@ namespace DirectX
|
||||||
TKey mKey;
|
TKey mKey;
|
||||||
std::shared_ptr<ResourceMap> mResourceMap;
|
std::shared_ptr<ResourceMap> mResourceMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Prevent copying.
|
|
||||||
SharedResourcePool(SharedResourcePool const&) DIRECTX_CTOR_DELETE
|
|
||||||
SharedResourcePool& operator= (SharedResourcePool const&) DIRECTX_CTOR_DELETE
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,8 +167,8 @@ RECT DirectX::SimpleMath::Viewport::ComputeDisplayArea(DXGI_SCALING scaling, UIN
|
||||||
|
|
||||||
RECT DirectX::SimpleMath::Viewport::ComputeTitleSafeArea(UINT backBufferWidth, UINT backBufferHeight)
|
RECT DirectX::SimpleMath::Viewport::ComputeTitleSafeArea(UINT backBufferWidth, UINT backBufferHeight)
|
||||||
{
|
{
|
||||||
float safew = (float(backBufferWidth) + 9.f) / 10.f;
|
float safew = (float(backBufferWidth) + 19.f) / 20.f;
|
||||||
float safeh = (float(backBufferHeight) + 9.f) / 10.f;
|
float safeh = (float(backBufferHeight) + 19.f) / 20.f;
|
||||||
|
|
||||||
RECT rct;
|
RECT rct;
|
||||||
rct.left = static_cast<LONG>(safew);
|
rct.left = static_cast<LONG>(safew);
|
||||||
|
|
|
@ -221,7 +221,7 @@ SpriteFont::SpriteFont(_In_ ID3D11Device* device, _In_z_ wchar_t const* fileName
|
||||||
{
|
{
|
||||||
BinaryReader reader(fileName);
|
BinaryReader reader(fileName);
|
||||||
|
|
||||||
pImpl.reset(new Impl(device, &reader));
|
pImpl = std::make_unique<Impl>(device, &reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ SpriteFont::SpriteFont(_In_ ID3D11Device* device, _In_reads_bytes_(dataSize) uin
|
||||||
{
|
{
|
||||||
BinaryReader reader(dataBlob, dataSize);
|
BinaryReader reader(dataBlob, dataSize);
|
||||||
|
|
||||||
pImpl.reset(new Impl(device, &reader));
|
pImpl = std::make_unique<Impl>(device, &reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,7 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
// VS 2010's stdint.h conflicts with intsafe.h
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <wincodec.h>
|
#include <wincodec.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include "WICTextureLoader.h"
|
#include "WICTextureLoader.h"
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,8 @@
|
||||||
#include <dxgiformat.h>
|
#include <dxgiformat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010's stdint.h conflicts with intsafe.h
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
namespace DirectX
|
namespace DirectX
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,29 +13,24 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if !defined(WIN32_LEAN_AND_MEAN)
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4005)
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(NOMINMAX)
|
|
||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#define NODRAWTEXT
|
||||||
|
#define NOGDI
|
||||||
|
#define NOBITMAP
|
||||||
|
#define NOMCX
|
||||||
|
#define NOSERVICE
|
||||||
|
#define NOHELP
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
#ifndef _WIN32_WINNT_WIN10
|
#ifndef _WIN32_WINNT_WIN10
|
||||||
#define _WIN32_WINNT_WIN10 0x0A00
|
#define _WIN32_WINNT_WIN10 0x0A00
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// VS 2010/2012 do not support =default =delete
|
|
||||||
#ifndef DIRECTX_CTOR_DEFAULT
|
|
||||||
#if defined(_MSC_VER) && (_MSC_VER < 1800)
|
|
||||||
#define DIRECTX_CTOR_DEFAULT {}
|
|
||||||
#define DIRECTX_CTOR_DELETE ;
|
|
||||||
#else
|
|
||||||
#define DIRECTX_CTOR_DEFAULT =default;
|
|
||||||
#define DIRECTX_CTOR_DELETE =delete;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_XBOX_ONE) && defined(_TITLE)
|
#if defined(_XBOX_ONE) && defined(_TITLE)
|
||||||
#include <d3d11_x.h>
|
#include <d3d11_x.h>
|
||||||
#define DCOMMON_H_INCLUDED
|
#define DCOMMON_H_INCLUDED
|
||||||
|
@ -43,6 +38,10 @@
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (defined(_XBOX_ONE) && defined(_TITLE)) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP))
|
||||||
|
#include <Windows.Foundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
#include <Windows.UI.Core.h>
|
#include <Windows.UI.Core.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,20 +61,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
// VS 2010's stdint.h conflicts with intsafe.h
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4005)
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <intsafe.h>
|
|
||||||
#pragma warning(pop)
|
|
||||||
|
|
||||||
#include <wrl.h>
|
#include <wrl.h>
|
||||||
|
|
||||||
namespace DirectX
|
|
||||||
{
|
|
||||||
#if (DIRECTX_MATH_VERSION < 305) && !defined(XM_CALLCONV)
|
|
||||||
#define XM_CALLCONV __fastcall
|
|
||||||
typedef const XMVECTOR& HXMVECTOR;
|
|
||||||
typedef const XMMATRIX& FXMMATRIX;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
Двоичный файл не отображается.
|
@ -297,7 +297,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
swapChainDesc.BufferCount = m_backBufferCount;
|
swapChainDesc.BufferCount = m_backBufferCount;
|
||||||
swapChainDesc.SampleDesc.Count = 1;
|
swapChainDesc.SampleDesc.Count = 1;
|
||||||
swapChainDesc.SampleDesc.Quality = 0;
|
swapChainDesc.SampleDesc.Quality = 0;
|
||||||
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
|
||||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||||
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
||||||
|
|
||||||
|
@ -352,6 +352,8 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
m_d3dRenderTargetView.ReleaseAndGetAddressOf()
|
m_d3dRenderTargetView.ReleaseAndGetAddressOf()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN)
|
||||||
|
{
|
||||||
// Create a depth stencil view for use with 3D rendering if needed.
|
// Create a depth stencil view for use with 3D rendering if needed.
|
||||||
CD3D11_TEXTURE2D_DESC depthStencilDesc(
|
CD3D11_TEXTURE2D_DESC depthStencilDesc(
|
||||||
m_depthBufferFormat,
|
m_depthBufferFormat,
|
||||||
|
@ -375,6 +377,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
&depthStencilViewDesc,
|
&depthStencilViewDesc,
|
||||||
m_d3dDepthStencilView.ReleaseAndGetAddressOf()
|
m_d3dDepthStencilView.ReleaseAndGetAddressOf()
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// Set the 3D rendering viewport to target the entire window.
|
// Set the 3D rendering viewport to target the entire window.
|
||||||
m_screenViewport = CD3D11_VIEWPORT(
|
m_screenViewport = CD3D11_VIEWPORT(
|
||||||
|
@ -522,8 +525,11 @@ void DX::DeviceResources::Present()
|
||||||
// overwritten. If dirty or scroll rects are used, this call should be removed.
|
// overwritten. If dirty or scroll rects are used, this call should be removed.
|
||||||
m_d3dContext->DiscardView(m_d3dRenderTargetView.Get());
|
m_d3dContext->DiscardView(m_d3dRenderTargetView.Get());
|
||||||
|
|
||||||
|
if (m_d3dDepthStencilView)
|
||||||
|
{
|
||||||
// Discard the contents of the depth stencil.
|
// Discard the contents of the depth stencil.
|
||||||
m_d3dContext->DiscardView(m_d3dDepthStencilView.Get());
|
m_d3dContext->DiscardView(m_d3dDepthStencilView.Get());
|
||||||
|
}
|
||||||
|
|
||||||
// If the device was removed either by a disconnection or a driver upgrade, we
|
// If the device was removed either by a disconnection or a driver upgrade, we
|
||||||
// must recreate all device resources.
|
// must recreate all device resources.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Main.cpp
|
// Main.cpp
|
||||||
//
|
//
|
||||||
// Entry point for universal Windows app.
|
// Entry point for Universal Windows Platform (UWP) app.
|
||||||
//
|
//
|
||||||
// Advanced Technology Group (ATG)
|
// Advanced Technology Group (ATG)
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
@ -152,17 +152,15 @@ protected:
|
||||||
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
||||||
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
||||||
|
|
||||||
auto desiredSize = Size( ConvertPixelsToDips( w ),
|
auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h));
|
||||||
ConvertPixelsToDips( h ) );
|
|
||||||
|
|
||||||
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
||||||
|
|
||||||
auto view = ApplicationView::GetForCurrentView();
|
auto view = ApplicationView::GetForCurrentView();
|
||||||
|
|
||||||
auto minSize = Size( ConvertPixelsToDips( 320 ),
|
auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200));
|
||||||
ConvertPixelsToDips( 200 ) );
|
|
||||||
|
|
||||||
view->SetPreferredMinSize( minSize );
|
view->SetPreferredMinSize(minSize);
|
||||||
|
|
||||||
CoreWindow::GetForCurrentThread()->Activate();
|
CoreWindow::GetForCurrentThread()->Activate();
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,8 @@ Sample::Sample() :
|
||||||
m_pSourceVoice(nullptr),
|
m_pSourceVoice(nullptr),
|
||||||
m_currentFile(0)
|
m_currentFile(0)
|
||||||
{
|
{
|
||||||
m_deviceResources = std::make_unique<DX::DeviceResources>();
|
// Renders only 2D, so no need for a depth buffer.
|
||||||
|
m_deviceResources = std::make_unique<DX::DeviceResources>(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN);
|
||||||
m_deviceResources->RegisterDeviceNotify(this);
|
m_deviceResources->RegisterDeviceNotify(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,9 +41,6 @@ void Sample::Initialize(IUnknown* window, int width, int height, DXGI_MODE_ROTAT
|
||||||
m_keyboard = std::make_unique<Keyboard>();
|
m_keyboard = std::make_unique<Keyboard>();
|
||||||
m_keyboard->SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
|
m_keyboard->SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
|
||||||
|
|
||||||
m_mouse = std::make_unique<Mouse>();
|
|
||||||
m_mouse->SetWindow(reinterpret_cast<ABI::Windows::UI::Core::ICoreWindow*>(window));
|
|
||||||
|
|
||||||
m_deviceResources->SetWindow(window, width, height, rotation);
|
m_deviceResources->SetWindow(window, width, height, rotation);
|
||||||
|
|
||||||
m_deviceResources->CreateDeviceResources();
|
m_deviceResources->CreateDeviceResources();
|
||||||
|
@ -157,7 +155,10 @@ void Sample::Render()
|
||||||
|
|
||||||
PIXEndEvent(context);
|
PIXEndEvent(context);
|
||||||
|
|
||||||
|
// Show the new frame.
|
||||||
|
PIXBeginEvent(PIX_COLOR_DEFAULT, L"Present");
|
||||||
m_deviceResources->Present();
|
m_deviceResources->Present();
|
||||||
|
PIXEndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to clear the back buffers.
|
// Helper method to clear the back buffers.
|
||||||
|
@ -168,12 +169,10 @@ void Sample::Clear()
|
||||||
|
|
||||||
// Clear the views
|
// Clear the views
|
||||||
auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView();
|
auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView();
|
||||||
auto depthStencil = m_deviceResources->GetDepthStencilView();
|
|
||||||
|
|
||||||
// Don't need to clear color as the sample draws a fullscreen image background
|
// Don't need to clear color as the sample draws a fullscreen image background
|
||||||
context->ClearDepthStencilView(depthStencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
|
|
||||||
|
|
||||||
context->OMSetRenderTargets(1, &renderTarget, depthStencil);
|
context->OMSetRenderTargets(1, &renderTarget, nullptr);
|
||||||
|
|
||||||
// Set the viewport.
|
// Set the viewport.
|
||||||
auto viewport = m_deviceResources->GetScreenViewport();
|
auto viewport = m_deviceResources->GetScreenViewport();
|
||||||
|
@ -256,6 +255,7 @@ void Sample::OnDeviceLost()
|
||||||
{
|
{
|
||||||
m_spriteBatch.reset();
|
m_spriteBatch.reset();
|
||||||
m_font.reset();
|
m_font.reset();
|
||||||
|
m_background.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sample::OnDeviceRestored()
|
void Sample::OnDeviceRestored()
|
||||||
|
|
|
@ -62,7 +62,6 @@ private:
|
||||||
// Input devices.
|
// Input devices.
|
||||||
std::unique_ptr<DirectX::GamePad> m_gamePad;
|
std::unique_ptr<DirectX::GamePad> m_gamePad;
|
||||||
std::unique_ptr<DirectX::Keyboard> m_keyboard;
|
std::unique_ptr<DirectX::Keyboard> m_keyboard;
|
||||||
std::unique_ptr<DirectX::Mouse> m_mouse;
|
|
||||||
|
|
||||||
// Render objects.
|
// Render objects.
|
||||||
std::unique_ptr<DirectX::SpriteBatch> m_spriteBatch;
|
std::unique_ptr<DirectX::SpriteBatch> m_spriteBatch;
|
||||||
|
|
|
@ -297,7 +297,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
swapChainDesc.BufferCount = m_backBufferCount;
|
swapChainDesc.BufferCount = m_backBufferCount;
|
||||||
swapChainDesc.SampleDesc.Count = 1;
|
swapChainDesc.SampleDesc.Count = 1;
|
||||||
swapChainDesc.SampleDesc.Quality = 0;
|
swapChainDesc.SampleDesc.Quality = 0;
|
||||||
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
|
||||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||||
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,11 @@ void Sample::Render()
|
||||||
PIXEndEvent(context);
|
PIXEndEvent(context);
|
||||||
|
|
||||||
PIXEndEvent(context);
|
PIXEndEvent(context);
|
||||||
|
|
||||||
|
// Show the new frame.
|
||||||
|
PIXBeginEvent(PIX_COLOR_DEFAULT, L"Present");
|
||||||
m_deviceResources->Present();
|
m_deviceResources->Present();
|
||||||
|
PIXEndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to clear the back buffers.
|
// Helper method to clear the back buffers.
|
||||||
|
|
|
@ -100,6 +100,9 @@
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PackageCertificateKeyFile>DirectXTKSimpleSample_TemporaryKey.pfx</PackageCertificateKeyFile>
|
<PackageCertificateKeyFile>DirectXTKSimpleSample_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||||
|
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
|
||||||
|
<AppxBundle>Always</AppxBundle>
|
||||||
|
<AppxBundlePlatforms>x86</AppxBundlePlatforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
|
||||||
<Link>
|
<Link>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Main.cpp
|
// Main.cpp
|
||||||
//
|
//
|
||||||
// Entry point for universal Windows app.
|
// Entry point for Universal Windows Platform (UWP) app.
|
||||||
//
|
//
|
||||||
// Advanced Technology Group (ATG)
|
// Advanced Technology Group (ATG)
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
@ -160,17 +160,15 @@ protected:
|
||||||
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
||||||
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
||||||
|
|
||||||
auto desiredSize = Size( ConvertPixelsToDips( w ),
|
auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h));;
|
||||||
ConvertPixelsToDips( h ) );
|
|
||||||
|
|
||||||
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
||||||
|
|
||||||
auto view = ApplicationView::GetForCurrentView();
|
auto view = ApplicationView::GetForCurrentView();
|
||||||
|
|
||||||
auto minSize = Size( ConvertPixelsToDips( 320 ),
|
auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200));
|
||||||
ConvertPixelsToDips( 200 ) );
|
|
||||||
|
|
||||||
view->SetPreferredMinSize( minSize );
|
view->SetPreferredMinSize(minSize);
|
||||||
|
|
||||||
CoreWindow::GetForCurrentThread()->Activate();
|
CoreWindow::GetForCurrentThread()->Activate();
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
swapChainDesc.BufferCount = m_backBufferCount;
|
swapChainDesc.BufferCount = m_backBufferCount;
|
||||||
swapChainDesc.SampleDesc.Count = 1;
|
swapChainDesc.SampleDesc.Count = 1;
|
||||||
swapChainDesc.SampleDesc.Quality = 0;
|
swapChainDesc.SampleDesc.Quality = 0;
|
||||||
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
|
||||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||||
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Main.cpp
|
// Main.cpp
|
||||||
//
|
//
|
||||||
// Entry point for universal Windows app.
|
// Entry point for Universal Windows Platform (UWP) app.
|
||||||
//
|
//
|
||||||
// Advanced Technology Group (ATG)
|
// Advanced Technology Group (ATG)
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
@ -152,17 +152,15 @@ protected:
|
||||||
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
||||||
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
||||||
|
|
||||||
auto desiredSize = Size( ConvertPixelsToDips( w ),
|
auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h));
|
||||||
ConvertPixelsToDips( h ) );
|
|
||||||
|
|
||||||
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
||||||
|
|
||||||
auto view = ApplicationView::GetForCurrentView();
|
auto view = ApplicationView::GetForCurrentView();
|
||||||
|
|
||||||
auto minSize = Size( ConvertPixelsToDips( 320 ),
|
auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200));
|
||||||
ConvertPixelsToDips( 200 ) );
|
|
||||||
|
|
||||||
view->SetPreferredMinSize( minSize );
|
view->SetPreferredMinSize(minSize);
|
||||||
|
|
||||||
CoreWindow::GetForCurrentThread()->Activate();
|
CoreWindow::GetForCurrentThread()->Activate();
|
||||||
|
|
||||||
|
|
Двоичные данные
Samples/Graphics/SimpleTriangleUWP/Readme.docx
Двоичные данные
Samples/Graphics/SimpleTriangleUWP/Readme.docx
Двоичный файл не отображается.
|
@ -8,6 +8,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "SimpleTriangleUWP.h"
|
#include "SimpleTriangleUWP.h"
|
||||||
|
|
||||||
|
#include "ATGColors.h"
|
||||||
#include "ReadData.h"
|
#include "ReadData.h"
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
@ -25,7 +26,8 @@ namespace
|
||||||
|
|
||||||
Sample::Sample()
|
Sample::Sample()
|
||||||
{
|
{
|
||||||
m_deviceResources = std::make_unique<DX::DeviceResources>();
|
// Use gamma-correct rendering.
|
||||||
|
m_deviceResources = std::make_unique<DX::DeviceResources>(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB);
|
||||||
m_deviceResources->RegisterDeviceNotify(this);
|
m_deviceResources->RegisterDeviceNotify(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +99,7 @@ void Sample::Render()
|
||||||
auto context = m_deviceResources->GetD3DDeviceContext();
|
auto context = m_deviceResources->GetD3DDeviceContext();
|
||||||
PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Render");
|
PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Render");
|
||||||
|
|
||||||
// Set input assembler state
|
// Set input assembler state.
|
||||||
context->IASetInputLayout(m_spInputLayout.Get());
|
context->IASetInputLayout(m_spInputLayout.Get());
|
||||||
|
|
||||||
UINT strides = sizeof(Vertex);
|
UINT strides = sizeof(Vertex);
|
||||||
|
@ -105,16 +107,20 @@ void Sample::Render()
|
||||||
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
context->IASetVertexBuffers(0, 1, m_spVertexBuffer.GetAddressOf(), &strides, &offsets);
|
context->IASetVertexBuffers(0, 1, m_spVertexBuffer.GetAddressOf(), &strides, &offsets);
|
||||||
|
|
||||||
// Set shaders
|
// Set shaders.
|
||||||
context->VSSetShader(m_spVertexShader.Get(), nullptr, 0);
|
context->VSSetShader(m_spVertexShader.Get(), nullptr, 0);
|
||||||
context->GSSetShader(nullptr, nullptr, 0);
|
context->GSSetShader(nullptr, nullptr, 0);
|
||||||
context->PSSetShader(m_spPixelShader.Get(), nullptr, 0);
|
context->PSSetShader(m_spPixelShader.Get(), nullptr, 0);
|
||||||
|
|
||||||
// Draw triangle
|
// Draw triangle.
|
||||||
context->Draw(3, 0);
|
context->Draw(3, 0);
|
||||||
|
|
||||||
PIXEndEvent(context);
|
PIXEndEvent(context);
|
||||||
|
|
||||||
|
// Show the new frame.
|
||||||
|
PIXBeginEvent(PIX_COLOR_DEFAULT, L"Present");
|
||||||
m_deviceResources->Present();
|
m_deviceResources->Present();
|
||||||
|
PIXEndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to clear the back buffers.
|
// Helper method to clear the back buffers.
|
||||||
|
@ -123,11 +129,13 @@ void Sample::Clear()
|
||||||
auto context = m_deviceResources->GetD3DDeviceContext();
|
auto context = m_deviceResources->GetD3DDeviceContext();
|
||||||
PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Clear");
|
PIXBeginEvent(context, PIX_COLOR_DEFAULT, L"Clear");
|
||||||
|
|
||||||
// Clear the views
|
// Clear the views.
|
||||||
auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView();
|
auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView();
|
||||||
auto depthStencil = m_deviceResources->GetDepthStencilView();
|
auto depthStencil = m_deviceResources->GetDepthStencilView();
|
||||||
|
|
||||||
context->ClearRenderTargetView(renderTarget, Colors::CornflowerBlue);
|
// Use linear clear color for gamma-correct rendering.
|
||||||
|
context->ClearRenderTargetView(renderTarget, ATG::ColorsLinear::Background);
|
||||||
|
|
||||||
context->ClearDepthStencilView(depthStencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
|
context->ClearDepthStencilView(depthStencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
|
||||||
|
|
||||||
context->OMSetRenderTargets(1, &renderTarget, depthStencil);
|
context->OMSetRenderTargets(1, &renderTarget, depthStencil);
|
||||||
|
@ -190,7 +198,7 @@ void Sample::CreateDeviceDependentResources()
|
||||||
{
|
{
|
||||||
auto device = m_deviceResources->GetD3DDevice();
|
auto device = m_deviceResources->GetD3DDevice();
|
||||||
|
|
||||||
// Load and create shaders
|
// Load and create shaders.
|
||||||
auto vertexShaderBlob = DX::ReadData(L"VertexShader.cso");
|
auto vertexShaderBlob = DX::ReadData(L"VertexShader.cso");
|
||||||
|
|
||||||
DX::ThrowIfFailed(
|
DX::ThrowIfFailed(
|
||||||
|
@ -203,7 +211,7 @@ void Sample::CreateDeviceDependentResources()
|
||||||
device->CreatePixelShader(pixelShaderBlob.data(), pixelShaderBlob.size(),
|
device->CreatePixelShader(pixelShaderBlob.data(), pixelShaderBlob.size(),
|
||||||
nullptr, m_spPixelShader.ReleaseAndGetAddressOf()));
|
nullptr, m_spPixelShader.ReleaseAndGetAddressOf()));
|
||||||
|
|
||||||
// Create input layout
|
// Create input layout.
|
||||||
static const D3D11_INPUT_ELEMENT_DESC s_inputElementDesc[2] =
|
static const D3D11_INPUT_ELEMENT_DESC s_inputElementDesc[2] =
|
||||||
{
|
{
|
||||||
{ "SV_Position", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
{ "SV_Position", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||||
|
@ -215,7 +223,7 @@ void Sample::CreateDeviceDependentResources()
|
||||||
vertexShaderBlob.data(), vertexShaderBlob.size(),
|
vertexShaderBlob.data(), vertexShaderBlob.size(),
|
||||||
m_spInputLayout.ReleaseAndGetAddressOf()));
|
m_spInputLayout.ReleaseAndGetAddressOf()));
|
||||||
|
|
||||||
// Create vertex buffer
|
// Create vertex buffer.
|
||||||
static const Vertex s_vertexData[3] =
|
static const Vertex s_vertexData[3] =
|
||||||
{
|
{
|
||||||
{ { 0.0f, 0.5f, 0.5f, 1.0f },{ 1.0f, 0.0f, 0.0f, 1.0f } }, // Top / Red
|
{ { 0.0f, 0.5f, 0.5f, 1.0f },{ 1.0f, 0.0f, 0.0f, 1.0f } }, // Top / Red
|
||||||
|
|
|
@ -212,6 +212,7 @@
|
||||||
</FXCompile>
|
</FXCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h" />
|
||||||
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h" />
|
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h" />
|
||||||
<ClInclude Include="SimpleTriangleUWP.h" />
|
<ClInclude Include="SimpleTriangleUWP.h" />
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h">
|
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h">
|
||||||
<Filter>ATG Tool Kit</Filter>
|
<Filter>ATG Tool Kit</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h">
|
||||||
|
<Filter>ATG Tool Kit</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="pch.cpp" />
|
<ClCompile Include="pch.cpp" />
|
||||||
|
|
|
@ -185,7 +185,7 @@ void DX::DeviceResources::CreateDeviceResources()
|
||||||
|
|
||||||
// Create a command list for recording graphics commands.
|
// Create a command list for recording graphics commands.
|
||||||
DX::ThrowIfFailed(m_d3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocators[0].Get(), nullptr, IID_PPV_ARGS(m_commandList.ReleaseAndGetAddressOf())));
|
DX::ThrowIfFailed(m_d3dDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, m_commandAllocators[0].Get(), nullptr, IID_PPV_ARGS(m_commandList.ReleaseAndGetAddressOf())));
|
||||||
m_commandList->Close();
|
DX::ThrowIfFailed(m_commandList->Close());
|
||||||
|
|
||||||
// Create a fence for tracking GPU execution progress.
|
// Create a fence for tracking GPU execution progress.
|
||||||
DX::ThrowIfFailed(m_d3dDevice->CreateFence(m_fenceValues[m_backBufferIndex], D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.ReleaseAndGetAddressOf())));
|
DX::ThrowIfFailed(m_d3dDevice->CreateFence(m_fenceValues[m_backBufferIndex], D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(m_fence.ReleaseAndGetAddressOf())));
|
||||||
|
@ -259,7 +259,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
swapChainDesc.BufferCount = m_backBufferCount;
|
swapChainDesc.BufferCount = m_backBufferCount;
|
||||||
swapChainDesc.SampleDesc.Count = 1;
|
swapChainDesc.SampleDesc.Count = 1;
|
||||||
swapChainDesc.SampleDesc.Quality = 0;
|
swapChainDesc.SampleDesc.Quality = 0;
|
||||||
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
|
||||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||||
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ void DX::DeviceResources::Present()
|
||||||
m_commandList->ResourceBarrier(1, &barrier);
|
m_commandList->ResourceBarrier(1, &barrier);
|
||||||
|
|
||||||
// Send the command list off to the GPU for processing.
|
// Send the command list off to the GPU for processing.
|
||||||
m_commandList->Close();
|
DX::ThrowIfFailed(m_commandList->Close());
|
||||||
m_commandQueue->ExecuteCommandLists(1, CommandListCast(m_commandList.GetAddressOf()));
|
m_commandQueue->ExecuteCommandLists(1, CommandListCast(m_commandList.GetAddressOf()));
|
||||||
|
|
||||||
// The first argument instructs DXGI to block until VSync, putting the application
|
// The first argument instructs DXGI to block until VSync, putting the application
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Main.cpp
|
// Main.cpp
|
||||||
//
|
//
|
||||||
// Entry point for universal Windows app.
|
// Entry point for Universal Windows Platform (UWP) app.
|
||||||
//
|
//
|
||||||
// Advanced Technology Group (ATG)
|
// Advanced Technology Group (ATG)
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
@ -152,17 +152,15 @@ protected:
|
||||||
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
||||||
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
||||||
|
|
||||||
auto desiredSize = Size( ConvertPixelsToDips( w ),
|
auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h));;
|
||||||
ConvertPixelsToDips( h ) );
|
|
||||||
|
|
||||||
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
||||||
|
|
||||||
auto view = ApplicationView::GetForCurrentView();
|
auto view = ApplicationView::GetForCurrentView();
|
||||||
|
|
||||||
auto minSize = Size( ConvertPixelsToDips( 320 ),
|
auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200));
|
||||||
ConvertPixelsToDips( 200 ) );
|
|
||||||
|
|
||||||
view->SetPreferredMinSize( minSize );
|
view->SetPreferredMinSize(minSize);
|
||||||
|
|
||||||
CoreWindow::GetForCurrentThread()->Activate();
|
CoreWindow::GetForCurrentThread()->Activate();
|
||||||
|
|
||||||
|
|
Двоичные данные
Samples/Graphics/SimpleTriangleUWP12/Readme.docx
Двоичные данные
Samples/Graphics/SimpleTriangleUWP12/Readme.docx
Двоичный файл не отображается.
|
@ -8,6 +8,7 @@
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "SimpleTriangleUWP12.h"
|
#include "SimpleTriangleUWP12.h"
|
||||||
|
|
||||||
|
#include "ATGColors.h"
|
||||||
#include "ReadData.h"
|
#include "ReadData.h"
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
@ -27,7 +28,8 @@ namespace
|
||||||
|
|
||||||
Sample::Sample()
|
Sample::Sample()
|
||||||
{
|
{
|
||||||
m_deviceResources = std::make_unique<DX::DeviceResources>();
|
// Use gamma-correct rendering.
|
||||||
|
m_deviceResources = std::make_unique<DX::DeviceResources>(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB);
|
||||||
m_deviceResources->RegisterDeviceNotify(this);
|
m_deviceResources->RegisterDeviceNotify(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,10 +115,16 @@ void Sample::Render()
|
||||||
// Set necessary state.
|
// Set necessary state.
|
||||||
commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||||
commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView);
|
commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView);
|
||||||
|
|
||||||
|
// Draw triangle.
|
||||||
commandList->DrawInstanced(3, 1, 0, 0);
|
commandList->DrawInstanced(3, 1, 0, 0);
|
||||||
|
|
||||||
PIXEndEvent(commandList);
|
PIXEndEvent(commandList);
|
||||||
|
|
||||||
|
// Show the new frame.
|
||||||
|
PIXBeginEvent(m_deviceResources->GetCommandQueue(), PIX_COLOR_DEFAULT, L"Present");
|
||||||
m_deviceResources->Present();
|
m_deviceResources->Present();
|
||||||
|
PIXEndEvent(m_deviceResources->GetCommandQueue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to clear the back buffers.
|
// Helper method to clear the back buffers.
|
||||||
|
@ -130,7 +138,10 @@ void Sample::Clear()
|
||||||
auto dsvDescriptor = m_deviceResources->GetDepthStencilView();
|
auto dsvDescriptor = m_deviceResources->GetDepthStencilView();
|
||||||
|
|
||||||
commandList->OMSetRenderTargets(1, &rtvDescriptor, FALSE, &dsvDescriptor);
|
commandList->OMSetRenderTargets(1, &rtvDescriptor, FALSE, &dsvDescriptor);
|
||||||
commandList->ClearRenderTargetView(rtvDescriptor, Colors::CornflowerBlue, 0, nullptr);
|
|
||||||
|
// Use linear clear color for gamma-correct rendering.
|
||||||
|
commandList->ClearRenderTargetView(rtvDescriptor, ATG::ColorsLinear::Background, 0, nullptr);
|
||||||
|
|
||||||
commandList->ClearDepthStencilView(dsvDescriptor, D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr);
|
commandList->ClearDepthStencilView(dsvDescriptor, D3D12_CLEAR_FLAG_DEPTH, 1.0f, 0, 0, nullptr);
|
||||||
|
|
||||||
// Set the viewport and scissor rect.
|
// Set the viewport and scissor rect.
|
||||||
|
@ -233,7 +244,7 @@ void Sample::CreateDeviceDependentResources()
|
||||||
device->CreateGraphicsPipelineState(&psoDesc,
|
device->CreateGraphicsPipelineState(&psoDesc,
|
||||||
IID_PPV_ARGS(m_pipelineState.ReleaseAndGetAddressOf())));
|
IID_PPV_ARGS(m_pipelineState.ReleaseAndGetAddressOf())));
|
||||||
|
|
||||||
// Create vertex buffer
|
// Create vertex buffer.
|
||||||
{
|
{
|
||||||
static const Vertex s_vertexData[3] =
|
static const Vertex s_vertexData[3] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,6 +212,7 @@
|
||||||
</FXCompile>
|
</FXCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h" />
|
||||||
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h" />
|
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h" />
|
||||||
<ClInclude Include="SimpleTriangleUWP12.h" />
|
<ClInclude Include="SimpleTriangleUWP12.h" />
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h">
|
<ClInclude Include="..\..\..\Kits\ATGTK\ReadData.h">
|
||||||
<Filter>ATG Tool Kit</Filter>
|
<Filter>ATG Tool Kit</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h">
|
||||||
|
<Filter>ATG Tool Kit</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="pch.cpp" />
|
<ClCompile Include="pch.cpp" />
|
||||||
|
|
|
@ -297,7 +297,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
swapChainDesc.BufferCount = m_backBufferCount;
|
swapChainDesc.BufferCount = m_backBufferCount;
|
||||||
swapChainDesc.SampleDesc.Count = 1;
|
swapChainDesc.SampleDesc.Count = 1;
|
||||||
swapChainDesc.SampleDesc.Quality = 0;
|
swapChainDesc.SampleDesc.Quality = 0;
|
||||||
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
|
||||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||||
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Main.cpp
|
// Main.cpp
|
||||||
//
|
//
|
||||||
// Entry point for universal Windows app.
|
// Entry point for Universal Windows Platform (UWP) app.
|
||||||
//
|
//
|
||||||
// Initialize the mouse cursor object and implements the event handling for
|
// Initialize the mouse cursor object and implements the event handling for
|
||||||
// necessary mouse cursor events to implement clip cursor or relative mouse mode.
|
// necessary mouse cursor events to implement clip cursor or relative mouse mode.
|
||||||
|
|
|
@ -163,7 +163,11 @@ void Sample::Render()
|
||||||
m_spriteBatch->End();
|
m_spriteBatch->End();
|
||||||
|
|
||||||
PIXEndEvent(context);
|
PIXEndEvent(context);
|
||||||
|
|
||||||
|
// Show the new frame.
|
||||||
|
PIXBeginEvent(PIX_COLOR_DEFAULT, L"Present");
|
||||||
m_deviceResources->Present();
|
m_deviceResources->Present();
|
||||||
|
PIXEndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to clear the back buffers.
|
// Helper method to clear the back buffers.
|
||||||
|
|
|
@ -297,7 +297,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
swapChainDesc.BufferCount = m_backBufferCount;
|
swapChainDesc.BufferCount = m_backBufferCount;
|
||||||
swapChainDesc.SampleDesc.Count = 1;
|
swapChainDesc.SampleDesc.Count = 1;
|
||||||
swapChainDesc.SampleDesc.Quality = 0;
|
swapChainDesc.SampleDesc.Quality = 0;
|
||||||
swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
|
swapChainDesc.Scaling = DXGI_SCALING_ASPECT_RATIO_STRETCH;
|
||||||
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
|
||||||
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
|
||||||
|
|
||||||
|
@ -352,6 +352,8 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
m_d3dRenderTargetView.ReleaseAndGetAddressOf()
|
m_d3dRenderTargetView.ReleaseAndGetAddressOf()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if (m_depthBufferFormat != DXGI_FORMAT_UNKNOWN)
|
||||||
|
{
|
||||||
// Create a depth stencil view for use with 3D rendering if needed.
|
// Create a depth stencil view for use with 3D rendering if needed.
|
||||||
CD3D11_TEXTURE2D_DESC depthStencilDesc(
|
CD3D11_TEXTURE2D_DESC depthStencilDesc(
|
||||||
m_depthBufferFormat,
|
m_depthBufferFormat,
|
||||||
|
@ -375,6 +377,7 @@ void DX::DeviceResources::CreateWindowSizeDependentResources()
|
||||||
&depthStencilViewDesc,
|
&depthStencilViewDesc,
|
||||||
m_d3dDepthStencilView.ReleaseAndGetAddressOf()
|
m_d3dDepthStencilView.ReleaseAndGetAddressOf()
|
||||||
));
|
));
|
||||||
|
}
|
||||||
|
|
||||||
// Set the 3D rendering viewport to target the entire window.
|
// Set the 3D rendering viewport to target the entire window.
|
||||||
m_screenViewport = CD3D11_VIEWPORT(
|
m_screenViewport = CD3D11_VIEWPORT(
|
||||||
|
@ -522,8 +525,11 @@ void DX::DeviceResources::Present()
|
||||||
// overwritten. If dirty or scroll rects are used, this call should be removed.
|
// overwritten. If dirty or scroll rects are used, this call should be removed.
|
||||||
m_d3dContext->DiscardView(m_d3dRenderTargetView.Get());
|
m_d3dContext->DiscardView(m_d3dRenderTargetView.Get());
|
||||||
|
|
||||||
|
if (m_d3dDepthStencilView)
|
||||||
|
{
|
||||||
// Discard the contents of the depth stencil.
|
// Discard the contents of the depth stencil.
|
||||||
m_d3dContext->DiscardView(m_d3dDepthStencilView.Get());
|
m_d3dContext->DiscardView(m_d3dDepthStencilView.Get());
|
||||||
|
}
|
||||||
|
|
||||||
// If the device was removed either by a disconnection or a driver upgrade, we
|
// If the device was removed either by a disconnection or a driver upgrade, we
|
||||||
// must recreate all device resources.
|
// must recreate all device resources.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
// Main.cpp
|
// Main.cpp
|
||||||
//
|
//
|
||||||
// Entry point for universal Windows app.
|
// Entry point for Universal Windows Platform (UWP) app.
|
||||||
//
|
//
|
||||||
// Advanced Technology Group (ATG)
|
// Advanced Technology Group (ATG)
|
||||||
// Copyright (C) Microsoft Corporation. All rights reserved.
|
// Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
@ -152,17 +152,15 @@ protected:
|
||||||
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
ApplicationView::PreferredLaunchWindowingMode = ApplicationViewWindowingMode::PreferredLaunchViewSize;
|
||||||
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
// Change to ApplicationViewWindowingMode::FullScreen to default to full screen
|
||||||
|
|
||||||
auto desiredSize = Size( ConvertPixelsToDips( w ),
|
auto desiredSize = Size(ConvertPixelsToDips(w), ConvertPixelsToDips(h));
|
||||||
ConvertPixelsToDips( h ) );
|
|
||||||
|
|
||||||
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
ApplicationView::PreferredLaunchViewSize = desiredSize;
|
||||||
|
|
||||||
auto view = ApplicationView::GetForCurrentView();
|
auto view = ApplicationView::GetForCurrentView();
|
||||||
|
|
||||||
auto minSize = Size( ConvertPixelsToDips( 320 ),
|
auto minSize = Size(ConvertPixelsToDips(320), ConvertPixelsToDips(200));
|
||||||
ConvertPixelsToDips( 200 ) );
|
|
||||||
|
|
||||||
view->SetPreferredMinSize( minSize );
|
view->SetPreferredMinSize(minSize);
|
||||||
|
|
||||||
CoreWindow::GetForCurrentThread()->Activate();
|
CoreWindow::GetForCurrentThread()->Activate();
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "SystemInfo.h"
|
#include "SystemInfo.h"
|
||||||
|
|
||||||
|
#include "ATGColors.h"
|
||||||
#include "ControllerFont.h"
|
#include "ControllerFont.h"
|
||||||
|
|
||||||
using namespace DirectX;
|
using namespace DirectX;
|
||||||
|
@ -28,13 +30,13 @@ namespace
|
||||||
{
|
{
|
||||||
XMVECTOR size = font->MeasureString(text);
|
XMVECTOR size = font->MeasureString(text);
|
||||||
XMFLOAT2 pos(mid - XMVectorGetX(size)*scale, y);
|
XMFLOAT2 pos(mid - XMVectorGetX(size)*scale, y);
|
||||||
font->DrawString(batch, text, pos, Colors::White, 0.f, Vector2::Zero, scale);
|
font->DrawString(batch, text, pos, ATG::Colors::Blue, 0.f, Vector2::Zero, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float DrawStringRight(SpriteBatch* batch, SpriteFont* font, const wchar_t* text, float mid, float y, float scale)
|
inline float DrawStringRight(SpriteBatch* batch, SpriteFont* font, const wchar_t* text, float mid, float y, float scale)
|
||||||
{
|
{
|
||||||
XMFLOAT2 pos(mid, y);
|
XMFLOAT2 pos(mid, y);
|
||||||
font->DrawString(batch, text, pos, Colors::White, 0.f, Vector2::Zero, scale);
|
font->DrawString(batch, text, pos, ATG::Colors::White, 0.f, Vector2::Zero, scale);
|
||||||
return font->GetLineSpacing()*scale;
|
return font->GetLineSpacing()*scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +46,8 @@ Sample::Sample() :
|
||||||
m_current(0),
|
m_current(0),
|
||||||
m_gamepadPresent(false)
|
m_gamepadPresent(false)
|
||||||
{
|
{
|
||||||
m_deviceResources = std::make_unique<DX::DeviceResources>();
|
// Renders only 2D, so no need for a depth buffer.
|
||||||
|
m_deviceResources = std::make_unique<DX::DeviceResources>(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN);
|
||||||
m_deviceResources->RegisterDeviceNotify(this);
|
m_deviceResources->RegisterDeviceNotify(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,14 +160,14 @@ void Sample::Render()
|
||||||
|
|
||||||
float y = float(safeRect.top);
|
float y = float(safeRect.top);
|
||||||
|
|
||||||
XMFLOAT2 pos(float(safeRect.left), float(safeRect.bottom));
|
XMFLOAT2 pos(float(safeRect.left), float(safeRect.bottom) - m_smallFont->GetLineSpacing());
|
||||||
if (m_gamepadPresent)
|
if (m_gamepadPresent)
|
||||||
{
|
{
|
||||||
DX::DrawControllerString(m_batch.get(), m_smallFont.get(), m_ctrlFont.get(), L"Use [A], [B], or [DPad] to cycle pages", pos, Colors::Gray, m_scale);
|
DX::DrawControllerString(m_batch.get(), m_smallFont.get(), m_ctrlFont.get(), L"Use [A], [B], or [DPad] to cycle pages", pos, ATG::Colors::LightGrey, m_scale);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_smallFont->DrawString(m_batch.get(), L"Use Left/Right to cycle pages", pos, Colors::Gray, 0, Vector2::Zero, m_scale);
|
m_smallFont->DrawString(m_batch.get(), L"Use Left/Right to cycle pages", pos, ATG::Colors::LightGrey, 0, Vector2::Zero, m_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
float spacer = XMVectorGetX(m_smallFont->MeasureString(L"X")*m_scale);
|
float spacer = XMVectorGetX(m_smallFont->MeasureString(L"X")*m_scale);
|
||||||
|
@ -176,7 +179,7 @@ void Sample::Render()
|
||||||
{
|
{
|
||||||
case InfoPage::SYSTEMINFO:
|
case InfoPage::SYSTEMINFO:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"GetNativeSystemInfo", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"GetNativeSystemInfo", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
SYSTEM_INFO info = {};
|
SYSTEM_INFO info = {};
|
||||||
GetNativeSystemInfo(&info);
|
GetNativeSystemInfo(&info);
|
||||||
|
@ -229,7 +232,7 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::GETPROCESSINFO:
|
case InfoPage::GETPROCESSINFO:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"GetProcessInformation", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"GetProcessInformation", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
APP_MEMORY_INFORMATION info = {};
|
APP_MEMORY_INFORMATION info = {};
|
||||||
if (GetProcessInformation(GetCurrentProcess(), ProcessAppMemoryInfo, &info, sizeof(info)))
|
if (GetProcessInformation(GetCurrentProcess(), ProcessAppMemoryInfo, &info, sizeof(info)))
|
||||||
|
@ -240,19 +243,19 @@ void Sample::Render()
|
||||||
auto tc = static_cast<uint32_t>(info.TotalCommitUsage / (1024 * 1024));
|
auto tc = static_cast<uint32_t>(info.TotalCommitUsage / (1024 * 1024));
|
||||||
|
|
||||||
wchar_t buff[128] = { 0 };
|
wchar_t buff[128] = { 0 };
|
||||||
swprintf_s(buff, L"%u (MB)", ac);
|
swprintf_s(buff, L"%u (MiB)", ac);
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"AvailableCommit", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"AvailableCommit", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
||||||
|
|
||||||
swprintf_s(buff, L"%u (MB)", pc);
|
swprintf_s(buff, L"%u (MiB)", pc);
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"PrivateCommitUsage", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"PrivateCommitUsage", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
||||||
|
|
||||||
swprintf_s(buff, L"%u (MB)", ppc);
|
swprintf_s(buff, L"%u (MiB)", ppc);
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"PeakPrivateCommitUsage", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"PeakPrivateCommitUsage", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
||||||
|
|
||||||
swprintf_s(buff, L"%u (MB)", tc);
|
swprintf_s(buff, L"%u (MiB)", tc);
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"TotalCommitUsage", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"TotalCommitUsage", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
||||||
}
|
}
|
||||||
|
@ -261,7 +264,7 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::ANALYTICSINFO:
|
case InfoPage::ANALYTICSINFO:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"AnalyticsInfo", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"AnalyticsInfo", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
auto versionInfo = Windows::System::Profile::AnalyticsInfo::VersionInfo;
|
auto versionInfo = Windows::System::Profile::AnalyticsInfo::VersionInfo;
|
||||||
|
|
||||||
|
@ -283,7 +286,7 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::APICONTRACT:
|
case InfoPage::APICONTRACT:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"IsApiContractPresent", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"IsApiContractPresent", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
using namespace Windows::Foundation::Metadata;
|
using namespace Windows::Foundation::Metadata;
|
||||||
|
|
||||||
|
@ -308,7 +311,7 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::CPUSETS:
|
case InfoPage::CPUSETS:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"GetSystemCpuSetInformation", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"GetSystemCpuSetInformation", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
ULONG retsize = 0;
|
ULONG retsize = 0;
|
||||||
(void)GetSystemCpuSetInformation(nullptr, 0, &retsize, GetCurrentProcess(), 0);
|
(void)GetSystemCpuSetInformation(nullptr, 0, &retsize, GetCurrentProcess(), 0);
|
||||||
|
@ -408,7 +411,7 @@ void Sample::Render()
|
||||||
if (moreThanOneGroup)
|
if (moreThanOneGroup)
|
||||||
{
|
{
|
||||||
y += m_smallFont->GetLineSpacing() * m_scale;
|
y += m_smallFont->GetLineSpacing() * m_scale;
|
||||||
y += DrawStringCenter(m_batch.get(), m_smallFont.get(), L"Note more than one group found; ignored extra groups!", mid, y, Colors::Red, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_smallFont.get(), L"Note more than one group found; ignored extra groups!", mid, y, ATG::Colors::Orange, m_scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,9 +419,9 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::DXGI:
|
case InfoPage::DXGI:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"DXGI", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"DXGI", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
y += DrawStringCenter(m_batch.get(), m_smallFont.get(), L"DXGI_OUTPUT_DESC", mid, y, Colors::White, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_smallFont.get(), L"DXGI_OUTPUT_DESC", mid, y, ATG::Colors::OffWhite, m_scale);
|
||||||
|
|
||||||
ComPtr<IDXGIOutput> output;
|
ComPtr<IDXGIOutput> output;
|
||||||
if (SUCCEEDED(m_deviceResources->GetSwapChain()->GetContainingOutput(output.GetAddressOf())))
|
if (SUCCEEDED(m_deviceResources->GetSwapChain()->GetContainingOutput(output.GetAddressOf())))
|
||||||
|
@ -446,7 +449,7 @@ void Sample::Render()
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"Rotation", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"Rotation", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), rotation, right, y, m_scale) * 1.25f;
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), rotation, right, y, m_scale) * 1.25f;
|
||||||
|
|
||||||
y += DrawStringCenter(m_batch.get(), m_smallFont.get(), L"DXGI_ADAPTER_DESC", mid, y, Colors::White, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_smallFont.get(), L"DXGI_ADAPTER_DESC", mid, y, ATG::Colors::OffWhite, m_scale);
|
||||||
|
|
||||||
ComPtr<IDXGIAdapter> adapter;
|
ComPtr<IDXGIAdapter> adapter;
|
||||||
if (SUCCEEDED(output->GetParent(IID_PPV_ARGS(adapter.GetAddressOf()))))
|
if (SUCCEEDED(output->GetParent(IID_PPV_ARGS(adapter.GetAddressOf()))))
|
||||||
|
@ -469,15 +472,15 @@ void Sample::Render()
|
||||||
auto dsm = static_cast<uint32_t>(adapterDesc.DedicatedSystemMemory / (1024 * 1024));
|
auto dsm = static_cast<uint32_t>(adapterDesc.DedicatedSystemMemory / (1024 * 1024));
|
||||||
auto ssm = static_cast<uint32_t>(adapterDesc.SharedSystemMemory / (1024 * 1024));
|
auto ssm = static_cast<uint32_t>(adapterDesc.SharedSystemMemory / (1024 * 1024));
|
||||||
|
|
||||||
swprintf_s(buff, L"%u (MB)", dvm);
|
swprintf_s(buff, L"%u (MiB)", dvm);
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"DedicatedVideoMemory", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"DedicatedVideoMemory", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
||||||
|
|
||||||
swprintf_s(buff, L"%u (MB)", dsm);
|
swprintf_s(buff, L"%u (MiB)", dsm);
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"DedicatedSystemMemory", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"DedicatedSystemMemory", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
||||||
|
|
||||||
swprintf_s(buff, L"%u (MB)", ssm);
|
swprintf_s(buff, L"%u (MiB)", ssm);
|
||||||
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"SharedSystemMemory", left, y, m_scale);
|
DrawStringLeft(m_batch.get(), m_smallFont.get(), L"SharedSystemMemory", left, y, m_scale);
|
||||||
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
y += DrawStringRight(m_batch.get(), m_smallFont.get(), buff, right, y, m_scale);
|
||||||
}
|
}
|
||||||
|
@ -487,7 +490,7 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::DIRECT3D11_1:
|
case InfoPage::DIRECT3D11_1:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"Direct3D 11.1", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"Direct3D 11.1", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
const wchar_t* featLevel = L"Unknown";
|
const wchar_t* featLevel = L"Unknown";
|
||||||
switch (m_deviceResources->GetDeviceFeatureLevel())
|
switch (m_deviceResources->GetDeviceFeatureLevel())
|
||||||
|
@ -554,7 +557,7 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::DIRECT3D11_2:
|
case InfoPage::DIRECT3D11_2:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"Direct3D 11.2", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"Direct3D 11.2", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
auto device = m_deviceResources->GetD3DDevice();
|
auto device = m_deviceResources->GetD3DDevice();
|
||||||
|
|
||||||
|
@ -587,7 +590,7 @@ void Sample::Render()
|
||||||
|
|
||||||
case InfoPage::DIRECT3D11_3:
|
case InfoPage::DIRECT3D11_3:
|
||||||
{
|
{
|
||||||
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"Direct3D 11.3", mid, y, Colors::Yellow, m_scale);
|
y += DrawStringCenter(m_batch.get(), m_largeFont.get(), L"Direct3D 11.3", mid, y, ATG::Colors::LightGrey, m_scale);
|
||||||
|
|
||||||
auto device = m_deviceResources->GetD3DDevice();
|
auto device = m_deviceResources->GetD3DDevice();
|
||||||
|
|
||||||
|
@ -638,7 +641,11 @@ void Sample::Render()
|
||||||
m_batch->End();
|
m_batch->End();
|
||||||
|
|
||||||
PIXEndEvent(context);
|
PIXEndEvent(context);
|
||||||
|
|
||||||
|
// Show the new frame.
|
||||||
|
PIXBeginEvent(PIX_COLOR_DEFAULT, L"Present");
|
||||||
m_deviceResources->Present();
|
m_deviceResources->Present();
|
||||||
|
PIXEndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to clear the back buffers.
|
// Helper method to clear the back buffers.
|
||||||
|
@ -649,12 +656,10 @@ void Sample::Clear()
|
||||||
|
|
||||||
// Clear the views
|
// Clear the views
|
||||||
auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView();
|
auto renderTarget = m_deviceResources->GetBackBufferRenderTargetView();
|
||||||
auto depthStencil = m_deviceResources->GetDepthStencilView();
|
|
||||||
|
|
||||||
context->ClearRenderTargetView(renderTarget, Colors::CornflowerBlue);
|
// Don't need to clear render target since we drawing image to fill screen
|
||||||
context->ClearDepthStencilView(depthStencil, D3D11_CLEAR_DEPTH | D3D11_CLEAR_STENCIL, 1.0f, 0);
|
|
||||||
|
|
||||||
context->OMSetRenderTargets(1, &renderTarget, depthStencil);
|
context->OMSetRenderTargets(1, &renderTarget, nullptr);
|
||||||
|
|
||||||
// Set the viewport.
|
// Set the viewport.
|
||||||
auto viewport = m_deviceResources->GetScreenViewport();
|
auto viewport = m_deviceResources->GetScreenViewport();
|
||||||
|
@ -721,7 +726,7 @@ void Sample::CreateDeviceDependentResources()
|
||||||
|
|
||||||
m_smallFont = std::make_unique<SpriteFont>(device, L"SegoeUI_18.spritefont");
|
m_smallFont = std::make_unique<SpriteFont>(device, L"SegoeUI_18.spritefont");
|
||||||
m_largeFont = std::make_unique<SpriteFont>(device, L"SegoeUI_36.spritefont");
|
m_largeFont = std::make_unique<SpriteFont>(device, L"SegoeUI_36.spritefont");
|
||||||
m_ctrlFont = std::make_unique<SpriteFont>(device, L"XboxOneController.spritefont");
|
m_ctrlFont = std::make_unique<SpriteFont>(device, L"XboxOneControllerLegendSmall.spritefont");
|
||||||
|
|
||||||
DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L"ATGSampleBackground.DDS", nullptr, m_background.ReleaseAndGetAddressOf()));
|
DX::ThrowIfFailed(CreateDDSTextureFromFile(device, L"ATGSampleBackground.DDS", nullptr, m_background.ReleaseAndGetAddressOf()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,6 +194,7 @@
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h" />
|
||||||
<ClInclude Include="..\..\..\Kits\ATGTK\ControllerFont.h" />
|
<ClInclude Include="..\..\..\Kits\ATGTK\ControllerFont.h" />
|
||||||
<ClInclude Include="SystemInfo.h" />
|
<ClInclude Include="SystemInfo.h" />
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
|
@ -233,7 +234,7 @@
|
||||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
|
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
|
||||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
|
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\..\..\Media\Fonts\XboxOneController.spritefont">
|
<None Include="..\..\..\Media\Fonts\XboxOneControllerLegendSmall.spritefont">
|
||||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
|
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</DeploymentContent>
|
||||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
|
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DeploymentContent>
|
||||||
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
|
<DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</DeploymentContent>
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
<ClInclude Include="..\..\..\Kits\ATGTK\ControllerFont.h">
|
<ClInclude Include="..\..\..\Kits\ATGTK\ControllerFont.h">
|
||||||
<Filter>ATG Tool Kit</Filter>
|
<Filter>ATG Tool Kit</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\Kits\ATGTK\ATGColors.h">
|
||||||
|
<Filter>ATG Tool Kit</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="pch.cpp" />
|
<ClCompile Include="pch.cpp" />
|
||||||
|
@ -64,9 +67,9 @@
|
||||||
<None Include="..\..\..\Media\Fonts\SegoeUI_36.spritefont">
|
<None Include="..\..\..\Media\Fonts\SegoeUI_36.spritefont">
|
||||||
<Filter>Assets</Filter>
|
<Filter>Assets</Filter>
|
||||||
</None>
|
</None>
|
||||||
<None Include="..\..\..\Media\Fonts\XboxOneController.spritefont">
|
<None Include="Readme.docx" />
|
||||||
|
<None Include="..\..\..\Media\Fonts\XboxOneControllerLegendSmall.spritefont">
|
||||||
<Filter>Assets</Filter>
|
<Filter>Assets</Filter>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Readme.docx" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Загрузка…
Ссылка в новой задаче