#ifndef FILETEXTURE_H #define FILETEXTURE_H #include "wrapper/Texture.h" #include "images/PNGReader.h" class FileTexture final { Texture texture; public: FileTexture(const char* path); void bind(int index = 0) const; private: template void read(PNGReader& png) { Color* buffer = new Color[png.getBufferSize()]; if(png.readData(buffer)) { return; } texture.setColorData(png.getWidth(), png.getHeight(), buffer); delete[] buffer; } }; #endif