Game Development Reference
In-Depth Information
In the preceding code, we're simply calling a nice and handy helper function that is
designed to load the .dds file and create the required D3D11 resources, ready for
use. We let that method directly set the ID3D11Resource and ID3D11ShaderRe-
sourceView in our class.
Now we need to load in the textures that we added to the project earlier. We're going
to be managing the game inside our Game class (the one that implements Direc-
t3DBase ). For now we'll start by adding in the two textures, and loading them up.
Later on we'll create a manager to handle these textures and clean up the code.
Start by including Texture.h in your Game header, and add the following fields to
that class:
Texture^ _player;
Texture^ _enemy;
Now we need to create a place to load this content. Let's add a LoadContent meth-
od to our Game class, and then let's call Initialize in GameApplication and
invoke LoadContent .
Now create the following in our new LoadContent method:
void Game::LoadContent()
{
_player = ref new
Texture("textures\\player.dds");
_enemy = ref new
Texture("textures\\enemy.dds");
_player->X = 50;
_player->Y = 50;
_enemy->X = 300;
_enemy->Y = 300;
_player->Load(m_d3dDevice);
Search WWH ::




Custom Search