Browse Source

- updated Demo to load logo from oxygine
- fixed WebImage alpha channel
minor fixes

dmuratshin 10 years ago
parent
commit
a8b8c7c36a

+ 3 - 3
.hg_archival.txt

@@ -1,6 +1,6 @@
 repo: b6d71054df5712e643a0685bc3ba54b123db5729
-node: 8dec39b5cd7ec6078dfe6ac058c0e57eaf2254b7
+node: c8c8aaff672dd00da7bfbc646b2e280e70c3df63
 branch: default
 latesttag: oldrender
-latesttagdistance: 927
-changessincelatesttag: 1081
+latesttagdistance: 930
+changessincelatesttag: 1084

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

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

+ 8 - 2
examples/Demo/src/test.cpp

@@ -1,6 +1,7 @@
 #include "test.h"
 #include "oxygine-framework.h"
 #include "core/STDFileSystem.h"
+#include "WebImage.h"
 
 Resources Test::resourcesUI;
 file::STDFileSystem extfs(true);
@@ -17,12 +18,16 @@ void Test::init()
     resourcesUI.loadXML("demo/fonts.xml");
 
 
-    spSprite sp = new Sprite;
-    sp->setResAnim(resourcesUI.getResAnim("logo2"));
+    HttpRequestTask::init();
+
+    //load logo from oxygine server
+    spWebImage sp = new WebImage;
+    sp->load("http://oxygine.org/test/logo.png");
     sp->setInputEnabled(false);
     sp->attachTo(getStage());
     sp->setPriority(10);
     sp->setAlpha(128);
+    sp->setSize(150, 107);
 
     sp->setX(getStage()->getWidth() - sp->getWidth());
     sp->setY(getStage()->getHeight() - sp->getHeight());
@@ -33,6 +38,7 @@ void Test::free()
     resourcesUI.free();
     instance->detach();
     instance = 0;
+    HttpRequestTask::release();
 }
 
 class Toggle: public Button

+ 1 - 1
oxygine/src/WebImage.cpp

@@ -55,7 +55,7 @@ namespace oxygine
         _http->getResponseSwap(bf.data);
 
         MemoryTexture mt;
-        if (mt.init(bf))
+        if (mt.init(bf, true))
         {
             ResAnim rs;
             rs.init(&mt);

+ 2 - 1
oxygine/src/core/curl/HttpRequestCurlTask.cpp

@@ -138,7 +138,8 @@ namespace oxygine
 
     void HttpRequestTask::init()
     {
-        OX_ASSERT(!multi_handle);
+        if (multi_handle)
+            return;
         multi_handle = curl_multi_init();
         pthread_create(&_thread, 0, thread, 0);
     }

+ 0 - 117
ref_event.patch

@@ -1,117 +0,0 @@
-diff -r b08c7c8fbf4b oxygine/src/Actor.cpp
---- a/oxygine/src/Actor.cpp	Thu Apr 11 19:02:02 2013 +0600
-+++ b/oxygine/src/Actor.cpp	Thu Apr 11 19:20:22 2013 +0600
-@@ -247,6 +247,8 @@
- 		switch(event->type)
- 		{
- 		case  TouchEvent::TOUCH_DOWN:
-+			setPressed(me->index);
-+			/*
- 			if (isDescendant(act))
- 			{
- 				if (event->phase == Event::phase_target)
-@@ -255,6 +257,11 @@
- 				//_pressed = me->id;
- 				//setPressed(true);
- 			}	
-+			else
-+			{
-+				int q=0;
-+			}
-+			*/
- 			break;
- 		case  TouchEvent::TOUCH_UP:
- 			{
-@@ -264,15 +271,18 @@
- 					{
- 						setPressed(0);			
- 						//it is event from ROOT, convert to local space
--						Vector2 lp = convert_global2local(this, RootActor::instance, me->localPosition);
--						if (isDescendant(act))
-+						
-+						//if (isDescendant(act))
-+						if (me->currentTarget != RootActor::instance)
- 						{
-+							Vector2 lp = convert_global2local(this, RootActor::instance, me->localPosition);
- 							TouchEvent e(TouchEvent::CLICK, true, lp);
- 							e.index = me->index;
- 							dispatchEvent(&e);
- 						}
- 						else
- 						{
-+							//it is event from Root outside of this actor
- 							dispatchEvent(event);
- 						}
- 					}					
-@@ -383,8 +393,8 @@
- 					event->target = this;
- 
- 
--					if (event->type == TouchEvent::TOUCH_DOWN || event->type == TouchEvent::MOVE)
--						_onMouseEvent(event);
-+					//if (event->type == TouchEvent::TOUCH_DOWN || event->type == TouchEvent::MOVE)
-+					_onMouseEvent(event);
- 
- 
- 					dispatchEvent(event);
-diff -r b08c7c8fbf4b oxygine/src/Draggable.cpp
---- a/oxygine/src/Draggable.cpp	Thu Apr 11 19:02:02 2013 +0600
-+++ b/oxygine/src/Draggable.cpp	Thu Apr 11 19:20:22 2013 +0600
-@@ -111,6 +111,7 @@
- 		case TouchEvent::TOUCH_UP:
- 			{
- 				_pressed = false;
-+				event->stopPropagation();
- 				RootActor::instance->removeEventListeners(this);
- 			}
- 			break;
-diff -r b08c7c8fbf4b oxygine/src/SlidingActor.cpp
---- a/oxygine/src/SlidingActor.cpp	Thu Apr 11 19:02:02 2013 +0600
-+++ b/oxygine/src/SlidingActor.cpp	Thu Apr 11 19:20:22 2013 +0600
-@@ -14,14 +14,14 @@
- 		_clip = initActor(new ClipRectActor, 
- 			arg_attachTo = this);
- 
--		_clip->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &SlidingActor::_newEvent));
--		_clip->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &SlidingActor::_newEvent));
--		_clip->addEventListener(TouchEvent::MOVE, CLOSURE(this, &SlidingActor::_newEvent));
-+		
- 	}
- 	
- 	void SlidingActor::destroy()
- 	{
- 		_clip->removeChildren();
-+		if (_content)
-+			_content->removeEventListeners(this);
- 
- 		_drag.destroy();
- 		_content = 0; 
-@@ -69,6 +69,10 @@
- 		
- 		_clip->addChild(_content);
- 
-+		_content->addEventListener(TouchEvent::TOUCH_DOWN, CLOSURE(this, &SlidingActor::_newEvent));
-+		_content->addEventListener(TouchEvent::TOUCH_UP, CLOSURE(this, &SlidingActor::_newEvent));
-+		_content->addEventListener(TouchEvent::MOVE, CLOSURE(this, &SlidingActor::_newEvent));
-+
- 		updateDragBounds();
- 	}
- 
-@@ -198,7 +202,7 @@
- 		{
- 		case TouchEvent::TOUCH_DOWN:
- 			_holded = event->target;
--			_downPos = te->localPosition;
-+			_downPos = _content->local2global(te->localPosition);
- 			_down = true;
- 			break;
- 
-@@ -213,7 +217,7 @@
- 
- 		case TouchEvent::MOVE:
- 			{
--				Vector2 offset = _downPos - te->localPosition;
-+				Vector2 offset = _downPos - _content->local2global(te->localPosition);
- 				float d = offset.dot(offset);
- 				if (_holded && (d >= _rad * _rad))
- 				{