Browse Source

Merge branch 'master' into dev

# Conflicts:
#	oxygine/src/res/ResAtlas.cpp
dmuratshin 9 years ago
parent
commit
3fc3b1b8ff

+ 2 - 0
oxygine/src/MemoryTexture.cpp

@@ -761,6 +761,8 @@ namespace oxygine
         if (pRect)
         if (pRect)
         {
         {
             rect = *pRect;
             rect = *pRect;
+            OX_ASSERT(rect.getX() >= 0);
+            OX_ASSERT(rect.getY() >= 0);
             OX_ASSERT(rect.getX() + rect.getWidth() <= _image.w);
             OX_ASSERT(rect.getX() + rect.getWidth() <= _image.w);
             OX_ASSERT(rect.getY() + rect.getHeight() <= _image.h);
             OX_ASSERT(rect.getY() + rect.getHeight() <= _image.h);
         }
         }

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

@@ -18,7 +18,7 @@ namespace oxygine
     LoadResourcesContext* LoadResourcesContext::get()
     LoadResourcesContext* LoadResourcesContext::get()
     {
     {
         bool isMainThread = pthread_equal(_selfThread, pthread_self());
         bool isMainThread = pthread_equal(_selfThread, pthread_self());
-        
+
         LoadResourcesContext* mtcontext = &MTLoadingResourcesContext::instance;
         LoadResourcesContext* mtcontext = &MTLoadingResourcesContext::instance;
         LoadResourcesContext* scontext = &SingleThreadResourcesContext::instance;
         LoadResourcesContext* scontext = &SingleThreadResourcesContext::instance;
         return isMainThread ? scontext : mtcontext;
         return isMainThread ? scontext : mtcontext;

+ 4 - 4
oxygine/src/res/ResAtlasGeneric.cpp

@@ -370,25 +370,25 @@ namespace oxygine
                             MemoryTexture& mt = ad.mt;
                             MemoryTexture& mt = ad.mt;
                             ImageData tmp;
                             ImageData tmp;
 
 
-                            if (bounds.getY() == 0)
+                            if (bounds.getY() == 0 && dest.pos.y != 0)
                             {
                             {
                                 tmp = mt.lock(Rect(dest.pos.x, dest.pos.y - 1, src.w, 1));
                                 tmp = mt.lock(Rect(dest.pos.x, dest.pos.y - 1, src.w, 1));
                                 operations::copy(src.getRect(Rect(0, 0, src.w, 1)), tmp);
                                 operations::copy(src.getRect(Rect(0, 0, src.w, 1)), tmp);
                             }
                             }
 
 
-                            if (bounds.getHeight() == im.h)
+                            if (bounds.getHeight() == im.h && dest.getBottom() != mt.getHeight())
                             {
                             {
                                 tmp = mt.lock(Rect(dest.pos.x, dest.pos.y + src.h, src.w, 1));
                                 tmp = mt.lock(Rect(dest.pos.x, dest.pos.y + src.h, src.w, 1));
                                 operations::copy(src.getRect(Rect(0, src.h - 1, src.w, 1)), tmp);
                                 operations::copy(src.getRect(Rect(0, src.h - 1, src.w, 1)), tmp);
                             }
                             }
 
 
-                            if (bounds.getX() == 0)
+                            if (bounds.getX() == 0 && dest.pos.x != 0)
                             {
                             {
                                 tmp = mt.lock(Rect(dest.pos.x - 1, dest.pos.y, 1, src.h));
                                 tmp = mt.lock(Rect(dest.pos.x - 1, dest.pos.y, 1, src.h));
                                 operations::copy(src.getRect(Rect(0, 0, 1, src.h)), tmp);
                                 operations::copy(src.getRect(Rect(0, 0, 1, src.h)), tmp);
                             }
                             }
 
 
-                            if (bounds.getWidth() == im.w)
+                            if (bounds.getWidth() == im.w && dest.getRight() != mt.getWidth())
                             {
                             {
                                 tmp = mt.lock(Rect(dest.pos.x + src.w, dest.pos.y, 1, src.h));
                                 tmp = mt.lock(Rect(dest.pos.x + src.w, dest.pos.y, 1, src.h));
                                 operations::copy(src.getRect(Rect(src.w - 1, 0, 1, src.h)), tmp);
                                 operations::copy(src.getRect(Rect(src.w - 1, 0, 1, src.h)), tmp);

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

@@ -280,7 +280,7 @@ namespace oxygine
 
 
         FS_LOG("xml loaded");
         FS_LOG("xml loaded");
     }
     }
-	
+
     void Resources::collect(resources& r)
     void Resources::collect(resources& r)
     {
     {
 #ifdef __S3E__
 #ifdef __S3E__

+ 1 - 1
oxygine/src/res/Resources.h

@@ -64,7 +64,7 @@ namespace oxygine
 
 
         Resources();
         Resources();
         ~Resources();
         ~Resources();
-		
+
         /**Loads resources from xml file. Load could be called multiple times for different xml files.
         /**Loads resources from xml file. Load could be called multiple times for different xml files.
         @param xml file paths
         @param xml file paths
         @param options
         @param options

+ 4 - 0
readme/Android.txt

@@ -1,4 +1,8 @@
 1. Start from readme.txt
 1. Start from readme.txt
+
+step by step video tutorial:
+http://www.youtube.com/watch?v=d8eHHr_KHgQ
+
 2a. Examples folder have configured android project
 2a. Examples folder have configured android project
 =================================================================================================
 =================================================================================================
 How to build. Steps:
 How to build. Steps:

+ 10 - 2
tools/resbuild/process_atlas.py

@@ -274,9 +274,17 @@ def pck(st, frames):
             sq += size[0] * size[1]
             sq += size[0] * size[1]
             min_w = max(min_w, size[0])
             min_w = max(min_w, size[0])
             min_h = max(min_h, size[1])
             min_h = max(min_h, size[1])
+        
+        max_w = st.max_w    
+        max_h = st.max_h
+        
+        if st.square:
+            min_w = min_h = max(min_w, min_h)
+            max_w = max_h = max(max_w, max_h)
+            
 
 
-        sizes_w = list(get_pow2list(st.npot, min_w, st.max_w))
-        sizes_h = list(get_pow2list(st.npot, min_h, st.max_h))
+        sizes_w = list(get_pow2list(st.npot, min_w, max_w))
+        sizes_h = list(get_pow2list(st.npot, min_h, max_h))
 
 
         for sw in sizes_w:
         for sw in sizes_w:
             for sh in sizes_h:
             for sh in sizes_h: