Browse Source

fixed Box9Sprite settings from ResAnim

dmuratshin 9 years ago
parent
commit
b87c4f4662
3 changed files with 11 additions and 14 deletions
  1. 6 12
      oxygine/src/Box9Sprite.cpp
  2. 1 1
      oxygine/src/res/ResAtlas.cpp
  3. 4 1
      oxygine/src/res/ResAtlas.h

+ 6 - 12
oxygine/src/Box9Sprite.cpp

@@ -97,28 +97,22 @@ namespace oxygine
             float scaleFactor = resanim->getScaleFactor();
 
             pugi::xml_attribute attr = resanim->getAttribute("guideX1");
-            if (!attr.empty())
-                _guideX[0] = attr.as_float() * scaleFactor;
+            _guideX[0] = attr.as_float(0) * scaleFactor;
 
             attr = resanim->getAttribute("guideX2");
-            if (!attr.empty())
-                _guideX[1] = attr.as_float() * scaleFactor;
+            _guideX[1] = attr.as_float(0) * scaleFactor;
 
             attr = resanim->getAttribute("guideY1");
-            if (!attr.empty())
-                _guideY[0] = attr.as_float() * scaleFactor;
+            _guideY[0] = attr.as_float(0) * scaleFactor;
 
             attr = resanim->getAttribute("guideY2");
-            if (!attr.empty())
-                _guideY[1] = attr.as_float() * scaleFactor;
+            _guideY[1] = attr.as_float(0) * scaleFactor;
 
             attr = resanim->getAttribute("vertical");
-            if (!attr.empty())
-                _vertMode = (StretchMode)attr.as_uint();
+            _vertMode = (StretchMode)attr.as_uint(STRETCHING);
 
             attr = resanim->getAttribute("horizontal");
-            if (!attr.empty())
-                _horzMode = (StretchMode)attr.as_uint();
+            _horzMode = (StretchMode)attr.as_uint(STRETCHING);
         }
         _Sprite::animFrameChanged(f);
     }

+ 1 - 1
oxygine/src/res/ResAtlas.cpp

@@ -46,7 +46,7 @@ namespace oxygine
     {
         if (_hook)
         {
-            _hook(file, nt, load_context);
+            _hook(file, nt, linearFilter, clamp2edge, load_context);
             return;
         }
 

+ 4 - 1
oxygine/src/res/ResAtlas.h

@@ -55,6 +55,9 @@ namespace oxygine
         atlasses _atlasses;
     };
 
-    typedef void(*load_texture_hook)(const std::string& file, spNativeTexture nt, LoadResourcesContext* load_context);
+    typedef void(*load_texture_hook)(const std::string& file, spNativeTexture nt, bool linearFilter, bool clamp2edge, LoadResourcesContext* load_context);
     void set_load_texture_hook(load_texture_hook);
+
+    class LoadResourcesContext;
+    void load_texture_internal(const std::string& file, spNativeTexture nt, bool linearFilter, bool clamp2edge, LoadResourcesContext* load_context);
 }