X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FTilemap.cc;h=232d0034c72186ad4963d3cbdfae03fa6be979ee;hp=655475222c45e89754b1e37a39389fce4c84348a;hb=a31d65a998121df0651c57bfb68782e2a07d2e2f;hpb=31d52677b38d935297d132bdbd956c655cd3feee diff --git a/src/Tilemap.cc b/src/Tilemap.cc index 6554752..232d003 100644 --- a/src/Tilemap.cc +++ b/src/Tilemap.cc @@ -37,12 +37,12 @@ struct Tilemap::Impl : public Mf::Mippleton { Impl(const std::string& name) : Mf::Mippleton(name), - magFilter_(GL_NEAREST), - minFilter_(GL_NEAREST), - nTilesS_(1), - nTilesT_(1), - wrapS_(GL_CLAMP), - wrapT_(GL_CLAMP) + mMagFilter(GL_NEAREST), + mMinFilter(GL_NEAREST), + mTilesS(1), + mTilesT(1), + mWrapS(GL_CLAMP), + mWrapT(GL_CLAMP) { loadFromFile(); } @@ -83,36 +83,36 @@ struct Tilemap::Impl : public Mf::Mippleton Mf::Script::Value top = script[-1]; globals.pushField("tiles_s"); - top.get(nTilesS_); + top.get(mTilesS); globals.pushField("tiles_t"); - top.get(nTilesT_); + top.get(mTilesT); globals.pushField("min_filter"); - top.get(minFilter_); + top.get(mMinFilter); globals.pushField("mag_filter"); - top.get(magFilter_); + top.get(mMagFilter); globals.pushField("wrap_s"); - top.get(wrapS_); + top.get(mWrapS); globals.pushField("wrap_t"); - top.get(wrapT_); + top.get(mWrapT); } bool getTileCoords(Tilemap::Index index, Mf::Scalar coords[8]) const { // make sure the index represents a real tile - if (index >= nTilesS_ * nTilesT_) return false; + if (index >= mTilesS * mTilesT) return false; - Mf::Scalar w = 1.0 / Mf::Scalar(nTilesS_); - Mf::Scalar h = 1.0 / Mf::Scalar(nTilesT_); + Mf::Scalar w = 1.0 / Mf::Scalar(mTilesS); + Mf::Scalar h = 1.0 / Mf::Scalar(mTilesT); - coords[0] = Mf::Scalar(index % nTilesS_) * w; - coords[1] = (Mf::Scalar(nTilesT_ - 1) - - Mf::Scalar(index / nTilesS_)) * h; + coords[0] = Mf::Scalar(index % mTilesS) * w; + coords[1] = (Mf::Scalar(mTilesT - 1) - + Mf::Scalar(index / mTilesS)) * h; coords[2] = coords[0] + w; coords[3] = coords[1]; coords[4] = coords[2]; @@ -124,30 +124,30 @@ struct Tilemap::Impl : public Mf::Mippleton } - GLuint magFilter_; - GLuint minFilter_; - unsigned nTilesS_; - unsigned nTilesT_; - GLuint wrapS_; - GLuint wrapT_; + GLuint mMagFilter; + GLuint mMinFilter; + unsigned mTilesS; + unsigned mTilesT; + GLuint mWrapS; + GLuint mWrapT; }; Tilemap::Tilemap(const std::string& name) : Texture(name), - impl_(Tilemap::Impl::getInstance(name)) + mImpl(Tilemap::Impl::getInstance(name)) { - setMinFilter(impl_->minFilter_); - setMagFilter(impl_->magFilter_); - setWrapS(impl_->wrapS_); - setWrapT(impl_->wrapT_); + setMinFilter(mImpl->mMinFilter); + setMagFilter(mImpl->mMagFilter); + setWrapS(mImpl->mWrapS); + setWrapT(mImpl->mWrapT); } bool Tilemap::getTileCoords(Index index, Mf::Scalar coords[8]) const { // pass through - return impl_->getTileCoords(index, coords); + return mImpl->getTileCoords(index, coords); } bool Tilemap::getTileCoords(Index index, Mf::Scalar coords[8],