2023-03-02 02:37:42 +00:00
|
|
|
#include "IndexTexture.h"
|
|
|
|
|
|
|
|
sf::IntRect IndexTexture::spriteCoordinates(int index) {
|
|
|
|
int tx = index % grid_width, ty = index / grid_width;
|
|
|
|
return sf::IntRect(tx * grid_size, ty * grid_size, grid_size, grid_size);
|
|
|
|
}
|
2023-03-02 23:57:09 +00:00
|
|
|
|
|
|
|
IndexTexture::IndexTexture (sf::Texture t, int gs, int gw, int gh):
|
|
|
|
grid_size(gs), grid_width(gw), grid_height(gh) {
|
|
|
|
texture = t;
|
|
|
|
}
|