Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Disposable.h"
- #include "Texture.h"
- #include <vector>
- class TextureBank: public Disposable
- {
- public:
- TextureBank();
- ~TextureBank();
- virtual void dispose();
- void addTexture(int location, Texture *tex);
- Texture *getTexture(int location);
- private:
- std::vector<Texture*> textures;
- };
- #include "TextureBank.h"
- TextureBank::TextureBank()
- {
- }
- void TextureBank::dispose() {
- for each (Texture* tex in textures)
- {
- if (tex != nullptr) {
- tex->dispose();
- }
- }
- }
- void TextureBank::addTexture(int location, Texture *tex) {
- if (location > textures.size() - 1) {
- textures.resize(location + 1, nullptr);
- }
- textures[location] = tex;
- }
- Texture *TextureBank::getTexture(int location) {
- return textures[location];
- }
- TextureBank::~TextureBank()
- {
- for each (Texture* tex in textures)
- {
- if (tex != nullptr) {
- delete tex;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement