Browse Source

Added SetSpriteTextureEdgeOffset method for TmxFile2D.

Konstantin Guschin 8 years ago
parent
commit
9f926d02fa
2 changed files with 12 additions and 0 deletions
  1. 9 0
      Source/Urho3D/Urho2D/TmxFile2D.cpp
  2. 3 0
      Source/Urho3D/Urho2D/TmxFile2D.h

+ 9 - 0
Source/Urho3D/Urho2D/TmxFile2D.cpp

@@ -587,6 +587,15 @@ const TmxLayer2D* TmxFile2D::GetLayer(unsigned index) const
     return layers_[index];
 }
 
+void TmxFile2D::SetSpriteTextureEdgeOffset(float offset)
+{
+    for (HashMap<int, SharedPtr<Sprite2D> >::ConstIterator i = gidToSpriteMapping_.Begin();
+         i != gidToSpriteMapping_.End(); ++i)
+    {
+        i->second_->SetTextureEdgeOffset(offset);
+    }
+}
+
 SharedPtr<XMLFile> TmxFile2D::LoadTSXFile(const String& source)
 {
     String tsxFilePath = GetParentPath(GetName()) + source;

+ 3 - 0
Source/Urho3D/Urho2D/TmxFile2D.h

@@ -198,6 +198,9 @@ public:
     /// Return layer at index.
     const TmxLayer2D* GetLayer(unsigned index) const;
 
+    /// Set texture edge offset for all sprites, in pixels.
+    void SetSpriteTextureEdgeOffset(float offset);
+
 private:
     /// Load TSX file.
     SharedPtr<XMLFile> LoadTSXFile(const String& source);