Game Development Reference
In-Depth Information
you can change to true . Once that is done, the images will be included, and will be
ready for use.
We want to load two different textures onto the screen for this exercise:
player.dds
enemy.dds
To begin, we'll need to create something to hold and manage these images, so cre-
ate a Texture class. In the sample, I've created a Texture class using the new
C++/CX ref class system so that I can get the benefit of automatic reference counting
and resource management. You can use a standard C++ class here, but you need to
ensure that you manage the allocation and cleanup, either manually or using smart
pointers.
Inside Texture.h , place the following code:
#pragma once
#include <SpriteBatch.h>
ref class Texture sealed
{
private:
Platform::String^ _path;
Microsoft::WRL::ComPtr<ID3D11Texture2D> _tex;
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView>
_srv;
DirectX::XMFLOAT2 _pos;
internal:
void
Load(Microsoft::WRL::ComPtr<ID3D11Device>
device);
public:
property float X
{
Search WWH ::




Custom Search