Browse Source

-httprequest could store object
-min

dmuratshin 8 years ago
parent
commit
f97f327e60

+ 10 - 0
oxygine/src/oxygine/HttpRequestTask.cpp

@@ -84,6 +84,16 @@ namespace oxygine
         _setCacheEnabled(enabled);
     }
 
+    spObject HttpRequestTask::getObject() const
+    {
+        return _object;
+    }
+
+    void HttpRequestTask::setObject(spObject obj)
+    {
+        _object = obj;
+    }
+
     void HttpRequestTask::setSuccessOnAnyResponseCode(bool any)
     {
         _responseCodeChecker = any ? _defaultCheckerAny : _defaultChecker200;

+ 4 - 1
oxygine/src/oxygine/HttpRequestTask.h

@@ -48,6 +48,7 @@ namespace oxygine
         const std::string&                  getUrl() const;
         size_t                              getReceivedSize() const;
         size_t                              getExpectedSize() const;
+        spObject                            getObject() const;
 
         /**swap version of getResponse if you want to modify result buffer inplace*/
         void getResponseSwap(std::vector<unsigned char>&);
@@ -59,7 +60,7 @@ namespace oxygine
         void setUrl(const std::string& url);
         void setFileName(const std::string& name, bool continueDownload = false);
         void setCacheEnabled(bool enabled);
-
+        void setObject(spObject obj);
 
         void setResponseCodeChecker(const responseCodeChecker& f) {_responseCodeChecker = f;}
         /**by default only response code == 200 is succeded, other codes are dispatching Event::ERROR*/
@@ -111,6 +112,8 @@ namespace oxygine
         size_t _expectedContentSize;
         size_t _receivedContentSize;
 
+        spObject _object;
+
         bool _continueDownload;
 
         typedef std::vector< std::pair<std::string, std::string> >  headers;

+ 7 - 1
oxygine/src/oxygine/actor/DebugActor.cpp

@@ -492,12 +492,18 @@ namespace oxygine
     {
         TouchEvent* te = safeCast<TouchEvent*>(ev);
         spActor actor = safeSpCast<Actor>(ev->target);
+
+        Transform tr = actor->computeGlobalTransform();
+        //Vector2 lt = actor->local2stage();
+        //Vector2 rb = actor->local2stage(actor->getSize());
+
         spColorRectSprite cr = new ColorRectSprite;
         cr->setTouchEnabled(false);
         cr->setColor(Color(rand() % 255, rand() % 255, rand() % 255, 0));
         cr->setSize(actor->getSize());
         cr->addTween(ColorRectSprite::TweenColor(Color(Color::White, 200)), 700, 1, true, 0, Tween::ease_inCubic)->detachWhenDone();
-        actor->addChild(cr);
+        cr->setTransform(tr);
+        getStage()->addChild(cr);
         std::string dmp = actor->dump(0);
         log::messageln(">>>>>>>>>>>>>>>>>>>>\ntouched actor '%s' local pos: (%.0f,%.0f), pos: (%.0f,%.0f)\n%s",
                        actor->getName().c_str(),