- SDL_Surface* surface_;
- unsigned width_; ///< Horizontal dimension of the image.
- unsigned height_; ///< Vertical dimension.
+ bool getTileCoords(Texture::TileIndex index, Scalar coords[8]) const
+ {
+ // make sure the index represents a real tile
+ if (index >= mTilesS * mTilesT) return false;
+
+ Scalar w = 1.0 / Scalar(mTilesS);
+ Scalar h = 1.0 / Scalar(mTilesT);
+
+ coords[0] = Scalar(index % mTilesS) * w;
+ coords[1] = (Scalar(mTilesT - 1) -
+ Scalar(index / mTilesS)) * h;
+ coords[2] = coords[0] + w;
+ coords[3] = coords[1];
+ coords[4] = coords[2];
+ coords[5] = coords[1] + h;
+ coords[6] = coords[0];
+ coords[7] = coords[5];
+
+ return true;
+ }
+
+ ImageP mImage;
+
+ GLuint mMinFilter; ///< Minification filter.
+ GLuint mMagFilter; ///< Magnification filter.
+ GLuint mWrapS; ///< Wrapping behavior horizontally.
+ GLuint mWrapT; ///< Wrapping behavior vertically.
+ unsigned mTilesS;
+ unsigned mTilesT;