summaryrefslogblamecommitdiffstats
path: root/src/TextureAtlas.hpp
blob: 836ebf01a1e8c58c4094fe65e161d8e89f01a462 (plain) (tree)
1
2
3
4
5



                 
                  












                                                                   
                                              



                                                         
                                                       






                                         
#pragma once

#include <vector>

#include "Gal.hpp"

struct TextureData {
	std::vector<unsigned char> data; //expected format RGBA8888
	int width, height;
};

struct TextureCoord {
	double x, y, w, h;
	int pixelX, pixelY, pixelW, pixelH;
	size_t layer;
};

class TextureAtlas {
	std::shared_ptr<Gal::Texture> texture;
	std::vector<TextureCoord> textureCoords;
public:
	TextureAtlas(std::vector<TextureData> &textures);

	std::shared_ptr<Gal::Texture> GetGalTexture() {
		return texture;
	}

	TextureCoord GetTexture(int id) {
		return textureCoords[id];
	}
};