- // TODO named resources must be png for now
- return Resource::getPathToResource("textures/" + name + ".png");
+ // pass through
+ return mImpl->getTileCoords(index, coords);
+}
+
+bool Texture::getTileCoords(TileIndex index, Scalar coords[8],
+ Orientation orientation) const
+{
+ if (getTileCoords(index, coords))
+ {
+ if (orientation & FLIP)
+ {
+ // this looks kinda weird, but it's just swapping in a way that
+ // doesn't require an intermediate variable
+ coords[1] = coords[5];
+ coords[5] = coords[3];
+ coords[3] = coords[7];
+ coords[7] = coords[5];
+ }
+ if (orientation & REVERSE)
+ {
+ coords[0] = coords[2];
+ coords[2] = coords[6];
+ coords[4] = coords[6];
+ coords[6] = coords[0];
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+
+std::string Texture::getPath(const std::string& name)
+{
+ if (boost::find_last(name, ".png"))
+ {
+ return Resource::getPath(name);
+ }
+ else
+ {
+ std::string path("textures/");
+ path += name;
+ path += ".png";
+ return Resource::getPath(path);
+ }