Sfoglia il codice sorgente

- renamed OXYGINE_FS_STDIO to OXYGINE_FILESYSTEM_USE_STDIO
- clean up
- fixed xcode errors

dmuratshin 10 anni fa
parent
commit
07d5a9b9b3

+ 5 - 0
oxygine/src/MemoryTexture.cpp

@@ -768,6 +768,11 @@ namespace oxygine
         return lock(lock_read | lock_write, pRect);
     }
 
+    ImageData MemoryTexture::lock(const Rect& rect)
+    {
+        return lock(lock_read | lock_write, &rect);
+    }
+
     void MemoryTexture::unlock()
     {
 

+ 1 - 0
oxygine/src/MemoryTexture.h

@@ -44,6 +44,7 @@ namespace oxygine
 
         ImageData   lock(lock_flags f = 0, const Rect* pRect = 0);
         ImageData   lock(const Rect* pRect);
+        ImageData   lock(const Rect& pRect);
         void        unlock();
 
         void        updateRegion(int x, int y, const ImageData& data);

+ 2 - 27
oxygine/src/core/STDFileSystem.cpp

@@ -31,7 +31,7 @@ typedef s3eFile oxHandle;
 #define oxFileRead s3eFileRead
 #define oxExists(name) s3eFileCheckExists(name)
 
-#elif OXYGINE_SDL && !OXYGINE_FS_STDIO
+#elif OXYGINE_SDL && !OXYGINE_FILESYSTEM_USE_STDIO
 #ifdef _WIN32
 #include <direct.h>
 #include <Windows.h>
@@ -50,19 +50,6 @@ typedef SDL_RWops oxHandle;
 #define oxFileWrite(ptr, size, n, handle) SDL_RWwrite(handle, ptr, size, n)
 #define ox_FILESEEK_END RW_SEEK_END
 #define ox_FILESEEK_SET RW_SEEK_SET
-
-bool sdlExists(const char* name)
-{
-    //return true;
-    LOGD("check file exists: %s___", name);
-    oxHandle* h = oxFileOpen_(name, "rb");
-    LOGD("check ");
-    if (h)
-        oxFileClose_(h);
-    LOGD("check file exists: %s %d", name, (int)(h != 0));
-    return h != 0;
-}
-#define oxExists(name) sdlExists(name)
 #define oxFileRead(ptr, size, n, handle) SDL_RWread(handle, ptr, size, n)
 
 #else
@@ -85,18 +72,6 @@ typedef FILE oxHandle;
 #define oxFileWrite fwrite
 #define ox_FILESEEK_END SEEK_END
 #define ox_FILESEEK_SET SEEK_SET
-
-bool fileExists(const char* name)
-{
-	LOGD("check file exists: %s___", name);
-	oxHandle* h = oxFileOpen_(name, "rb");
-	LOGD("check ");
-	if (h)
-		oxFileClose_(h);
-	LOGD("check file exists: %s %d", name, (int)(h != 0));
-	return h != 0;
-}
-#define oxExists(name) fileExists(name)
 #define oxFileRead(ptr, size, n, handle) fread(ptr, size, n, handle)
 
 #endif//__S3E__
@@ -167,7 +142,7 @@ namespace oxygine
 
             virtual unsigned int getSize() const
             {
-#if OXYGINE_SDL && !OXYGINE_FS_STDIO
+#if OXYGINE_SDL && !OXYGINE_FILESYSTEM_USE_STDIO
                 return (int)SDL_RWsize((SDL_RWops*)_handle);
 #else
                 oxFileSeek(_handle, 0, ox_FILESEEK_END);

+ 1 - 1
oxygine/src/oxygine_include.h

@@ -16,7 +16,7 @@
 //#define OXYGINE_NO_YEILD 1
 
 // Bypass SDL file functions and use plain fopen, fread etc.
-//#define OXYGINE_FS_STDIO 1
+//#define OXYGINE_FILESYSTEM_USE_STDIO 1
 
 #if __S3E__
 #   define OXYGINE_MARMALADE 1

+ 15 - 6
oxygine/src/res/ResAtlas.cpp

@@ -526,13 +526,22 @@ namespace oxygine
 
                         //duplicate image edges
                         MemoryTexture& mt = ad.mt;
-                        operations::copy(src.getRect(Rect(0, 0, src.w, 1)),         mt.lock(&Rect(dest.pos.x, dest.pos.y - 1,    src.w, 1)));
-                        operations::copy(src.getRect(Rect(0, src.h - 1, src.w, 1)), mt.lock(&Rect(dest.pos.x, dest.pos.y + src.h, src.w, 1)));
-                        operations::copy(src.getRect(Rect(0, 0, 1, src.h)),         mt.lock(&Rect(dest.pos.x - 1, dest.pos.y,    1, src.h)));
-                        operations::copy(src.getRect(Rect(src.w - 1, 0, 1, src.h)), mt.lock(&Rect(dest.pos.x + src.w, dest.pos.y, 1, src.h)));
+                        ImageData tmp;
 
-                        operations::copy(src.getRect(Rect(0, 0, 1, 1)), mt.lock(&Rect(dest.pos.x - 1, dest.pos.y - 1, 1, 1)));
-                        operations::copy(src.getRect(Rect(src.w - 1, 0, 1, 1)), mt.lock(&Rect(dest.pos.x + src.w, dest.pos.y - 1, 1, 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);
+
+                        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);
+
+                        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);
+
+                        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(0, 0, 1, 1)), mt.lock(&Rect(dest.pos.x - 1, dest.pos.y - 1, 1, 1)));
+                        //operations::copy(src.getRect(Rect(src.w - 1, 0, 1, 1)), mt.lock(&Rect(dest.pos.x + src.w, dest.pos.y - 1, 1, 1)));
 
                         //operations::copy(src.getRect(Rect(0, src.h - 1, 1, 1)), mt.lock(&Rect(dest.pos.x - 1, dest.pos.y + src.h, 1, 1)));
                         //operations::copy(src.getRect(Rect(src.w - 1, src.h - 1, 1, 1)), mt.lock(&Rect(dest.pos.x + src.w, dest.pos.y + src.h, 1, 1)));