don't use fractional texture coordiantes in the shader

This commit is contained in:
Konstantin Käfer
2014-05-15 15:16:34 +02:00
parent 27b695b068
commit 4c99014a13
6 changed files with 21 additions and 12 deletions

View File

@@ -107,7 +107,7 @@ void Sprite::parseJSON(std::shared_ptr<Sprite> &sprite) {
}
}
ImagePosition Sprite::getPosition(const std::string& name, bool repeating) {
ImagePosition Sprite::getPosition(const std::string& name, bool repeating) const {
if (!isLoaded()) return ImagePosition {};
// `repeating` indicates that the image will be used in a repeating pattern
@@ -118,7 +118,7 @@ ImagePosition Sprite::getPosition(const std::string& name, bool repeating) {
auto it = pos.find(name);
if (it == pos.end()) return ImagePosition {};
SpritePosition& pos = it->second;
const SpritePosition& pos = it->second;
return ImagePosition {
{
pos.width,
@@ -134,3 +134,9 @@ ImagePosition Sprite::getPosition(const std::string& name, bool repeating) {
}
};
}
const SpritePosition &Sprite::getSpritePosition(const std::string& name) const {
if (!isLoaded()) return empty;
auto it = pos.find(name);
return it == pos.end() ? empty : it->second;
}