mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into developNewUI
This commit is contained in:
commit
c4588722dd
3
AUTHORS
3
AUTHORS
|
@ -695,6 +695,9 @@ Developers:
|
||||||
kicktheken (Kenneth Chan)
|
kicktheken (Kenneth Chan)
|
||||||
Fixed a bug that the setBlendFunc method of some classes wasn't exposed to LUA.
|
Fixed a bug that the setBlendFunc method of some classes wasn't exposed to LUA.
|
||||||
|
|
||||||
|
andyque
|
||||||
|
Fixed a bug that missing to check self assignment of Vector<T>, Map<K,V>, Value and String.
|
||||||
|
|
||||||
Retired Core Developers:
|
Retired Core Developers:
|
||||||
WenSheng Yang
|
WenSheng Yang
|
||||||
Author of windows port, CCTextField,
|
Author of windows port, CCTextField,
|
||||||
|
|
|
@ -21,6 +21,7 @@ cocos2d-x-3.0beta0 ?? 2013
|
||||||
[NEW] AngelCode binary file format support for LabelBMFont.
|
[NEW] AngelCode binary file format support for LabelBMFont.
|
||||||
[FIX] OpenAL context isn't destroyed correctly on mac and ios.
|
[FIX] OpenAL context isn't destroyed correctly on mac and ios.
|
||||||
[FIX] Useless conversion in ScrollView::onTouchBegan.
|
[FIX] Useless conversion in ScrollView::onTouchBegan.
|
||||||
|
[FIX] Two memory leak fixes in EventDispatcher::removeEventListener(s).
|
||||||
[Android]
|
[Android]
|
||||||
[NEW] build/android-build.sh: add supporting to generate .apk file
|
[NEW] build/android-build.sh: add supporting to generate .apk file
|
||||||
[FIX] XMLHttpRequest receives wrong binary array.
|
[FIX] XMLHttpRequest receives wrong binary array.
|
||||||
|
|
|
@ -205,7 +205,6 @@ LOCAL_EXPORT_LDLIBS := -lGLESv2 \
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static
|
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
|
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static
|
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
|
|
||||||
|
|
||||||
# define the macro to compile through support/zip_support/ioapi.c
|
# define the macro to compile through support/zip_support/ioapi.c
|
||||||
LOCAL_CFLAGS := -Wno-psabi -DUSE_FILE32API
|
LOCAL_CFLAGS := -Wno-psabi -DUSE_FILE32API
|
||||||
|
@ -218,4 +217,3 @@ include $(BUILD_STATIC_LIBRARY)
|
||||||
$(call import-module,freetype2/prebuilt/android)
|
$(call import-module,freetype2/prebuilt/android)
|
||||||
$(call import-module,chipmunk)
|
$(call import-module,chipmunk)
|
||||||
$(call import-module,2d/platform/android)
|
$(call import-module,2d/platform/android)
|
||||||
$(call import-module,editor-support/spine)
|
|
||||||
|
|
|
@ -462,6 +462,7 @@ void EventDispatcher::removeEventListener(EventListener* listener)
|
||||||
{
|
{
|
||||||
if (*iter == listener)
|
if (*iter == listener)
|
||||||
{
|
{
|
||||||
|
listener->release();
|
||||||
_toAddedListeners.erase(iter);
|
_toAddedListeners.erase(iter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1070,10 +1071,11 @@ void EventDispatcher::removeEventListenersForListenerID(const EventListener::Lis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto iter = _toAddedListeners.begin(); iter != _toAddedListeners.end();)
|
for (auto iter = _toAddedListeners.begin(); iter != _toAddedListeners.end();)
|
||||||
{
|
{
|
||||||
if ((*iter)->getListenerID() == listenerID)
|
if ((*iter)->getListenerID() == listenerID)
|
||||||
{
|
{
|
||||||
|
(*iter)->release();
|
||||||
iter = _toAddedListeners.erase(iter);
|
iter = _toAddedListeners.erase(iter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -92,7 +92,7 @@ std::string TextureCache::getDescription() const
|
||||||
return StringUtils::format("<TextureCache | Number of textures = %zd>", _textures.size());
|
return StringUtils::format("<TextureCache | Number of textures = %zd>", _textures.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCache::addImageAsync(const std::string &path, Object *target, SEL_CallFuncO selector)
|
void TextureCache::addImageAsync(const std::string &path, std::function<void(Texture2D*)> callback)
|
||||||
{
|
{
|
||||||
Texture2D *texture = nullptr;
|
Texture2D *texture = nullptr;
|
||||||
|
|
||||||
|
@ -102,9 +102,9 @@ void TextureCache::addImageAsync(const std::string &path, Object *target, SEL_Ca
|
||||||
if( it != _textures.end() )
|
if( it != _textures.end() )
|
||||||
texture = it->second;
|
texture = it->second;
|
||||||
|
|
||||||
if (texture != nullptr && target && selector)
|
if (texture != nullptr)
|
||||||
{
|
{
|
||||||
(target->*selector)(texture);
|
callback(texture);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,13 +127,8 @@ void TextureCache::addImageAsync(const std::string &path, Object *target, SEL_Ca
|
||||||
|
|
||||||
++_asyncRefCount;
|
++_asyncRefCount;
|
||||||
|
|
||||||
if (target)
|
|
||||||
{
|
|
||||||
target->retain();
|
|
||||||
}
|
|
||||||
|
|
||||||
// generate async struct
|
// generate async struct
|
||||||
AsyncStruct *data = new AsyncStruct(fullpath, target, selector);
|
AsyncStruct *data = new AsyncStruct(fullpath, callback);
|
||||||
|
|
||||||
// add async struct into queue
|
// add async struct into queue
|
||||||
_asyncStructQueueMutex.lock();
|
_asyncStructQueueMutex.lock();
|
||||||
|
@ -243,8 +238,6 @@ void TextureCache::addImageAsyncCallBack(float dt)
|
||||||
AsyncStruct *asyncStruct = imageInfo->asyncStruct;
|
AsyncStruct *asyncStruct = imageInfo->asyncStruct;
|
||||||
Image *image = imageInfo->image;
|
Image *image = imageInfo->image;
|
||||||
|
|
||||||
Object *target = asyncStruct->target;
|
|
||||||
SEL_CallFuncO selector = asyncStruct->selector;
|
|
||||||
const std::string& filename = asyncStruct->filename;
|
const std::string& filename = asyncStruct->filename;
|
||||||
|
|
||||||
Texture2D *texture = nullptr;
|
Texture2D *texture = nullptr;
|
||||||
|
@ -272,11 +265,7 @@ void TextureCache::addImageAsyncCallBack(float dt)
|
||||||
texture = it->second;
|
texture = it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target && selector)
|
asyncStruct->callback(texture);
|
||||||
{
|
|
||||||
(target->*selector)(texture);
|
|
||||||
target->release();
|
|
||||||
}
|
|
||||||
if(image)
|
if(image)
|
||||||
{
|
{
|
||||||
image->release();
|
image->release();
|
||||||
|
|
|
@ -34,6 +34,7 @@ THE SOFTWARE.
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include "CCObject.h"
|
#include "CCObject.h"
|
||||||
#include "CCTexture2D.h"
|
#include "CCTexture2D.h"
|
||||||
|
@ -115,7 +116,7 @@ public:
|
||||||
* Supported image extensions: .png, .jpg
|
* Supported image extensions: .png, .jpg
|
||||||
* @since v0.8
|
* @since v0.8
|
||||||
*/
|
*/
|
||||||
virtual void addImageAsync(const std::string &filepath, Object *target, SEL_CallFuncO selector);
|
virtual void addImageAsync(const std::string &filepath, std::function<void(Texture2D*)> callback);
|
||||||
|
|
||||||
/** Returns a Texture2D object given an Image.
|
/** Returns a Texture2D object given an Image.
|
||||||
* If the image was not previously loaded, it will create a new Texture2D object and it will return it.
|
* If the image was not previously loaded, it will create a new Texture2D object and it will return it.
|
||||||
|
@ -175,11 +176,10 @@ public:
|
||||||
struct AsyncStruct
|
struct AsyncStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AsyncStruct(const std::string& fn, Object *t, SEL_CallFuncO s) : filename(fn), target(t), selector(s) {}
|
AsyncStruct(const std::string& fn, std::function<void(Texture2D*)> f) : filename(fn), callback(f) {}
|
||||||
|
|
||||||
std::string filename;
|
std::string filename;
|
||||||
Object *target;
|
std::function<void(Texture2D*)> callback;
|
||||||
SEL_CallFuncO selector;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -316,18 +316,22 @@ public:
|
||||||
/** Copy assignment operator */
|
/** Copy assignment operator */
|
||||||
Map<K, V>& operator= ( const Map<K, V>& other )
|
Map<K, V>& operator= ( const Map<K, V>& other )
|
||||||
{
|
{
|
||||||
|
if (this != &other) {
|
||||||
CCLOGINFO("In the copy assignment operator of Map!");
|
CCLOGINFO("In the copy assignment operator of Map!");
|
||||||
clear();
|
clear();
|
||||||
_data = other._data;
|
_data = other._data;
|
||||||
addRefForAllObjects();
|
addRefForAllObjects();
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move assignment operator */
|
/** Move assignment operator */
|
||||||
Map<K, V>& operator= ( Map<K, V>&& other )
|
Map<K, V>& operator= ( Map<K, V>&& other )
|
||||||
{
|
{
|
||||||
|
if (this != &other) {
|
||||||
CCLOGINFO("In the move assignment operator of Map!");
|
CCLOGINFO("In the move assignment operator of Map!");
|
||||||
_data = std::move(other._data);
|
_data = std::move(other._data);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,9 @@ __String::~__String()
|
||||||
|
|
||||||
__String& __String::operator= (const __String& other)
|
__String& __String::operator= (const __String& other)
|
||||||
{
|
{
|
||||||
|
if (this != &other) {
|
||||||
_string = other._string;
|
_string = other._string;
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,7 @@ Value::~Value()
|
||||||
|
|
||||||
Value& Value::operator= (const Value& other)
|
Value& Value::operator= (const Value& other)
|
||||||
{
|
{
|
||||||
|
if (this != &other) {
|
||||||
switch (other._type) {
|
switch (other._type) {
|
||||||
case Type::BYTE:
|
case Type::BYTE:
|
||||||
_baseData.byteVal = other._baseData.byteVal;
|
_baseData.byteVal = other._baseData.byteVal;
|
||||||
|
@ -216,11 +217,13 @@ Value& Value::operator= (const Value& other)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_type = other._type;
|
_type = other._type;
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value& Value::operator= (Value&& other)
|
Value& Value::operator= (Value&& other)
|
||||||
{
|
{
|
||||||
|
if (this != &other) {
|
||||||
switch (other._type) {
|
switch (other._type) {
|
||||||
case Type::BYTE:
|
case Type::BYTE:
|
||||||
_baseData.byteVal = other._baseData.byteVal;
|
_baseData.byteVal = other._baseData.byteVal;
|
||||||
|
@ -261,6 +264,7 @@ Value& Value::operator= (Value&& other)
|
||||||
other._mapData = nullptr;
|
other._mapData = nullptr;
|
||||||
other._intKeyMapData = nullptr;
|
other._intKeyMapData = nullptr;
|
||||||
other._type = Type::NONE;
|
other._type = Type::NONE;
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,18 +107,22 @@ public:
|
||||||
/** Copy assignment operator */
|
/** Copy assignment operator */
|
||||||
Vector<T>& operator=(const Vector<T>& other)
|
Vector<T>& operator=(const Vector<T>& other)
|
||||||
{
|
{
|
||||||
|
if (this != &other) {
|
||||||
CCLOGINFO("In the copy assignment operator!");
|
CCLOGINFO("In the copy assignment operator!");
|
||||||
clear();
|
clear();
|
||||||
_data = other._data;
|
_data = other._data;
|
||||||
addRefForAllObjects();
|
addRefForAllObjects();
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move assignment operator */
|
/** Move assignment operator */
|
||||||
Vector<T>& operator=(Vector<T>&& other)
|
Vector<T>& operator=(Vector<T>&& other)
|
||||||
{
|
{
|
||||||
|
if (this != &other) {
|
||||||
CCLOGINFO("In the move assignment operator!");
|
CCLOGINFO("In the move assignment operator!");
|
||||||
_data = std::move(other._data);
|
_data = std::move(other._data);
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include "platform/CCFileUtils.h"
|
#include "platform/CCFileUtils.h"
|
||||||
|
|
||||||
using namespace cocos2d;
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
|
@ -501,4 +501,6 @@ void HttpClient::dispatchResponseCallbacks()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include "network/HttpResponse.h"
|
#include "network/HttpResponse.h"
|
||||||
#include "network/HttpClient.h"
|
#include "network/HttpClient.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,4 +115,6 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
#endif //__CCHTTPREQUEST_H__
|
#endif //__CCHTTPREQUEST_H__
|
||||||
|
|
|
@ -27,12 +27,14 @@
|
||||||
|
|
||||||
#include "cocos2d.h"
|
#include "cocos2d.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
class HttpClient;
|
class HttpClient;
|
||||||
class HttpResponse;
|
class HttpResponse;
|
||||||
typedef void (cocos2d::Object::*SEL_HttpResponse)(HttpClient* client, HttpResponse* response);
|
typedef void (cocos2d::Object::*SEL_HttpResponse)(HttpClient* client, HttpResponse* response);
|
||||||
#define httpresponse_selector(_SELECTOR) (network::SEL_HttpResponse)(&_SELECTOR)
|
#define httpresponse_selector(_SELECTOR) (cocos2d::network::SEL_HttpResponse)(&_SELECTOR)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief defines the object which users must packed for HttpClient::send(HttpRequest*) method.
|
@brief defines the object which users must packed for HttpClient::send(HttpRequest*) method.
|
||||||
|
@ -231,4 +233,6 @@ protected:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
#endif //__HTTP_REQUEST_H__
|
#endif //__HTTP_REQUEST_H__
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "cocos2d.h"
|
#include "cocos2d.h"
|
||||||
#include "network/HttpRequest.h"
|
#include "network/HttpRequest.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,4 +181,6 @@ protected:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
#endif //__HTTP_RESPONSE_H__
|
#endif //__HTTP_RESPONSE_H__
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include "HttpClient.h"
|
#include "HttpClient.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace cocos2d;
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
|
@ -688,3 +688,5 @@ void SocketIO::removeSocket(const std::string& uri)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
|
@ -61,6 +61,8 @@ in the onClose method the pointer should be set to NULL or used to connect to a
|
||||||
|
|
||||||
#include "cocos2d.h"
|
#include "cocos2d.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
//forward declarations
|
//forward declarations
|
||||||
|
@ -185,4 +187,6 @@ public:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
#endif /* defined(__CC_JSB_SOCKETIO_H__) */
|
#endif /* defined(__CC_JSB_SOCKETIO_H__) */
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#include "libwebsockets.h"
|
#include "libwebsockets.h"
|
||||||
|
|
||||||
using namespace cocos2d;
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief Websocket thread helper, it's used for sending message between UI thread and websocket thread.
|
* @brief Websocket thread helper, it's used for sending message between UI thread and websocket thread.
|
||||||
*/
|
*/
|
||||||
class WsThreadHelper : public cocos2d::Object
|
class WsThreadHelper : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WsThreadHelper();
|
WsThreadHelper();
|
||||||
|
@ -648,3 +648,5 @@ void WebSocket::onUIThreadReceiveMessage(WsMessage* msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
|
@ -37,6 +37,8 @@ struct libwebsocket;
|
||||||
struct libwebsocket_context;
|
struct libwebsocket_context;
|
||||||
struct libwebsocket_protocols;
|
struct libwebsocket_protocols;
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
namespace network {
|
namespace network {
|
||||||
|
|
||||||
class WsThreadHelper;
|
class WsThreadHelper;
|
||||||
|
@ -163,4 +165,6 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
#endif /* defined(__CC_JSB_WEBSOCKET_H__) */
|
#endif /* defined(__CC_JSB_WEBSOCKET_H__) */
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit b4cfb39999c217125bd0426cc4f132b414f88828
|
Subproject commit 46a4f8dfc80cf72227576d89305d4fe6b7572318
|
|
@ -54,6 +54,8 @@
|
||||||
|
|
||||||
#define BYTE_CODE_FILE_EXT ".jsc"
|
#define BYTE_CODE_FILE_EXT ".jsc"
|
||||||
|
|
||||||
|
using namespace cocos2d;
|
||||||
|
|
||||||
static std::string inData;
|
static std::string inData;
|
||||||
static std::string outData;
|
static std::string outData;
|
||||||
static std::vector<std::string> g_queue;
|
static std::vector<std::string> g_queue;
|
||||||
|
|
|
@ -21,20 +21,18 @@
|
||||||
|
|
||||||
void js_log(const char *format, ...);
|
void js_log(const char *format, ...);
|
||||||
|
|
||||||
using namespace cocos2d;
|
|
||||||
|
|
||||||
typedef void (*sc_register_sth)(JSContext* cx, JSObject* global);
|
typedef void (*sc_register_sth)(JSContext* cx, JSObject* global);
|
||||||
|
|
||||||
void registerDefaultClasses(JSContext* cx, JSObject* global);
|
void registerDefaultClasses(JSContext* cx, JSObject* global);
|
||||||
|
|
||||||
|
|
||||||
class SimpleRunLoop : public Object
|
class SimpleRunLoop : public cocos2d::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void update(float d);
|
void update(float d);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptingCore : public ScriptEngineProtocol
|
class ScriptingCore : public cocos2d::ScriptEngineProtocol
|
||||||
{
|
{
|
||||||
JSRuntime *_rt;
|
JSRuntime *_rt;
|
||||||
JSContext *_cx;
|
JSContext *_cx;
|
||||||
|
@ -54,13 +52,13 @@ public:
|
||||||
return pInstance;
|
return pInstance;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ccScriptType getScriptType() { return kScriptTypeJavascript; };
|
virtual cocos2d::ccScriptType getScriptType() { return cocos2d::kScriptTypeJavascript; };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Remove Object from lua state
|
@brief Remove Object from lua state
|
||||||
@param object to remove
|
@param object to remove
|
||||||
*/
|
*/
|
||||||
virtual void removeScriptObjectByObject(Object* pObj);
|
virtual void removeScriptObjectByObject(cocos2d::Object* pObj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Execute script code contained in the given string.
|
@brief Execute script code contained in the given string.
|
||||||
|
@ -87,13 +85,13 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int executeGlobalFunction(const char* functionName) { return 0; }
|
virtual int executeGlobalFunction(const char* functionName) { return 0; }
|
||||||
|
|
||||||
virtual int sendEvent(ScriptEvent* message) override;
|
virtual int sendEvent(cocos2d::ScriptEvent* message) override;
|
||||||
|
|
||||||
virtual bool parseConfig(ConfigType type, const std::string& str) override;
|
virtual bool parseConfig(ConfigType type, const std::string& str) override;
|
||||||
|
|
||||||
virtual bool handleAssert(const char *msg) { return false; }
|
virtual bool handleAssert(const char *msg) { return false; }
|
||||||
|
|
||||||
bool executeFunctionWithObjectData(Node *self, const char *name, JSObject *obj);
|
bool executeFunctionWithObjectData(cocos2d::Node *self, const char *name, JSObject *obj);
|
||||||
JSBool executeFunctionWithOwner(jsval owner, const char *name, uint32_t argc = 0, jsval* vp = NULL, jsval* retVal = NULL);
|
JSBool executeFunctionWithOwner(jsval owner, const char *name, uint32_t argc = 0, jsval* vp = NULL, jsval* retVal = NULL);
|
||||||
|
|
||||||
void executeJSFunctionWithThisObj(jsval thisObj, jsval callback, uint32_t argc = 0, jsval* vp = NULL, jsval* retVal = NULL);
|
void executeJSFunctionWithThisObj(jsval thisObj, jsval callback, uint32_t argc = 0, jsval* vp = NULL, jsval* retVal = NULL);
|
||||||
|
@ -142,12 +140,12 @@ public:
|
||||||
static void removeAllRoots(JSContext *cx);
|
static void removeAllRoots(JSContext *cx);
|
||||||
|
|
||||||
|
|
||||||
int executeCustomTouchEvent(EventTouch::EventCode eventType,
|
int executeCustomTouchEvent(cocos2d::EventTouch::EventCode eventType,
|
||||||
Touch *pTouch, JSObject *obj, jsval &retval);
|
cocos2d::Touch *pTouch, JSObject *obj, jsval &retval);
|
||||||
int executeCustomTouchEvent(EventTouch::EventCode eventType,
|
int executeCustomTouchEvent(cocos2d::EventTouch::EventCode eventType,
|
||||||
Touch *pTouch, JSObject *obj);
|
cocos2d::Touch *pTouch, JSObject *obj);
|
||||||
int executeCustomTouchesEvent(EventTouch::EventCode eventType,
|
int executeCustomTouchesEvent(cocos2d::EventTouch::EventCode eventType,
|
||||||
const std::vector<Touch*>& touches, JSObject *obj);
|
const std::vector<cocos2d::Touch*>& touches, JSObject *obj);
|
||||||
/**
|
/**
|
||||||
* @return the global context
|
* @return the global context
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
887e2d3869dfa674b390e1373c94937ae965ea6f
|
0690676c834cdda681e69a387225425f186a0cc6
|
|
@ -11,20 +11,20 @@ class JSScheduleWrapper;
|
||||||
// It will prove that i'm right. :)
|
// It will prove that i'm right. :)
|
||||||
typedef struct jsScheduleFunc_proxy {
|
typedef struct jsScheduleFunc_proxy {
|
||||||
JSObject* jsfuncObj;
|
JSObject* jsfuncObj;
|
||||||
Array* targets;
|
cocos2d::Array* targets;
|
||||||
UT_hash_handle hh;
|
UT_hash_handle hh;
|
||||||
} schedFunc_proxy_t;
|
} schedFunc_proxy_t;
|
||||||
|
|
||||||
typedef struct jsScheduleTarget_proxy {
|
typedef struct jsScheduleTarget_proxy {
|
||||||
JSObject* jsTargetObj;
|
JSObject* jsTargetObj;
|
||||||
Array* targets;
|
cocos2d::Array* targets;
|
||||||
UT_hash_handle hh;
|
UT_hash_handle hh;
|
||||||
} schedTarget_proxy_t;
|
} schedTarget_proxy_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct jsCallFuncTarget_proxy {
|
typedef struct jsCallFuncTarget_proxy {
|
||||||
void * ptr;
|
void * ptr;
|
||||||
Array *obj;
|
cocos2d::Array *obj;
|
||||||
UT_hash_handle hh;
|
UT_hash_handle hh;
|
||||||
} callfuncTarget_proxy_t;
|
} callfuncTarget_proxy_t;
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string);
|
||||||
void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj);
|
void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj);
|
||||||
|
|
||||||
|
|
||||||
class JSCallbackWrapper: public Object {
|
class JSCallbackWrapper: public cocos2d::Object {
|
||||||
public:
|
public:
|
||||||
JSCallbackWrapper();
|
JSCallbackWrapper();
|
||||||
virtual ~JSCallbackWrapper();
|
virtual ~JSCallbackWrapper();
|
||||||
|
@ -118,9 +118,9 @@ public:
|
||||||
virtual ~JSScheduleWrapper();
|
virtual ~JSScheduleWrapper();
|
||||||
|
|
||||||
static void setTargetForSchedule(jsval sched, JSScheduleWrapper *target);
|
static void setTargetForSchedule(jsval sched, JSScheduleWrapper *target);
|
||||||
static Array * getTargetForSchedule(jsval sched);
|
static cocos2d::Array * getTargetForSchedule(jsval sched);
|
||||||
static void setTargetForJSObject(JSObject* jsTargetObj, JSScheduleWrapper *target);
|
static void setTargetForJSObject(JSObject* jsTargetObj, JSScheduleWrapper *target);
|
||||||
static Array * getTargetForJSObject(JSObject* jsTargetObj);
|
static cocos2d::Array * getTargetForJSObject(JSObject* jsTargetObj);
|
||||||
|
|
||||||
// Remove all targets.
|
// Remove all targets.
|
||||||
static void removeAllTargets();
|
static void removeAllTargets();
|
||||||
|
@ -157,7 +157,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class JSTouchDelegate: public Object
|
class JSTouchDelegate: public cocos2d::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
JSTouchDelegate();
|
JSTouchDelegate();
|
||||||
|
@ -178,16 +178,16 @@ public:
|
||||||
// So this function need to be binded.
|
// So this function need to be binded.
|
||||||
void unregisterTouchDelegate();
|
void unregisterTouchDelegate();
|
||||||
|
|
||||||
bool onTouchBegan(Touch *touch, Event *event);
|
bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event);
|
||||||
void onTouchMoved(Touch *touch, Event *event);
|
void onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *event);
|
||||||
void onTouchEnded(Touch *touch, Event *event);
|
void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *event);
|
||||||
void onTouchCancelled(Touch *touch, Event *event);
|
void onTouchCancelled(cocos2d::Touch *touch, cocos2d::Event *event);
|
||||||
|
|
||||||
// optional
|
// optional
|
||||||
void onTouchesBegan(const std::vector<Touch*>& touches, Event *event);
|
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
|
||||||
void onTouchesMoved(const std::vector<Touch*>& touches, Event *event);
|
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
|
||||||
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
|
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
|
||||||
void onTouchesCancelled(const std::vector<Touch*>& touches, Event *event);
|
void onTouchesCancelled(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JSObject* _obj;
|
JSObject* _obj;
|
||||||
|
@ -195,8 +195,8 @@ private:
|
||||||
typedef std::pair<JSObject*, JSTouchDelegate*> TouchDelegatePair;
|
typedef std::pair<JSObject*, JSTouchDelegate*> TouchDelegatePair;
|
||||||
static TouchDelegateMap sTouchDelegateMap;
|
static TouchDelegateMap sTouchDelegateMap;
|
||||||
bool _needUnroot;
|
bool _needUnroot;
|
||||||
EventListenerTouchOneByOne* _touchListenerOneByOne;
|
cocos2d::EventListenerTouchOneByOne* _touchListenerOneByOne;
|
||||||
EventListenerTouchAllAtOnce* _touchListenerAllAtOnce;
|
cocos2d::EventListenerTouchAllAtOnce* _touchListenerAllAtOnce;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
#include "cocos2d_specifics.hpp"
|
#include "cocos2d_specifics.hpp"
|
||||||
#include "gui/CocosGUI.h"
|
#include "gui/CocosGUI.h"
|
||||||
|
|
||||||
using namespace gui;
|
using namespace cocos2d;
|
||||||
|
using namespace cocos2d::gui;
|
||||||
|
|
||||||
class JSStudioEventListenerWrapper: public JSCallbackWrapper {
|
class JSStudioEventListenerWrapper: public JSCallbackWrapper {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -167,22 +167,20 @@ void MinXmlHttpRequest::_setHttpRequestHeader()
|
||||||
* @param sender Object which initialized callback
|
* @param sender Object which initialized callback
|
||||||
* @param respone Response object
|
* @param respone Response object
|
||||||
*/
|
*/
|
||||||
void MinXmlHttpRequest::handle_requestResponse(network::HttpClient *sender, network::HttpResponse *response)
|
void MinXmlHttpRequest::handle_requestResponse(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response)
|
||||||
{
|
{
|
||||||
if (0 != strlen(response->getHttpRequest()->getTag()))
|
if (0 != strlen(response->getHttpRequest()->getTag()))
|
||||||
{
|
{
|
||||||
CCLOG("%s completed", response->getHttpRequest()->getTag());
|
CCLOG("%s completed", response->getHttpRequest()->getTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
int statusCode = response->getResponseCode();
|
long statusCode = response->getResponseCode();
|
||||||
char statusString[64] = {};
|
char statusString[64] = {0};
|
||||||
sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
|
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
|
||||||
|
|
||||||
if (!response->isSucceed())
|
if (!response->isSucceed())
|
||||||
{
|
{
|
||||||
CCLOG("response failed");
|
CCLOG("Response failed, error buffer: %s", response->getErrorBuffer());
|
||||||
CCLOG("error buffer: %s", response->getErrorBuffer());
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set header
|
// set header
|
||||||
|
@ -207,7 +205,7 @@ void MinXmlHttpRequest::handle_requestResponse(network::HttpClient *sender, netw
|
||||||
_status = 200;
|
_status = 200;
|
||||||
_readyState = DONE;
|
_readyState = DONE;
|
||||||
|
|
||||||
_dataSize = buffer->size();
|
_dataSize = static_cast<uint32_t>(buffer->size());
|
||||||
CC_SAFE_FREE(_data);
|
CC_SAFE_FREE(_data);
|
||||||
_data = (char*) malloc(_dataSize + 1);
|
_data = (char*) malloc(_dataSize + 1);
|
||||||
_data[_dataSize] = '\0';
|
_data[_dataSize] = '\0';
|
||||||
|
@ -247,7 +245,7 @@ void MinXmlHttpRequest::handle_requestResponse(network::HttpClient *sender, netw
|
||||||
void MinXmlHttpRequest::_sendRequest(JSContext *cx)
|
void MinXmlHttpRequest::_sendRequest(JSContext *cx)
|
||||||
{
|
{
|
||||||
_httpRequest->setResponseCallback(this, httpresponse_selector(MinXmlHttpRequest::handle_requestResponse));
|
_httpRequest->setResponseCallback(this, httpresponse_selector(MinXmlHttpRequest::handle_requestResponse));
|
||||||
network::HttpClient::getInstance()->send(_httpRequest);
|
cocos2d::network::HttpClient::getInstance()->send(_httpRequest);
|
||||||
_httpRequest->release();
|
_httpRequest->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +262,7 @@ MinXmlHttpRequest::MinXmlHttpRequest()
|
||||||
_requestHeader.clear();
|
_requestHeader.clear();
|
||||||
_withCredentialsValue = true;
|
_withCredentialsValue = true;
|
||||||
_cx = ScriptingCore::getInstance()->getGlobalContext();
|
_cx = ScriptingCore::getInstance()->getGlobalContext();
|
||||||
_httpRequest = new network::HttpRequest();
|
_httpRequest = new cocos2d::network::HttpRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -546,17 +544,23 @@ JS_BINDED_PROP_SET_IMPL(MinXmlHttpRequest, withCredentials)
|
||||||
*/
|
*/
|
||||||
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, responseText)
|
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, responseText)
|
||||||
{
|
{
|
||||||
|
if (_data)
|
||||||
|
{
|
||||||
jsval strVal = std_string_to_jsval(cx, _data);
|
jsval strVal = std_string_to_jsval(cx, _data);
|
||||||
|
|
||||||
if (strVal != JSVAL_NULL)
|
if (strVal != JSVAL_NULL)
|
||||||
{
|
{
|
||||||
vp.set(strVal);
|
vp.set(strVal);
|
||||||
//JS_ReportError(cx, "Result: %s", data.str().c_str());
|
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
} else {
|
|
||||||
JS_ReportError(cx, "Error trying to create JSString from data");
|
|
||||||
return JS_FALSE;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCLOGERROR("ResponseText was empty, probably there is a network error!");
|
||||||
|
|
||||||
|
// Return an empty string
|
||||||
|
vp.set(std_string_to_jsval(cx, ""));
|
||||||
|
|
||||||
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -627,11 +631,11 @@ JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, open)
|
||||||
|
|
||||||
if (_meth.compare("post") == 0 || _meth.compare("POST") == 0)
|
if (_meth.compare("post") == 0 || _meth.compare("POST") == 0)
|
||||||
{
|
{
|
||||||
_httpRequest->setRequestType(network::HttpRequest::Type::POST);
|
_httpRequest->setRequestType(cocos2d::network::HttpRequest::Type::POST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_httpRequest->setRequestType(network::HttpRequest::Type::GET);
|
_httpRequest->setRequestType(cocos2d::network::HttpRequest::Type::GET);
|
||||||
}
|
}
|
||||||
|
|
||||||
_httpRequest->setUrl(_url.c_str());
|
_httpRequest->setUrl(_url.c_str());
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
JS_BINDED_FUNC(MinXmlHttpRequest, setRequestHeader);
|
JS_BINDED_FUNC(MinXmlHttpRequest, setRequestHeader);
|
||||||
JS_BINDED_FUNC(MinXmlHttpRequest, overrideMimeType);
|
JS_BINDED_FUNC(MinXmlHttpRequest, overrideMimeType);
|
||||||
|
|
||||||
void handle_requestResponse(network::HttpClient *sender, network::HttpResponse *response);
|
void handle_requestResponse(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -102,7 +102,7 @@ private:
|
||||||
ResponseType _responseType;
|
ResponseType _responseType;
|
||||||
unsigned _timeout;
|
unsigned _timeout;
|
||||||
bool _isAsync;
|
bool _isAsync;
|
||||||
network::HttpRequest* _httpRequest;
|
cocos2d::network::HttpRequest* _httpRequest;
|
||||||
bool _isNetwork;
|
bool _isNetwork;
|
||||||
bool _withCredentialsValue;
|
bool _withCredentialsValue;
|
||||||
std::unordered_map<std::string, std::string> _httpHeader;
|
std::unordered_map<std::string, std::string> _httpHeader;
|
||||||
|
|
|
@ -30,7 +30,7 @@ THE SOFTWARE.
|
||||||
#include "ScriptingCore.h"
|
#include "ScriptingCore.h"
|
||||||
#include "cocos2d_specifics.hpp"
|
#include "cocos2d_specifics.hpp"
|
||||||
|
|
||||||
using namespace network;
|
using namespace cocos2d::network;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
[Constructor(in DOMString url, in optional DOMString protocols)]
|
[Constructor(in DOMString url, in optional DOMString protocols)]
|
||||||
|
|
|
@ -12,7 +12,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "network/WebSocket.h"
|
#include "network/WebSocket.h"
|
||||||
class LuaWebSocket: public network::WebSocket,public network::WebSocket::Delegate
|
class LuaWebSocket: public cocos2d::network::WebSocket,public cocos2d::network::WebSocket::Delegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~LuaWebSocket();
|
virtual ~LuaWebSocket();
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
LuaMinXmlHttpRequest();
|
LuaMinXmlHttpRequest();
|
||||||
~LuaMinXmlHttpRequest();
|
~LuaMinXmlHttpRequest();
|
||||||
|
|
||||||
void handle_requestResponse(network::HttpClient *sender, network::HttpResponse *response);
|
void handle_requestResponse(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response);
|
||||||
|
|
||||||
inline void setResponseType(ResponseType type) { _responseType = type; }
|
inline void setResponseType(ResponseType type) { _responseType = type; }
|
||||||
inline ResponseType getResponseType() {return _responseType; }
|
inline ResponseType getResponseType() {return _responseType; }
|
||||||
|
@ -48,7 +48,7 @@ public:
|
||||||
inline void setReadyState(int readyState) { _readyState = readyState; }
|
inline void setReadyState(int readyState) { _readyState = readyState; }
|
||||||
inline int getReadyState() { return _readyState ;}
|
inline int getReadyState() { return _readyState ;}
|
||||||
|
|
||||||
inline network::HttpRequest* getHttpRequest() { return _httpRequest; }
|
inline cocos2d::network::HttpRequest* getHttpRequest() { return _httpRequest; }
|
||||||
inline int getStatus() { return _status; }
|
inline int getStatus() { return _status; }
|
||||||
inline std::string getStatusText() { return _statusText ;}
|
inline std::string getStatusText() { return _statusText ;}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ private:
|
||||||
ResponseType _responseType;
|
ResponseType _responseType;
|
||||||
unsigned _timeout;
|
unsigned _timeout;
|
||||||
bool _isAsync;
|
bool _isAsync;
|
||||||
network::HttpRequest* _httpRequest;
|
cocos2d::network::HttpRequest* _httpRequest;
|
||||||
bool _isNetwork;
|
bool _isNetwork;
|
||||||
bool _withCredentialsValue;
|
bool _withCredentialsValue;
|
||||||
std::map<std::string, std::string> _httpHeader;
|
std::map<std::string, std::string> _httpHeader;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
USING_NS_CC_EXT;
|
USING_NS_CC_EXT;
|
||||||
using namespace network;
|
using namespace cocos2d::network;
|
||||||
|
|
||||||
HttpClientTest::HttpClientTest()
|
HttpClientTest::HttpClientTest()
|
||||||
: _labelStatusCode(NULL)
|
: _labelStatusCode(NULL)
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
void onMenuDeleteTestClicked(cocos2d::Object *sender);
|
void onMenuDeleteTestClicked(cocos2d::Object *sender);
|
||||||
|
|
||||||
//Http Response Callback
|
//Http Response Callback
|
||||||
void onHttpRequestCompleted(network::HttpClient *sender, network::HttpResponse *response);
|
void onHttpRequestCompleted(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cocos2d::LabelTTF* _labelStatusCode;
|
cocos2d::LabelTTF* _labelStatusCode;
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
USING_NS_CC_EXT;
|
USING_NS_CC_EXT;
|
||||||
using namespace network;
|
using namespace cocos2d::network;
|
||||||
|
|
||||||
SocketIOTestLayer::SocketIOTestLayer(void)
|
SocketIOTestLayer::SocketIOTestLayer(void)
|
||||||
: _sioClient(NULL)
|
: _sioClient(NULL)
|
||||||
|
|
|
@ -14,16 +14,16 @@
|
||||||
|
|
||||||
class SocketIOTestLayer
|
class SocketIOTestLayer
|
||||||
: public cocos2d::Layer
|
: public cocos2d::Layer
|
||||||
, public network::SocketIO::SIODelegate
|
, public cocos2d::network::SocketIO::SIODelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SocketIOTestLayer(void);
|
SocketIOTestLayer(void);
|
||||||
virtual ~SocketIOTestLayer(void);
|
virtual ~SocketIOTestLayer(void);
|
||||||
|
|
||||||
virtual void onConnect(network::SIOClient* client);
|
virtual void onConnect(cocos2d::network::SIOClient* client);
|
||||||
virtual void onMessage(network::SIOClient* client, const std::string& data);
|
virtual void onMessage(cocos2d::network::SIOClient* client, const std::string& data);
|
||||||
virtual void onClose(network::SIOClient* client);
|
virtual void onClose(cocos2d::network::SIOClient* client);
|
||||||
virtual void onError(network::SIOClient* client, const std::string& data);
|
virtual void onError(cocos2d::network::SIOClient* client, const std::string& data);
|
||||||
|
|
||||||
void toExtensionsMainLayer(cocos2d::Object *sender);
|
void toExtensionsMainLayer(cocos2d::Object *sender);
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ public:
|
||||||
void onMenuTestEndpointDisconnectClicked(cocos2d::Object *sender);
|
void onMenuTestEndpointDisconnectClicked(cocos2d::Object *sender);
|
||||||
|
|
||||||
|
|
||||||
void testevent(network::SIOClient *client, const std::string& data);
|
void testevent(cocos2d::network::SIOClient *client, const std::string& data);
|
||||||
void echotest(network::SIOClient *client, const std::string& data);
|
void echotest(cocos2d::network::SIOClient *client, const std::string& data);
|
||||||
|
|
||||||
network::SIOClient *_sioClient, *_sioEndpoint;
|
cocos2d::network::SIOClient *_sioClient, *_sioEndpoint;
|
||||||
|
|
||||||
cocos2d::LabelTTF *_sioClientStatus;
|
cocos2d::LabelTTF *_sioClientStatus;
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
USING_NS_CC_EXT;
|
USING_NS_CC_EXT;
|
||||||
using namespace network;
|
|
||||||
|
|
||||||
WebSocketTestLayer::WebSocketTestLayer()
|
WebSocketTestLayer::WebSocketTestLayer()
|
||||||
: _wsiSendText(NULL)
|
: _wsiSendText(NULL)
|
||||||
|
@ -74,9 +73,9 @@ WebSocketTestLayer::WebSocketTestLayer()
|
||||||
menuBack->setPosition(Point::ZERO);
|
menuBack->setPosition(Point::ZERO);
|
||||||
addChild(menuBack);
|
addChild(menuBack);
|
||||||
|
|
||||||
_wsiSendText = new WebSocket();
|
_wsiSendText = new network::WebSocket();
|
||||||
_wsiSendBinary = new WebSocket();
|
_wsiSendBinary = new network::WebSocket();
|
||||||
_wsiError = new WebSocket();
|
_wsiError = new network::WebSocket();
|
||||||
|
|
||||||
if (!_wsiSendText->init(*this, "ws://echo.websocket.org"))
|
if (!_wsiSendText->init(*this, "ws://echo.websocket.org"))
|
||||||
{
|
{
|
||||||
|
@ -202,7 +201,7 @@ void WebSocketTestLayer::toExtensionsMainLayer(cocos2d::Object *sender)
|
||||||
// Menu Callbacks
|
// Menu Callbacks
|
||||||
void WebSocketTestLayer::onMenuSendTextClicked(cocos2d::Object *sender)
|
void WebSocketTestLayer::onMenuSendTextClicked(cocos2d::Object *sender)
|
||||||
{
|
{
|
||||||
if (_wsiSendText->getReadyState() == WebSocket::State::OPEN)
|
if (_wsiSendText->getReadyState() == network::WebSocket::State::OPEN)
|
||||||
{
|
{
|
||||||
_sendTextStatus->setString("Send Text WS is waiting...");
|
_sendTextStatus->setString("Send Text WS is waiting...");
|
||||||
_wsiSendText->send("Hello WebSocket, I'm a text message.");
|
_wsiSendText->send("Hello WebSocket, I'm a text message.");
|
||||||
|
@ -217,7 +216,7 @@ void WebSocketTestLayer::onMenuSendTextClicked(cocos2d::Object *sender)
|
||||||
|
|
||||||
void WebSocketTestLayer::onMenuSendBinaryClicked(cocos2d::Object *sender)
|
void WebSocketTestLayer::onMenuSendBinaryClicked(cocos2d::Object *sender)
|
||||||
{
|
{
|
||||||
if (_wsiSendBinary->getReadyState() == WebSocket::State::OPEN)
|
if (_wsiSendBinary->getReadyState() == network::WebSocket::State::OPEN)
|
||||||
{
|
{
|
||||||
_sendBinaryStatus->setString("Send Binary WS is waiting...");
|
_sendBinaryStatus->setString("Send Binary WS is waiting...");
|
||||||
char buf[] = "Hello WebSocket,\0 I'm\0 a\0 binary\0 message\0.";
|
char buf[] = "Hello WebSocket,\0 I'm\0 a\0 binary\0 message\0.";
|
||||||
|
|
|
@ -15,16 +15,16 @@
|
||||||
|
|
||||||
class WebSocketTestLayer
|
class WebSocketTestLayer
|
||||||
: public cocos2d::Layer
|
: public cocos2d::Layer
|
||||||
, public network::WebSocket::Delegate
|
, public cocos2d::network::WebSocket::Delegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WebSocketTestLayer();
|
WebSocketTestLayer();
|
||||||
virtual ~WebSocketTestLayer();
|
virtual ~WebSocketTestLayer();
|
||||||
|
|
||||||
virtual void onOpen(network::WebSocket* ws);
|
virtual void onOpen(cocos2d::network::WebSocket* ws);
|
||||||
virtual void onMessage(network::WebSocket* ws, const network::WebSocket::Data& data);
|
virtual void onMessage(cocos2d::network::WebSocket* ws, const cocos2d::network::WebSocket::Data& data);
|
||||||
virtual void onClose(network::WebSocket* ws);
|
virtual void onClose(cocos2d::network::WebSocket* ws);
|
||||||
virtual void onError(network::WebSocket* ws, const network::WebSocket::ErrorCode& error);
|
virtual void onError(cocos2d::network::WebSocket* ws, const cocos2d::network::WebSocket::ErrorCode& error);
|
||||||
|
|
||||||
void toExtensionsMainLayer(cocos2d::Object *sender);
|
void toExtensionsMainLayer(cocos2d::Object *sender);
|
||||||
|
|
||||||
|
@ -33,9 +33,9 @@ public:
|
||||||
void onMenuSendBinaryClicked(cocos2d::Object *sender);
|
void onMenuSendBinaryClicked(cocos2d::Object *sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
network::WebSocket* _wsiSendText;
|
cocos2d::network::WebSocket* _wsiSendText;
|
||||||
network::WebSocket* _wsiSendBinary;
|
cocos2d::network::WebSocket* _wsiSendBinary;
|
||||||
network::WebSocket* _wsiError;
|
cocos2d::network::WebSocket* _wsiError;
|
||||||
|
|
||||||
cocos2d::LabelTTF* _sendTextStatus;
|
cocos2d::LabelTTF* _sendTextStatus;
|
||||||
cocos2d::LabelTTF* _sendBinaryStatus;
|
cocos2d::LabelTTF* _sendBinaryStatus;
|
||||||
|
|
|
@ -22,40 +22,33 @@ Layer* restartCocosNodeAction();
|
||||||
|
|
||||||
static int sceneIdx = -1;
|
static int sceneIdx = -1;
|
||||||
|
|
||||||
#define MAX_LAYER 14
|
|
||||||
|
|
||||||
Layer* createCocosNodeLayer(int nIndex)
|
static std::function<Layer*()> createFunctions[] =
|
||||||
{
|
{
|
||||||
switch(nIndex)
|
CL(CameraCenterTest),
|
||||||
{
|
CL(Test2),
|
||||||
case 0: return new CameraCenterTest();
|
CL(Test4),
|
||||||
case 1: return new Test2();
|
CL(Test5),
|
||||||
case 2: return new Test4();
|
CL(Test6),
|
||||||
case 3: return new Test5();
|
CL(StressTest1),
|
||||||
case 4: return new Test6();
|
CL(StressTest2),
|
||||||
case 5: return new StressTest1();
|
CL(NodeToWorld),
|
||||||
case 6: return new StressTest2();
|
CL(SchedulerTest1),
|
||||||
case 7: return new NodeToWorld();
|
CL(CameraOrbitTest),
|
||||||
case 8: return new SchedulerTest1();
|
CL(CameraZoomTest),
|
||||||
case 9: return new CameraOrbitTest();
|
CL(ConvertToNode),
|
||||||
case 10: return new CameraZoomTest();
|
CL(NodeOpaqueTest),
|
||||||
case 11: return new ConvertToNode();
|
CL(NodeNonOpaqueTest),
|
||||||
case 12: return new NodeOpaqueTest();
|
};
|
||||||
case 13: return new NodeNonOpaqueTest();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))
|
||||||
}
|
|
||||||
|
|
||||||
Layer* nextCocosNodeAction()
|
Layer* nextCocosNodeAction()
|
||||||
{
|
{
|
||||||
sceneIdx++;
|
sceneIdx++;
|
||||||
sceneIdx = sceneIdx % MAX_LAYER;
|
sceneIdx = sceneIdx % MAX_LAYER;
|
||||||
|
|
||||||
auto layer = createCocosNodeLayer(sceneIdx);
|
return createFunctions[sceneIdx]();
|
||||||
layer->autorelease();
|
|
||||||
|
|
||||||
return layer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer* backCocosNodeAction()
|
Layer* backCocosNodeAction()
|
||||||
|
@ -65,18 +58,12 @@ Layer* backCocosNodeAction()
|
||||||
if( sceneIdx < 0 )
|
if( sceneIdx < 0 )
|
||||||
sceneIdx += total;
|
sceneIdx += total;
|
||||||
|
|
||||||
auto layer = createCocosNodeLayer(sceneIdx);
|
return createFunctions[sceneIdx]();
|
||||||
layer->autorelease();
|
|
||||||
|
|
||||||
return layer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Layer* restartCocosNodeAction()
|
Layer* restartCocosNodeAction()
|
||||||
{
|
{
|
||||||
auto layer = createCocosNodeLayer(sceneIdx);
|
return createFunctions[sceneIdx]();
|
||||||
layer->autorelease();
|
|
||||||
|
|
||||||
return layer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
class TestCocosNodeDemo : public BaseTest
|
class TestCocosNodeDemo : public BaseTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TestCocosNodeDemo(void);
|
|
||||||
~TestCocosNodeDemo(void);
|
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
@ -18,11 +16,16 @@ public:
|
||||||
void restartCallback(Object* sender);
|
void restartCallback(Object* sender);
|
||||||
void nextCallback(Object* sender);
|
void nextCallback(Object* sender);
|
||||||
void backCallback(Object* sender);
|
void backCallback(Object* sender);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TestCocosNodeDemo();
|
||||||
|
virtual ~TestCocosNodeDemo();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Test2 : public TestCocosNodeDemo
|
class Test2 : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CREATE_FUNC(Test2);
|
||||||
virtual void onEnter();
|
virtual void onEnter();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
};
|
};
|
||||||
|
@ -30,120 +33,153 @@ public:
|
||||||
class Test4 : public TestCocosNodeDemo
|
class Test4 : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Test4();
|
CREATE_FUNC(Test4);
|
||||||
void delay2(float dt);
|
void delay2(float dt);
|
||||||
void delay4(float dt);
|
void delay4(float dt);
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Test4();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Test5 : public TestCocosNodeDemo
|
class Test5 : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Test5();
|
CREATE_FUNC(Test5);
|
||||||
void addAndRemove(float dt);
|
|
||||||
|
|
||||||
|
void addAndRemove(float dt);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Test5();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Test6 : public TestCocosNodeDemo
|
class Test6 : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Test6();
|
CREATE_FUNC(Test6);
|
||||||
void addAndRemove(float dt);
|
void addAndRemove(float dt);
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Test6();
|
||||||
};
|
};
|
||||||
|
|
||||||
class StressTest1 : public TestCocosNodeDemo
|
class StressTest1 : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
CREATE_FUNC(StressTest1);
|
||||||
void shouldNotCrash(float dt);
|
void shouldNotCrash(float dt);
|
||||||
void removeMe(Node* node);
|
void removeMe(Node* node);
|
||||||
public:
|
|
||||||
StressTest1();
|
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
StressTest1();
|
||||||
};
|
};
|
||||||
|
|
||||||
class StressTest2 : public TestCocosNodeDemo
|
class StressTest2 : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
void shouldNotLeak(float dt);
|
|
||||||
public:
|
public:
|
||||||
StressTest2();
|
CREATE_FUNC(StressTest2);
|
||||||
|
void shouldNotLeak(float dt);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
StressTest2();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SchedulerTest1 : public TestCocosNodeDemo
|
class SchedulerTest1 : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SchedulerTest1();
|
CREATE_FUNC(SchedulerTest1);
|
||||||
void doSomething(float dt);
|
void doSomething(float dt);
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SchedulerTest1();
|
||||||
};
|
};
|
||||||
|
|
||||||
class NodeToWorld : public TestCocosNodeDemo
|
class NodeToWorld : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NodeToWorld();
|
CREATE_FUNC(NodeToWorld);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NodeToWorld();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CameraOrbitTest : public TestCocosNodeDemo
|
class CameraOrbitTest : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CameraOrbitTest();
|
CREATE_FUNC(CameraOrbitTest);
|
||||||
|
virtual void onEnter() override;
|
||||||
virtual void onEnter();
|
virtual void onExit() override;
|
||||||
virtual void onExit();
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CameraOrbitTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CameraZoomTest : public TestCocosNodeDemo
|
class CameraZoomTest : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
float _z;
|
|
||||||
public:
|
public:
|
||||||
CameraZoomTest();
|
CREATE_FUNC(CameraZoomTest);
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
virtual void onEnter();
|
virtual void onEnter() override;
|
||||||
virtual void onExit();
|
virtual void onExit() override;
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CameraZoomTest();
|
||||||
|
float _z;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CameraCenterTest : public TestCocosNodeDemo
|
class CameraCenterTest : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CameraCenterTest();
|
CREATE_FUNC(CameraCenterTest);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CameraCenterTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConvertToNode : public TestCocosNodeDemo
|
class ConvertToNode : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConvertToNode();
|
CREATE_FUNC(ConvertToNode);
|
||||||
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
|
void onTouchesEnded(const std::vector<Touch*>& touches, Event *event);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ConvertToNode();
|
||||||
};
|
};
|
||||||
|
|
||||||
class NodeOpaqueTest : public TestCocosNodeDemo
|
class NodeOpaqueTest : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NodeOpaqueTest();
|
CREATE_FUNC(NodeOpaqueTest);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NodeOpaqueTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
class NodeNonOpaqueTest : public TestCocosNodeDemo
|
class NodeNonOpaqueTest : public TestCocosNodeDemo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NodeNonOpaqueTest();
|
CREATE_FUNC(NodeNonOpaqueTest);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NodeNonOpaqueTest();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CocosNodeTestScene : public TestScene
|
class CocosNodeTestScene : public TestScene
|
||||||
|
|
|
@ -37,7 +37,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SpriteTestDemo(void);
|
SpriteTestDemo(void);
|
||||||
~SpriteTestDemo(void);
|
virtual ~SpriteTestDemo(void);
|
||||||
|
|
||||||
void restartCallback(Object* sender);
|
void restartCallback(Object* sender);
|
||||||
void nextCallback(Object* sender);
|
void nextCallback(Object* sender);
|
||||||
|
@ -383,7 +383,7 @@ class SpriteOffsetAnchorSkew : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteOffsetAnchorSkew);
|
CREATE_FUNC(SpriteOffsetAnchorSkew);
|
||||||
SpriteOffsetAnchorSkew();
|
SpriteOffsetAnchorSkew();
|
||||||
~SpriteOffsetAnchorSkew();
|
virtual ~SpriteOffsetAnchorSkew();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -393,7 +393,7 @@ class SpriteOffsetAnchorRotationalSkew : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteOffsetAnchorRotationalSkew);
|
CREATE_FUNC(SpriteOffsetAnchorRotationalSkew);
|
||||||
SpriteOffsetAnchorRotationalSkew();
|
SpriteOffsetAnchorRotationalSkew();
|
||||||
~SpriteOffsetAnchorRotationalSkew();
|
virtual ~SpriteOffsetAnchorRotationalSkew();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -403,7 +403,7 @@ class SpriteBatchNodeOffsetAnchorSkew : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteBatchNodeOffsetAnchorSkew);
|
CREATE_FUNC(SpriteBatchNodeOffsetAnchorSkew);
|
||||||
SpriteBatchNodeOffsetAnchorSkew();
|
SpriteBatchNodeOffsetAnchorSkew();
|
||||||
~SpriteBatchNodeOffsetAnchorSkew();
|
virtual ~SpriteBatchNodeOffsetAnchorSkew();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -413,7 +413,7 @@ class SpriteOffsetAnchorRotationalSkewScale : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteOffsetAnchorRotationalSkewScale);
|
CREATE_FUNC(SpriteOffsetAnchorRotationalSkewScale);
|
||||||
SpriteOffsetAnchorRotationalSkewScale();
|
SpriteOffsetAnchorRotationalSkewScale();
|
||||||
~SpriteOffsetAnchorRotationalSkewScale();
|
virtual ~SpriteOffsetAnchorRotationalSkewScale();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -423,7 +423,7 @@ class SpriteBatchNodeOffsetAnchorRotationalSkew : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteBatchNodeOffsetAnchorRotationalSkew);
|
CREATE_FUNC(SpriteBatchNodeOffsetAnchorRotationalSkew);
|
||||||
SpriteBatchNodeOffsetAnchorRotationalSkew();
|
SpriteBatchNodeOffsetAnchorRotationalSkew();
|
||||||
~SpriteBatchNodeOffsetAnchorRotationalSkew();
|
virtual ~SpriteBatchNodeOffsetAnchorRotationalSkew();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -433,7 +433,7 @@ class SpriteOffsetAnchorSkewScale : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteOffsetAnchorSkewScale);
|
CREATE_FUNC(SpriteOffsetAnchorSkewScale);
|
||||||
SpriteOffsetAnchorSkewScale();
|
SpriteOffsetAnchorSkewScale();
|
||||||
~SpriteOffsetAnchorSkewScale();
|
virtual ~SpriteOffsetAnchorSkewScale();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -443,7 +443,7 @@ class SpriteBatchNodeOffsetAnchorSkewScale : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteBatchNodeOffsetAnchorSkewScale);
|
CREATE_FUNC(SpriteBatchNodeOffsetAnchorSkewScale);
|
||||||
SpriteBatchNodeOffsetAnchorSkewScale();
|
SpriteBatchNodeOffsetAnchorSkewScale();
|
||||||
~SpriteBatchNodeOffsetAnchorSkewScale();
|
virtual ~SpriteBatchNodeOffsetAnchorSkewScale();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -453,7 +453,7 @@ class SpriteBatchNodeOffsetAnchorRotationalSkewScale : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteBatchNodeOffsetAnchorRotationalSkewScale);
|
CREATE_FUNC(SpriteBatchNodeOffsetAnchorRotationalSkewScale);
|
||||||
SpriteBatchNodeOffsetAnchorRotationalSkewScale();
|
SpriteBatchNodeOffsetAnchorRotationalSkewScale();
|
||||||
~SpriteBatchNodeOffsetAnchorRotationalSkewScale();
|
virtual ~SpriteBatchNodeOffsetAnchorRotationalSkewScale();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -463,7 +463,7 @@ class SpriteOffsetAnchorFlip : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteOffsetAnchorFlip);
|
CREATE_FUNC(SpriteOffsetAnchorFlip);
|
||||||
SpriteOffsetAnchorFlip();
|
SpriteOffsetAnchorFlip();
|
||||||
~SpriteOffsetAnchorFlip();
|
virtual ~SpriteOffsetAnchorFlip();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -473,7 +473,7 @@ class SpriteBatchNodeOffsetAnchorFlip : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteBatchNodeOffsetAnchorFlip);
|
CREATE_FUNC(SpriteBatchNodeOffsetAnchorFlip);
|
||||||
SpriteBatchNodeOffsetAnchorFlip();
|
SpriteBatchNodeOffsetAnchorFlip();
|
||||||
~SpriteBatchNodeOffsetAnchorFlip();
|
virtual ~SpriteBatchNodeOffsetAnchorFlip();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -533,7 +533,7 @@ class SpriteChildrenVisibilityIssue665 : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteChildrenVisibilityIssue665);
|
CREATE_FUNC(SpriteChildrenVisibilityIssue665);
|
||||||
SpriteChildrenVisibilityIssue665();
|
SpriteChildrenVisibilityIssue665();
|
||||||
~SpriteChildrenVisibilityIssue665();
|
virtual ~SpriteChildrenVisibilityIssue665();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -668,7 +668,7 @@ class SpriteBatchNodeSkewNegativeScaleChildren : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteBatchNodeSkewNegativeScaleChildren);
|
CREATE_FUNC(SpriteBatchNodeSkewNegativeScaleChildren);
|
||||||
SpriteBatchNodeSkewNegativeScaleChildren();
|
SpriteBatchNodeSkewNegativeScaleChildren();
|
||||||
~SpriteBatchNodeSkewNegativeScaleChildren();
|
virtual ~SpriteBatchNodeSkewNegativeScaleChildren();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -678,7 +678,7 @@ class SpriteBatchNodeRotationalSkewNegativeScaleChildren : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteBatchNodeRotationalSkewNegativeScaleChildren);
|
CREATE_FUNC(SpriteBatchNodeRotationalSkewNegativeScaleChildren);
|
||||||
SpriteBatchNodeRotationalSkewNegativeScaleChildren();
|
SpriteBatchNodeRotationalSkewNegativeScaleChildren();
|
||||||
~SpriteBatchNodeRotationalSkewNegativeScaleChildren();
|
virtual ~SpriteBatchNodeRotationalSkewNegativeScaleChildren();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -688,7 +688,7 @@ class SpriteSkewNegativeScaleChildren : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteSkewNegativeScaleChildren);
|
CREATE_FUNC(SpriteSkewNegativeScaleChildren);
|
||||||
SpriteSkewNegativeScaleChildren();
|
SpriteSkewNegativeScaleChildren();
|
||||||
~SpriteSkewNegativeScaleChildren();
|
virtual ~SpriteSkewNegativeScaleChildren();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
@ -698,7 +698,7 @@ class SpriteRotationalSkewNegativeScaleChildren : public SpriteTestDemo
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(SpriteRotationalSkewNegativeScaleChildren);
|
CREATE_FUNC(SpriteRotationalSkewNegativeScaleChildren);
|
||||||
SpriteRotationalSkewNegativeScaleChildren();
|
SpriteRotationalSkewNegativeScaleChildren();
|
||||||
~SpriteRotationalSkewNegativeScaleChildren();
|
virtual ~SpriteRotationalSkewNegativeScaleChildren();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1511,21 +1511,20 @@ void TextureAsync::loadImages(float dt)
|
||||||
for( int j=0;j < 8; j++) {
|
for( int j=0;j < 8; j++) {
|
||||||
char szSpriteName[100] = {0};
|
char szSpriteName[100] = {0};
|
||||||
sprintf(szSpriteName, "Images/sprites_test/sprite-%d-%d.png", i, j);
|
sprintf(szSpriteName, "Images/sprites_test/sprite-%d-%d.png", i, j);
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync(szSpriteName,this, callfuncO_selector(TextureAsync::imageLoaded));
|
Director::getInstance()->getTextureCache()->addImageAsync(szSpriteName, CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/background1.jpg",this, callfuncO_selector(TextureAsync::imageLoaded));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/background1.jpg", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/background2.jpg",this, callfuncO_selector(TextureAsync::imageLoaded));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/background2.jpg", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/background.png",this, callfuncO_selector(TextureAsync::imageLoaded));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/background.png", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/atlastest.png",this, callfuncO_selector(TextureAsync::imageLoaded));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/atlastest.png", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_atlas.png",this, callfuncO_selector(TextureAsync::imageLoaded));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_atlas.png", CC_CALLBACK_1(TextureAsync::imageLoaded, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TextureAsync::imageLoaded(Object* pObj)
|
void TextureAsync::imageLoaded(Texture2D* texture)
|
||||||
{
|
{
|
||||||
auto tex = static_cast<Texture2D*>(pObj);
|
|
||||||
auto director = Director::getInstance();
|
auto director = Director::getInstance();
|
||||||
|
|
||||||
//CCASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread");
|
//CCASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread");
|
||||||
|
@ -1534,7 +1533,7 @@ void TextureAsync::imageLoaded(Object* pObj)
|
||||||
|
|
||||||
// This test just creates a sprite based on the Texture
|
// This test just creates a sprite based on the Texture
|
||||||
|
|
||||||
auto sprite = Sprite::createWithTexture(tex);
|
auto sprite = Sprite::createWithTexture(texture);
|
||||||
sprite->setAnchorPoint(Point(0,0));
|
sprite->setAnchorPoint(Point(0,0));
|
||||||
addChild(sprite, -1);
|
addChild(sprite, -1);
|
||||||
|
|
||||||
|
@ -1544,7 +1543,7 @@ void TextureAsync::imageLoaded(Object* pObj)
|
||||||
|
|
||||||
_imageOffset++;
|
_imageOffset++;
|
||||||
|
|
||||||
log("Image loaded: %p", tex);
|
log("Image loaded: %p", texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TextureAsync::title() const
|
std::string TextureAsync::title() const
|
||||||
|
|
|
@ -387,7 +387,7 @@ public:
|
||||||
CREATE_FUNC(TextureAsync);
|
CREATE_FUNC(TextureAsync);
|
||||||
virtual ~TextureAsync();
|
virtual ~TextureAsync();
|
||||||
void loadImages(float dt);
|
void loadImages(float dt);
|
||||||
void imageLoaded(Object* pObj);
|
void imageLoaded(cocos2d::Texture2D* texture);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
virtual void onEnter();
|
virtual void onEnter();
|
||||||
|
|
|
@ -21,29 +21,29 @@ TextureCacheTest::TextureCacheTest()
|
||||||
this->addChild(_labelPercent);
|
this->addChild(_labelPercent);
|
||||||
|
|
||||||
// load textrues
|
// load textrues
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/HelloWorld.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/HelloWorld.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_01.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_01.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_02.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_02.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_03.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_03.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_04.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_04.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_05.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_05.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_06.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_06.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_07.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_07.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_08.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_08.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_09.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_09.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_10.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_10.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_11.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_11.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_12.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_12.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_13.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_13.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_14.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/grossini_dance_14.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/background1.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/background1.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/background2.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/background2.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/background3.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/background3.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
Director::getInstance()->getTextureCache()->addImageAsync("Images/blocks.png", this, callfuncO_selector(TextureCacheTest::loadingCallBack));
|
Director::getInstance()->getTextureCache()->addImageAsync("Images/blocks.png", CC_CALLBACK_1(TextureCacheTest::loadingCallBack, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCacheTest::loadingCallBack(Object *obj)
|
void TextureCacheTest::loadingCallBack(cocos2d::Texture2D *texture)
|
||||||
{
|
{
|
||||||
++_numberOfLoadedSprites;
|
++_numberOfLoadedSprites;
|
||||||
char tmp[10];
|
char tmp[10];
|
||||||
|
|
|
@ -10,7 +10,7 @@ class TextureCacheTest : public Layer
|
||||||
public:
|
public:
|
||||||
TextureCacheTest();
|
TextureCacheTest();
|
||||||
void addSprite();
|
void addSprite();
|
||||||
void loadingCallBack(cocos2d::Object *obj);
|
void loadingCallBack(cocos2d::Texture2D *texture);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cocos2d::LabelTTF *_labelLoading;
|
cocos2d::LabelTTF *_labelLoading;
|
||||||
|
|
|
@ -142,126 +142,82 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_LAYER 41
|
#define STRINGIFY(x) #x
|
||||||
|
|
||||||
static std::string transitions[MAX_LAYER] = {
|
#define TRANS(__className__) { \
|
||||||
"CCTransitionJumpZoom",
|
{ [](float t, Scene* s){ return __className__::create(t,s);} }, \
|
||||||
|
STRINGIFY(__className__), \
|
||||||
|
}
|
||||||
|
|
||||||
"CCTransitionProgressRadialCCW",
|
struct _transitions {
|
||||||
"CCTransitionProgressRadialCW",
|
std::function<TransitionScene*(float t, Scene* s)> function;
|
||||||
"CCTransitionProgressHorizontal",
|
const char * name;
|
||||||
"CCTransitionProgressVertical",
|
} transitions[] {
|
||||||
"CCTransitionProgressInOut",
|
TRANS(TransitionJumpZoom),
|
||||||
"CCTransitionProgressOutIn",
|
TRANS(TransitionProgressRadialCCW),
|
||||||
|
TRANS(TransitionProgressRadialCW),
|
||||||
|
TRANS(TransitionProgressHorizontal),
|
||||||
|
TRANS(TransitionProgressVertical),
|
||||||
|
TRANS(TransitionProgressInOut),
|
||||||
|
TRANS(TransitionProgressOutIn),
|
||||||
|
|
||||||
"CCTransitionCrossFade",
|
TRANS(TransitionCrossFade),
|
||||||
"TransitionPageForward",
|
|
||||||
"TransitionPageBackward",
|
|
||||||
"CCTransitionFadeTR",
|
|
||||||
"CCTransitionFadeBL",
|
|
||||||
"CCTransitionFadeUp",
|
|
||||||
"CCTransitionFadeDown",
|
|
||||||
"CCTransitionTurnOffTiles",
|
|
||||||
"CCTransitionSplitRows",
|
|
||||||
"CCTransitionSplitCols",
|
|
||||||
|
|
||||||
"CCTransitionFade",
|
TRANS(PageTransitionForward),
|
||||||
"FadeWhiteTransition",
|
TRANS(PageTransitionBackward),
|
||||||
|
TRANS(TransitionFadeTR),
|
||||||
|
TRANS(TransitionFadeBL),
|
||||||
|
TRANS(TransitionFadeUp),
|
||||||
|
TRANS(TransitionFadeDown),
|
||||||
|
|
||||||
"FlipXLeftOver",
|
TRANS(TransitionTurnOffTiles),
|
||||||
"FlipXRightOver",
|
|
||||||
"FlipYUpOver",
|
|
||||||
"FlipYDownOver",
|
|
||||||
"FlipAngularLeftOver",
|
|
||||||
"FlipAngularRightOver",
|
|
||||||
|
|
||||||
"ZoomFlipXLeftOver",
|
TRANS(TransitionSplitRows),
|
||||||
"ZoomFlipXRightOver",
|
TRANS(TransitionSplitCols),
|
||||||
"ZoomFlipYUpOver",
|
|
||||||
"ZoomFlipYDownOver",
|
|
||||||
"ZoomFlipAngularLeftOver",
|
|
||||||
"ZoomFlipAngularRightOver",
|
|
||||||
|
|
||||||
"CCTransitionShrinkGrow",
|
TRANS(TransitionFade),
|
||||||
"CCTransitionRotoZoom",
|
TRANS(FadeWhiteTransition),
|
||||||
|
|
||||||
"CCTransitionMoveInL",
|
TRANS(FlipXLeftOver),
|
||||||
"CCTransitionMoveInR",
|
TRANS(FlipXRightOver),
|
||||||
"CCTransitionMoveInT",
|
TRANS(FlipYUpOver),
|
||||||
"CCTransitionMoveInB",
|
TRANS(FlipYDownOver),
|
||||||
"CCTransitionSlideInL",
|
TRANS(FlipAngularLeftOver),
|
||||||
"CCTransitionSlideInR",
|
TRANS(FlipAngularRightOver),
|
||||||
"CCTransitionSlideInT",
|
|
||||||
"CCTransitionSlideInB",
|
|
||||||
|
|
||||||
|
TRANS(ZoomFlipXLeftOver),
|
||||||
|
TRANS(ZoomFlipXRightOver),
|
||||||
|
TRANS(ZoomFlipYUpOver),
|
||||||
|
TRANS(ZoomFlipYDownOver),
|
||||||
|
TRANS(ZoomFlipAngularLeftOver),
|
||||||
|
TRANS(ZoomFlipAngularRightOver),
|
||||||
|
|
||||||
|
TRANS(TransitionShrinkGrow),
|
||||||
|
TRANS(TransitionRotoZoom),
|
||||||
|
|
||||||
|
TRANS(TransitionMoveInL),
|
||||||
|
TRANS(TransitionMoveInR),
|
||||||
|
TRANS(TransitionMoveInT),
|
||||||
|
TRANS(TransitionMoveInB),
|
||||||
|
|
||||||
|
TRANS(TransitionSlideInL),
|
||||||
|
TRANS(TransitionSlideInR),
|
||||||
|
TRANS(TransitionSlideInT),
|
||||||
|
TRANS(TransitionSlideInB),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#define MAX_LAYER (sizeof(transitions) / sizeof(transitions[0]))
|
||||||
|
|
||||||
|
|
||||||
static int s_nSceneIdx = 0;
|
static int s_nSceneIdx = 0;
|
||||||
|
|
||||||
TransitionScene* createTransition(int nIndex, float t, Scene* s)
|
TransitionScene* createTransition(int index, float t, Scene* s)
|
||||||
{
|
{
|
||||||
// fix bug #486, without setDepthTest(false), FlipX,Y will flickers
|
// fix bug #486, without setDepthTest(false), FlipX,Y will flickers
|
||||||
Director::getInstance()->setDepthTest(false);
|
Director::getInstance()->setDepthTest(false);
|
||||||
|
|
||||||
switch(nIndex)
|
return transitions[index].function(t,s);
|
||||||
{
|
|
||||||
case 0: return TransitionJumpZoom::create(t, s);
|
|
||||||
|
|
||||||
case 1: return TransitionProgressRadialCCW::create(t, s);
|
|
||||||
case 2: return TransitionProgressRadialCW::create(t, s);
|
|
||||||
case 3: return TransitionProgressHorizontal::create(t, s);
|
|
||||||
case 4: return TransitionProgressVertical::create(t, s);
|
|
||||||
case 5: return TransitionProgressInOut::create(t, s);
|
|
||||||
case 6: return TransitionProgressOutIn::create(t, s);
|
|
||||||
|
|
||||||
case 7: return TransitionCrossFade::create(t,s);
|
|
||||||
|
|
||||||
case 8: return PageTransitionForward::create(t, s);
|
|
||||||
case 9: return PageTransitionBackward::create(t, s);
|
|
||||||
case 10: return TransitionFadeTR::create(t, s);
|
|
||||||
case 11: return TransitionFadeBL::create(t, s);
|
|
||||||
case 12: return TransitionFadeUp::create(t, s);
|
|
||||||
case 13: return TransitionFadeDown::create(t, s);
|
|
||||||
|
|
||||||
case 14: return TransitionTurnOffTiles::create(t, s);
|
|
||||||
|
|
||||||
case 15: return TransitionSplitRows::create(t, s);
|
|
||||||
case 16: return TransitionSplitCols::create(t, s);
|
|
||||||
|
|
||||||
case 17: return TransitionFade::create(t, s);
|
|
||||||
case 18: return FadeWhiteTransition::create(t, s);
|
|
||||||
|
|
||||||
case 19: return FlipXLeftOver::create(t, s);
|
|
||||||
case 20: return FlipXRightOver::create(t, s);
|
|
||||||
case 21: return FlipYUpOver::create(t, s);
|
|
||||||
case 22: return FlipYDownOver::create(t, s);
|
|
||||||
case 23: return FlipAngularLeftOver::create(t, s);
|
|
||||||
case 24: return FlipAngularRightOver::create(t, s);
|
|
||||||
|
|
||||||
case 25: return ZoomFlipXLeftOver::create(t, s);
|
|
||||||
case 26: return ZoomFlipXRightOver::create(t, s);
|
|
||||||
case 27: return ZoomFlipYUpOver::create(t, s);
|
|
||||||
case 28: return ZoomFlipYDownOver::create(t, s);
|
|
||||||
case 29: return ZoomFlipAngularLeftOver::create(t, s);
|
|
||||||
case 30: return ZoomFlipAngularRightOver::create(t, s);
|
|
||||||
|
|
||||||
case 31: return TransitionShrinkGrow::create(t, s);
|
|
||||||
case 32: return TransitionRotoZoom::create(t, s);
|
|
||||||
|
|
||||||
case 33: return TransitionMoveInL::create(t, s);
|
|
||||||
case 34: return TransitionMoveInR::create(t, s);
|
|
||||||
case 35: return TransitionMoveInT::create(t, s);
|
|
||||||
case 36: return TransitionMoveInB::create(t, s);
|
|
||||||
|
|
||||||
case 37: return TransitionSlideInL::create(t, s);
|
|
||||||
case 38: return TransitionSlideInR::create(t, s);
|
|
||||||
case 39: return TransitionSlideInT::create(t, s);
|
|
||||||
case 40: return TransitionSlideInB::create(t, s);
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,7 +242,7 @@ TestLayer1::TestLayer1(void)
|
||||||
bg1->setPosition( Point(size.width/2, size.height/2) );
|
bg1->setPosition( Point(size.width/2, size.height/2) );
|
||||||
addChild(bg1, -1);
|
addChild(bg1, -1);
|
||||||
|
|
||||||
auto title = LabelTTF::create( (transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 );
|
auto title = LabelTTF::create( (transitions[s_nSceneIdx]).name, "Thonburi", 32 );
|
||||||
addChild(title);
|
addChild(title);
|
||||||
title->setColor( Color3B(255,32,32) );
|
title->setColor( Color3B(255,32,32) );
|
||||||
title->setPosition( Point(x/2, y-100) );
|
title->setPosition( Point(x/2, y-100) );
|
||||||
|
@ -415,7 +371,7 @@ TestLayer2::TestLayer2()
|
||||||
bg1->setPosition( Point(size.width/2, size.height/2) );
|
bg1->setPosition( Point(size.width/2, size.height/2) );
|
||||||
addChild(bg1, -1);
|
addChild(bg1, -1);
|
||||||
|
|
||||||
auto title = LabelTTF::create((transitions[s_nSceneIdx]).c_str(), "Thonburi", 32 );
|
auto title = LabelTTF::create((transitions[s_nSceneIdx]).name, "Thonburi", 32 );
|
||||||
addChild(title);
|
addChild(title);
|
||||||
title->setColor( Color3B(255,32,32) );
|
title->setColor( Color3B(255,32,32) );
|
||||||
title->setPosition( Point(x/2, y-100) );
|
title->setPosition( Point(x/2, y-100) );
|
||||||
|
|
|
@ -19,6 +19,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES += jsb_network_static
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_builder_static
|
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_builder_static
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_gui_static
|
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_gui_static
|
||||||
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_studio_static
|
LOCAL_WHOLE_STATIC_LIBRARIES += jsb_studio_static
|
||||||
|
LOCAL_WHOLE_STATIC_LIBRARIES += spine_static
|
||||||
|
|
||||||
|
|
||||||
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2
|
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2
|
||||||
|
@ -33,3 +34,4 @@ $(call import-module,scripting/javascript/bindings/network)
|
||||||
$(call import-module,scripting/javascript/bindings/cocosbuilder)
|
$(call import-module,scripting/javascript/bindings/cocosbuilder)
|
||||||
$(call import-module,scripting/javascript/bindings/gui)
|
$(call import-module,scripting/javascript/bindings/gui)
|
||||||
$(call import-module,scripting/javascript/bindings/cocostudio)
|
$(call import-module,scripting/javascript/bindings/cocostudio)
|
||||||
|
$(call import-module,editor-support/spine)
|
||||||
|
|
|
@ -1,839 +0,0 @@
|
||||||
# Imports the monkeyrunner modules used by this program
|
|
||||||
import sys
|
|
||||||
import subprocess
|
|
||||||
import random
|
|
||||||
import os
|
|
||||||
from com.android.monkeyrunner import MonkeyRunner as mr
|
|
||||||
from com.android.monkeyrunner import MonkeyDevice as md
|
|
||||||
from com.android.monkeyrunner import MonkeyImage as mi
|
|
||||||
|
|
||||||
#Define test functions.
|
|
||||||
def common_test(a,b,c):
|
|
||||||
for i in range(a,b):
|
|
||||||
mr.sleep(c)
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
|
|
||||||
def random_click(a,b,c):
|
|
||||||
for i in range(a,b):
|
|
||||||
touch_x = random.randint(0,s_width/20*19)
|
|
||||||
touch_y = random.randint(0,s_height)
|
|
||||||
device.touch(touch_x,touch_y,'DOWN_AND_UP')
|
|
||||||
mr.sleep(c)
|
|
||||||
|
|
||||||
def random_drag(a,b,c):
|
|
||||||
for i in range(a,b):
|
|
||||||
drag_x = random.randint(0,s_width/20*18)
|
|
||||||
drag_y = random.randint(0,s_height)
|
|
||||||
drop_x = random.randint(0,s_width/20*18)
|
|
||||||
drop_y = random.randint(0,s_height)
|
|
||||||
device.drag((drag_x,drag_y),(drop_x,drop_y))
|
|
||||||
|
|
||||||
def check_activity(a):
|
|
||||||
print "get running activities..."
|
|
||||||
subprocess.call("adb shell ps > running_activities.txt",shell=True)
|
|
||||||
#subprocess.call("adb pull running_activities.txt",shell=True)
|
|
||||||
|
|
||||||
f1 = open('running_activities.txt')
|
|
||||||
while True:
|
|
||||||
line = f1.readline()
|
|
||||||
if not line.find('org.cocos2dx.testcpp') == -1:
|
|
||||||
break;
|
|
||||||
if len(line) == 0:
|
|
||||||
str = "TestCpp wasn't running,maybe it has crashes,please checkout:"
|
|
||||||
f2 = file('monkeyrunner_Error.log','w')
|
|
||||||
print "get logcat information..."
|
|
||||||
f2.write(str)
|
|
||||||
f2.write(a)
|
|
||||||
#subprocess.call("adb shell logcat | $ANDROID_NDK/ndk-stack -sym $ANDROID_HOME/tools/obj/local/armeabi > monkeyrunner_Error.log",shell=True);
|
|
||||||
f2.close()
|
|
||||||
sys.exit(1)
|
|
||||||
print "subprocess has finished!"
|
|
||||||
f1.close()
|
|
||||||
|
|
||||||
# Connects to the current device, returning a MonkeyDevice object
|
|
||||||
device = mr.waitForConnection()
|
|
||||||
if not device:
|
|
||||||
print >> sys.stderr,"fail"
|
|
||||||
check_activity("is there a device connect to the testing machine.")
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
print "Start......"
|
|
||||||
|
|
||||||
# Installs the Android package. Notice that this method returns a boolean, so you can test
|
|
||||||
# to see if the installation worked.
|
|
||||||
if device.installPackage(sys.argv[1]):
|
|
||||||
print "Install success!"
|
|
||||||
else:
|
|
||||||
print "Install failed,please make sure you have put apk in the right places"
|
|
||||||
check_activity("you have put apk in the right place")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# sets a variable with the package's internal name
|
|
||||||
package = 'org.cocos2dx.testcpp'
|
|
||||||
print "Package name: "+ package
|
|
||||||
|
|
||||||
# sets a variable with the name of an Activity in the package
|
|
||||||
activity = 'org.cocos2dx.testcpp.TestCpp'
|
|
||||||
print "Activity name: " + activity
|
|
||||||
|
|
||||||
# sets the name of the component to start
|
|
||||||
runComponent = package + '/' + activity
|
|
||||||
|
|
||||||
# Runs the component
|
|
||||||
device.startActivity(component=runComponent)
|
|
||||||
print "Running activity......"
|
|
||||||
|
|
||||||
#Set Screen's Length and Width
|
|
||||||
s_width = 800
|
|
||||||
s_height = 480
|
|
||||||
|
|
||||||
#Set boolean variable of Acticity_IsRunning
|
|
||||||
Acticity_IsRunning = 1
|
|
||||||
|
|
||||||
#----------------ActionsTest----------------
|
|
||||||
print "Run ActionsTest"
|
|
||||||
mr.sleep(2.0)
|
|
||||||
device.touch(s_width/2,s_height/48*5,'DOWN_AND_UP')
|
|
||||||
#Last Test
|
|
||||||
#device.touch(s_width/8*3,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
common_test(1,28,1.0)
|
|
||||||
common_test(1,3,3.0)
|
|
||||||
common_test(1,6,1.0)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
#device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
print "ActionsTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ActionsTest")
|
|
||||||
|
|
||||||
#----------------TransitionsTest----------------
|
|
||||||
print "Run TransitionsTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/6,'DOWN_AND_UP')
|
|
||||||
common_test(1,27,1.0)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "TransitionsTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("TransitionsTest")
|
|
||||||
|
|
||||||
#----------------ActionsProgressTest----------------
|
|
||||||
print "Run ActionsProgressTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*11,'DOWN_AND_UP')
|
|
||||||
common_test(1,8,2.0)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "ActionsProgressTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ActionsProgressTest")
|
|
||||||
|
|
||||||
#----------------EffectsTest----------------
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "Run EffectsTest"
|
|
||||||
device.touch(s_width/2,s_height/3,'DOWN_AND_UP')
|
|
||||||
common_test(1,22,3.0)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "EffectsTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("EffectsTest")
|
|
||||||
|
|
||||||
#----------------ClickAndMoveTest----------------
|
|
||||||
print "Run ClickAndMoveTest"
|
|
||||||
mr.sleep(5.0)
|
|
||||||
device.touch(s_width/2,s_height/12*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_click(1,11,2.0)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_click(1,101,0.0)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "ClickAndMoveTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ClickAndMoveTest")
|
|
||||||
|
|
||||||
#----------------RotateWorldTest----------------
|
|
||||||
print "Run RotateWorldTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(5.0)
|
|
||||||
print "RotateWorldTest finished!"
|
|
||||||
mr.sleep(3.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("RotateWorldTest")
|
|
||||||
|
|
||||||
#----------------ParticleTest----------------
|
|
||||||
print "Run ParticleTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*7,'DOWN_AND_UP')
|
|
||||||
common_test(1,43,2.0)
|
|
||||||
print "ParticleTest finished!"
|
|
||||||
mr.sleep(2.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ParticleTest")
|
|
||||||
|
|
||||||
#----------------ActionsEaseTest----------------
|
|
||||||
print "Run ActionsEaseTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/3*2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(2.0)
|
|
||||||
common_test(1,14,2.0)
|
|
||||||
print "ActionsEaseTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ActionsEaseTest")
|
|
||||||
|
|
||||||
#----------------MotionStreakTest----------------
|
|
||||||
print "Run MontionStreakTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/4*3,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
random_drag(1,11,0.5)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/4*3,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_drag(1,11,0.5)
|
|
||||||
print "MontionStreakTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("MontionStreakTest")
|
|
||||||
|
|
||||||
#----------------DrawPrimitivesTest----------------
|
|
||||||
print "Run DrawprimitivesTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/6*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "DrawPrimitivesTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("DrawPrimitivesTest")
|
|
||||||
|
|
||||||
#----------------NodeTest----------------
|
|
||||||
print "Run NodeTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
common_test(1,14,1.0)
|
|
||||||
print "NodeTest finished!"
|
|
||||||
mr.sleep(3.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("NodeTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------TouchesTest----------------
|
|
||||||
print "Run TouchesTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12,'DOWN_AND_UP')
|
|
||||||
print "TouchesTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("TouchesTest")
|
|
||||||
|
|
||||||
#----------------MenuTest----------------
|
|
||||||
print "Run MenuTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/6,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Atlas Sprite
|
|
||||||
device.touch(s_width/2,s_height/48*13,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Play
|
|
||||||
device.touch(s_width/8*3,s_height/24*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#items
|
|
||||||
device.touch(s_width/2,s_height/24*11,'DOWN_AND_UP')
|
|
||||||
device.touch(s_width/2,s_height/24*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Configuration
|
|
||||||
device.touch(400,260,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "MenuTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("MenuTest")
|
|
||||||
|
|
||||||
#----------------ActionManagerTest----------------
|
|
||||||
print "Run ActionManagerTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*11,'DOWN_AND_UP')
|
|
||||||
common_test(1,5,3.0)
|
|
||||||
print "ActionManagerTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ActionManagerTest")
|
|
||||||
|
|
||||||
#----------------LayerTest----------------
|
|
||||||
print "Run LayerTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/3,'DOWN_AND_UP')
|
|
||||||
random_drag(1,11,0.5)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(2.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(2.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
random_drag(1,11,0.5)
|
|
||||||
print "LayerTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("LayerTest")
|
|
||||||
|
|
||||||
#----------------SceneTest----------------
|
|
||||||
print "Run SceneTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*7,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/2,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/2,s_height/2,'DOWN_AND_UP')
|
|
||||||
print "SceneTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("SceneTest")
|
|
||||||
|
|
||||||
#----------------ParallaxTest----------------
|
|
||||||
print "Run ParallaxTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(5.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
random_drag(1,11,0.5)
|
|
||||||
print "ParallaxTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ParallaxTest")
|
|
||||||
|
|
||||||
#----------------TileMapTest----------------
|
|
||||||
print "Run TileMapTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*7,'DOWN_AND_UP')
|
|
||||||
mr.sleep(2.0)
|
|
||||||
for TileMap_i in range(1,20):
|
|
||||||
random_drag(1,5,2.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
|
|
||||||
mr.sleep(2.0)
|
|
||||||
print "TileMapTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("TileMapTest")
|
|
||||||
|
|
||||||
#----------------IntervalTest----------------
|
|
||||||
print "Run IntervalTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/3*2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(3.0)
|
|
||||||
device.touch(s_width/2,s_height/12,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12,'DOWN_AND_UP')
|
|
||||||
print "IntervalTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("IntervalTest")
|
|
||||||
|
|
||||||
#----------------ChipmunkAccelTouchTest----------------
|
|
||||||
print "Run ChipmunkAccelTouchTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/4*3,'DOWN_AND_UP')
|
|
||||||
random_click(1,21,0.1)
|
|
||||||
print "ChipmunkAccelTouchTest finished!"
|
|
||||||
mr.sleep(2.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ChipmunkAccelTouchTest")
|
|
||||||
|
|
||||||
#----------------LabelTest----------------
|
|
||||||
print "Run LabelTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/6*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(3.0)
|
|
||||||
common_test(1,26,0.5)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "LableTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("LabelTest")
|
|
||||||
|
|
||||||
#----------------TestInputTest----------------
|
|
||||||
print "Run TestInputTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*11,'DOWN_AND_UP')
|
|
||||||
print "TestInputTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("TestInputTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------SpriteTest----------------
|
|
||||||
print "Run SpriteTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/16,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_click(1,11,0.1)
|
|
||||||
mr.sleep(2.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
random_click(1,11,0.1)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
common_test(1,109,0.5)
|
|
||||||
print "SpriteTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("SpriteTest")
|
|
||||||
|
|
||||||
#----------------SchdulerTest----------------
|
|
||||||
print "Run SchdulerTest"
|
|
||||||
mr.sleep(2.0)
|
|
||||||
device.touch(s_width/2,s_height/48*7,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
#Scheduler timeScale Test
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/16*9,s_height/8*5),(s_width/16*7,s_height/8*5))
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
#Two custom schedulers
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/16*5,s_height/24),(s_width/16*3,s_height/24))
|
|
||||||
mr.sleep(1.0)
|
|
||||||
common_test(1,11,1)
|
|
||||||
print "SchdulerTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("SchdulerTest")
|
|
||||||
|
|
||||||
#----------------RenderTextureTest----------------
|
|
||||||
print "Run RenderTextureTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_drag(1,11,0.5)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/8*7,s_height/24,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Testing Z Buffer in Render Texture
|
|
||||||
random_click(1,11,0.1)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
print "RenderTextureTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("RenderTextureTest")
|
|
||||||
|
|
||||||
#----------------Testure2DTest----------------
|
|
||||||
print "Run Testure2DTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/16*5,'DOWN_AND_UP')
|
|
||||||
common_test(1,36,0.5)
|
|
||||||
print "Testure2DTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("Testure2DTest")
|
|
||||||
|
|
||||||
#----------------Box2dTest----------------
|
|
||||||
print "Run Box2dTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*19,'DOWN_AND_UP')
|
|
||||||
random_click(1,31,0.1)
|
|
||||||
print "Box2dTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("Box2dTest")
|
|
||||||
|
|
||||||
#----------------Box2dTestBed----------------
|
|
||||||
print "Run Box2dTestBed"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*23,'DOWN_AND_UP')
|
|
||||||
common_test(1,36,2.0)
|
|
||||||
print "Box2dTestBed finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("Box2dTestBed")
|
|
||||||
|
|
||||||
#----------------EffectAdvancedTest----------------
|
|
||||||
print "Run EffectAdvancedTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/16*9,'DOWN_AND_UP')
|
|
||||||
common_test(1,6,1.0)
|
|
||||||
print "EffectAdvancedTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("EffectAdvancedTest")
|
|
||||||
|
|
||||||
#----------------Accelerometer----------------
|
|
||||||
print "Run Accelerometer"
|
|
||||||
mr.sleep(5.0)
|
|
||||||
device.touch(s_width/2,s_height/48*31,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "Accelerometer finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
mr.sleep(3.0)
|
|
||||||
check_activity("Accelerometer")
|
|
||||||
|
|
||||||
#----------------KeypadTest----------------
|
|
||||||
print "Run KeypadTest"
|
|
||||||
mr.sleep(3.0)
|
|
||||||
device.touch(s_width/2,s_height/48*35,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.press('KEYCODE_BACK','DOWN_AND_UP')
|
|
||||||
print "KeypadTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("KeypadTest")
|
|
||||||
|
|
||||||
#----------------CocosDenshionTest----------------
|
|
||||||
print "Run CocosDenshionTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*39,'DOWN_AND_UP')
|
|
||||||
#device.touch(400,30,'DOWN_AND_UP')
|
|
||||||
#device.touch(400,100,'DOWN_AND_UP')
|
|
||||||
print "CocosDenshionTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("CocosDenshionTest")
|
|
||||||
|
|
||||||
#----------------PerformanceTest----------------
|
|
||||||
print "Run PerformanceTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*43,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#PerformanceNodeChildrenTest
|
|
||||||
device.touch(s_width/2,s_height/12,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
common_test(1,6,1.0)
|
|
||||||
#Back
|
|
||||||
device.touch(s_width/20*19,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#PerformanceParticleTest
|
|
||||||
device.touch(s_width/2,s_height/6,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#for NodeChildren_i in range(1,5):
|
|
||||||
# device.touch(450,240,'DOWN_AND_UP')
|
|
||||||
# mr.sleep(1.0)
|
|
||||||
# device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
# mr.sleep(1.0)
|
|
||||||
common_test(1,5,1.0)
|
|
||||||
#Back
|
|
||||||
device.touch(s_width/20*19,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#PerformanceSpriteTest
|
|
||||||
device.touch(s_width/2,s_height/4,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#for NodeChildren_i in range(1,8):
|
|
||||||
# device.touch(430,80,'DOWN_AND_UP')
|
|
||||||
# mr.sleep(1.0)
|
|
||||||
# device.touch(370,80,'DOWN_AND_UP')
|
|
||||||
# mr.sleep(1.0)
|
|
||||||
common_test(1,8,1.0)
|
|
||||||
#Back
|
|
||||||
device.touch(s_width/20*19,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#PerformanceTextureTest
|
|
||||||
#device.touch(s_width/2,s_height/3,'DOWN_AND_UP')
|
|
||||||
#mr.sleep(1.0)
|
|
||||||
#Back
|
|
||||||
#device.touch(s_width/20*19,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
#mr.sleep(1.0)
|
|
||||||
#PerformanceTouchesTest
|
|
||||||
device.touch(s_width/2,s_height/12*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_drag(1,11,0.2)
|
|
||||||
#Next Test
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_drag(1,11,0.2)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Back
|
|
||||||
device.touch(s_width/20*19,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
print "PerformanceTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("PerformanceTest")
|
|
||||||
|
|
||||||
#----------------ZwoptexTest----------------
|
|
||||||
print "Run ZwoptexTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/48*47,'DOWN_AND_UP')
|
|
||||||
print "ZwoptexTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ZwoptexTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------CurlTest----------------
|
|
||||||
print "Run CurlTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/4,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_click(1,2,1.0)
|
|
||||||
print "CurlTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("CurlTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------UserDefaultTest----------------
|
|
||||||
print "Run UserDefaultTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/3,'DOWN_AND_UP')
|
|
||||||
print "UserDefaultTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("UserDefaultTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------BugsTest----------------
|
|
||||||
print "Run BugsTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*5,'DOWN_AND_UP')
|
|
||||||
print "BugsTest is finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("BugsTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------FontTest----------------
|
|
||||||
print "Run FontTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
common_test(1,6,0.5)
|
|
||||||
mr.sleep(1.0)
|
|
||||||
print "FontTest finished!"
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("FontTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------CurrentLanguageTest----------------
|
|
||||||
print "Run CurrentLanguageTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12*7,'DOWN_AND_UP')
|
|
||||||
print "CurrentLanguageTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("CurrentLanguageTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------TextureCacheTest----------------
|
|
||||||
print "Run TextureCacheTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/3*2,'DOWN_AND_UP')
|
|
||||||
print "TextureCacheTest is finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("TextureCacheTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------ExtensionsTest----------------
|
|
||||||
print "Run ExtensionsTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/4*3,'DOWN_AND_UP')
|
|
||||||
#NotificationCenterTest
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/12,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/40*23,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/40*23,s_height/2,'DOWN_AND_UP')
|
|
||||||
#Back
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/20*19,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
#CCControlButtonTest
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/2,s_height/6,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.drag((s_width/2,s_height/48*25),(s_width/20*13,s_height/48*25))
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.drag((s_width/20*13,s_height/48*25),(s_width/20*7,s_height/48*25))
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/16*7,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/40*19,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
random_click(1,10,0.1)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
random_click(1,10,0.1)
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
random_click(1,10,0.1)
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Back
|
|
||||||
device.touch(s_width/20*19,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#CocosBuilderTest
|
|
||||||
device.touch(s_width/2,s_height/4,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Menus & Items
|
|
||||||
device.touch(s_width/4,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/4,s_height/24*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/2,s_height/24*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#ItemBack
|
|
||||||
device.touch(s_width/40,s_height/24,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Sprite & 9 Slice
|
|
||||||
device.touch(s_width/4*3,s_height/2,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#ItemBack
|
|
||||||
device.touch(s_width/40,s_height/24,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Button
|
|
||||||
device.touch(s_width/4,s_height/8*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.touch(s_width/2,s_height/24*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
device.drag((s_width/2,s_height/24*11),(s_width/2,s_height/8*5))
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#ItemBack
|
|
||||||
device.touch(s_width/40,s_height/24,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Labels
|
|
||||||
device.touch(s_width/4*3,s_height/8*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#ItemBack
|
|
||||||
device.touch(s_width/40,s_height/24,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Particle Systems
|
|
||||||
device.touch(s_width/40,s_height/4*3,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#ItemBack
|
|
||||||
device.touch(s_width/40,s_height/24,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#Scroll Views
|
|
||||||
device.touch(s_width/4*3,s_height/4*3,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
random_drag(1,10,0.2)
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#ItemBack
|
|
||||||
device.touch(s_width/40,s_height/24,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.5)
|
|
||||||
print "ExtensionsTest finished!"
|
|
||||||
mr.sleep(1.5)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ExtensionsTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------ShaderTest----------------
|
|
||||||
print "Run ShaderTest"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/2,s_height/6*5,'DOWN_AND_UP')
|
|
||||||
mr.sleep(7.0)
|
|
||||||
common_test(1,7,1.0)
|
|
||||||
mr.sleep(2.0)
|
|
||||||
device.drag((s_width/2,s_height/3*2),(s_width/80*51,s_height/3*2))
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/80*51,s_height/3*2),(s_width/80*29,s_height/3*2))
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#Next Test
|
|
||||||
device.touch(s_width/8*5,s_height/16*15,'DOWN_AND_UP')
|
|
||||||
print "ShaderTest finished!"
|
|
||||||
mr.sleep(3.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("ShaderTest")
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.drag((s_width/4*3,s_height/16*15),(s_width/4*3,0))
|
|
||||||
|
|
||||||
#----------------MutiTouchTest----------------
|
|
||||||
print "Run MutiTouchTest"
|
|
||||||
mr.sleep(3.0)
|
|
||||||
device.touch(s_width/2,s_height/12*11,'DOWN_AND_UP')
|
|
||||||
mr.sleep(1.0)
|
|
||||||
random_drag(1,10,0.1)
|
|
||||||
print "MutiTouchTest finished!"
|
|
||||||
mr.sleep(1.0)
|
|
||||||
#MainMenu
|
|
||||||
device.touch(s_width/40*39,s_height/96*91,'DOWN_AND_UP')
|
|
||||||
check_activity("MutiTouchTest")
|
|
||||||
|
|
||||||
#----------------Quit----------------
|
|
||||||
mr.sleep(1.0)
|
|
||||||
device.touch(s_width/80*77,s_height/12,'DOWN_AND_UP')
|
|
|
@ -1,95 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project name="Tests" default="help">
|
|
||||||
|
|
||||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
|
||||||
It contains the path to the SDK. It should *NOT* be checked into
|
|
||||||
Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="local.properties" />
|
|
||||||
|
|
||||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
|
||||||
'android' tool to add properties to it.
|
|
||||||
This is the place to change some Ant specific build properties.
|
|
||||||
Here are some properties you may want to change/update:
|
|
||||||
|
|
||||||
source.dir
|
|
||||||
The name of the source directory. Default is 'src'.
|
|
||||||
out.dir
|
|
||||||
The name of the output directory. Default is 'bin'.
|
|
||||||
|
|
||||||
For other overridable properties, look at the beginning of the rules
|
|
||||||
files in the SDK, at tools/ant/build.xml
|
|
||||||
|
|
||||||
Properties related to the SDK location or the project target should
|
|
||||||
be updated using the 'android' tool with the 'update' action.
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems.
|
|
||||||
|
|
||||||
-->
|
|
||||||
<property file="ant.properties" />
|
|
||||||
|
|
||||||
<!-- The project.properties file is created and updated by the 'android'
|
|
||||||
tool, as well as ADT.
|
|
||||||
|
|
||||||
This contains project specific properties such as project target, and library
|
|
||||||
dependencies. Lower level build properties are stored in ant.properties
|
|
||||||
(or in .classpath for Eclipse projects).
|
|
||||||
|
|
||||||
This file is an integral part of the build system for your
|
|
||||||
application and should be checked into Version Control Systems. -->
|
|
||||||
<loadproperties srcFile="project.properties" />
|
|
||||||
|
|
||||||
<!-- quick check on sdk.dir -->
|
|
||||||
<fail
|
|
||||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
|
|
||||||
unless="sdk.dir"
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- extension targets. Uncomment the ones where you want to do custom work
|
|
||||||
in between standard targets -->
|
|
||||||
|
|
||||||
<target name="-pre-build">
|
|
||||||
<copy todir="src/org/cocos2dx">
|
|
||||||
<fileset dir="..\..\..\..\cocos2dx\platform\android\java\src\org\cocos2dx">
|
|
||||||
<include name="lib/" />
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
</target>
|
|
||||||
<target name="-pre-compile">
|
|
||||||
<path id="android.target.classpath">
|
|
||||||
<pathelement path="${sdk.dir}/platforms/${target}/android.jar"/>
|
|
||||||
<pathelement path="${sdk.dir}/platforms/${target}/data/layoutlib.jar"/>
|
|
||||||
</path>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
/* This is typically used for code obfuscation.
|
|
||||||
Compiled code location: ${out.classes.absolute.dir}
|
|
||||||
If this is not done in place, override ${out.dex.input.absolute.dir} */
|
|
||||||
<target name="-post-compile">
|
|
||||||
</target>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Import the actual build file.
|
|
||||||
|
|
||||||
To customize existing targets, there are two options:
|
|
||||||
- Customize only one target:
|
|
||||||
- copy/paste the target into this file, *before* the
|
|
||||||
<import> task.
|
|
||||||
- customize it to your needs.
|
|
||||||
- Customize the whole content of build.xml
|
|
||||||
- copy/paste the content of the rules files (minus the top node)
|
|
||||||
into this file, replacing the <import> task.
|
|
||||||
- customize to your needs.
|
|
||||||
|
|
||||||
***********************
|
|
||||||
****** IMPORTANT ******
|
|
||||||
***********************
|
|
||||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
|
||||||
in order to avoid having your file be overridden by tools such as "android update project"
|
|
||||||
-->
|
|
||||||
<!-- version-tag: 1 -->
|
|
||||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -7,28 +7,9 @@ import urllib2
|
||||||
import urllib
|
import urllib
|
||||||
import base64
|
import base64
|
||||||
import requests
|
import requests
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
#get payload from os env
|
|
||||||
payload_str = os.environ['payload']
|
|
||||||
#parse to json obj
|
|
||||||
payload = json.loads(payload_str)
|
|
||||||
|
|
||||||
#get pull number
|
|
||||||
pr_num = payload['number']
|
|
||||||
print 'pr_num:' + str(pr_num)
|
|
||||||
|
|
||||||
#build for pull request action 'open' and 'synchronize', skip 'close'
|
|
||||||
action = payload['action']
|
|
||||||
print 'action: ' + action
|
|
||||||
if((action != 'opened') and (action != 'synchronize')):
|
|
||||||
print 'pull request #' + str(pr_num) + ' is closed, no build triggered'
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
pr = payload['pull_request']
|
|
||||||
url = pr['html_url']
|
|
||||||
print "url:" + url
|
|
||||||
pr_desc = '<h3><a href='+ url + '> pr#' + str(pr_num) + '</a></h3>'
|
|
||||||
#set Jenkins build description using submitDescription to mock browser behavior
|
#set Jenkins build description using submitDescription to mock browser behavior
|
||||||
#TODO: need to set parent build description
|
#TODO: need to set parent build description
|
||||||
def set_description(desc):
|
def set_description(desc):
|
||||||
|
@ -38,74 +19,90 @@ def set_description(desc):
|
||||||
req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
req.add_header('Content-Type', 'application/x-www-form-urlencoded')
|
||||||
base64string = base64.encodestring(os.environ['JENKINS_ADMIN']+ ":" + os.environ['JENKINS_ADMIN_PW']).replace('\n', '')
|
base64string = base64.encodestring(os.environ['JENKINS_ADMIN']+ ":" + os.environ['JENKINS_ADMIN_PW']).replace('\n', '')
|
||||||
req.add_header("Authorization", "Basic " + base64string)
|
req.add_header("Authorization", "Basic " + base64string)
|
||||||
|
try:
|
||||||
urllib2.urlopen(req)
|
urllib2.urlopen(req)
|
||||||
try:
|
except:
|
||||||
|
traceback.format_exc()
|
||||||
|
def main():
|
||||||
|
#get payload from os env
|
||||||
|
payload_str = os.environ['payload']
|
||||||
|
#parse to json obj
|
||||||
|
payload = json.loads(payload_str)
|
||||||
|
|
||||||
|
#get pull number
|
||||||
|
pr_num = payload['number']
|
||||||
|
print 'pr_num:' + str(pr_num)
|
||||||
|
|
||||||
|
#build for pull request action 'open' and 'synchronize', skip 'close'
|
||||||
|
action = payload['action']
|
||||||
|
print 'action: ' + action
|
||||||
|
if((action != 'opened') and (action != 'synchronize')):
|
||||||
|
print 'pull request #' + str(pr_num) + ' is closed, no build triggered'
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
pr = payload['pull_request']
|
||||||
|
url = pr['html_url']
|
||||||
|
print "url:" + url
|
||||||
|
pr_desc = '<h3><a href='+ url + '> pr#' + str(pr_num) + '</a></h3>'
|
||||||
set_description(pr_desc)
|
set_description(pr_desc)
|
||||||
except Exception as e:
|
|
||||||
print e
|
|
||||||
|
|
||||||
#get statuses url
|
#get statuses url
|
||||||
statuses_url = pr['statuses_url']
|
statuses_url = pr['statuses_url']
|
||||||
|
|
||||||
#get pr target branch
|
#get pr target branch
|
||||||
branch = pr['head']['ref']
|
branch = pr['base']['ref']
|
||||||
|
|
||||||
#set commit status to pending
|
#set commit status to pending
|
||||||
target_url = os.environ['BUILD_URL']
|
target_url = os.environ['BUILD_URL']
|
||||||
data = {"state":"pending", "target_url":target_url}
|
data = {"state":"pending", "target_url":target_url}
|
||||||
acccess_token = os.environ['GITHUB_ACCESS_TOKEN']
|
acccess_token = os.environ['GITHUB_ACCESS_TOKEN']
|
||||||
Headers = {"Authorization":"token " + acccess_token}
|
Headers = {"Authorization":"token " + acccess_token}
|
||||||
try:
|
|
||||||
|
try:
|
||||||
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
|
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
|
||||||
|
except:
|
||||||
|
traceback.format_exc()
|
||||||
|
|
||||||
#reset path to workspace root
|
#build
|
||||||
os.system("cd " + os.environ['WORKSPACE']);
|
#TODO: support android-mac build currently
|
||||||
|
#TODO: add android-windows7 build
|
||||||
#fetch pull request to local repo
|
#TODO: add android-linux build
|
||||||
git_fetch_pr = "git fetch origin pull/" + str(pr_num) + "/head"
|
#TODO: add ios build
|
||||||
os.system(git_fetch_pr)
|
#TODO: add mac build
|
||||||
|
#TODO: add win32 build
|
||||||
#checkout
|
if(branch == 'develop'):
|
||||||
git_checkout = "git checkout -b " + "pull" + str(pr_num) + " FETCH_HEAD"
|
|
||||||
os.system(git_checkout)
|
|
||||||
|
|
||||||
#update submodule
|
|
||||||
git_update_submodule = "git submodule update --init --force"
|
|
||||||
os.system(git_update_submodule)
|
|
||||||
except Exception as e:
|
|
||||||
print e
|
|
||||||
|
|
||||||
|
|
||||||
#build
|
|
||||||
#TODO: support android-mac build currently
|
|
||||||
#TODO: add android-windows7 build
|
|
||||||
#TODO: add android-linux build
|
|
||||||
#TODO: add ios build
|
|
||||||
#TODO: add mac build
|
|
||||||
#TODO: add win32 build
|
|
||||||
if(branch == 'develop'):
|
|
||||||
ret = os.system("python build/android-build.py -n -j5 testcpp")
|
ret = os.system("python build/android-build.py -n -j5 testcpp")
|
||||||
elif(branch == 'master'):
|
elif(branch == 'master'):
|
||||||
ret = os.system("samples/Cpp/TestCpp/proj.android/build_native.sh")
|
ret = os.system("samples/Cpp/TestCpp/proj.android/build_native.sh")
|
||||||
|
|
||||||
#get build result
|
#get build result
|
||||||
print "build finished and return " + str(ret)
|
print "build finished and return " + str(ret)
|
||||||
if ret == 0:
|
if ret == 0:
|
||||||
exit_code = 0
|
exit_code = 0
|
||||||
data['state'] = "success"
|
data['state'] = "success"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
exit_code = 1
|
exit_code = 1
|
||||||
data['state'] = "failure"
|
data['state'] = "failure"
|
||||||
try:
|
|
||||||
#set commit status
|
#set commit status
|
||||||
|
try:
|
||||||
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
|
requests.post(statuses_url, data=json.dumps(data), headers=Headers)
|
||||||
|
except:
|
||||||
|
traceback.format_exc()
|
||||||
|
|
||||||
#clean workspace
|
#clean workspace
|
||||||
os.system("cd " + os.environ['WORKSPACE']);
|
os.system("cd " + os.environ['WORKSPACE']);
|
||||||
os.system("git checkout develop")
|
os.system("git checkout develop")
|
||||||
os.system("git branch -D pull" + str(pr_num))
|
os.system("git branch -D pull" + str(pr_num))
|
||||||
except Exception as e:
|
|
||||||
print e
|
|
||||||
exit(exit_code)
|
|
||||||
|
|
||||||
|
exit(exit_code)
|
||||||
|
|
||||||
|
# -------------- main --------------
|
||||||
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
main()
|
||||||
|
except:
|
||||||
|
traceback.format_exc()
|
||||||
|
exit(1)
|
||||||
|
|
|
@ -101,7 +101,7 @@ skip = Node::[^setPosition$ setGrid setGLServerState description getUserObject .
|
||||||
Bezier.*::[create actionWithDuration],
|
Bezier.*::[create actionWithDuration],
|
||||||
CardinalSpline.*::[create actionWithDuration setPoints],
|
CardinalSpline.*::[create actionWithDuration setPoints],
|
||||||
Scheduler::[pause resume unschedule schedule update isTargetPaused],
|
Scheduler::[pause resume unschedule schedule update isTargetPaused],
|
||||||
TextureCache::[addPVRTCImage],
|
TextureCache::[addPVRTCImage addImageAsync],
|
||||||
Timer::[getSelector createWithScriptHandler],
|
Timer::[getSelector createWithScriptHandler],
|
||||||
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener],
|
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener],
|
||||||
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getFileData getDataFromFile],
|
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getFileData getDataFromFile],
|
||||||
|
|
|
@ -99,7 +99,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
||||||
Bezier.*::[create actionWithDuration],
|
Bezier.*::[create actionWithDuration],
|
||||||
CardinalSpline.*::[create actionWithDuration setPoints],
|
CardinalSpline.*::[create actionWithDuration setPoints],
|
||||||
Scheduler::[pause resume unschedule schedule update isTargetPaused],
|
Scheduler::[pause resume unschedule schedule update isTargetPaused],
|
||||||
TextureCache::[addPVRTCImage],
|
TextureCache::[addPVRTCImage addImageAsync],
|
||||||
Timer::[getSelector createWithScriptHandler],
|
Timer::[getSelector createWithScriptHandler],
|
||||||
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener],
|
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType (g|s)etDelegate onTouch.* onAcc.* onKey.* onRegisterTouchListener],
|
||||||
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getFileData getDataFromFile],
|
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getFileData getDataFromFile],
|
||||||
|
|
Loading…
Reference in New Issue