don't use fractional texture coordiantes in the shader
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user