]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Tilemap.cc
considerable refactoring
[chaz/yoink] / src / Moof / Tilemap.cc
index 1bfbfbcb9796e9b257970070b6243f2299a3b5eb..4fe5e974597d19e2baacb1eb97c788be6f66df9f 100644 (file)
@@ -36,7 +36,7 @@
 namespace Mf {
 
 
-class Tilemap::TilemapImpl : public Mippleton<TilemapImpl>
+class Tilemap::Impl : public Mippleton<Impl>
 {
        static GLint filterFromString(const std::string& filter)
        {
@@ -75,8 +75,8 @@ class Tilemap::TilemapImpl : public Mippleton<TilemapImpl>
        }
 
 public:
-       TilemapImpl(const std::string& name) :
-               Mippleton<TilemapImpl>(name),
+       Impl(const std::string& name) :
+               Mippleton<Impl>(name),
                magFilter_(GL_NEAREST),
                minFilter_(GL_NEAREST),
                nTilesS_(1),
@@ -89,17 +89,17 @@ public:
 
        void loadFromFile()
        {
-               Deserializer deserializer(Tilemap::getPathToResource(getName()));
+               Deserializer deserializer(Tilemap::getPath(getName()));
 
-               SerializablePtr root = deserializer.deserialize();
+               SerializableP root = deserializer.deserialize();
 
                if (root)
                {
-                       std::map<std::string,SerializablePtr> rootObj;
+                       Serializable::Map rootObj;
 
                        if (root->get(rootObj))
                        {
-                               std::map<std::string,SerializablePtr>::iterator it;
+                               Serializable::Map::iterator it;
 
                                if ((it = rootObj.find("tiles_s")) != rootObj.end())
                                {
@@ -164,10 +164,8 @@ public:
 
 Tilemap::Tilemap(const std::string& name) :
        Texture(name),
-       impl_(Tilemap::TilemapImpl::retain(name), &Tilemap::TilemapImpl::release)
+       impl_(Tilemap::Impl::getInstance(name))
 {
-       bind();
-
        setMinFilter(impl_->minFilter_);
        setMagFilter(impl_->magFilter_);
        setWrapS(impl_->wrapS_);
@@ -175,7 +173,7 @@ Tilemap::Tilemap(const std::string& name) :
 }
 
 
-bool Tilemap::getTileCoords(unsigned index, Scalar coords[8])
+bool Tilemap::getTileCoords(unsigned index, Scalar coords[8]) const
 {
        // make sure the index represents a real tile
        if (index >= impl_->nTilesS_ * impl_->nTilesT_) return false;
@@ -197,7 +195,7 @@ bool Tilemap::getTileCoords(unsigned index, Scalar coords[8])
 }
 
 bool Tilemap::getTileCoords(unsigned index, Scalar coords[8],
-               Orientation orientation)
+               Orientation orientation) const
 {
        if (getTileCoords(index, coords))
        {
@@ -225,9 +223,9 @@ bool Tilemap::getTileCoords(unsigned index, Scalar coords[8],
 }
 
 
-std::string Tilemap::getPathToResource(const std::string& name)
+std::string Tilemap::getPath(const std::string& name)
 {
-       return Resource::getPathToResource("tilemaps/" + name + ".json");
+       return Resource::getPath("tilemaps/" + name + ".json");
 }
 
 
This page took 0.022393 seconds and 4 git commands to generate.