]> Dogcows Code - chaz/yoink/blobdiff - src/Tilemap.cc
minor refactoring and state progress
[chaz/yoink] / src / Tilemap.cc
index 655475222c45e89754b1e37a39389fce4c84348a..232d0034c72186ad4963d3cbdfae03fa6be979ee 100644 (file)
@@ -37,12 +37,12 @@ struct Tilemap::Impl : public Mf::Mippleton<Impl>
 {
        Impl(const std::string& name) :
                Mf::Mippleton<Impl>(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<Impl>
                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<Impl>
        }
 
 
-       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],
This page took 0.022145 seconds and 4 git commands to generate.