Browse Source

Merge branch 'dev' of github.com:oxygine/oxygine-framework into dev

dmuratshin 9 years ago
parent
commit
1656b64dbd

+ 5 - 5
examples/Demo/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.Demo.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -23,13 +23,13 @@
             </intent-filter>
         </activity>
     </application>
-   
-    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests demo-->    
-    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests demo (downloading files)-->
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/DemoBox2D/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.DemoBox2D.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/Game/part1/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.GamePart1.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/Game/part2/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.GamePart2.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/Game/part3/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.GamePart3.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/Game/part4/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.GamePart4.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/Game/part5/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.GamePart5.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/HelloWorld/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.HelloWorld.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 5 - 1
examples/Match3/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.Match3.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" /> 
 

+ 8 - 0
oxygine/src/Image.cpp

@@ -810,6 +810,14 @@ namespace oxygine
 
     }
 
+    void Image::toPOT(Image& dest)
+    {
+		OX_ASSERT(this != &dest);
+        dest.init(nextPOT(_image.w), nextPOT(_image.h), _image.format);
+        dest.fill_zero();
+        dest.updateRegion(0, 0, _image);
+    }
+
     void Image::updateRegion(int x, int y, const ImageData& src)
     {
         Rect r(x, y, src.w, src.h);

+ 1 - 0
oxygine/src/Image.h

@@ -47,6 +47,7 @@ namespace oxygine
         ImageData   lock(const Rect* pRect);
         ImageData   lock(const Rect& pRect);
         void        unlock();
+        void        toPOT(Image& dest);
 
         void        updateRegion(int x, int y, const ImageData& data);
         void        apply(const Rect*);

+ 1 - 1
oxygine/src/core/ZipFileSystem.cpp

@@ -195,7 +195,7 @@ namespace oxygine
         {
             std::sort(_files.begin(), _files.end(), sortFiles);
 #ifdef OX_DEBUG
-            for (size_t i = 0; i < _files.size() - 1; ++i)
+            for (int i = 0; i < (int)_files.size() - 1; ++i)
             {
                 OX_ASSERT(strcmp(_files[i].name, _files[i + 1].name) != 0);
             }

+ 2 - 1
oxygine/src/core/gl/NativeTextureGLES.cpp

@@ -226,6 +226,7 @@ namespace oxygine
             NativeTextureGLES::created--;
             glDeleteTextures(1, (GLuint*)&_id);
             _id = 0;
+            CHECKGL();
         }
 
 
@@ -233,10 +234,10 @@ namespace oxygine
         {
             oxglDeleteFramebuffers(1, (GLuint*)&_fbo);
             _fbo = 0;
+            CHECKGL();
         }
 
         unreg();
-        CHECKGL();
     }
 
 

+ 21 - 3
oxygine/src/core/oxygine.cpp

@@ -70,11 +70,11 @@ extern "C"
 
 
 #if EMSCRIPTEN
-#define HANDLE_FOCUS_LOST 0
+#   define HANDLE_FOCUS_LOST 0
 #elif !SDL_VIDEO_OPENGL
-#define HANDLE_FOCUS_LOST 1
+#   define HANDLE_FOCUS_LOST 1
 #else
-#define HANDLE_FOCUS_LOST 0
+#   define HANDLE_FOCUS_LOST 0
 #endif
 
 #define LOST_RESET_CONTEXT 0
@@ -534,7 +534,10 @@ namespace oxygine
             if (!wnd)
             {
                 if (!focus)
+                {
+                    log::messageln("!focus");
                     return false;
+                }
 
                 wnd = _window;
             }
@@ -549,6 +552,10 @@ namespace oxygine
                 IVideoDriver::_stats.start = getTimeMS();
                 updatePortProcessItems();
             }
+            else
+            {
+                log::messageln("!ready");
+            }
 
             return ready;
         }
@@ -606,6 +613,7 @@ namespace oxygine
                 switch (event.type)
                 {
                     case SDL_QUIT:
+						log::messageln("SDL_QUIT");
                         done = true;
                         break;
                     case SDL_WINDOWEVENT:
@@ -617,6 +625,8 @@ namespace oxygine
                         active = true;
                         */
 
+                        log::messageln("SDL_WINDOWEVENT %d", (int)event.window.event);
+
                         if (event.window.event == SDL_WINDOWEVENT_MINIMIZED)
                             active = false;
                         if (event.window.event == SDL_WINDOWEVENT_RESTORED)
@@ -627,6 +637,11 @@ namespace oxygine
                             newFocus = false;
                         if (event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
                             newFocus = true;
+#ifdef __ANDROID__
+                        //if (event.window.event == SDL_WINDOWEVENT_ENTER)
+                         //   newFocus = true;
+#endif
+
                         if (focus != newFocus)
                         {
 #if HANDLE_FOCUS_LOST
@@ -772,6 +787,8 @@ namespace oxygine
 
         void release()
         {
+			log::messageln("core::release");
+
             _threadMessages.clear();
             _uiMessages.clear();
 
@@ -845,6 +862,7 @@ namespace oxygine
 
         void requestQuit()
         {
+			log::messageln("requestQuit");
 #ifdef __S3E__
             s3eDeviceRequestQuit();
 #elif OXYGINE_SDL

+ 2 - 2
oxygine/src/dev_tools/TexturesInspector.cpp

@@ -48,10 +48,10 @@ namespace oxygine
             path::normalize(t->getName().c_str(), path);
 
             char txt[255];
-            safe_sprintf(txt, "%s\n<div c=\"FF0000\">%s</div>-<div c=\"0000ff\">%dx%d</div>\nid: %d",
+            safe_sprintf(txt, "%s\n<div c=\"FF0000\">%s</div>-<div c=\"0000ff\">%dx%d</div>\nid: %d tid: %d",
                          path,
                          textureFormat2String(t->getFormat()),
-                         t->getWidth(), t->getHeight(), t->getObjectID());
+                         t->getWidth(), t->getHeight(), t->getObjectID(), (int)(size_t)t->getHandle());
 
             spTextField text = initActor(new TextField,
                                          arg_color = Color::Black,

+ 5 - 1
tools/templates/proj.android/AndroidManifest.xml

@@ -14,7 +14,7 @@
         <activity android:name="org.oxygine.${PROJECT}.MainActivity"
                   android:label="@string/app_name"
                   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
-                  android:configChanges="locale|orientation|keyboardHidden" 
+                  android:configChanges="locale|orientation|keyboardHidden|screenSize" 
                   android:screenOrientation="landscape">
 
             <intent-filter>
@@ -26,6 +26,10 @@
 
     <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="16" />
 
+    <uses-permission android:name="android.permission.INTERNET" /> <!--used for http requests-->    
+    <uses-permission android:name="android.permission.WAKE_LOCK" /><!--used for http requests (downloading files)-->
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><!--used for Proxy detection, could be disabled-->  
+
     <!-- OpenGL ES 2.0 -->
     <uses-feature android:glEsVersion="0x00020000" />