Browse Source

fixed emscripten http request
minor

dmuratshin 10 years ago
parent
commit
1e21e305cc

+ 4 - 2
oxygine/src/core/emscripten/HttpRequestEmscriptenTask.cpp

@@ -43,9 +43,11 @@ namespace oxygine
         addRef();
 
         log::messageln("HttpRequestEmscriptenTask::_run %s", _url.c_str());
-        _postData.push_back(0);
+        const char* method = _postData.empty() ? "GET" : "POST";
+        if (!_postData.empty())
+            _postData.push_back(0);
 
-        emscripten_async_wget2_data(_url.c_str(), _postData.empty() ? "GET" : "POST", (char*)&_postData.front(), this, false, onload, onerror, onprogress);
+        emscripten_async_wget2_data(_url.c_str(), method, (char*)&_postData.front(), this, false, onload, onerror, onprogress);
     }
     //int  emscripten_async_wget2_data(const char* url, const char* requesttype, const char* param, void *arg, int free, em_async_wget2_data_onload_func onload, em_async_wget2_data_onerror_func onerror, em_async_wget2_data_onprogress_func onprogress);
     //void emscripten_async_wget2_data(const char* url, const char* requesttype, const char* param, void *arg, int free, void (*onload)(void*, void*, unsigned), void (*onerror)(void*, int, const char*), void (*onprogress)(void*, int, int));

+ 16 - 0
oxygine/src/math/Rect.h

@@ -2,6 +2,7 @@
 #include "oxygine_include.h"
 #include "Vector2.h"
 #include <algorithm>
+#include <limits>
 
 namespace oxygine
 {
@@ -16,6 +17,15 @@ namespace oxygine
         RectT(const point2& Pos, const point2& Size): pos(Pos), size(Size) {}
         RectT(T x, T y, T w, T h): pos(x, y), size(w, h) {}
 
+        static const RectT invalidated()
+        {
+            return RectT(
+                       std::numeric_limits<T>::max() / 2,
+                       std::numeric_limits<T>::max() / 2,
+                       -std::numeric_limits<T>::max(),
+                       -std::numeric_limits<T>::max());
+        }
+
         bool operator == (const RectT& r) const
         {
             return r.pos == pos && r.size == size;
@@ -79,6 +89,12 @@ namespace oxygine
             size.y = std::max(rbA.y, rbB.y) - pos.y;
         }
 
+        void unite(const point2& p)
+        {
+            RectT r(p, point2(0, 0));
+            unite(r);
+        }
+
         point2 getCenter() const {return pos + size / 2;}
         point2 getSize() const {return size;}
         point2 getLeftTop() const {return pos;}

+ 1 - 1
readme/Android.txt

@@ -3,7 +3,7 @@
 =================================================================================================
 How to build. Steps:
 - Install Android NDK (https://developer.android.com/tools/sdk/ndk/index.html) and set it up
-- Install Android SDK (https://developer.android.com/sdk/index.html) - version 16
+- Install Android SDK Tools (https://developer.android.com/intl/ru/sdk/index.html#Other), launch SDK Manager and install Android SDK v16
 - Install apache-ant (http://ant.apache.org/bindownload.cgi)
 - Install JDK version 6/7
 - Configure environment variables properly: