Quellcode durchsuchen

Merge branch 'dev' into apply-font-global-scale

dmuratshin vor 9 Jahren
Ursprung
Commit
9bda212eb4
100 geänderte Dateien mit 749 neuen und 549 gelöschten Zeilen
  1. 3 0
      .gitignore
  2. BIN
      doc/doc.zip
  3. BIN
      doc/wiki.zip
  4. 5 5
      examples/Demo/proj.android/AndroidManifest.xml
  5. 2 0
      examples/Demo/proj.cmake/build_emsc.bat
  6. 2 0
      examples/Demo/proj.cmake/build_emsc_release.bat
  7. 62 2
      examples/Demo/src/TestDrag.h
  8. 2 1
      examples/Demo/src/TestProgressBar.h
  9. 29 14
      examples/Demo/src/TestTouches.h
  10. 5 1
      examples/DemoBox2D/proj.android/AndroidManifest.xml
  11. 2 0
      examples/DemoBox2D/proj.cmake/build_emsc.bat
  12. 2 0
      examples/DemoBox2D/proj.cmake/build_emsc_release.bat
  13. 1 1
      examples/DemoBox2D/src/example.cpp
  14. 5 1
      examples/Game/part1/proj.android/AndroidManifest.xml
  15. 2 0
      examples/Game/part1/proj.cmake/build_emsc.bat
  16. 2 0
      examples/Game/part1/proj.cmake/build_emsc_release.bat
  17. 5 1
      examples/Game/part2/proj.android/AndroidManifest.xml
  18. 2 0
      examples/Game/part2/proj.cmake/build_emsc.bat
  19. 2 0
      examples/Game/part2/proj.cmake/build_emsc_release.bat
  20. 5 1
      examples/Game/part3/proj.android/AndroidManifest.xml
  21. 2 0
      examples/Game/part3/proj.cmake/build_emsc.bat
  22. 2 0
      examples/Game/part3/proj.cmake/build_emsc_release.bat
  23. 5 1
      examples/Game/part4/proj.android/AndroidManifest.xml
  24. 2 0
      examples/Game/part4/proj.cmake/build_emsc.bat
  25. 2 0
      examples/Game/part4/proj.cmake/build_emsc_release.bat
  26. 5 1
      examples/Game/part5/proj.android/AndroidManifest.xml
  27. 2 0
      examples/Game/part5/proj.cmake/build_emsc.bat
  28. 2 0
      examples/Game/part5/proj.cmake/build_emsc_release.bat
  29. 5 1
      examples/HelloWorld/proj.android/AndroidManifest.xml
  30. 2 0
      examples/HelloWorld/proj.cmake/build_emsc.bat
  31. 2 0
      examples/HelloWorld/proj.cmake/build_emsc_release.bat
  32. 0 1
      examples/HelloWorld/src/example.cpp
  33. 5 1
      examples/Match3/proj.android/AndroidManifest.xml
  34. 2 0
      examples/Match3/proj.cmake/build_emsc.bat
  35. 2 0
      examples/Match3/proj.cmake/build_emsc_release.bat
  36. BIN
      libs/SDL2.dll
  37. BIN
      libs/SDL2.lib
  38. BIN
      libs/SDL2main.lib
  39. 3 3
      oxygine/SDL/android/extension/build.gradle
  40. 7 7
      oxygine/SDL/android/lib/build.gradle
  41. 39 25
      oxygine/SDL/android/lib/src/org/libsdl/app/SDLActivity.java
  42. 32 2
      oxygine/SDL/android/lib/src/org/oxygine/lib/HttpRequests.java
  43. 7 0
      oxygine/SDL/android/lib/src/org/oxygine/lib/Utils.java
  44. 0 8
      oxygine/SDL/ios/oxygine/oxygine_ios.xcodeproj/project.pbxproj
  45. 0 8
      oxygine/SDL/macosx/oxygine_macosx/oxygine_macosx.xcodeproj/project.pbxproj
  46. 2 2
      oxygine/SDL/win32/oxygine.vcxproj
  47. 6 6
      oxygine/SDL/win32/oxygine.vcxproj.filters
  48. 49 62
      oxygine/src/Actor.cpp
  49. 40 72
      oxygine/src/Actor.h
  50. 11 0
      oxygine/src/AnimationFrame.cpp
  51. 3 5
      oxygine/src/AnimationFrame.h
  52. 6 5
      oxygine/src/AsyncTask.h
  53. 6 6
      oxygine/src/Box9Sprite.cpp
  54. 4 7
      oxygine/src/Box9Sprite.h
  55. 20 11
      oxygine/src/Button.cpp
  56. 4 12
      oxygine/src/Button.h
  57. 5 5
      oxygine/src/ClipRectActor.cpp
  58. 4 7
      oxygine/src/ClipRectActor.h
  59. 1 4
      oxygine/src/Clock.h
  60. 6 1
      oxygine/src/ColorRectSprite.cpp
  61. 8 11
      oxygine/src/ColorRectSprite.h
  62. 68 19
      oxygine/src/DebugActor.cpp
  63. 6 8
      oxygine/src/DebugActor.h
  64. 9 5
      oxygine/src/Draggable.cpp
  65. 3 2
      oxygine/src/Draggable.h
  66. 1 6
      oxygine/src/Event.h
  67. 0 1
      oxygine/src/EventDispatcher.cpp
  68. 11 7
      oxygine/src/EventDispatcher.h
  69. 6 13
      oxygine/src/Font.cpp
  70. 12 10
      oxygine/src/Font.h
  71. 1 4
      oxygine/src/HttpRequestTask.h
  72. 25 0
      oxygine/src/Image.cpp
  73. 6 1
      oxygine/src/Image.h
  74. 17 1
      oxygine/src/Input.cpp
  75. 8 8
      oxygine/src/Input.h
  76. 1 2
      oxygine/src/InputText.h
  77. 1 3
      oxygine/src/MaskedRenderer.h
  78. 3 3
      oxygine/src/MaskedSprite.cpp
  79. 4 10
      oxygine/src/MaskedSprite.h
  80. 1 10
      oxygine/src/Material.h
  81. 3 3
      oxygine/src/PointerState.cpp
  82. 8 9
      oxygine/src/PointerState.h
  83. 4 4
      oxygine/src/Polygon.cpp
  84. 4 12
      oxygine/src/Polygon.h
  85. 12 1
      oxygine/src/PostProcess.cpp
  86. 6 7
      oxygine/src/PostProcess.h
  87. 11 16
      oxygine/src/ProgressBar.cpp
  88. 4 8
      oxygine/src/ProgressBar.h
  89. 1 5
      oxygine/src/RenderState.h
  90. 3 3
      oxygine/src/STDMaterial.cpp
  91. 3 6
      oxygine/src/STDMaterial.h
  92. 2 4
      oxygine/src/STDRenderer.h
  93. 1 5
      oxygine/src/Serializable.h
  94. 1 7
      oxygine/src/Serialize.h
  95. 23 5
      oxygine/src/SlidingActor.cpp
  96. 6 9
      oxygine/src/SlidingActor.h
  97. 22 9
      oxygine/src/Sprite.cpp
  98. 6 12
      oxygine/src/Sprite.h
  99. 2 2
      oxygine/src/Stage.cpp
  100. 3 8
      oxygine/src/Stage.h

+ 3 - 0
.gitignore

@@ -62,3 +62,6 @@ build
 /examples/Demo/proj.cmake/mingw
 **/proj.marmalade/build_demo_vc*
 .DS_Store
+*.VC.db
+*.VC.VC.opendb
+oxygine/SDL/win32/oxygine.vcxproj.user

BIN
doc/doc.zip


BIN
doc/wiki.zip


+ 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" /> 
 

+ 2 - 0
examples/Demo/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/Demo/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 62 - 2
examples/Demo/src/TestDrag.h

@@ -7,10 +7,68 @@ class DraggableSprite: public Sprite
 public:
     DraggableSprite()
     {
-        drag.init(this);
+        //drag.init(this);
     }
 
-    Draggable drag;
+    //Draggable drag;
+    void onEvent(Event* ev)
+    {
+        TouchEvent* te = safeCast<TouchEvent*>(ev);
+        if (te->type == TouchEvent::TOUCH_DOWN)
+        {
+            local = te->localPosition;
+            _stage->addEventListener(TouchEvent::MOVE, CLOSURE(this, &DraggableSprite::onEvent));
+            _stage->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &DraggableSprite::onEvent));
+        }
+
+        if (te->type == TouchEvent::MOVE)
+        {
+            move(te->localPosition);
+        }
+
+        if (te->type == TouchEvent::TOUCH_UP)
+        {
+            _stage->removeEventListeners(this);
+        }
+    }
+
+    void move(const Vector2& pos)
+    {
+        Vector2 localPos = stage2local(pos);
+        Vector2 offset = localPos - local;
+
+        Transform tr = getTransform();
+        tr.x = 0;
+        tr.y = 0;
+        Vector2 p = tr.transform(offset);
+        setPosition(getPosition() + p);
+    }
+
+    void doUpdate(const UpdateState& us)
+    {
+        pointer_index ind = getPressed();
+        if (!ind)
+            return;
+        PointerState* st = Input::instance.getTouchByIndex(ind);
+        move(_stage->parent2local(st->getPosition()));
+    }
+
+
+
+
+
+    void onAdded2Stage()
+    {
+        addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DraggableSprite::onEvent));
+    }
+
+    void onRemovedFromStage()
+    {
+        _stage->removeEventListeners(this);
+    }
+
+
+    Vector2 local;
 };
 
 class DragTest: public Test
@@ -30,6 +88,7 @@ public:
         pos[1] = Vector2(600, 225);
         pos[2] = Vector2(305, 170);
 
+
         for (int i = 0; i < 3; ++i)
         {
             spSprite sprite = new DraggableSprite;
@@ -37,6 +96,7 @@ public:
             sprite->setResAnim(resources.getResAnim("batterfly"));
             sprite->attachTo(content);
 
+
             float angle = scalar::randFloat(0, (float)MATH_PI * 2);
             sprite->setRotation(angle);
             sprite->addTween(Actor::TweenRotation(MATH_PI * 2 + angle), 30000, -1);

+ 2 - 1
examples/Demo/src/TestProgressBar.h

@@ -19,7 +19,8 @@ public:
         bar->setResAnim(resources.getResAnim("bg"));
         bar->setAnchor(Vector2(0.5f, 0.5f));
         bar->setPosition(getSize() / 2);
-        bar->setScale(0.5f);
+
+        //bar->setSize(600, 200);
         content->addChild(bar);
     }
 

+ 29 - 14
examples/Demo/src/TestTouches.h

@@ -1,5 +1,6 @@
 #pragma once
 #include "test.h"
+#include "utils/stringUtils.h"
 
 class TestTouches: public Test
 {
@@ -35,20 +36,28 @@ public:
         tf->setY(5);
         tf->attachTo(orange);
 
-        tf = new TextField;
-        tf->setText("");
-        tf->setColor(Color::Black);
-        tf->setName("state2");
-        tf->setX(35);
-        tf->setY(5);
-        tf->attachTo(orange);
+        for (int i = 0; i < MouseButton_Num; ++i)
+        {
+            tf = new TextField;
+            tf->setText("");
+            tf->setColor(Color::Black);
+            char name[255];
+            safe_sprintf(name, "pressed %d", i);
+            tf->setName(name);
+            tf->setX(5);
+            tf->setY(15 + i * 10);
+            tf->attachTo(orange);
+        }
+
+
+
 
         tf = new TextField;
         tf->setText("");
         tf->setColor(Color::Black);
         tf->setName("local");
         tf->setX(5);
-        tf->setY(25);
+        tf->setY(50);
         tf->setMultiline(true);
         tf->setWidth(orange->getWidth());
         tf->attachTo(orange);
@@ -66,9 +75,14 @@ public:
 
     void onDownUp(Event* ev)
     {
+        TouchEvent* te = safeCast<TouchEvent*>(ev);
         spSprite s = safeSpCast<Sprite>(ev->currentTarget);
-        spTextField tf = s->getChildT<TextField>("state2");
-        tf->setText(ev->type == TouchEvent::TOUCH_DOWN ? "pressed" : "");
+
+        char name[255];
+        safe_sprintf(name, "pressed %d", (int)te->mouseButton);
+
+        spTextField tf = s->getChildT<TextField>(name);
+        tf->setText(ev->type == TouchEvent::TOUCH_DOWN ? name : "");
         updateLocalPos(ev);
     }
 
@@ -110,10 +124,10 @@ public:
         spSprite Green = createRect("Green", Color::Green, Vector2(100, 25), Vector2(100, 150));
         Green->attachTo(Orange);
 
-        spSprite Beige = createRect("Beige", Color::Beige, Vector2(150, 150), Vector2(250, 100));
+        spSprite Beige = createRect("Beige", Color::Beige, Vector2(150, 150), Vector2(260, 100));
         Beige->attachTo(Orange);
 
-        spSprite LightGreen = createRect("LightGreen", Color::LightGreen, Vector2(180, -50), Vector2(50, 200));
+        spSprite LightGreen = createRect("LightGreen", Color::LightGreen, Vector2(180, -50), Vector2(65, 200));
         LightGreen->attachTo(Beige);
 
 
@@ -174,14 +188,15 @@ public:
                      "\n"
                      "current target: %s\n"
                      "local position: %d %d\n"
+                     "button: %d\n"
                      ,
                      n,
                      eventName,
                      te->target->getName().c_str(),
                      (int)te->position.x, (int)te->position.y,
                      te->currentTarget->getName().c_str(),
-                     (int)te->localPosition.x, (int)te->localPosition.y
-
+                     (int)te->localPosition.x, (int)te->localPosition.y,
+                     (int)te->mouseButton
                     );
 
 

+ 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" /> 
 

+ 2 - 0
examples/DemoBox2D/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/DemoBox2D/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 1 - 1
examples/DemoBox2D/src/example.cpp

@@ -183,7 +183,7 @@ public:
 
             spSprite sprite = new Sprite();
             sprite->setResAnim(gameResources.getResAnim("shot"));
-            Vector2 local = actor->global2local(te->localPosition);
+            Vector2 local = actor->parent2local(te->localPosition);
             sprite->setPosition(local);
             sprite->setAnchor(Vector2(0.5f, 0.5f));
             sprite->attachTo(actor);

+ 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" /> 
 

+ 2 - 0
examples/Game/part1/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/Game/part1/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 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" /> 
 

+ 2 - 0
examples/Game/part2/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/Game/part2/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 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" /> 
 

+ 2 - 0
examples/Game/part3/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/Game/part3/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 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" /> 
 

+ 2 - 0
examples/Game/part4/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/Game/part4/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 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" /> 
 

+ 2 - 0
examples/Game/part5/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/Game/part5/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 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" /> 
 

+ 2 - 0
examples/HelloWorld/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/HelloWorld/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

+ 0 - 1
examples/HelloWorld/src/example.cpp

@@ -1,6 +1,5 @@
 #include "oxygine-framework.h"
 #include <functional>
-#include "res/SingleResAnim.h"
 using namespace oxygine;
 
 //it is our resources

+ 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" /> 
 

+ 2 - 0
examples/Match3/proj.cmake/build_emsc.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc

+ 2 - 0
examples/Match3/proj.cmake/build_emsc_release.bat

@@ -1,3 +1,5 @@
+call emsdk activate
+
 python ../../..//tools/others/embed_folder_js.py -s ../data
 
 mkdir build_emsc_release

BIN
libs/SDL2.dll


BIN
libs/SDL2.lib


BIN
libs/SDL2main.lib


+ 3 - 3
oxygine/SDL/android/extension/build.gradle

@@ -10,9 +10,9 @@ buildscript {
 apply plugin: 'com.android.library'
 
 android {
-        compileSdkVersion 23
-  		buildToolsVersion '23.0.3'
-
+        compileSdkVersion rootProject.android.compileSdkVersion
+        buildToolsVersion rootProject.android.buildToolsVersion
+        
         sourceSets {
             main {
                 manifest.srcFile 'AndroidManifest.xml'

+ 7 - 7
oxygine/SDL/android/lib/build.gradle

@@ -11,17 +11,17 @@ apply plugin: 'com.android.library'
 
 dependencies {
         compile project(':oxygine-extension')
-    }
+}
 
 android {
-		lintOptions {
-        	abortOnError false
-    	}
+        lintOptions {
+            abortOnError false
+        }
 
-        compileSdkVersion 23
-  		buildToolsVersion '23.0.2'
+        compileSdkVersion rootProject.android.compileSdkVersion
+        buildToolsVersion rootProject.android.buildToolsVersion
 
-  		sourceSets {
+        sourceSets {
             main {
                 manifest.srcFile 'AndroidManifest.xml'
                 java.srcDirs = ['src']

+ 39 - 25
oxygine/SDL/android/lib/src/org/libsdl/app/SDLActivity.java

@@ -369,7 +369,10 @@ public class SDLActivity extends Activity {
                 break;
             case COMMAND_TEXTEDIT_HIDE:
                 if (mTextEdit != null) {
-                    mTextEdit.setVisibility(View.GONE);
+                    // Note: On some devices setting view to GONE creates a flicker in landscape.
+                    // Setting the View's sizes to 0 is similar to GONE but without the flicker.
+                    // The sizes will be set to useful values when the keyboard is shown again.
+                    mTextEdit.setLayoutParams(new RelativeLayout.LayoutParams(0, 0));
 
                     InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
                     imm.hideSoftInputFromWindow(mTextEdit.getWindowToken(), 0);
@@ -724,6 +727,21 @@ public class SDLActivity extends Activity {
         }
     }
 
+    // Check if a given device is considered a possible SDL joystick
+    public static boolean isDeviceSDLJoystick(int deviceId) {
+        InputDevice device = InputDevice.getDevice(deviceId);
+        // We cannot use InputDevice.isVirtual before API 16, so let's accept
+        // only nonnegative device ids (VIRTUAL_KEYBOARD equals -1)
+        if ((device == null) || (deviceId < 0)) {
+            return false;
+        }
+        int sources = device.getSources();
+        return (((sources & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK) ||
+                ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) ||
+                ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
+        );
+    }
+
     // APK expansion files support
 
     /** com.android.vending.expansion.zipfile.ZipResourceFile object or null. */
@@ -1220,23 +1238,25 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
     @Override
     public boolean onKey(View  v, int keyCode, KeyEvent event) {
         // Dispatch the different events depending on where they come from
-        // Some SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD
-        // So, we try to process them as DPAD or GAMEPAD events first, if that fails we try them as KEYBOARD
-
-        if ( (event.getSource() & InputDevice.SOURCE_GAMEPAD) != 0 ||
-                   (event.getSource() & InputDevice.SOURCE_DPAD) != 0 ) {
+        // Some SOURCE_JOYSTICK, SOURCE_DPAD or SOURCE_GAMEPAD are also SOURCE_KEYBOARD
+        // So, we try to process them as JOYSTICK/DPAD/GAMEPAD events first, if that fails we try them as KEYBOARD
+        //
+        // Furthermore, it's possible a game controller has SOURCE_KEYBOARD and
+        // SOURCE_JOYSTICK, while its key events arrive from the keyboard source
+        // So, retrieve the device itself and check all of its sources
+        if (SDLActivity.isDeviceSDLJoystick(event.getDeviceId())) {
+            // Note that we always process a pressed/released button here, as an unopened
+            // SDL_Joystick's button press should not be processed as a keyboard's key press
             if (event.getAction() == KeyEvent.ACTION_DOWN) {
-                if (SDLActivity.onNativePadDown(event.getDeviceId(), keyCode) == 0) {
-                    return true;
-                }
+                SDLActivity.onNativePadDown(event.getDeviceId(), keyCode);
+                return true;
             } else if (event.getAction() == KeyEvent.ACTION_UP) {
-                if (SDLActivity.onNativePadUp(event.getDeviceId(), keyCode) == 0) {
-                    return true;
-                }
+                SDLActivity.onNativePadUp(event.getDeviceId(), keyCode);
+                return true;
             }
         }
 
-        if( (event.getSource() & InputDevice.SOURCE_KEYBOARD) != 0) {
+        if ((event.getSource() & InputDevice.SOURCE_KEYBOARD) != 0) {
             if (event.getAction() == KeyEvent.ACTION_DOWN) {
                 //Log.v("SDL", "key down: " + keyCode);
                 SDLActivity.onNativeKeyDown(keyCode);
@@ -1395,7 +1415,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
             }
             SDLActivity.onNativeAccel(-x / SensorManager.GRAVITY_EARTH,
                                       y / SensorManager.GRAVITY_EARTH,
-                                      event.values[2] / SensorManager.GRAVITY_EARTH - 1);
+                                      event.values[2] / SensorManager.GRAVITY_EARTH);
         }
     }
 }
@@ -1422,7 +1442,7 @@ class DummyEdit extends View implements View.OnKeyListener {
     public boolean onKey(View v, int keyCode, KeyEvent event) {
 
         // This handles the hardware keyboard input
-        if (event.isPrintingKey()) {
+        if (event.isPrintingKey() || keyCode == KeyEvent.KEYCODE_SPACE) {
             if (event.getAction() == KeyEvent.ACTION_DOWN) {
                 ic.commitText(String.valueOf((char) event.getUnicodeChar()), 1);
             }
@@ -1485,7 +1505,7 @@ class SDLInputConnection extends BaseInputConnection {
          */
         int keyCode = event.getKeyCode();
         if (event.getAction() == KeyEvent.ACTION_DOWN) {
-            if (event.isPrintingKey()) {
+            if (event.isPrintingKey() || keyCode == KeyEvent.KEYCODE_SPACE) {
                 commitText(String.valueOf((char) event.getUnicodeChar()), 1);
             }
             SDLActivity.onNativeKeyDown(keyCode);
@@ -1586,13 +1606,7 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
             if (joystick == null) {
                 joystick = new SDLJoystick();
                 InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]);
-
-                if ( 
-                      (joystickDevice.getSources() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 
-                   ||
-                      (joystickDevice.getSources() & InputDevice.SOURCE_CLASS_BUTTON) != 0 
-                  )
-                {
+                if (SDLActivity.isDeviceSDLJoystick(deviceIds[i])) {
                     joystick.device_id = deviceIds[i];
                     joystick.name = joystickDevice.getName();
                     joystick.axes = new ArrayList<InputDevice.MotionRange>();
@@ -1601,7 +1615,7 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
                     List<InputDevice.MotionRange> ranges = joystickDevice.getMotionRanges();
                     Collections.sort(ranges, new RangeComparator());
                     for (InputDevice.MotionRange range : ranges ) {
-                        if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0 ) {
+                        if ((range.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
                             if (range.getAxis() == MotionEvent.AXIS_HAT_X ||
                                 range.getAxis() == MotionEvent.AXIS_HAT_Y) {
                                 joystick.hats.add(range);
@@ -1655,7 +1669,7 @@ class SDLJoystickHandler_API12 extends SDLJoystickHandler {
 
     @Override
     public boolean handleMotionEvent(MotionEvent event) {
-        if ( (event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) {
+        if ((event.getSource() & InputDevice.SOURCE_JOYSTICK) != 0) {
             int actionPointerIndex = event.getActionIndex();
             int action = event.getActionMasked();
             switch(action) {

+ 32 - 2
oxygine/SDL/android/lib/src/org/oxygine/lib/HttpRequests.java

@@ -104,7 +104,8 @@ class HttpRequest extends AsyncTask<RequestDetails, Integer, String> {
             else
                 connection = (HttpURLConnection) url.openConnection();
 
-
+            connection.setInstanceFollowRedirects(true);
+            
             if (details.postData != null) {
                 connection.setDoOutput(true);
                 //connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
@@ -114,6 +115,35 @@ class HttpRequest extends AsyncTask<RequestDetails, Integer, String> {
 
             //connection.connect();
 
+            /*
+
+            boolean redirect = false;
+
+            int status = conn.getResponseCode();
+            if (status != HttpURLConnection.HTTP_OK) {
+                if (status == HttpURLConnection.HTTP_MOVED_TEMP || status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_SEE_OTHER)
+                    redirect = true;
+            }
+
+            if (redirect) {
+
+                // get redirect url from "location" header field
+                String newUrl = conn.getHeaderField("Location");
+
+                // get the cookie if need, for login
+                String cookies = conn.getHeaderField("Set-Cookie");
+
+                // open the new connnection again
+                conn = (HttpURLConnection) new URL(newUrl).openConnection();
+                conn.setRequestProperty("Cookie", cookies);
+                conn.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
+                conn.addRequestProperty("User-Agent", "Mozilla");
+                conn.addRequestProperty("Referer", "google.com");
+
+                System.out.println("Redirect to URL : " + newUrl);
+            }
+            */
+
             // expect HTTP 200 OK, so we don't mistakenly save error report
             // instead of the file
             if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
@@ -247,7 +277,7 @@ public class HttpRequests {
     }
 
     static public void release() {
-
+        _handler = null;
     }
 
     static public HttpRequestHolder createRequest(String url, String fname, byte[] post, long handle) {

+ 7 - 0
oxygine/SDL/android/lib/src/org/oxygine/lib/Utils.java

@@ -6,6 +6,7 @@ import android.content.Intent;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 import android.net.Uri;
+import android.provider.Settings;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -27,6 +28,12 @@ public class Utils {
         return _context.getPackageName();
     }
 
+    public static String getProperty(String prop) {
+    	if (prop == "ANDROID_ID")
+    		return Settings.Secure.ANDROID_ID;
+        return "";
+    }
+
     public static boolean isNetworkAvailable() {
         if (_context == null)
             return false;

+ 0 - 8
oxygine/SDL/ios/oxygine/oxygine_ios.xcodeproj/project.pbxproj

@@ -115,8 +115,6 @@
 		C3E86FFF16EBC8EB00052915 /* Actor.h in Headers */ = {isa = PBXBuildFile; fileRef = C3E86F5616EBC8EB00052915 /* Actor.h */; };
 		C3E8700016EBC8EB00052915 /* AnimationFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3E86F5716EBC8EB00052915 /* AnimationFrame.cpp */; };
 		C3E8700116EBC8EB00052915 /* AnimationFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = C3E86F5816EBC8EB00052915 /* AnimationFrame.h */; };
-		C3E8700216EBC8EB00052915 /* Blocking.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3E86F5916EBC8EB00052915 /* Blocking.cpp */; };
-		C3E8700316EBC8EB00052915 /* Blocking.h in Headers */ = {isa = PBXBuildFile; fileRef = C3E86F5A16EBC8EB00052915 /* Blocking.h */; };
 		C3E8700416EBC8EB00052915 /* Box9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3E86F5B16EBC8EB00052915 /* Box9Sprite.cpp */; };
 		C3E8700516EBC8EB00052915 /* Box9Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = C3E86F5C16EBC8EB00052915 /* Box9Sprite.h */; };
 		C3E8700616EBC8EB00052915 /* Button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3E86F5D16EBC8EB00052915 /* Button.cpp */; };
@@ -357,8 +355,6 @@
 		C3E86F5616EBC8EB00052915 /* Actor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Actor.h; path = ../../../src/Actor.h; sourceTree = "<group>"; };
 		C3E86F5716EBC8EB00052915 /* AnimationFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AnimationFrame.cpp; path = ../../../src/AnimationFrame.cpp; sourceTree = "<group>"; };
 		C3E86F5816EBC8EB00052915 /* AnimationFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationFrame.h; path = ../../../src/AnimationFrame.h; sourceTree = "<group>"; };
-		C3E86F5916EBC8EB00052915 /* Blocking.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Blocking.cpp; path = ../../../src/Blocking.cpp; sourceTree = "<group>"; };
-		C3E86F5A16EBC8EB00052915 /* Blocking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Blocking.h; path = ../../../src/Blocking.h; sourceTree = "<group>"; };
 		C3E86F5B16EBC8EB00052915 /* Box9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Box9Sprite.cpp; path = ../../../src/Box9Sprite.cpp; sourceTree = "<group>"; };
 		C3E86F5C16EBC8EB00052915 /* Box9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Box9Sprite.h; path = ../../../src/Box9Sprite.h; sourceTree = "<group>"; };
 		C3E86F5D16EBC8EB00052915 /* Button.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Button.cpp; path = ../../../src/Button.cpp; sourceTree = "<group>"; };
@@ -584,7 +580,6 @@
 				C3E86F5516EBC8EB00052915 /* Actor.cpp */,
 				C3E86F5716EBC8EB00052915 /* AnimationFrame.cpp */,
 				9223E3101A5193E000B2770B /* AsyncTask.cpp */,
-				C3E86F5916EBC8EB00052915 /* Blocking.cpp */,
 				C3E86F5B16EBC8EB00052915 /* Box9Sprite.cpp */,
 				C3E86F5D16EBC8EB00052915 /* Button.cpp */,
 				C3E86F5F16EBC8EB00052915 /* ClipRectActor.cpp */,
@@ -625,7 +620,6 @@
 				C3E86F5616EBC8EB00052915 /* Actor.h */,
 				C3E86F5816EBC8EB00052915 /* AnimationFrame.h */,
 				9223E3111A5193E000B2770B /* AsyncTask.h */,
-				C3E86F5A16EBC8EB00052915 /* Blocking.h */,
 				C3E86F5C16EBC8EB00052915 /* Box9Sprite.h */,
 				C3E86F5E16EBC8EB00052915 /* Button.h */,
 				C3E86F6016EBC8EB00052915 /* ClipRectActor.h */,
@@ -894,7 +888,6 @@
 				C3E86FFF16EBC8EB00052915 /* Actor.h in Headers */,
 				9250AFB31C9B14950060A168 /* TweenOutline.h in Headers */,
 				C3E8700116EBC8EB00052915 /* AnimationFrame.h in Headers */,
-				C3E8700316EBC8EB00052915 /* Blocking.h in Headers */,
 				929AF5671C88AA4000D276ED /* ThreadLoader.h in Headers */,
 				9225533A1CAFA4EF00333A1E /* TweenGlow.h in Headers */,
 				C3E8700516EBC8EB00052915 /* Box9Sprite.h in Headers */,
@@ -1077,7 +1070,6 @@
 				C3E86FFE16EBC8EB00052915 /* Actor.cpp in Sources */,
 				922553391CAFA4EF00333A1E /* TweenGlow.cpp in Sources */,
 				C3E8700016EBC8EB00052915 /* AnimationFrame.cpp in Sources */,
-				C3E8700216EBC8EB00052915 /* Blocking.cpp in Sources */,
 				C3E8700416EBC8EB00052915 /* Box9Sprite.cpp in Sources */,
 				C3E8700616EBC8EB00052915 /* Button.cpp in Sources */,
 				0472E37717F8A2D30016A832 /* ioapi_mem.c in Sources */,

+ 0 - 8
oxygine/SDL/macosx/oxygine_macosx/oxygine_macosx.xcodeproj/project.pbxproj

@@ -17,8 +17,6 @@
 		049B56661871F21E00EF3C66 /* Actor.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B55921871F21D00EF3C66 /* Actor.h */; };
 		049B56671871F21E00EF3C66 /* AnimationFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B55931871F21D00EF3C66 /* AnimationFrame.cpp */; };
 		049B56681871F21E00EF3C66 /* AnimationFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B55941871F21D00EF3C66 /* AnimationFrame.h */; };
-		049B56691871F21E00EF3C66 /* blocking.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B55951871F21D00EF3C66 /* blocking.cpp */; };
-		049B566A1871F21E00EF3C66 /* blocking.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B55961871F21D00EF3C66 /* blocking.h */; };
 		049B566B1871F21E00EF3C66 /* Box9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B55971871F21D00EF3C66 /* Box9Sprite.cpp */; };
 		049B566C1871F21E00EF3C66 /* Box9Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 049B55981871F21D00EF3C66 /* Box9Sprite.h */; };
 		049B566D1871F21E00EF3C66 /* Button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 049B55991871F21D00EF3C66 /* Button.cpp */; };
@@ -258,8 +256,6 @@
 		049B55921871F21D00EF3C66 /* Actor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Actor.h; path = ../../../src/Actor.h; sourceTree = "<group>"; };
 		049B55931871F21D00EF3C66 /* AnimationFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AnimationFrame.cpp; path = ../../../src/AnimationFrame.cpp; sourceTree = "<group>"; };
 		049B55941871F21D00EF3C66 /* AnimationFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AnimationFrame.h; path = ../../../src/AnimationFrame.h; sourceTree = "<group>"; };
-		049B55951871F21D00EF3C66 /* blocking.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = blocking.cpp; path = ../../../src/blocking.cpp; sourceTree = "<group>"; };
-		049B55961871F21D00EF3C66 /* blocking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = blocking.h; path = ../../../src/blocking.h; sourceTree = "<group>"; };
 		049B55971871F21D00EF3C66 /* Box9Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Box9Sprite.cpp; path = ../../../src/Box9Sprite.cpp; sourceTree = "<group>"; };
 		049B55981871F21D00EF3C66 /* Box9Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Box9Sprite.h; path = ../../../src/Box9Sprite.h; sourceTree = "<group>"; };
 		049B55991871F21D00EF3C66 /* Button.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Button.cpp; path = ../../../src/Button.cpp; sourceTree = "<group>"; };
@@ -531,7 +527,6 @@
 				049B55911871F21D00EF3C66 /* Actor.cpp */,
 				049B55931871F21D00EF3C66 /* AnimationFrame.cpp */,
 				92CE26711A58ABDC003901D6 /* AsyncTask.cpp */,
-				049B55951871F21D00EF3C66 /* blocking.cpp */,
 				049B55971871F21D00EF3C66 /* Box9Sprite.cpp */,
 				049B55991871F21D00EF3C66 /* Button.cpp */,
 				049B559B1871F21D00EF3C66 /* ClipRectActor.cpp */,
@@ -571,7 +566,6 @@
 				049B55921871F21D00EF3C66 /* Actor.h */,
 				049B55941871F21D00EF3C66 /* AnimationFrame.h */,
 				92CE26721A58ABDC003901D6 /* AsyncTask.h */,
-				049B55961871F21D00EF3C66 /* blocking.h */,
 				049B55981871F21D00EF3C66 /* Box9Sprite.h */,
 				049B559A1871F21D00EF3C66 /* Button.h */,
 				049B559C1871F21D00EF3C66 /* ClipRectActor.h */,
@@ -989,7 +983,6 @@
 				049B57181871F21E00EF3C66 /* AtlasTool.h in Headers */,
 				049B56EA1871F21E00EF3C66 /* oxygine-framework.h in Headers */,
 				049B571F1871F21E00EF3C66 /* VisualStyle.h in Headers */,
-				049B566A1871F21E00EF3C66 /* blocking.h in Headers */,
 				AD14D5621D72B19600182666 /* Image.h in Headers */,
 				923663591A47561500EB65B3 /* Serializable.h in Headers */,
 				049B56741871F21E00EF3C66 /* closure_impl.h in Headers */,
@@ -1133,7 +1126,6 @@
 				049B56BA1871F21E00EF3C66 /* ZipFileSystem.cpp in Sources */,
 				CEC2CFF61C47274C00450163 /* Material.cpp in Sources */,
 				049B56861871F21E00EF3C66 /* VideoDriverGL.cpp in Sources */,
-				049B56691871F21E00EF3C66 /* blocking.cpp in Sources */,
 				049B56AC1871F21E00EF3C66 /* STDFileSystem.cpp in Sources */,
 				049B56C21871F21E00EF3C66 /* TreeInspector.cpp in Sources */,
 				92CE266C1A58AADB003901D6 /* HttpRequestCocoaTask.mm in Sources */,

+ 2 - 2
oxygine/SDL/win32/oxygine.vcxproj

@@ -115,7 +115,6 @@
     <ClCompile Include="..\..\src\Actor.cpp" />
     <ClCompile Include="..\..\src\AnimationFrame.cpp" />
     <ClCompile Include="..\..\src\AsyncTask.cpp" />
-    <ClCompile Include="..\..\src\Blocking.cpp" />
     <ClCompile Include="..\..\src\Box9Sprite.cpp" />
     <ClCompile Include="..\..\src\Button.cpp" />
     <ClCompile Include="..\..\src\ClipRectActor.cpp" />
@@ -219,7 +218,6 @@
     <ClInclude Include="..\..\src\Actor.h" />
     <ClInclude Include="..\..\src\AnimationFrame.h" />
     <ClInclude Include="..\..\src\AsyncTask.h" />
-    <ClInclude Include="..\..\src\Blocking.h" />
     <ClInclude Include="..\..\src\Box9Sprite.h" />
     <ClInclude Include="..\..\src\Button.h" />
     <ClInclude Include="..\..\src\ClipRectActor.h" />
@@ -286,6 +284,8 @@
     <ClInclude Include="..\..\src\minizip\ioapi.h" />
     <ClInclude Include="..\..\src\minizip\ioapi_mem.h" />
     <ClInclude Include="..\..\src\minizip\unzip.h" />
+    <ClInclude Include="..\..\src\oxygine-forwards.h" />
+    <ClInclude Include="..\..\src\oxygine-include.h" />
     <ClInclude Include="..\..\src\PostProcess.h" />
     <ClInclude Include="..\..\src\res\SingleResAnim.h" />
     <ClInclude Include="..\..\src\ThreadLoader.h" />

+ 6 - 6
oxygine/SDL/win32/oxygine.vcxproj.filters

@@ -201,9 +201,6 @@
     <ClCompile Include="..\..\src\AnimationFrame.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\src\Blocking.cpp">
-      <Filter>src</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\Box9Sprite.cpp">
       <Filter>src</Filter>
     </ClCompile>
@@ -569,9 +566,6 @@
     <ClInclude Include="..\..\src\AnimationFrame.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\src\Blocking.h">
-      <Filter>src</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\Box9Sprite.h">
       <Filter>src</Filter>
     </ClInclude>
@@ -755,6 +749,12 @@
     <ClInclude Include="..\..\src\res\SingleResAnim.h">
       <Filter>src\res</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\oxygine-forwards.h">
+      <Filter>src</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\oxygine-include.h">
+      <Filter>src</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="ReadMe.txt" />

+ 49 - 62
oxygine/src/Actor.cpp

@@ -32,16 +32,15 @@ namespace oxygine
         _zOrder(0),
         _scale(1, 1),
         _rotation(0),
-        _flags(flag_visible | flag_touchEnabled | flag_touchChildrenEnabled | flag_childrenRelative | flag_fastTransform),
+        _flags(flag_visible | flag_touchEnabled | flag_touchChildrenEnabled | flag_fastTransform),
         _parent(0),
         _alpha(255),
-        _pressed(0),
-        _overred(0),
         _stage(0),
         _material(0)
     {
         _transform.identity();
         _transformInvert.identity();
+        _pressedOvered = 0;
     }
 
     void Actor::copyFrom(const Actor& src, cloneOptions opt)
@@ -58,8 +57,8 @@ namespace oxygine
         _flags = src._flags;
         _parent = 0;
         _alpha = src._alpha;
-        _overred = 0;
-        _pressed = 0;
+
+        _pressedOvered = 0;
 
         _transform = src._transform;
         _transformInvert = src._transformInvert;
@@ -105,8 +104,6 @@ namespace oxygine
         OX_ASSERT(_stage == 0);
         _stage = stage;
 
-        onAdded2Stage();
-
         spActor actor = _children._first;
         while (actor)
         {
@@ -114,6 +111,8 @@ namespace oxygine
             actor->added2stage(stage);
             actor = next;
         }
+
+        onAdded2Stage();
     }
 
     void Actor::removedFromStage()
@@ -124,8 +123,7 @@ namespace oxygine
         _stage->removeEventListeners(this);
         _stage = 0;
 
-        _pressed = 0;
-        _overred = 0;
+        _pressedOvered = 0;
 
         spActor actor = _children._first;
         while (actor)
@@ -276,9 +274,9 @@ namespace oxygine
         return stream.str();
     }
 
-    pointer_index Actor::getPressed() const
+    pointer_index Actor::getPressed(MouseButton b) const
     {
-        return _pressed;
+        return _pressedButton[b];
     }
 
     pointer_index Actor::getOvered() const
@@ -286,10 +284,15 @@ namespace oxygine
         return _overred;
     }
 
-    void Actor::setNotPressed()
+    void Actor::setNotPressed(MouseButton b)
     {
-        _pressed = 0;
-        _getStage()->removeEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Actor::_onGlobalTouchUpEvent));
+        _pressedButton[b] = 0;
+        if (_pressedOvered == _overred)//!_pressed[0] && !_pressed[1] && !_pressed[2])
+        {
+            Stage* stage = _getStage();
+            if (stage)
+                stage->removeEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Actor::_onGlobalTouchUpEvent));
+        }
 
         updateStatePressed();
     }
@@ -297,10 +300,10 @@ namespace oxygine
     void Actor::_onGlobalTouchUpEvent(Event* ev)
     {
         TouchEvent* te = safeCast<TouchEvent*>(ev);
-        if (te->index != _pressed)
+        if (te->index != _pressedButton[te->mouseButton])
             return;
 
-        setNotPressed();
+        setNotPressed(te->mouseButton);
 
         TouchEvent up = *te;
         up.bubbles = false;
@@ -351,11 +354,12 @@ namespace oxygine
         if (event->type == TouchEvent::TOUCH_DOWN)
         {
             TouchEvent* te = safeCast<TouchEvent*>(event);
-            if (!_pressed)
+            if (!_pressedButton[te->mouseButton])
             {
-                _pressed = te->index;
-                _getStage()->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Actor::_onGlobalTouchUpEvent));
+                if (_pressedOvered == _overred)//!_pressed[0] && !_pressed[1] && !_pressed[2])
+                    _getStage()->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Actor::_onGlobalTouchUpEvent));
 
+                _pressedButton[te->mouseButton] = te->index;
                 updateStatePressed();
             }
         }
@@ -365,21 +369,21 @@ namespace oxygine
         if (event->type == TouchEvent::TOUCH_UP)
         {
             TouchEvent* te = safeCast<TouchEvent*>(event);
-            if (_pressed == te->index)
+            if (_pressedButton[te->mouseButton] == te->index && !te->__clickDispatched)
             {
+                te->__clickDispatched = true;
                 click = *te;
                 click.type = TouchEvent::CLICK;
-                click.bubbles = false;
+                click.bubbles = true;
                 //will be dispatched later after UP
 
-                setNotPressed();
+                setNotPressed(te->mouseButton);
             }
         }
 
 
         EventDispatcher::dispatchEvent(event);
 
-
         if (!event->stopsImmediatePropagation && event->bubbles && !event->stopsPropagation)
         {
             if (_parent)
@@ -387,7 +391,7 @@ namespace oxygine
                 if (TouchEvent::isTouchEvent(event->type))
                 {
                     TouchEvent* me = safeCast<TouchEvent*>(event);
-                    me->localPosition = local2global(me->localPosition);
+                    me->localPosition = local2parent(me->localPosition);
                 }
 
                 event->phase = Event::phase_bubbling;
@@ -418,7 +422,7 @@ namespace oxygine
         {
             TouchEvent* me = safeCast<TouchEvent*>(event);
             originalLocalPos = me->localPosition;
-            me->localPosition = global2local(originalLocalPos);
+            me->localPosition = parent2local(originalLocalPos);
         }
 
         event->phase = Event::phase_capturing;
@@ -730,23 +734,21 @@ namespace oxygine
                      _pos.x, _pos.y);
         }
 
-        if (_flags & flag_childrenRelative)
+        Vector2 offset;
+        if (_flags & flag_anchorInPixels)
         {
-            Vector2 offset;
-            if (_flags & flag_anchorInPixels)
-            {
-                offset.x = -_anchor.x;
-                offset.y = -_anchor.y;
-            }
-            else
-            {
-                offset.x = -float(_size.x * _anchor.x);
-                offset.y = -float(_size.y * _anchor.y);//todo, what to do? (per pixel quality)
-            }
-
-            tr.translate(offset);
+            offset.x = -_anchor.x;
+            offset.y = -_anchor.y;
+        }
+        else
+        {
+            offset.x = -float(_size.x * _anchor.x);
+            offset.y = -float(_size.y * _anchor.y);//todo, what to do? (per pixel quality)
         }
 
+        tr.translate(offset);
+
+
         _transform = tr;
         _flags &= ~flag_transformDirty;
 
@@ -926,6 +928,8 @@ namespace oxygine
 
     void Actor::prependChild(Actor* actor)
     {
+        if (actor == getFirstChild().get())
+            return;
         if (getFirstChild())
             getFirstChild()->insertSiblingBefore(actor);
         else
@@ -1037,13 +1041,13 @@ namespace oxygine
 
     }
 
-    Vector2 Actor::global2local(const Vector2& global) const
+    Vector2 Actor::parent2local(const Vector2& global) const
     {
         const AffineTransform& t = getTransformInvert();
         return t.transform(global);
     }
 
-    Vector2 Actor::local2global(const Vector2& local) const
+    Vector2 Actor::local2parent(const Vector2& local) const
     {
         const AffineTransform& t = getTransform();
         return t.transform(local);
@@ -1133,26 +1137,9 @@ namespace oxygine
         rs.material->render(this, rs);
     }
 
-    RectF Actor::calcDestRectF(const RectF& destRect_, const Vector2& size) const
-    {
-        RectF destRect = destRect_;
-        if (!(_flags & flag_childrenRelative))
-        {
-            Vector2 a;
-
-            if ((_flags & flag_anchorInPixels))
-                a = Vector2(_anchor.x, _anchor.y);
-            else
-                a = Vector2(_anchor.x * size.x, _anchor.y * size.y);
-
-            destRect.pos -= a;
-        }
-        return destRect;
-    }
-
     RectF Actor::getDestRect() const
     {
-        return calcDestRectF(RectF(Vector2(0, 0), getSize()), getSize());
+        return RectF(Vector2(0, 0), getSize());
     }
 
     spTween Actor::_addTween(spTween tween, bool rel)
@@ -1357,7 +1344,7 @@ namespace oxygine
         if (child->getParent() && child->getParent() != parent)
             pos = convert_global2local_(child->getParent(), parent, pos);
 
-        pos = child->global2local(pos);
+        pos = child->parent2local(pos);
         return pos;
     }
 
@@ -1370,7 +1357,7 @@ namespace oxygine
     {
         while (child && child != parent)
         {
-            pos = child->local2global(pos);
+            pos = child->local2parent(pos);
             child = child->getParent();
         }
 
@@ -1442,7 +1429,7 @@ namespace oxygine
         spActor act = actor->getParent();
         while (act && act != mutualParent)
         {
-            pos = act->local2global(pos);
+            pos = act->local2parent(pos);
             act = act->getParent();
         }
 

+ 40 - 72
oxygine/src/Actor.h

@@ -1,5 +1,6 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
+#include "oxygine-forwards.h"
 #include "core/Object.h"
 #include "core/Renderer.h"
 #include "math/Rect.h"
@@ -10,50 +11,8 @@
 #include "TouchEvent.h"
 #include "Tween.h"
 
-
-
 namespace oxygine
 {
-    class Event;
-    typedef char pointer_index;
-
-    typedef unsigned int dumpOptions;
-
-    class RenderState;
-    class UpdateState;
-    class Material;
-
-
-    DECLARE_SMART(Texture, spTexture);
-    DECLARE_SMART(Actor, spActor);
-    DECLARE_SMART(Clock, spClock);
-
-
-    typedef Closure<void (const UpdateState& us)> UpdateCallback;
-    typedef Closure<void (const RenderState& rs)> RenderCallback;
-
-    const int cloneOptionsDoNotCloneClildren = 0x01;
-    const int cloneOptionsResetTransform = 0x02;
-    typedef int cloneOptions;
-    typedef int copyOptions;//deprecated typedef
-
-
-#define DECLARE_COPYCLONE(type) type(const type &src, cloneOptions);\
-    virtual type* clone(cloneOptions opt=0) const {return new type(*this, opt);}\
-
-
-#define DECLARE_COPYCLONE_NEW(type)  type(const type &src, cloneOptions opt = 0){copyFrom(src, opt);}\
-    virtual type* clone(cloneOptions opt=0) const {type *tp = new type(); tp->copyFrom(*this, opt); return tp;}\
-    virtual void copyFrom(const type &src, cloneOptions opt = 0);
-
-#define DECLARE_COPYCLONE_NEW2(type)  type(const type &src, cloneOptions opt = 0);\
-    virtual type* clone(cloneOptions opt=0) const;\
-    virtual void copyFrom(const type &src, cloneOptions opt = 0);
-
-#define CREATE_COPYCLONE_NEW(type) type::type(const type &src, cloneOptions opt){copyFrom(src, opt);}\
-    type* type::clone(cloneOptions opt) const {type *tp = new type(); tp->copyFrom(*this, opt); return tp;}
-
-
     class TweenOptions
     {
     public:
@@ -78,7 +37,9 @@ namespace oxygine
         bool            _detach;
     };
 
-    class Actor : public EventDispatcher, public intrusive_list_item<spActor>, public Serializable
+    DECLARE_SMART(Actor, spActor);
+
+    class Actor: public EventDispatcher, public intrusive_list_item<spActor>, public Serializable
     {
         typedef intrusive_list_item<spActor> intr_list;
     public:
@@ -145,12 +106,11 @@ namespace oxygine
         const spClock&      getClock() const;
         virtual RectF       getDestRect() const;
         /**returns touch id if actor is pressed down*/
-        pointer_index       getPressed() const;
+        pointer_index       getPressed(MouseButton b = MouseButton_Touch) const;
         /**returns touch id if actor is moused overred*/
         pointer_index       getOvered() const;
         bool                getTouchEnabled() const { return (_flags & flag_touchEnabled) != 0; }
         bool                getTouchChildrenEnabled() const { return (_flags & flag_touchChildrenEnabled) != 0; }
-        bool                getChildrenRelative() const {return (_flags & flag_childrenRelative) != 0;;}
         UpdateCallback      getCallbackDoUpdate() const {return _cbDoUpdate;}
         Material*           getMaterial() { return _material; }
         //RenderCallback        getCallbackDoRender() const {return _cbDoRender;}
@@ -193,8 +153,6 @@ namespace oxygine
         void setRotation(float angle);
         /**Sets rotation angle in degrees. Converts internally to radians. (use setRotation!)*/
         void setRotationDegrees(float angle);
-        /**This option is connected with Anchor. By default value is True*/
-        void setChildrenRelative(bool r) {_flags &= ~flag_childrenRelative; if (r) _flags |= flag_childrenRelative;}
 
         /**Sets Size of Actor. Size doesn't scale contents of Actor. Size only affects event handling and rendering if you change Anchor*/
         void setSize(const Vector2&);
@@ -287,13 +245,20 @@ namespace oxygine
         virtual void handleEvent(Event* event);
         virtual void doRender(const RenderState& rs) {}
 
-        //converts global position (position in parent space) to local space
-        Vector2 global2local(const Vector2& pos) const;
+        //converts global position (position in parent space) to local space, deprecated use parent2local
+        OXYGINE_DEPRECATED
+        Vector2 global2local(const Vector2& pos) const { return parent2local(pos); }
+        //converts local position to parent space, deprecated use local2parent
+        OXYGINE_DEPRECATED
+        Vector2 local2global(const Vector2& pos = Vector2(0, 0)) const { return local2parent(pos); }
+
+        //converts position in parent space to local space
+        Vector2 parent2local(const Vector2& pos) const;
         //converts local position to parent space
-        Vector2 local2global(const Vector2& pos) const;
+        Vector2 local2parent(const Vector2& pos = Vector2(0, 0)) const;
 
         //converts local position to Stage
-        Vector2 local2stage(const Vector2& pos, Actor* stage = 0) const;
+        Vector2 local2stage(const Vector2& pos = Vector2(0, 0), Actor* stage = 0) const;
         //converts global position (position in Stage space) to local space
         Vector2 stage2local(const Vector2& pos, Actor* stage = 0) const;
 
@@ -321,7 +286,7 @@ namespace oxygine
         /**Returns Stage where Actor attached to. Used for multi stage (window) mode*/
         Stage*              _getStage();
 
-        void setNotPressed();
+        void setNotPressed(MouseButton b);
 
         bool internalRender(RenderState& rs, const RenderState& parentRS);
 
@@ -350,9 +315,11 @@ namespace oxygine
         static unsigned short& _getFlags(Actor* actor) { return actor->_flags; }
 
         void _onGlobalTouchUpEvent(Event*);
+        void _onGlobalTouchUpEvent1(Event*);
+        void _onGlobalTouchUpEvent2(Event*);
         void _onGlobalTouchMoveEvent(Event*);
 
-        RectF calcDestRectF(const RectF& destRect, const Vector2& size) const;
+        const Vector2& _getSize() const { return _size; }
         void _setSize(const Vector2&);
         virtual void sizeChanged(const Vector2& size);
         Actor*  _getDescendant(const std::string& name);
@@ -378,13 +345,12 @@ namespace oxygine
             flag_anchorInPixels         = 1,
             flag_visible                = 1 << 1,
             flag_touchEnabled           = 1 << 2,
-            flag_childrenRelative       = 1 << 3,
-            flag_transformDirty         = 1 << 4,
-            flag_transformInvertDirty   = 1 << 5,
-            flag_touchChildrenEnabled   = 1 << 6,
-            flag_cull                   = 1 << 7,
-            flag_fastTransform          = 1 << 8,
-            flag_reserved               = 1 << 9,
+            flag_transformDirty         = 1 << 3,
+            flag_transformInvertDirty   = 1 << 4,
+            flag_touchChildrenEnabled   = 1 << 5,
+            flag_cull                   = 1 << 6,
+            flag_fastTransform          = 1 << 7,
+            flag_reserved               = 1 << 8,
             flag_last                   = flag_reserved
         };
 
@@ -400,17 +366,26 @@ namespace oxygine
 
         children _children;
 
-        pointer_index _pressed;
-        pointer_index _overred;
+        union
+        {
+            //dont change order!!! or brake statements: if (_pressedOvered == _overred)
+            struct
+            {
+                pointer_index _overred;
+                pointer_index _pressedButton[MouseButton_Num];
+            };
+            int32_t _pressedOvered;
+        };
+
 
     private:
-        short   _zOrder;
 
         Vector2 _pos;
         Vector2 _anchor;
         Vector2 _scale;
         Vector2 _size;
         float   _rotation;
+        short   _zOrder;
     };
 
     Vector2 convert_local2stage(spActor child, const Vector2& pos, spActor root = 0);
@@ -446,11 +421,4 @@ namespace oxygine
 }
 
 
-#ifdef OX_EDITOR
-#include "EditorActor.h"
-#else
-namespace oxygine
-{
-    typedef Actor _Actor;
-}
-#endif
+EDITOR_INCLUDE(Actor);

+ 11 - 0
oxygine/src/AnimationFrame.cpp

@@ -79,4 +79,15 @@ namespace oxygine
         _srcRect.setY(_srcRect.getBottom());
         _srcRect.setHeight(-_srcRect.getHeight());
     }
+
+    AnimationFrame::AnimationFrame(spNativeTexture t)
+    {
+        _row = _column = 0;
+        _resAnim = 0;
+        _diffuse.base = t;
+        _diffuse.premultiplied = true;
+        _srcRect = RectF(0, 0, 1, 1);
+        _destRect = RectF(0, 0, (float)t->getWidth(), (float)t->getHeight());
+        _frameSize = Vector2((float)t->getWidth(), (float)t->getHeight());
+    }
 }

+ 3 - 5
oxygine/src/AnimationFrame.h

@@ -1,14 +1,11 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "math/Rect.h"
 #include "core/Texture.h"
 #include "core/NativeTexture.h"
 
 namespace oxygine
 {
-    DECLARE_SMART(Texture, spTexture);
-    DECLARE_SMART(NativeTexture, spNativeTexture);
-
     class Diffuse
     {
     public:
@@ -28,11 +25,11 @@ namespace oxygine
         unsigned char pitch;
     };
 
-    class ResAnim;
     class AnimationFrame
     {
     public:
         AnimationFrame() : _srcRect(0, 0, 1, 1), _destRect(0, 0, 1, 1), _resAnim(0), _row(0), _column(0) {}
+        AnimationFrame(spNativeTexture t);
 
         void init(ResAnim* rs, const Diffuse& df,
                   const RectF& srcRect, const RectF& destRect, const Vector2& frame_size);
@@ -60,6 +57,7 @@ namespace oxygine
         void            setResAnim(ResAnim* rs) {_resAnim = rs;}
         void            setDiffuse(const Diffuse& d) { _diffuse = d; }
         void            setSize(const Vector2& size) {_frameSize = size;}
+        void            setSize(float w, float h) { setSize(Vector2(w, h)); }
         void            setHitTestData(const HitTestData& ad) { _hittest = ad; }
         void            setRow(int v) {_row = v;}
         void            setColumn(int v) {_column = v;}

+ 6 - 5
oxygine/src/AsyncTask.h

@@ -1,25 +1,26 @@
 #pragma once
+#include "oxygine-include.h"
 #include "core/ThreadDispatcher.h"
 #include "EventDispatcher.h"
 #include "Event.h"
 
-namespace oxygine
-{
-
 #ifdef ERROR
 #undef ERROR
 #endif
 
+namespace oxygine
+{
     DECLARE_SMART(AsyncTask, spAsyncTask);
 
-    class AsyncTaskEvent : public Event
+    class AsyncTaskEvent: public Event
     {
     public:
         AsyncTaskEvent(eventType type, AsyncTask* t) : Event(type), task(t) {}
         AsyncTask* task;
     };
 
-    class AsyncTask : public EventDispatcher
+
+    class AsyncTask: public EventDispatcher
     {
     public:
         enum

+ 6 - 6
oxygine/src/Box9Sprite.cpp

@@ -14,7 +14,7 @@ namespace oxygine
 {
     void Box9Sprite::copyFrom(const Box9Sprite& src, cloneOptions opt)
     {
-        _Sprite::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
 
         _prepared = src._prepared;
 
@@ -90,7 +90,7 @@ namespace oxygine
     void Box9Sprite::changeAnimFrame(const AnimationFrame& f)
     {
         Vector2 size = getSize();
-        _Sprite::changeAnimFrame(f);
+        inherited::changeAnimFrame(f);
         setSize(size);
     }
 
@@ -121,7 +121,7 @@ namespace oxygine
             attr = resanim->getAttribute("horizontal");
             _horzMode = (StretchMode)attr.as_uint(STRETCHING);
         }
-        _Sprite::animFrameChanged(f);
+        inherited::animFrameChanged(f);
     }
 
     RectF Box9Sprite::getDestRect() const
@@ -274,7 +274,7 @@ namespace oxygine
         stream << "\n";
 
 
-        stream << _Sprite::dump(options);
+        stream << inherited::dump(options);
         return stream.str();
     }
 
@@ -342,7 +342,7 @@ namespace oxygine
 
     void Box9Sprite::serialize(serializedata* data)
     {
-        _Sprite::serialize(data);
+        inherited::serialize(data);
         setAttrV2(data->node, "size", getSize(), Vector2(0, 0));
         data->node.set_name("Box9Sprite");
     }
@@ -351,7 +351,7 @@ namespace oxygine
 
     void Box9Sprite::deserialize(const deserializedata* data)
     {
-        _Sprite::deserialize(data);
+        inherited::deserialize(data);
 
         setSize(attr2Vector2(data->node.attribute("size").as_string()));
     }

+ 4 - 7
oxygine/src/Box9Sprite.h

@@ -1,12 +1,13 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Sprite.h"
 namespace oxygine
 {
     DECLARE_SMART(Box9Sprite, spBox9Sprite);
 
-    class Box9Sprite: public _Sprite
+    class Box9Sprite: public Sprite
     {
+        INHERITED(Sprite);
     public:
         DECLARE_COPYCLONE_NEW(Box9Sprite);
         enum StretchMode
@@ -64,9 +65,5 @@ namespace oxygine
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorBox9Sprite.h"
-#else
-typedef oxygine::Box9Sprite BaseBox9Sprite;
-#endif
 
+EDITOR_INCLUDE(Box9Sprite);

+ 20 - 11
oxygine/src/Button.cpp

@@ -8,7 +8,7 @@ namespace oxygine
 {
     void Button::copyFrom(const Button& src, cloneOptions opt)
     {
-        _Sprite::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
 
         _state = src._state;
         _resAnim = src._resAnim;
@@ -34,15 +34,26 @@ namespace oxygine
     void Button::_mouseEvent(Event* event)
     {
         TouchEvent* me = safeCast<TouchEvent*>(event);
-
-        switch (event->type)
+        if (event->type == TouchEvent::CLICK)
         {
-            case TouchEvent::CLICK:
+            if (me->mouseButton == MouseButton_Left)
             {
                 event->phase = Event::phase_target;
                 event->target = this;
             }
-            break;
+            else
+            {
+                event->stopImmediatePropagation();
+            }
+
+            return;
+        }
+
+        if (me->mouseButton != MouseButton_Left)
+            return;
+
+        switch (event->type)
+        {
             case TouchEvent::OVER:
             {
                 if (!_btnOvered)
@@ -69,8 +80,7 @@ namespace oxygine
                 {
                     _btnPressed = me->index;
                     setState(statePressed);
-
-                    _getStage()->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Button::_mouseEvent));
+                    addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Button::_mouseEvent));
                 }
             }
             break;
@@ -79,8 +89,7 @@ namespace oxygine
                 if (_btnPressed == me->index)
                 {
                     setState(stateNormal);
-                    if (_getStage())
-                        _getStage()->removeEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Button::_mouseEvent));
+                    removeEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &Button::_mouseEvent));
                     _btnPressed = 0;
                 }
             }
@@ -115,9 +124,9 @@ namespace oxygine
             return;
 
         if (_resAnim->getColumns() > s)
-            _Sprite::setAnimFrame(_resAnim->getFrame(s, _row));
+            inherited::setAnimFrame(_resAnim->getFrame(s, _row));
         else
-            _Sprite::setAnimFrame(_resAnim->getFrame(0, _row));
+            inherited::setAnimFrame(_resAnim->getFrame(0, _row));
 
     }
 }

+ 4 - 12
oxygine/src/Button.h

@@ -1,14 +1,13 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Sprite.h"
 namespace oxygine
 {
     DECLARE_SMART(Button, spButton);
 
-    class ResAnim;
-
-    class Button: public _Sprite
+    class Button: public Sprite
     {
+        INHERITED(Sprite);
     public:
         DECLARE_COPYCLONE_NEW(Button);
 
@@ -45,11 +44,4 @@ namespace oxygine
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorButton.h"
-#else
-namespace oxygine
-{
-    typedef Button _Button;
-}
-#endif
+EDITOR_INCLUDE(Button);

+ 5 - 5
oxygine/src/ClipRectActor.cpp

@@ -10,7 +10,7 @@ namespace oxygine
 {
     void ClipRectActor::copyFrom(const ClipRectActor& src, cloneOptions opt)
     {
-        _Actor::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
         _clipping = src._clipping;
     }
 
@@ -29,12 +29,12 @@ namespace oxygine
         if (TouchEvent::isTouchEvent(event->type))
         {
             TouchEvent* te = safeCast<TouchEvent*>(event);
-            Vector2 localPosition = global2local(te->localPosition);
+            Vector2 localPosition = parent2local(te->localPosition);
             if (!isOn(localPosition))
                 return;
         }
 
-        _Actor::handleEvent(event);
+        inherited::handleEvent(event);
     }
 
     void ClipRectActor::render(const RenderState& parentRS)
@@ -44,13 +44,13 @@ namespace oxygine
 
     void ClipRectActor::serialize(serializedata* data)
     {
-        _Actor::serialize(data);
+        inherited::serialize(data);
         pugi::xml_node node = data->node;
         node.set_name("ClipRectActor");
     }
 
     void ClipRectActor::deserialize(const deserializedata* data)
     {
-        _Actor::deserialize(data);
+        inherited::deserialize(data);
     }
 }

+ 4 - 7
oxygine/src/ClipRectActor.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Actor.h"
 
 namespace oxygine
@@ -8,8 +8,9 @@ namespace oxygine
     /**
     ClipRectActor clips all out of bound children. Rotation is not supported
     */
-    class ClipRectActor : public _Actor
+    class ClipRectActor : public Actor
     {
+        INHERITED(Actor);
     public:
         DECLARE_COPYCLONE_NEW(ClipRectActor);
         ClipRectActor();
@@ -34,8 +35,4 @@ namespace oxygine
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorClipRectActor.h"
-#else
-typedef oxygine::ClipRectActor BaseClipRectActor;
-#endif
+EDITOR_INCLUDE(ClipRectActor);

+ 1 - 4
oxygine/src/Clock.h

@@ -1,12 +1,9 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "core/Object.h"
 
 namespace oxygine
 {
-    class UpdateState;
-
-
     DECLARE_SMART(Clock, spClock);
     class Clock: public Object
     {

+ 6 - 1
oxygine/src/ColorRectSprite.cpp

@@ -8,7 +8,7 @@ namespace oxygine
 {
     void ColorRectSprite::copyFrom(const ColorRectSprite& src, cloneOptions opt)
     {
-        _Sprite::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
     }
 
     ColorRectSprite::ColorRectSprite()
@@ -25,6 +25,11 @@ namespace oxygine
         rs.material->doRender(this, rs);
     }
 
+    void ColorRectSprite::sizeChanged(const Vector2& size)
+    {
+        Actor::sizeChanged(size);
+    }
+
     void ColorRectSprite::serialize(serializedata* data)
     {
         VStyleActor::serialize(data);

+ 8 - 11
oxygine/src/ColorRectSprite.h

@@ -1,13 +1,14 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Sprite.h"
 
 namespace oxygine
 {
     DECLARE_SMART(ColorRectSprite, spColorRectSprite);
 
-    class ColorRectSprite: public _Sprite
+    class ColorRectSprite: public Sprite
     {
+        INHERITED(Sprite);
     public:
         DECLARE_COPYCLONE_NEW(ColorRectSprite);
         ColorRectSprite();
@@ -18,15 +19,11 @@ namespace oxygine
 
         void doRender(const RenderState& rs);
 
-    private:
+        RectF getDestRect() const OVERRIDE { return Actor::getDestRect(); }
+
+    protected:
+        void sizeChanged(const Vector2& size) OVERRIDE;
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorColorRectSprite.h"
-#else
-namespace oxygine
-{
-    typedef ColorRectSprite _ColorRectSprite;
-}
-#endif
+EDITOR_INCLUDE(ColorRectSprite);

+ 68 - 19
oxygine/src/DebugActor.cpp

@@ -31,18 +31,31 @@
 #include <stdarg.h>
 #include <iomanip>
 
+
 #ifdef __S3E__
 #include "s3eMemory.h"
 #elif __APPLE__
 #include "core/ios/ios.h"
 #endif
 
+#ifndef __S3E__
+#include "SDL_video.h"
+#endif
+
+#ifdef __WIN32__
+#pragma comment(lib, "psapi.lib") // Added to support GetProcessMemoryInfo()
+#include <windows.h>
+#include <Psapi.h>
+#endif
+
+
 namespace oxygine
 {
     Resources* DebugActor::resSystem = 0;
     file::ZipFileSystem zp;
 
     spDebugActor DebugActor::instance;
+    int _corner = 0;
 
     void DebugActor::initialize()
     {
@@ -54,7 +67,6 @@ namespace oxygine
         zp.setPrefix("system/");
         zp.add(system_data, system_size);
 
-        //file::ZipFileSystem zp;
         file::mount(&zp);
         resSystem = new Resources;
         resSystem->loadXML("system/res.xml", ResourcesLoadOptions().prebuiltFolder("system"));
@@ -92,8 +104,7 @@ namespace oxygine
 
     void DebugActor::setCorner(int corner)
     {
-        if (DebugActor::instance)
-            DebugActor::instance->setCornerPosition(corner);
+        _corner = corner;
     }
 
     void DebugActor::release()
@@ -107,7 +118,7 @@ namespace oxygine
 
     void DebugActor::setCornerPosition(int corner)
     {
-        _corner = corner;
+        setCorner(corner);
     }
 
     void DebugActor::addButton(float& x, const char* name, const char* anim)
@@ -123,7 +134,7 @@ namespace oxygine
         btn->addEventListener(TouchEvent::CLICK, CLOSURE(this, &DebugActor::_btnClicked));
     }
 
-    DebugActor::DebugActor(): _frames(0), _startTime(0), _corner(0), _showTexel2PixelErrors(false), _showTouchedActor(false)
+    DebugActor::DebugActor(): _frames(0), _startTime(0), _showTexel2PixelErrors(false), _showTouchedActor(false), _dragging(false)
     {
         DebugActor::initialize();
 
@@ -183,11 +194,24 @@ namespace oxygine
 
 
         instance = this;
+        /*
+
+        float dpi = 0;
+        float dpi1 = 0;
+        float dpi2 = 0;
+        int ret = SDL_GetDisplayDPI(0, &dpi, &dpi1, &dpi2);
+        {
+            log::messageln("dpi>>>>> %d %f %f %f", ret, dpi, dpi1, dpi2);
+        }
+        */
     }
 
     void DebugActor::onAdded2Stage()
     {
+        _dragging = false;
         _stage->addEventListener(TouchEvent::MOVE, CLOSURE(this, &DebugActor::onDAEvent));
+        _stage->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &DebugActor::onDAEvent));
+        _stage->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &DebugActor::onDAEvent));
     }
 
     void DebugActor::onRemovedFromStage()
@@ -195,13 +219,6 @@ namespace oxygine
         _stage->removeEventListeners(this);
     }
 
-    /*
-    void DebugActor::addDebugString(const string &str)
-    {
-        _debugText += str;
-    }
-    */
-
     void DebugActor::addDebugString(const char* format, ...)
     {
         char buff[1024] = "";
@@ -334,7 +351,8 @@ namespace oxygine
 #if OXYGINE_TRACE_VIDEO_STATS
         int primitives = 0;
         primitives += vstats.elements[IVideoDriver::PT_TRIANGLES] / 3;
-        primitives += vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP] - 2;
+        if (vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP])
+            primitives += vstats.elements[IVideoDriver::PT_TRIANGLE_STRIP] - 2;
         s << "batches=" << aligned(vstats.batches, 3) << " primitives=" << aligned(primitives, 3) << std::endl;
 #endif
 
@@ -348,6 +366,13 @@ namespace oxygine
         s << "memory=" << mem / 1024 << "kb ";
 #endif
 
+#ifdef __WIN32__
+        PROCESS_MEMORY_COUNTERS_EX pmc;
+        GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS*) &pmc, sizeof(pmc));
+        s << "memory=" << pmc.PrivateUsage / 1024 << "kb ";
+
+#endif
+
         if (!_debugText.empty())
         {
             s << "\n";
@@ -379,7 +404,7 @@ namespace oxygine
                 break;
         }
 
-        pos = getStage()->global2local(pos);
+        pos = getStage()->parent2local(pos);
 
         Vector2 realSize = getScaledSize();
         switch (_corner)
@@ -395,10 +420,9 @@ namespace oxygine
                 break;
         }
 
-        setPosition(pos);
+        //setPosition(pos);
         setScale(1.0f / getStage()->getScaleX());
 
-
         RenderState rs = parentRS;
         parentRS.material->finish();
 
@@ -455,8 +479,33 @@ namespace oxygine
     void DebugActor::onDAEvent(Event* ev)
     {
         TouchEvent* t = safeCast<TouchEvent*>(ev);
-        Vector2 loc = stage2local(t->localPosition, _getStage());
-        setAlpha(isOn(loc) ? 64 : 255);
+        Vector2 loc = parent2local(t->localPosition);
+        if (t->type == TouchEvent::MOVE)
+        {
+            setAlpha(isOn(loc) ? 64 : 255);
+
+            if (_dragging)
+            {
+                Transform tr = getTransform();
+                tr.x = 0;
+                tr.y = 0;
+                Vector2 p = tr.transform(_local);
+                setPosition(t->localPosition - p);
+            }
+        }
+
+        if (t->type == TouchEvent::TOUCH_DOWN)
+        {
+            if (isOn(loc))
+            {
+                _local = loc;
+                _dragging = true;
+            }
+        }
+        if (t->type == TouchEvent::TOUCH_UP)
+        {
+            _dragging = false;
+        }
     }
 
     void DebugActor::onEvent(Event* ev)
@@ -470,7 +519,7 @@ namespace oxygine
         cr->addTween(ColorRectSprite::TweenColor(Color(Color::White, 200)), 700, 1, true, 0, Tween::ease_inCubic)->setDetachActor(true);
         actor->addChild(cr);
         std::string dmp = actor->dump(0);
-        log::messageln("touched actor '%s' local pos: (%.0f,%.0f), pos: (%.0f,%.0f)\n%s",
+        log::messageln(">>>>>>>>>>>>>>>>>>>>\ntouched actor '%s' local pos: (%.0f,%.0f), pos: (%.0f,%.0f)\n%s",
                        actor->getName().c_str(),
                        te->localPosition.x, te->localPosition.y,
                        te->position.x, te->position.y,

+ 6 - 8
oxygine/src/DebugActor.h

@@ -1,16 +1,10 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Actor.h"
 
 
 namespace oxygine
 {
-    class ResFontBM;
-    class ResAnim;
-    class Resources;
-
-    DECLARE_SMART(TextField, spTextField);
-    DECLARE_SMART(ColorRectSprite, spColorRectSprite);
     DECLARE_SMART(DebugActor, spDebugActor);
 
     /**DebugActor is helper class. It displays FPS, memory usage, other stats and dev tools buttons*/
@@ -33,6 +27,7 @@ namespace oxygine
         ~DebugActor();
 
         /**where to display DebugActor. 0 - top left, 1 - top right, 2 - bottom right, 3 - bottom left corner*/
+        OXYGINE_DEPRECATED
         void setCornerPosition(int corner);
         //void addDebugString(const string &str);
 
@@ -57,11 +52,14 @@ namespace oxygine
         std::string _debugText;
         int _frames;
         timeMS _startTime;
-        int _corner;
+
 
         bool _showTouchedActor;
         bool _showTexel2PixelErrors;
 
+        bool _dragging;
+        Vector2 _local;
+
         void onEvent(Event* ev);
         void onDAEvent(Event* ev);
     };

+ 9 - 5
oxygine/src/Draggable.cpp

@@ -58,7 +58,8 @@ namespace oxygine
         _clientIsParent(false),
         _dragEnabled(true),
         _pressed(false),
-        _singleDrag(false)
+        _singleDrag(false),
+        _ignoreTouchUp(false)
     {
 
     }
@@ -164,11 +165,14 @@ namespace oxygine
             break;
             case TouchEvent::TOUCH_UP:
             {
-                _pressed = false;
-                _actor->_getStage()->removeEventListeners(this);
-                if (getTimeMS() - _startTm < 2)
+                if (!_ignoreTouchUp)
                 {
-                    _actor->setPosition(_clientPos);
+                    _pressed = false;
+                    _actor->_getStage()->removeEventListeners(this);
+                    if (getTimeMS() - _startTm < 2)
+                    {
+                        _actor->setPosition(_clientPos);
+                    }
                 }
             }
             break;

+ 3 - 2
oxygine/src/Draggable.h

@@ -1,11 +1,10 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Actor.h"
 //#include "Event.h"
 
 namespace oxygine
 {
-    class TouchEvent;
     Vector2 convertPosUp(Actor* src, Actor* dest, const Vector2& pos, bool direction);
     Vector2 convertPosDown(Actor* src, Actor* dest, const Vector2& pos, bool direction);
 
@@ -31,6 +30,7 @@ namespace oxygine
         void setDragBounds(const RectF& bounds);
         /**sets destination drag client. Default value is Actor attached to DragHandler*/
         void setDragClient(Actor* actor);
+        void setIgnoreTouchUp(bool ignore) { _ignoreTouchUp = ignore; }
         void snapClient2Bounds();
 
     protected:
@@ -53,5 +53,6 @@ namespace oxygine
         bool _clientIsParent;
         bool _pressed;
         bool _dragEnabled;
+        bool _ignoreTouchUp;
     };
 }

+ 1 - 6
oxygine/src/Event.h

@@ -1,17 +1,12 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "closure/closure.h"
 #include "Input.h"
 #include "EventDispatcher.h"
 #undef OUT
 
-struct SDL_KeyboardEvent;
-
 namespace oxygine
 {
-    typedef int eventType;
-    DECLARE_SMART(EventDispatcher, spEventDispatcher);
-
     class Event
     {
     public:

+ 0 - 1
oxygine/src/EventDispatcher.cpp

@@ -54,7 +54,6 @@ namespace oxygine
     {
         __doCheck();
 
-        OX_ASSERT(_listeners);
         if (!_listeners)
             return;
 

+ 11 - 7
oxygine/src/EventDispatcher.h

@@ -1,30 +1,34 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include <list>
 #include "core/Object.h"
 #include "closure/closure.h"
 
 namespace oxygine
 {
-    typedef int eventType;
-    class Event;
-
 #define makefourcc(a,b,c,d) ( ((unsigned int)a) | (((unsigned int)b)<< 8) | (((unsigned int)c)<<16) | (((unsigned int)d)<<24))
 
+#ifdef OX_HAS_CPP11
+    inline int error_eventID_should_be_size_of_4_chars(int x) { return x; }
+    constexpr size_t constStringLength(const char* str) { return (*str == 0) ? 0 : constStringLength(str + 1) + 1; }
+    constexpr int EventIDc11(const char* str) { return constStringLength(str) == 4 ? makefourcc(str[0], str[1], str[2], str[3]) : error_eventID_should_be_size_of_4_chars(0); }
+#endif
+
     //eventID('_', '_', '_', '_')
 #define eventID(a,b,c,d) makefourcc(a,b,c,d)
 
     /*sysEventID is used for system Oxygine events, use 'eventID' for custom game events*/
 #define sysEventID(b,c,d) makefourcc(0xA,b,c,d)
 
+#define  EventID(str) EventIDc11(str)
 
-    typedef Closure<void (Event* ev)> EventCallback;
 
     DECLARE_SMART(EventDispatcher, spEventDispatcher);
-    class EventDispatcher: public _Object
+    class EventDispatcher: public Object
     {
+        INHERITED(Object);
     public:
-        EventDispatcher(const EventDispatcher& ed): _Object(ed), _lastID(0), _listeners(0) {}
+        EventDispatcher(const EventDispatcher& ed): inherited(ed), _lastID(0), _listeners(0) {}
         EventDispatcher();
         ~EventDispatcher();
 

+ 6 - 13
oxygine/src/Font.cpp

@@ -32,14 +32,11 @@ namespace oxygine
         _sdf = sdf;
         _size = realSize;
         _baselineDistance = baselineDistance;
-        _lineHeight = lineHeight;
-        //_glyphs.reserve(200);
     }
 
     void Font::addGlyph(const glyph& gl)
     {
         _glyphs.insert(gl);
-        //_glyphs.push_back(gl);
     }
 
     bool glyphFindPred(const glyph& g, int code)
@@ -52,10 +49,11 @@ namespace oxygine
         return ob1.ch < ob2.ch;
     }
 
-    const glyph* Font::findGlyph(int code) const
+    const glyph* Font::findGlyph(int code, const glyphOptions& opt) const
     {
         glyph g;
         g.ch = code;
+        g.opt = opt;
         glyphs::const_iterator it = _glyphs.find(g);
         if (it != _glyphs.end())
         {
@@ -65,18 +63,18 @@ namespace oxygine
         return 0;
     }
 
-    const glyph* Font::getGlyph(int code) const
+    const glyph* Font::getGlyph(int code, const glyphOptions& opt) const
     {
-        const glyph* g = findGlyph(code);
+        const glyph* g = findGlyph(code, opt);
         if (g)
             return g;
 
         glyph gl;
         Font* fn = const_cast<Font*>(this);
-        if (fn->loadGlyph(code, gl))
+        if (fn->loadGlyph(code, gl, opt))
         {
             fn->_glyphs.insert(gl);
-            g = findGlyph(code);
+            g = findGlyph(code, opt);
             OX_ASSERT(g);
         }
 
@@ -98,11 +96,6 @@ namespace oxygine
         return _scale;
     }
 
-    int Font::getLineHeight() const
-    {
-        return _lineHeight;
-    }
-
     bool Font::isSDF() const
     {
         return _sdf;

+ 12 - 10
oxygine/src/Font.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "core/Object.h"
 #include "math/Rect.h"
 #ifdef __S3E__
@@ -7,15 +7,15 @@
 #else
 #include <unordered_set>
 #endif
+
 namespace oxygine
 {
-    DECLARE_SMART(NativeTexture, spNativeTexture);
-
     struct glyph
     {
         RectF src;
 
         int ch;
+        glyphOptions opt;
 
         short sw;
         short sh;
@@ -28,18 +28,21 @@ namespace oxygine
 
         spNativeTexture texture;
 
-        bool operator == (const glyph& r) const {return ch == r.ch;}
+        bool operator == (const glyph& r) const {return ch == r.ch && opt == r.opt;}
+#ifdef __S3E__
         bool operator < (const glyph& r) const { return ch < r.ch; }
+#endif
     };
 
     struct GlyphHasher
     {
         std::size_t operator()(const glyph& k) const
         {
-            return std::hash<int>()(k.ch);
+            return std::hash<int>()(k.ch + k.opt);
         }
     };
 
+
     class Font: public ObjectBase
     {
     public:
@@ -52,18 +55,18 @@ namespace oxygine
         void sortGlyphs() {}
 
         void setScale(float scale) { _scale = scale; }
+        void setBaselineDistance(int d) { _baselineDistance = d; }
 
-        const glyph*    getGlyph(int code) const;
+        const glyph*    getGlyph(int code, const glyphOptions& opt) const;
         int             getBaselineDistance() const;
         int             getSize() const;
         float           getScale() const;
-        int             getLineHeight() const;
         bool            isSDF() const;
 
     protected:
-        const glyph* findGlyph(int code) const;
+        const glyph* findGlyph(int code, const glyphOptions& opt) const;
 
-        virtual bool loadGlyph(int code, glyph&) { return false; }
+        virtual bool loadGlyph(int code, glyph&, const glyphOptions& opt) { return false; }
 
 #ifdef __S3E__
         typedef std::set<glyph> glyphs;
@@ -77,6 +80,5 @@ namespace oxygine
 
         int _size;
         int _baselineDistance;
-        int _lineHeight;
     };
 }

+ 1 - 4
oxygine/src/HttpRequestTask.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "AsyncTask.h"
 #include <vector>
 #include <string>
@@ -75,8 +75,5 @@ namespace oxygine
         bool _cacheEnabled;
         std::vector<unsigned char> _response;
         std::vector<unsigned char> _postData;
-
-        //size_t _loaded;
-        //size_t _total;
     };
 }

+ 25 - 0
oxygine/src/Image.cpp

@@ -555,6 +555,13 @@ namespace oxygine
         memset(&_buffer.front(), 0, _buffer.size());
     }
 
+    void Image::fill(unsigned int val)
+    {
+        if (_buffer.empty())
+            return;
+        memset(&_buffer.front(), val, _buffer.size());
+    }
+
     bool Image::init(file::buffer& buffer, bool premultiplied, TextureFormat format)
     {
         cleanup();
@@ -798,11 +805,29 @@ namespace oxygine
         return lock(lock_read | lock_write, &rect);
     }
 
+    ImageData Image::lock(int x, int y, int w, int h)
+    {
+        return lock(Rect(x, y, w, h));
+    }
+
+    ImageData Image::lock(int x, int y)
+    {
+        return lock(Rect(x, y, _image.w - x, _image.h - y));
+    }
+
     void Image::unlock()
     {
 
     }
 
+    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);

+ 6 - 1
oxygine/src/Image.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "core/Texture.h"
 #include "core/file.h"
 
@@ -35,6 +35,7 @@ namespace oxygine
         //void convert2pot(MemoryTexture &dest);
 
         void fill_zero();
+        void fill(unsigned int val);
 
         unsigned int    getSizeVRAM() const {return (unsigned int)_buffer.size();}
         int             getWidth() const;
@@ -45,7 +46,11 @@ namespace oxygine
         ImageData   lock(lock_flags f = 0, const Rect* pRect = 0);
         ImageData   lock(const Rect* pRect);
         ImageData   lock(const Rect& pRect);
+        ImageData   lock(int x, int y, int w, int h);
+        ImageData   lock(int x, int y);
+
         void        unlock();
+        void        toPOT(Image& dest);
 
         void        updateRegion(int x, int y, const ImageData& data);
         void        apply(const Rect*);

+ 17 - 1
oxygine/src/Input.cpp

@@ -17,6 +17,9 @@ namespace oxygine
 
     void Input::sendPointerButtonEvent(spStage stage, MouseButton button, float x, float y, float pressure, int type, PointerState* ps)
     {
+        if (!_multiTouch && ps->getIndex() != 1 && ps != &_pointerMouse)
+            return;
+
         Vector2 p(x, y);
 
         TouchEvent me(type, true, p);
@@ -43,6 +46,10 @@ namespace oxygine
 
     void Input::sendPointerMotionEvent(spStage stage, float x, float y, float pressure, PointerState* ps)
     {
+
+        if (!_multiTouch && ps->getIndex() != 1 && ps != &_pointerMouse)
+            return;
+
         TouchEvent me(TouchEvent::MOVE, true, Vector2(x, y));
         me.index = ps->getIndex();
         me.pressure = pressure;
@@ -69,6 +76,7 @@ namespace oxygine
         for (int i = 0; i < MAX_TOUCHES; ++i)
             _pointers[i].init(i + 1);
         memset(_ids, 0, sizeof(_ids));
+        _multiTouch = true;
     }
 
     Input::~Input()
@@ -80,8 +88,16 @@ namespace oxygine
     {
     }
 
-    PointerState* Input::getTouchByIndex(int index)
+    void Input::multiTouchEnabled(bool en)
     {
+        _multiTouch = en;
+    }
+
+    PointerState* Input::getTouchByIndex(pointer_index index_)
+    {
+        OX_ASSERT(index_ != 0);
+
+        int index = index_;
         if (index == MAX_TOUCHES + 1)
             return &_pointerMouse;
         index -= 1;

+ 8 - 8
oxygine/src/Input.h

@@ -1,15 +1,11 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "EventDispatcher.h"
 #include "closure/closure.h"
 #include "PointerState.h"
 
 namespace oxygine
 {
-    DECLARE_SMART(Stage, spStage);
-    class Actor;
-    class EventState;
-
     const int MAX_TOUCHES = 17;
 
     class Input
@@ -22,8 +18,10 @@ namespace oxygine
 
         void cleanup();
 
-        /**id should be in range [1, MAX_TOUCHES]*/
-        PointerState* getTouchByIndex(int index);
+        void multiTouchEnabled(bool en);
+
+        /**index should be in range [1, MAX_TOUCHES]*/
+        PointerState* getTouchByIndex(pointer_index index);
 
 #ifndef __S3E__
         int touchID2index(int64 id);
@@ -41,5 +39,7 @@ namespace oxygine
         void sendPointerButtonEvent(spStage, MouseButton button, float x, float y, float pressure, int type, PointerState*);
         void sendPointerMotionEvent(spStage, float x, float y, float pressure, PointerState*);
         void sendPointerWheelEvent(spStage, int scroll, PointerState*);
+
+        bool _multiTouch;
     };
-}
+}

+ 1 - 2
oxygine/src/InputText.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "EventDispatcher.h"
 #include <string>
 
@@ -9,7 +9,6 @@
 
 namespace oxygine
 {
-    DECLARE_SMART(TextField, spTextField);
     DECLARE_SMART(InputText, spInputText);
 
     class InputText: public EventDispatcher

+ 1 - 3
oxygine/src/MaskedRenderer.h

@@ -1,11 +1,9 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "STDRenderer.h"
 
 namespace oxygine
 {
-
-
     class ClipUV
     {
     public:

+ 3 - 3
oxygine/src/MaskedSprite.cpp

@@ -16,7 +16,7 @@ namespace oxygine
 
     void MaskedSprite::copyFrom(const MaskedSprite& src, cloneOptions opt)
     {
-        _Sprite::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
         _useRChannel = src._useRChannel;
         //_mask = src._mask;
     }
@@ -49,13 +49,13 @@ namespace oxygine
 
     void MaskedSprite::serialize(serializedata* data)
     {
-        _Sprite::serialize(data);
+        inherited::serialize(data);
         data->node.set_name("MaskedSprite");
     }
 
     void MaskedSprite::deserialize(const deserializedata* data)
     {
-        _Sprite::deserialize(data);
+        inherited::deserialize(data);
     }
 
     void MaskedSprite::deserializeLink(const deserializeLinkData* data)

+ 4 - 10
oxygine/src/MaskedSprite.h

@@ -1,12 +1,13 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Sprite.h"
 
 namespace oxygine
 {
     DECLARE_SMART(MaskedSprite, spMaskedSprite);
-    class MaskedSprite: public _Sprite
+    class MaskedSprite: public Sprite
     {
+        INHERITED(Sprite);
     public:
         DECLARE_COPYCLONE_NEW(MaskedSprite);
 
@@ -31,11 +32,4 @@ namespace oxygine
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorMaskedSprite.h"
-#else
-namespace oxygine
-{
-    typedef MaskedSprite _MaskedSprite;
-}
-#endif
+EDITOR_INCLUDE(MaskedSprite);

+ 1 - 10
oxygine/src/Material.h

@@ -1,17 +1,8 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 
 namespace oxygine
 {
-    class RenderState;
-    class Actor;
-    class ClipRectActor;
-    class MaskedSprite;
-    class Sprite;
-    class TextField;
-    class ColorRectSprite;
-    class ProgressBar;
-
     class Material
     {
     public:

+ 3 - 3
oxygine/src/PointerState.cpp

@@ -2,14 +2,14 @@
 #include "Actor.h"
 namespace oxygine
 {
-    PointerState::PointerState(): _index(0)
+    PointerState::PointerState(): _index(1)
     {
         init(_index);
     }
 
-    void PointerState::init(int pointerIndex)
+    void PointerState::init(pointer_index index)
     {
-        _index = pointerIndex;
+        _index = index;
         _pressed = 0;
         _position.setZero();
     }

+ 8 - 9
oxygine/src/PointerState.h

@@ -1,19 +1,18 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "math/Vector2.h"
 #include <list>
 
 namespace oxygine
 {
-    class EventState;
-    class Actor;
-
     enum MouseButton
     {
         MouseButton_Touch = 0,
         MouseButton_Left = 0,
         MouseButton_Middle = 1,
-        MouseButton_Right = 2
+        MouseButton_Right = 2,
+        MouseButton_Num = 3
+
     };
 
     class PointerState
@@ -21,17 +20,17 @@ namespace oxygine
     public:
         PointerState();
 
-        void init(int pointerIndex);
+        void init(pointer_index pointerIndex);
 
         bool            isPressed(MouseButton mb = MouseButton_Touch) const;
-        int             getIndex() const {return _index;}
+        pointer_index   getIndex() const {return _index;}
         const Vector2&  getPosition() const {return _position;}
 
     private:
         friend class Input;
 
-        int _index;
-        int _pressed;
         Vector2 _position;
+        int _pressed;
+        pointer_index _index;
     };
 }

+ 4 - 4
oxygine/src/Polygon.cpp

@@ -22,12 +22,12 @@ namespace oxygine
 
     void Polygon::copyFrom(const Polygon& src, cloneOptions opt)
     {
-        _Sprite::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
     }
 
     void Polygon::serialize(serializedata* data)
     {
-        _Sprite::serialize(data);
+        inherited::serialize(data);
 
         pugi::xml_node node = data->node;
         node.set_name("Polygon");
@@ -35,7 +35,7 @@ namespace oxygine
 
     void Polygon::deserialize(const deserializedata* data)
     {
-        _Sprite::deserialize(data);
+        inherited::deserialize(data);
     }
 
     std::string Polygon::dump(const dumpOptions& options) const
@@ -48,7 +48,7 @@ namespace oxygine
             stream << "vertices=" << _verticesSize / _vdecl->size << " ";
         }
 
-        stream << _Sprite::dump(options);
+        stream << inherited::dump(options);
         return stream.str();
     }
 

+ 4 - 12
oxygine/src/Polygon.h

@@ -1,14 +1,13 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Sprite.h"
 
 namespace oxygine
 {
-    class ResAnim;
-
     DECLARE_SMART(Polygon, spPolygon);
-    class Polygon : public _Sprite
+    class Polygon : public Sprite
     {
+        INHERITED(Sprite);
     public:
         DECLARE_COPYCLONE_NEW(Polygon);
 
@@ -35,11 +34,4 @@ namespace oxygine
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorPolygon.h"
-#else
-namespace oxygine
-{
-    typedef Polygon _Polygon;
-}
-#endif
+EDITOR_INCLUDE(Polygon);

+ 12 - 1
oxygine/src/PostProcess.cpp

@@ -280,11 +280,17 @@ namespace oxygine
     }
 
 
+    bool _renderingPP = false;
+    bool isRenderingPostProcessItems()
+    {
+        return _renderingPP;
+    }
 
     void updatePortProcessItems()
     {
         if (!postProcessItems.empty())
         {
+            _renderingPP = true;
             Material::setCurrent(0);
 
             IVideoDriver* driver = IVideoDriver::instance;
@@ -300,6 +306,7 @@ namespace oxygine
 
             postProcessItems.clear();
             driver->setRenderTarget(prevRT);
+            _renderingPP = false;
         }
 
         _rtm.update();
@@ -354,6 +361,9 @@ namespace oxygine
 
     Rect PostProcess::getScreenRect(const Actor& actor) const
     {
+        if (_options._flags & PostProcessOptions::flag_screen)
+            return _screen;
+
         Rect screen;
 
         Rect display(Point(0, 0), core::getDisplaySize());
@@ -395,7 +405,8 @@ namespace oxygine
         Rect vp = _screen;
         vp.pos = Point(0, 0);
         driver->setViewport(vp);
-        driver->clear(0);
+
+        driver->clear(_options._clearColor);
 
 
         RenderState rs;

+ 6 - 7
oxygine/src/PostProcess.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "math/Rect.h"
 #include "core/NativeTexture.h"
 #include "core/Renderer.h"
@@ -8,11 +8,6 @@
 
 namespace oxygine
 {
-    class Actor;
-    class ShaderProgram;
-    class PostProcessOptions;
-
-
     class PostProcessOptions
     {
     public:
@@ -20,16 +15,19 @@ namespace oxygine
         {
             flag_singleR2T = 1,
             flag_fullscreen = 1 << 1,
+            flag_screen = 1 << 2,
         };
 
-        PostProcessOptions(int flags = 0) : _flags(flags), _downscale(1) {}
+        PostProcessOptions(int flags = 0) : _flags(flags), _downscale(1), _clearColor(0, 0, 0, 0) {}
         PostProcessOptions& fullscreen(bool enable = true) { _flags = enable ? (_flags | flag_fullscreen) : (_flags  & (~flag_fullscreen)); return *this; }
         PostProcessOptions& singleRender(bool enable = true) { _flags = enable ? (_flags | flag_singleR2T) : (_flags  & (~flag_singleR2T)); return *this; }
         //loops -(2, 3, 4, ...),  final size: 2^loops
         PostProcessOptions& downscale(int loops = 2) { _downscale = loops; return *this; }
+        PostProcessOptions& clear(const Color& c) { _clearColor = c; return *this; }
 
         int _flags;
         int _downscale;
+        Color _clearColor;
     };
 
 
@@ -122,6 +120,7 @@ namespace oxygine
     RenderTargetsManager& getRTManager();
 
     void updatePortProcessItems();
+    bool isRenderingPostProcessItems();
     void addPostProcessItem(PPTask*);
     void removePostProcessItem(PPTask*);
     void clearPostProcessItems();

+ 11 - 16
oxygine/src/ProgressBar.cpp

@@ -42,7 +42,10 @@ namespace oxygine
 
     ProgressBar::ProgressBar(): _progress(1.0f), _direction(dir_0)
     {
-
+        AnimationFrame f(STDRenderer::white);
+        f.setSize(200, 60);
+        f.setDestRect(RectF(0, 0, 200, 60));
+        setAnimFrame(f);
     }
 
     ProgressBar::~ProgressBar()
@@ -52,7 +55,7 @@ namespace oxygine
 
     void ProgressBar::copyFrom(const ProgressBar& src, cloneOptions opt)
     {
-        _Sprite::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
         _progress = src._progress;
         _direction = src._direction;
         _originalFrame = src._originalFrame;
@@ -62,7 +65,7 @@ namespace oxygine
     {
         _originalFrame = f;
         _update();
-        _Sprite::animFrameChanged(f);
+        inherited::animFrameChanged(f);
     }
 
     void ProgressBar::_update()
@@ -101,11 +104,9 @@ namespace oxygine
 
     void ProgressBar::doRender(const RenderState& rs)
     {
-        if (_progress == 0)
-            return;
         if (((_direction != __dir_radial_ccw) && (_direction != dir_radial_cw)) || (_progress == 1.0f))
         {
-            _Sprite::doRender(rs);
+            inherited::doRender(rs);
             return;
         }
 
@@ -124,7 +125,7 @@ namespace oxygine
             renderer->setBlendMode(getBlendMode());
             renderer->setTexture(df.base, df.alpha, df.premultiplied);
 
-            RectF destRect = _Sprite::getDestRect();
+            RectF destRect = inherited::getDestRect();
 
             RectF srcRect = _frame.getSrcRect();
             float u = srcRect.pos.x;
@@ -344,16 +345,10 @@ namespace oxygine
         }
         stream << " direction=" << dir << "";
 
-        stream << "\n" << _Sprite::dump(options);
+        stream << "\n" << inherited::dump(options);
 
         return stream.str();
     }
-
-    RectF ProgressBar::getDestRect() const
-    {
-        return calcDestRectF(_frame.getDestRect(), _frame.getSize());
-    }
-
     void ProgressBar::setProgress(float f)
     {
         _progress = scalar::clamp(f, 0.0f, 1.0f);
@@ -389,7 +384,7 @@ namespace oxygine
 
     void ProgressBar::serialize(serializedata* data)
     {
-        _Sprite::serialize(data);
+        inherited::serialize(data);
         pugi::xml_node node = data->node;
         data->node.set_name("ProgressBar");
         data->node.append_attribute("progress").set_value(_progress);
@@ -398,7 +393,7 @@ namespace oxygine
 
     void ProgressBar::deserialize(const deserializedata* data)
     {
-        _Sprite::deserialize(data);
+        inherited::deserialize(data);
         _direction = (direction)data->node.attribute("direction").as_int();
         _progress = data->node.attribute("progress").as_float(1.0f);
 

+ 4 - 8
oxygine/src/ProgressBar.h

@@ -1,13 +1,14 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Sprite.h"
 
 namespace oxygine
 {
     DECLARE_SMART(ProgressBar, spProgressBar);
 
-    class ProgressBar: public _Sprite
+    class ProgressBar: public Sprite
     {
+        INHERITED(Sprite);
     public:
         enum { PROGRESS_CHANGED = sysEventID('P', 'C', 'h') };
 
@@ -45,7 +46,6 @@ namespace oxygine
     private:
         void doRender(const RenderState& rs);
 
-        RectF getDestRect() const OVERRIDE;
         virtual void _update();
 
         void animFrameChanged(const AnimationFrame& f);
@@ -56,8 +56,4 @@ namespace oxygine
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorProgressBar.h"
-#else
-typedef oxygine::ProgressBar BaseProgressBar;
-#endif
+EDITOR_INCLUDE(ProgressBar);

+ 1 - 5
oxygine/src/RenderState.h

@@ -1,13 +1,9 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "core/Renderer.h"
 
 namespace oxygine
 {
-    class Color;
-    class Event;
-    class Material;
-
     class RState
     {
     public:

+ 3 - 3
oxygine/src/STDMaterial.cpp

@@ -82,7 +82,7 @@ namespace oxygine
         }
 
         if (vis)
-            actor->_Actor::render(rs);
+            actor->Actor::render(rs);
 
 
         if (actor->getClipping())
@@ -120,14 +120,14 @@ namespace oxygine
             mr.begin(_renderer);
             _renderer = &mr;
             RenderState rs = parentRS;
-            sprite->_Sprite::render(rs);
+            sprite->Sprite::render(rs);
             mr.end();
 
             _renderer = original;
         }
         else
         {
-            sprite->_Sprite::render(parentRS);
+            sprite->Sprite::render(parentRS);
         }
     }
 

+ 3 - 6
oxygine/src/STDMaterial.h

@@ -1,13 +1,11 @@
 #pragma once
+#include "oxygine-include.h"
 #include "STDRenderer.h"
 #include "Material.h"
+
 namespace oxygine
 {
-    class ClipRectActor;
-    class Sprite;
-    class TextField;
-    class ColorRectSprite;
-
+    DECLARE_SMART(STDMaterial, spSTDMaterial);
     class STDMaterial : public Material
     {
     public:
@@ -30,7 +28,6 @@ namespace oxygine
         STDRenderer* getRenderer() { return _renderer; }
 
     protected:
-        //STDRenderer _renderer_;
         STDRenderer* _renderer;
     };
 

+ 2 - 4
oxygine/src/STDRenderer.h

@@ -1,11 +1,9 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "core/Renderer.h"
+
 namespace oxygine
 {
-    class UberShaderProgram;
-    DECLARE_SMART(STDMaterial, spSTDMaterial);
-
     class STDRenderer : public IElementRenderer
     {
     public:

+ 1 - 5
oxygine/src/Serializable.h

@@ -1,12 +1,8 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 
 namespace oxygine
 {
-    struct serializedata;
-    struct deserializedata;
-    struct deserializeLinkData;
-
     class Serializable
     {
     public:

+ 1 - 7
oxygine/src/Serialize.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "core/Object.h"
 #include "pugixml/pugixml.hpp"
 #include "res/ResAnim.h"
@@ -8,12 +8,6 @@
 
 namespace oxygine
 {
-    DECLARE_SMART(Actor, spActor);
-
-    class Resource;
-    class ResAnim;
-    class ResFont;
-
     class creator
     {
     public:

+ 23 - 5
oxygine/src/SlidingActor.cpp

@@ -5,6 +5,7 @@
 //#include "Draggable.h"
 #include "initActor.h"
 #include "Serialize.h"
+#include "Stage.h"
 
 namespace oxygine
 {
@@ -19,6 +20,7 @@ namespace oxygine
         _rad(_defaultTouchThreshold),
         _maxSpeed(250),
         _downTime(0),
+        _ignoreTouchUp(false),
         _lastTime(0), _current(0), _lastIterTime(0),
         _finger(0)
     {
@@ -204,7 +206,7 @@ namespace oxygine
 
     void SlidingActor::handleEvent(Event* event)
     {
-        _Actor::handleEvent(event);
+        inherited::handleEvent(event);
     }
 
     void SlidingActor::_newEvent(Event* event)
@@ -237,7 +239,12 @@ namespace oxygine
 
             case TouchEvent::TOUCH_UP:
             {
-                if (_drag.getDragEnabled() && te->index == _finger)
+                if (_ignoreTouchUp)
+                {
+                    te->stopImmediatePropagation();
+                }
+
+                if (_drag.getDragEnabled() && te->index == _finger && _ignoreTouchUp == false)
                 {
                     _finger = 0;
                     _downTime = 0;
@@ -317,9 +324,20 @@ namespace oxygine
                     if (_holded && (d >= _rad * _rad))
                     {
                         spActor act = safeSpCast<Actor>(_holded);
+
                         while (act && act.get() != _content.get())
                         {
-                            act->setNotPressed();
+                            for (int i = 0; i < MouseButton_Num; ++i)
+                            {
+                                act->setNotPressed((MouseButton)i);
+
+                                TouchEvent ev(TouchEvent::TOUCH_UP, true, Vector2(-100000, -100000));
+                                ev.mouseButton = (MouseButton)i;
+                                ev.index = te->index;
+                                ev.bubbles = false;
+                                act->dispatchEvent(&ev);
+
+                            }
                             act = act->getParent();
                         }
 
@@ -333,13 +351,13 @@ namespace oxygine
 
     void SlidingActor::serialize(serializedata* data)
     {
-        _Actor::serialize(data);
+        inherited::serialize(data);
 
         data->node.set_name("SlidingActor");
     }
 
     void SlidingActor::deserialize(const deserializedata* data)
     {
-        _Actor::deserialize(data);
+        inherited::deserialize(data);
     }
 }

+ 6 - 9
oxygine/src/SlidingActor.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Actor.h"
 #include "math/Vector2.h"
 #include "Draggable.h"
@@ -8,10 +8,9 @@
 namespace oxygine
 {
     DECLARE_SMART(SlidingActor, spSlidingActor);
-    DECLARE_SMART(DragHandler, spDragHandler);
-
-    class SlidingActor: public _Actor
+    class SlidingActor: public Actor
     {
+        INHERITED(Actor);
     public:
         static void setDefaultTouchThreshold(float val);
 
@@ -90,11 +89,9 @@ namespace oxygine
 
         timeMS _lastIterTime;
         pointer_index _finger;
+
+        bool _ignoreTouchUp;
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorSlidingActor.h"
-#else
-typedef oxygine::SlidingActor BaseSlidingActor;
-#endif
+EDITOR_INCLUDE(SlidingActor);

+ 22 - 9
oxygine/src/Sprite.cpp

@@ -9,7 +9,7 @@
 
 namespace oxygine
 {
-    Sprite::Sprite()
+    Sprite::Sprite(): _localScale(1.0f, 1.0f)
     {
 
     }
@@ -26,9 +26,10 @@ namespace oxygine
 
     void Sprite::copyFrom(const Sprite& src, cloneOptions opt)
     {
-        _VStyleActor::copyFrom(src, opt);
+        inherited::copyFrom(src, opt);
 
         _frame = src._frame;
+        _localScale = src._localScale;
         animFrameChanged(_frame);
 
         _vstyle = src._vstyle;
@@ -61,6 +62,9 @@ namespace oxygine
         if (_flags & flag_manageResAnim)
             stream << "manageResAnim=true";
 
+        if (_localScale != Vector2(1.0f, 1.0f))
+            stream << " localScale=(" << _localScale.x << "," << _localScale.y << ")";
+
         stream << Actor::dump(options);
         return stream.str();
     }
@@ -209,7 +213,8 @@ namespace oxygine
             _frame = frame.getFlipped(flipY, flipX);
         else
             _frame = frame;
-        setSize(_frame.getSize());
+        _setSize(_frame.getSize().mult(_localScale));
+
 
         animFrameChanged(_frame);
     }
@@ -219,12 +224,20 @@ namespace oxygine
 
     }
 
-    RectF Sprite::getDestRect() const
+    void Sprite::sizeChanged(const Vector2& size)
     {
-        if (_frame.getDiffuse().base)
-            return calcDestRectF(_frame.getDestRect(), _frame.getSize());
+        Actor::sizeChanged(size);
+        const Vector2& sz = _frame.getSize();
+        _localScale.x = size.x / sz.x;
+        _localScale.y = size.y / sz.y;
+    }
 
-        return Actor::getDestRect();
+    RectF Sprite::getDestRect() const
+    {
+        RectF r = _frame.getDestRect();
+        r.pos = r.pos.mult(_localScale);
+        r.size = r.size.mult(_localScale);
+        return r;
     }
 
 
@@ -235,7 +248,7 @@ namespace oxygine
 
     void Sprite::serialize(serializedata* data)
     {
-        _VStyleActor::serialize(data);
+        inherited::serialize(data);
 
         pugi::xml_node node = data->node;
 
@@ -278,7 +291,7 @@ namespace oxygine
 
     void Sprite::deserialize(const deserializedata* data)
     {
-        _VStyleActor::deserialize(data);
+        inherited::deserialize(data);
 
         pugi::xml_node node = data->node;
         const char* res = node.attribute("resanim").as_string(0);

+ 6 - 12
oxygine/src/Sprite.h

@@ -1,5 +1,5 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "core/Texture.h"
 #include "math/Rect.h"
 #include "res/ResAnim.h"
@@ -10,11 +10,10 @@
 
 namespace oxygine
 {
-    class ResAnim;
-
     DECLARE_SMART(Sprite, spSprite);
-    class Sprite : public _VStyleActor
+    class Sprite : public VStyleActor
     {
+        INHERITED(VStyleActor);
     public:
         DECLARE_COPYCLONE_NEW(Sprite);
 
@@ -65,16 +64,11 @@ namespace oxygine
         };
         virtual void changeAnimFrame(const AnimationFrame& f);
         virtual void animFrameChanged(const AnimationFrame& f);
+        void sizeChanged(const Vector2& size) OVERRIDE;
 
+        Vector2 _localScale;
         AnimationFrame _frame;
     };
 }
 
-#ifdef OX_EDITOR
-#include "EditorSprite.h"
-#else
-namespace oxygine
-{
-    typedef Sprite _Sprite;
-}
-#endif
+EDITOR_INCLUDE(Sprite);

+ 2 - 2
oxygine/src/Stage.cpp

@@ -117,9 +117,9 @@ namespace oxygine
 
     RectF Stage::getDestRect() const
     {
+        OX_ASSERT(0);
         Vector2 s = getSize() + getPosition();
-        RectF r = calcDestRectF(RectF(-getPosition(), s), s);
-        return r;
+        return RectF(-getPosition(), s);
     }
 
     /*

+ 3 - 8
oxygine/src/Stage.h

@@ -1,19 +1,14 @@
 #pragma once
-#include "oxygine_include.h"
+#include "oxygine-include.h"
 #include "Actor.h"
 
-#ifdef OXYGINE_SDL
-typedef struct SDL_Window SDL_Window;
-#endif
-
 
 namespace oxygine
 {
     DECLARE_SMART(Stage, spStage);
-
-    class DebugActor;
-    class Stage : public _Actor
+    class Stage : public Actor
     {
+        INHERITED(Actor);
     public:
         enum
         {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.