diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-03-04 07:31:12 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-03-04 07:31:12 -0500 |
commit | 6af8dcbaa41a7db52ff8f6074d2b113ec7eaf12d (patch) | |
tree | 96be39f3670d5dd2d71b001340d7aff9b6164003 /src/Texture.cpp | |
parent | b61bbe703a03d58dc660d05b4bb32f69a4c70436 (diff) | |
parent | fe5ea7fe415857f49d6630f2b0f50e1246c38eee (diff) |
Merge branch 'master' of http://github.com/tcsullivan/gamedev
Diffstat (limited to 'src/Texture.cpp')
-rw-r--r-- | src/Texture.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Texture.cpp b/src/Texture.cpp index 1aaadf6..731a1d6 100644 --- a/src/Texture.cpp +++ b/src/Texture.cpp @@ -1,5 +1,7 @@ +#include <algorithm> +#include <string> + #include <Texture.h> -#include <string.h> /** * A structure for keeping track of loaded textures. @@ -173,32 +175,30 @@ namespace Texture{ Texturec::Texturec(uint amt, ...){ va_list fNames; texState = 0; - image = new GLuint[amt]; va_start(fNames, amt); - for(unsigned int i = 0; i < amt; i++){ - image[i] = Texture::loadTexture(va_arg(fNames, char *)); - } + for(unsigned int i = 0; i < amt; i++) + image.push_back( Texture::loadTexture(va_arg(fNames, char *)) ); va_end(fNames); } +Texturec::Texturec( std::initializer_list<std::string> l ) +{ + texState = 0; + std::for_each( l.begin(), l.end(), [&](std::string s){ image.push_back( Texture::loadTexture( s ) ); }); +} + Texturec::Texturec(std::vector<std::string>v){ texState = 0; - image = new GLuint[v.size()]; - for(unsigned int i = 0; i < v.size(); i++){ - image[i] = Texture::loadTexture(v[i].c_str()); - } + std::for_each( v.begin(), v.end(), [&](std::string s){ image.push_back( Texture::loadTexture( s ) ); }); } Texturec::Texturec(uint amt,const char **paths){ texState = 0; - image = new GLuint[amt]; - for(unsigned int i = 0; i < amt; i++){ - image[i] = Texture::loadTexture(paths[i]); - } + for(unsigned int i = 0; i < amt; i++) + image.push_back( Texture::loadTexture(paths[i]) ); } Texturec::~Texturec(){ - delete[] image; } void Texturec::bind(unsigned int bn){ |