Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dmuratshin 9 years ago
parent
commit
199f7b6384

+ 14 - 0
oxygine/src/DebugActor.cpp

@@ -70,6 +70,20 @@ namespace oxygine
         getStage()->addChild(DebugActor::instance);
         getStage()->addChild(DebugActor::instance);
     }
     }
 
 
+    void DebugActor::toggle()
+    {
+        if (!DebugActor::instance)
+        {
+            show();
+            return;
+        }
+
+        if (DebugActor::instance->_getStage())
+            hide();
+        else
+            show();
+    }
+
     void DebugActor::hide()
     void DebugActor::hide()
     {
     {
         if (DebugActor::instance)
         if (DebugActor::instance)

+ 1 - 0
oxygine/src/DebugActor.h

@@ -22,6 +22,7 @@ namespace oxygine
         static Resources* resSystem;
         static Resources* resSystem;
         static void initialize();
         static void initialize();
         static void show();
         static void show();
+        static void toggle();
         static void hide();
         static void hide();
         static void release();
         static void release();
         static void setCorner(int corner);
         static void setCorner(int corner);

+ 3 - 1
oxygine/src/Tween.h

@@ -35,6 +35,8 @@ namespace oxygine
     class UpdateState;
     class UpdateState;
     class TweenOptions;
     class TweenOptions;
 
 
+    const int TWEEN_COMPLETE_DT = std::numeric_limits<int>::max() / 2;
+
 
 
     DECLARE_SMART(Tween, spTween);
     DECLARE_SMART(Tween, spTween);
 
 
@@ -141,7 +143,7 @@ namespace oxygine
         void setDetachActor(bool detach) { _detach = detach; }
         void setDetachActor(bool detach) { _detach = detach; }
 
 
         /**immediately completes tween, calls doneCallback and mark tween as completed and removes self from Actor. If tween has infinity loops (=-1) then do nothing*/
         /**immediately completes tween, calls doneCallback and mark tween as completed and removes self from Actor. If tween has infinity loops (=-1) then do nothing*/
-        virtual void complete(timeMS deltaTime = std::numeric_limits<int>::max() / 2);
+        virtual void complete(timeMS deltaTime = TWEEN_COMPLETE_DT);
 
 
         /**removes self from Actor, complete callback not called*/
         /**removes self from Actor, complete callback not called*/
         void remove();
         void remove();

+ 1 - 1
oxygine/src/core/android/HttpRequestJavaTask.cpp

@@ -39,7 +39,7 @@ namespace oxygine
         JNI_NOT_NULL(jRelease);
         JNI_NOT_NULL(jRelease);
         env->CallStaticObjectMethod(_jHttpRequestsClass, jRelease);
         env->CallStaticObjectMethod(_jHttpRequestsClass, jRelease);
     }
     }
-    
+
     HttpRequestJavaTask::HttpRequestJavaTask(): _handle(0)
     HttpRequestJavaTask::HttpRequestJavaTask(): _handle(0)
     {
     {
 
 

+ 1 - 1
oxygine/src/core/ios/ios.h

@@ -8,7 +8,7 @@ namespace oxygine
     {
     {
         std::string getSupportFolder();
         std::string getSupportFolder();
     }
     }
-    
+
     class Image;
     class Image;
 
 
 
 

+ 4 - 0
tools/oxyresbuild.py

@@ -38,6 +38,8 @@ def get_parser():
         "Value > 1 - upscale, Value < 1 - downscale. Should be used "
         "Value > 1 - upscale, Value < 1 - downscale. Should be used "
         "with --resize", type=float, default=1.0
         "with --resize", type=float, default=1.0
     )
     )
+    parser.add_argument(
+        "--trim_threshold", help="Alpha trim threshold. Used to optimize image when trimming transparent borders of image", type=int, default=2)
     parser.add_argument("-r", "--resize", help="Resize images by a scale value",
     parser.add_argument("-r", "--resize", help="Resize images by a scale value",
                         action="store_true", default=False)
                         action="store_true", default=False)
     parser.add_argument("-us", "--upscale",
     parser.add_argument("-us", "--upscale",
@@ -57,6 +59,8 @@ def get_parser():
                         action="store_true", default=False)
                         action="store_true", default=False)
     parser.add_argument("-w", "--warnings", help="show warnings",
     parser.add_argument("-w", "--warnings", help="show warnings",
                         action="store_true", default=False)
                         action="store_true", default=False)
+    parser.add_argument("--simple_downsample", help="don't use smart algorithm when resizing args",
+                        action="store_true", default=False)
     parser.add_argument(
     parser.add_argument(
         "-v", "--verbosity", help="verbosity level. 1 - only errors, "
         "-v", "--verbosity", help="verbosity level. 1 - only errors, "
         "2 - normal. Default value is 2", type=int, default=2)
         "2 - normal. Default value is 2", type=int, default=2)

+ 5 - 3
tools/resbuild/process_atlas.py

@@ -47,7 +47,7 @@ def as_bool(attr, df=False):
     return lw == "true" or lw == "1"
     return lw == "true" or lw == "1"
 
 
 
 
-def fixImage(image):
+def fixImage_unused(image):
     if image.mode != "RGBA":
     if image.mode != "RGBA":
         return image
         return image
 
 
@@ -450,7 +450,7 @@ def processRS(context, walker):
                 resize_filter = Image.BICUBIC
                 resize_filter = Image.BICUBIC
 
 
             if context.args.resize:
             if context.args.resize:
-                if as_bool(image_el.getAttribute("trueds")) or (not trim and not extend):
+                if as_bool(image_el.getAttribute("trueds")) or (not trim and not extend) or context.args.simple_downsample:
                     frame_image = frame_image.resize(
                     frame_image = frame_image.resize(
                         (frame_size[0], frame_size[1]), resize_filter)
                         (frame_size[0], frame_size[1]), resize_filter)
                 else:
                 else:
@@ -470,7 +470,9 @@ def processRS(context, walker):
 
 
             if image.mode == "RGBA" and trim:
             if image.mode == "RGBA" and trim:
                 r, g, b, a = frame_image.split()
                 r, g, b, a = frame_image.split()
-                a = a.point(lambda p: p - 2)
+                tt = context.args.trim_threshold
+                if tt:
+                	a = a.point(lambda p: p - tt)
 
 
                 if walker.hit_test:
                 if walker.hit_test:
                     adata = makeAlpha(a)
                     adata = makeAlpha(a)