Browse Source

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

dmuratshin 9 years ago
parent
commit
ecbdace7b6

+ 1 - 1
examples/Demo/src/Counter.cpp

@@ -22,7 +22,7 @@ public:
     void setActor(int n, spActor a)
     {
         _sprites[n] = a;
-        a->setUserData((void*)n);
+        a->setUserData((void*)(intptr_t)n);
     }
 
     int getCurrent() const

+ 1 - 1
examples/Demo/src/TestHttp.h

@@ -78,7 +78,7 @@ public:
 
     void onError(Event* event)
     {
-        HttpRequestTask* task = safeCast<HttpRequestTask*>(event->currentTarget.get());
+        //HttpRequestTask* task = safeCast<HttpRequestTask*>(event->currentTarget.get());
         //OX_ASSERT(task->_ref_counter == 2);
     }
 

+ 1 - 1
examples/Demo/src/TestSliding.h

@@ -86,7 +86,7 @@ public:
     void slideBegin(Event* event)
     {
         notify("slideBegin");
-        SlidingActor::SlidingEvent* sd = safeCast<SlidingActor::SlidingEvent*>(event);
+        //SlidingActor::SlidingEvent* sd = safeCast<SlidingActor::SlidingEvent*>(event);
     }
 
     void snap()

+ 2 - 2
examples/Demo/src/TestUserShader2.h

@@ -82,9 +82,9 @@ public:
         driver->setTexture(0, _base);
 
         if (indices <= STDRenderer::indices8.size())
-            driver->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), count, &STDRenderer::indices8.front(), indices, false);
+            driver->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), (unsigned int)count, &STDRenderer::indices8.front(), (unsigned int)indices, false);
         else
-            driver->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), count, &STDRenderer::indices16.front(), indices, true);
+            driver->draw(IVideoDriver::PT_TRIANGLES, _vdecl, &_vertices.front(), (unsigned int)count, &STDRenderer::indices16.front(), (unsigned int)indices, true);
 
         _vertices.clear();
     }

+ 19 - 5
oxygine/src/Input.cpp

@@ -37,7 +37,21 @@ namespace oxygine
 
         if (type == TouchEvent::TOUCH_UP)
         {
-            _ids[ps->getIndex() - 1] = 0;
+			// Remove id and compact the array:
+			//  - stop on first copied zero id
+			//  - if end is reached, zero the last element
+			int i = ps->getIndex() - 1;
+			while (i < MAX_TOUCHES - 1) {
+				if ((_ids[i] = _ids[i + 1]) == 0)
+					break;
+				_pointers[i] = _pointers[i + 1];
+				_pointers[i]._index = i + 1;
+				++i;
+			}
+			if (i == MAX_TOUCHES - 1) {
+	            _ids[i] = 0;
+				_pointers[i].init(i + 1);
+			}
         }
     }
 
@@ -92,12 +106,12 @@ namespace oxygine
     }
 
 #ifndef __S3E__
-    int Input::touchID2index(int id)
+    int Input::touchID2index(int64_t id)
     {
         id += 1;//id could be = 0 ?
         for (int i = 0; i < MAX_TOUCHES; ++i)
         {
-            int& d = _ids[i];
+            int64_t& d = _ids[i];
             int index = i + 1;
             if (d == 0)
             {
@@ -112,9 +126,9 @@ namespace oxygine
         return -1;
     }
 
-    PointerState* Input::getTouchByID(int id)
+    PointerState* Input::getTouchByID(int64_t id)
     {
-        int i = touchID2index(id);
+        int64_t i = touchID2index(id);
         if (i == -1)
             return 0;
         return getTouchByIndex(i);

+ 3 - 3
oxygine/src/Input.h

@@ -26,8 +26,8 @@ namespace oxygine
         PointerState* getTouchByIndex(int index);
 
 #ifndef __S3E__
-        int touchID2index(int id);
-        PointerState* getTouchByID(int id);
+        int touchID2index(int64_t id);
+        PointerState* getTouchByID(int64_t id);
 #endif
 
 
@@ -35,7 +35,7 @@ namespace oxygine
         PointerState _pointers[MAX_TOUCHES];
         PointerState _pointerMouse;
 
-        int _ids[MAX_TOUCHES + 1];
+        int64_t _ids[MAX_TOUCHES + 1];
 
 
         void sendPointerButtonEvent(spStage, MouseButton button, float x, float y, float pressure, int type, PointerState*);

+ 8 - 6
oxygine/src/PointerState.cpp

@@ -4,14 +4,16 @@ namespace oxygine
 {
     PointerState::PointerState(): _index(0)
     {
-        for (int i = 0; i < MouseButton_Count; ++i)
-            _isPressed[i] = false;
+		init(_index);
     }
 
-    void PointerState::init(int ID)
-    {
-        _index = ID;
-    }
+	void PointerState::init(int pointerIndex)
+	{
+		_index = pointerIndex;
+		for (int i = 0; i < MouseButton_Count; ++i)
+			_isPressed[i] = false;
+		_position.setZero();
+	}
 
     bool isFriend22(Actor* actor, Actor* max_parent, Actor* checkParent)
     {

+ 3 - 2
oxygine/src/core/ThreadDispatcher.cpp

@@ -5,16 +5,17 @@
 
 namespace oxygine
 {
+#if 0
     static size_t threadID()
     {
         pthread_t pt = pthread_self();
         return ((size_t*)(&pt))[0];
     }
-
-#if 0
 #define  LOGDN(format, ...)  log::messageln("ThreadMessages(%lu)::" format, threadID(), __VA_ARGS__)
+
 #else
 #define  LOGDN(...)  ((void)0)
+
 #endif
 
 

+ 2 - 0
oxygine/src/core/ios/HttpRequestCocoaTask.mm

@@ -105,10 +105,12 @@ namespace oxygine
         NSURLSessionConfiguration* config = [NSURLSessionConfiguration defaultSessionConfiguration];
         HttpRequests *cls = [[HttpRequests alloc] init];
         _session = [NSURLSession sessionWithConfiguration:config delegate:cls delegateQueue:[[NSOperationQueue alloc] init]];
+		[_session retain];
     }
     
     void HttpRequestTask::release()
     {
+		[_session release];
         _session = 0;
     }
     

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

@@ -691,7 +691,7 @@ namespace oxygine
                         {
                             //log::messageln("SDL_FINGERMOTION");
                             Vector2 pos = convertTouch(event);
-                            PointerState* ps = input->getTouchByID((int)event.tfinger.fingerId);
+                            PointerState* ps = input->getTouchByID((int64_t)event.tfinger.fingerId);
                             if (ps)
                                 input->sendPointerMotionEvent(stage,
                                                               pos.x, pos.y, event.tfinger.pressure, ps);
@@ -706,7 +706,7 @@ namespace oxygine
                         {
                             //log::messageln("SDL_FINGER");
                             Vector2 pos = convertTouch(event);
-                            PointerState* ps = input->getTouchByID((int)event.tfinger.fingerId);
+                            PointerState* ps = input->getTouchByID((int64_t)event.tfinger.fingerId);
                             if (ps)
                                 input->sendPointerButtonEvent(stage,
                                                               MouseButton_Touch,

+ 1 - 1
oxygine/src/oxygine_include.h

@@ -75,7 +75,7 @@ namespace oxygine { namespace log { void error(const char* format, ...); } }
 //assert without log::error
 #ifdef OXYGINE_QT
 #   define OX_ASSERT_NL(x) {Q_ASSERT(x);}
-#elif EMSCRIPTEN
+#elif !OX_DEBUG || EMSCRIPTEN
 #   define OX_ASSERT_NL(x)
 #else
 #   define OX_ASSERT_NL(x) {assert(x);}