summaryrefslogtreecommitdiffstats
path: root/src/TextureAtlas.hpp
blob: 836ebf01a1e8c58c4094fe65e161d8e89f01a462 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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];
	}
};