Using the TextureHolder class for all textures
Since we have our TextureHolder
class, we might as well be consistent and use it to load all our textures. Let's make some very small alterations to the existing code that loads textures for the background sprite sheet and the player.
Change the way the background gets its textures
In the ZombieArena.cpp
file, find this code:
// Load the texture for our background vertex array
Texture textureBackground;
textureBackground.loadFromFile("graphics/background_sheet.png");
Delete the code highlighted previously and replace it with the following highlighted code, which uses our new TextureHolder
class:
// Load the texture for our background vertex array
Texture textureBackground = TextureHolder::GetTexture(
"graphics/background_sheet.png");
Change the way Player gets its texture
In the Player.cpp
file, inside the constructor, find this code:
#include "stdafx.h" #include "player.h" Player::Player() { ...