Merge branch 'gles20' of git://github.com/cocos2d/cocos2d-x into gles20

This commit is contained in:
YuLei 2012-08-28 12:22:57 +08:00
commit 02e77faf51
82 changed files with 1342 additions and 633 deletions

2
.gitignore vendored
View File

@ -27,6 +27,8 @@ obj/
[Rr]elease*/ [Rr]elease*/
_ReSharper*/ _ReSharper*/
[Tt]est[Rr]esult* [Tt]est[Rr]esult*
ipch/
*.opensdf
# Ignore files build by ndk and eclipse # Ignore files build by ndk and eclipse
libs/ libs/

View File

@ -969,6 +969,16 @@ void CCNode::unscheduleAllSelectors()
m_pScheduler->unscheduleAllSelectorsForTarget(this); m_pScheduler->unscheduleAllSelectorsForTarget(this);
} }
unsigned int CCNode::scheduleScriptFunc(unsigned int nHandler, float fInterval, bool bPaused)
{
return m_pScheduler->scheduleScriptFunc(nHandler, fInterval, bPaused);
}
void CCNode::unscheduleScriptEntry(unsigned int uScheduleScriptEntryID)
{
m_pScheduler->unscheduleScriptEntry(uScheduleScriptEntryID);
}
void CCNode::resumeSchedulerAndActions() void CCNode::resumeSchedulerAndActions()
{ {
m_pScheduler->resumeTarget(this); m_pScheduler->resumeTarget(this);

View File

@ -543,6 +543,16 @@ public:
/** unschedules a custom selector.*/ /** unschedules a custom selector.*/
void unschedule(SEL_SCHEDULE selector); void unschedule(SEL_SCHEDULE selector);
/** The scheduled script callback will be called every 'interval' seconds.
If paused is YES, then it won't be called until it is resumed.
If 'interval' is 0, it will be called every frame.
return schedule script entry ID, used for unscheduleScriptFunc().
*/
unsigned int scheduleScriptFunc(unsigned int nHandler, float fInterval, bool bPaused);
/** Unschedule a script entry. */
void unscheduleScriptEntry(unsigned int uScheduleScriptEntryID);
/** unschedule all scheduled selectors: custom selectors, and the 'update' selector. /** unschedule all scheduled selectors: custom selectors, and the 'update' selector.
Actions are not affected by this method. Actions are not affected by this method.
@since v0.99.3 @since v0.99.3

View File

@ -119,9 +119,7 @@ void calculate_line_normal(kmVec2 p1, kmVec2 p2, kmVec2* normal_out) {
kmBool kmRay2IntersectTriangle(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, const kmVec2* p3, kmVec2* intersection, kmVec2* normal_out) { kmBool kmRay2IntersectTriangle(const kmRay2* ray, const kmVec2* p1, const kmVec2* p2, const kmVec2* p3, kmVec2* intersection, kmVec2* normal_out) {
kmVec2 intersect; kmVec2 intersect;
kmVec2 final_intersect; kmVec2 final_intersect = {0., 0.}, normal = {0., 0.}; // Silencing LLVM SA.
kmVec2 normal;
//kmVec2 final_intersect = {.x = 0, .y = 0}, normal = {.x = 0, .y = 0}; // Silencing LLVM SA
kmScalar distance = 10000.0f; kmScalar distance = 10000.0f;
kmBool intersected = KM_FALSE; kmBool intersected = KM_FALSE;

View File

@ -131,79 +131,6 @@ private:
int excuteScriptTouchHandler(int nEventType, CCSet *pTouches); int excuteScriptTouchHandler(int nEventType, CCSet *pTouches);
}; };
// for the subclass of CCLayer, each has to implement the static "node" method
// @deprecated: This interface will be deprecated sooner or later.
#define LAYER_NODE_FUNC(layer) \
CC_DEPRECATED_ATTRIBUTE static layer* node() \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
// for the subclass of CCLayer, each has to implement the static "create" method
#define LAYER_CREATE_FUNC(layer) \
static layer* create() \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
// @deprecated: This interface will be deprecated sooner or later.
#define LAYER_NODE_FUNC_PARAM(layer,__PARAMTYPE__,__PARAM__) \
CC_DEPRECATED_ATTRIBUTE static layer* node(__PARAMTYPE__ __PARAM__) \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init(__PARAM__)) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
#define LAYER_CREATE_FUNC_PARAM(layer,__PARAMTYPE__,__PARAM__) \
static layer* create(__PARAMTYPE__ __PARAM__) \
{ \
layer *pRet = new layer(); \
if (pRet && pRet->init(__PARAM__)) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
// //
// CCLayerColor // CCLayerColor
// //
@ -266,8 +193,8 @@ public:
virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);} virtual void setOpacityModifyRGB(bool bValue) {CC_UNUSED_PARAM(bValue);}
virtual bool isOpacityModifyRGB(void) { return false;} virtual bool isOpacityModifyRGB(void) { return false;}
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
LAYER_CREATE_FUNC(CCLayerColor) CREATE_FUNC(CCLayerColor)
LAYER_NODE_FUNC(CCLayerColor) NODE_FUNC(CCLayerColor)
protected: protected:
virtual void updateColor(); virtual void updateColor();
}; };
@ -336,8 +263,8 @@ public:
virtual bool isCompressedInterpolation(); virtual bool isCompressedInterpolation();
// @deprecated: This interface will be deprecated sooner or later. // @deprecated: This interface will be deprecated sooner or later.
LAYER_NODE_FUNC(CCLayerGradient) NODE_FUNC(CCLayerGradient)
LAYER_CREATE_FUNC(CCLayerGradient) CREATE_FUNC(CCLayerGradient)
protected: protected:
virtual void updateColor(); virtual void updateColor();
}; };
@ -392,9 +319,9 @@ public:
void switchToAndReleaseMe(unsigned int n); void switchToAndReleaseMe(unsigned int n);
//@deprecated: This interface will be deprecated sooner or later. //@deprecated: This interface will be deprecated sooner or later.
LAYER_NODE_FUNC(CCLayerMultiplex) NODE_FUNC(CCLayerMultiplex)
LAYER_CREATE_FUNC(CCLayerMultiplex) CREATE_FUNC(CCLayerMultiplex)
}; };
// end of layer group // end of layer group

View File

@ -61,72 +61,4 @@ public:
NS_CC_END NS_CC_END
// for the subclass of CCScene, each has to implement the static "node" method
// @deprecated: This interface will be deprecated sooner or later.
#define SCENE_NODE_FUNC(scene) \
CC_DEPRECATED_ATTRIBUTE static scene* node() \
{ \
scene *pRet = new scene(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
};
// @deprecated: This interface will be deprecated sooner or later.
#define SCENE_FUNC_PARAM(__TYPE__,__PARAMTYPE__,__PARAM__) \
CC_DEPRECATED_ATTRIBUTE static cocos2d::CCScene* node(__PARAMTYPE__ __PARAM__) \
{ \
cocos2d::CCScene * scene = NULL; \
do \
{ \
scene = cocos2d::CCScene::node(); \
CC_BREAK_IF(! scene); \
__TYPE__ *layer = __TYPE__::node(__PARAM__); \
CC_BREAK_IF(! layer); \
scene->addChild(layer); \
} while (0); \
return scene; \
}
// for the subclass of CCScene, each has to implement the static "create" method
#define SCENE_CREATE_FUNC(scene) \
static scene* create() \
{ \
scene *pRet = new scene(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
};
#define SCENE_CREATE_FUNC_PARAM(__TYPE__,__PARAMTYPE__,__PARAM__) \
static cocos2d::CCScene* create(__PARAMTYPE__ __PARAM__) \
{ \
cocos2d::CCScene * scene = NULL; \
do \
{ \
scene = cocos2d::CCScene::create(); \
CC_BREAK_IF(! scene); \
__TYPE__ *layer = __TYPE__::create(__PARAM__); \
CC_BREAK_IF(! layer); \
scene->addChild(layer); \
} while (0); \
return scene; \
}
#endif // __CCSCENE_H__ #endif // __CCSCENE_H__

View File

@ -31,6 +31,48 @@
#include "CCPlatformConfig.h" #include "CCPlatformConfig.h"
#include "CCPlatformDefine.h" #include "CCPlatformDefine.h"
/**
* define a create function for a specific type, such as CCLayer
* @__TYPE__ class type to add create(), such as CCLayer
*/
#define CREATE_FUNC(__TYPE__) \
static __TYPE__* create() \
{ \
__TYPE__ *pRet = new __TYPE__(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
/**
* define a node function for a specific type, such as CCLayer
* @__TYPE__ class type to add node(), such as CCLayer
* @deprecated: This interface will be deprecated sooner or later.
*/
#define NODE_FUNC(__TYPE__) \
CC_DEPRECATED_ATTRIBUTE static __TYPE__* node() \
{ \
__TYPE__ *pRet = new __TYPE__(); \
if (pRet && pRet->init()) \
{ \
pRet->autorelease(); \
return pRet; \
} \
else \
{ \
delete pRet; \
pRet = NULL; \
return NULL; \
} \
}
/** @def CC_ENABLE_CACHE_TEXTURE_DATA /** @def CC_ENABLE_CACHE_TEXTURE_DATA
Enable it if you want to cache the texture data. Enable it if you want to cache the texture data.

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2010-2011 cocos2d-x.org Copyright (c) 2010-2012 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -24,11 +24,12 @@ THE SOFTWARE.
package org.cocos2dx.lib; package org.cocos2dx.lib;
import java.lang.ref.WeakReference;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
@ -57,6 +58,28 @@ public class Cocos2dxActivity extends Activity{
private static native void nativeSetPaths(String apkPath); private static native void nativeSetPaths(String apkPath);
private static native void nativeSetEditboxText(byte[] text); private static native void nativeSetEditboxText(byte[] text);
static class ShowDialogHandler extends Handler {
WeakReference<Cocos2dxActivity> mActivity;
ShowDialogHandler(Cocos2dxActivity activity) {
mActivity = new WeakReference<Cocos2dxActivity>(activity);
}
@Override
public void handleMessage(Message msg) {
Cocos2dxActivity theActivity = mActivity.get();
switch(msg.what) {
case HANDLER_SHOW_DIALOG:
theActivity.showDialog(((DialogMessage)msg.obj).title, ((DialogMessage)msg.obj).message);
break;
case HANDLER_SHOW_EDITBOX_DIALOG:
theActivity.onShowEditBoxDialog((EditBoxMessage)msg.obj);
break;
}
}
};
public Cocos2dxGLSurfaceView getGLView() { public Cocos2dxGLSurfaceView getGLView() {
return mGLView; return mGLView;
} }
@ -80,18 +103,7 @@ public class Cocos2dxActivity extends Activity{
// init bitmap context // init bitmap context
Cocos2dxBitmap.setContext(this); Cocos2dxBitmap.setContext(this);
handler = new Handler(){ handler = new ShowDialogHandler(this);
public void handleMessage(Message msg){
switch(msg.what){
case HANDLER_SHOW_DIALOG:
showDialog(((DialogMessage)msg.obj).title, ((DialogMessage)msg.obj).message);
break;
case HANDLER_SHOW_EDITBOX_DIALOG:
onShowEditBoxDialog((EditBoxMessage)msg.obj);
break;
}
}
};
} }
public static String getDeviceModel(){ public static String getDeviceModel(){

View File

@ -36,11 +36,8 @@ import android.graphics.Rect;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.Paint.Align; import android.graphics.Paint.Align;
import android.graphics.Paint.FontMetricsInt; import android.graphics.Paint.FontMetricsInt;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextPaint; import android.text.TextPaint;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.style.StyleSpan;
import android.util.Log; import android.util.Log;
public class Cocos2dxBitmap{ public class Cocos2dxBitmap{

View File

@ -1,11 +1,32 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
package org.cocos2dx.lib; package org.cocos2dx.lib;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.InputFilter; import android.text.InputFilter;
@ -13,7 +34,6 @@ import android.text.InputType;
import android.util.Log; import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2010 cocos2d-x.org Copyright (c) 2012 cocos2d-x.org
http://www.cocos2d-x.org http://www.cocos2d-x.org
@ -25,6 +25,7 @@ THE SOFTWARE.
#define __CC_PLATFORM_FILEUTILS_CPP__ #define __CC_PLATFORM_FILEUTILS_CPP__
#include "platform/CCFileUtilsCommon_cpp.h" #include "platform/CCFileUtilsCommon_cpp.h"
#include "CCApplication.h" #include "CCApplication.h"
#include <unistd.h>
NS_CC_BEGIN; NS_CC_BEGIN;
@ -57,9 +58,12 @@ void CCFileUtils::purgeCachedEntries()
static std::string fullPathFromRelativePathThreadSafe(const char* pszRelativePath) static std::string fullPathFromRelativePathThreadSafe(const char* pszRelativePath)
{ {
bool bFileExist = true;
std::string ret(""); std::string ret("");
std::string strPathWithoutResDir("");
const char* pszRootPath = CCApplication::sharedApplication()->getResourceRootPath(); const char* pszRootPath = CCApplication::sharedApplication()->getResourceRootPath();
CCAssert(pszRootPath != NULL, "The resource root path must be set in the main.cpp"); CCAssert(pszRootPath != NULL, "The resource root path must be set in the main.cpp");
CCAssert(pszRelativePath != NULL, "Parameter can't be NULL!");
std::string pstrRelativePath = pszRelativePath; std::string pstrRelativePath = pszRelativePath;
// if the relative path contains root path, skip it. // if the relative path contains root path, skip it.
@ -68,6 +72,8 @@ static std::string fullPathFromRelativePathThreadSafe(const char* pszRelativePat
ret += pszRootPath; ret += pszRootPath;
} }
strPathWithoutResDir = ret + pszRelativePath;
const char* resDir = CCFileUtils::sharedFileUtils()->getResourceDirectory(); const char* resDir = CCFileUtils::sharedFileUtils()->getResourceDirectory();
if (resDir != NULL) if (resDir != NULL)
@ -81,10 +87,35 @@ static std::string fullPathFromRelativePathThreadSafe(const char* pszRelativePat
} }
} }
if (pszRelativePath != NULL)
{
ret += pszRelativePath; ret += pszRelativePath;
// If file or directory doesn't exist, try to find it in the root path.
if (access(ret.c_str(), F_OK) == -1)
{
//CCLOG("file or directory(%s) in Resource Directory doesn't exist.", ret.c_str());
ret = strPathWithoutResDir;
if (access(ret.c_str(), F_OK) == -1)
{
//CCLOG("file or directory(%s) in Root Directory also doesn't exist.", ret.c_str());
bFileExist = false;
} }
else
{
//CCLOG("(%s) in Root Directory exist.", ret.c_str());
}
}
else
{
//CCLOG("(%s) in Resource Directory exist.", ret.c_str());
}
if (!bFileExist)
{ // Can't find the file, return the relative path.
ret = pszRelativePath;
//CCLOG("Can't find the file, return the relative path(%s).", ret.c_str());
}
return ret; return ret;
} }

View File

@ -84,7 +84,8 @@ const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
} }
const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile) { const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
{
std::string relativeFile = pszRelativeFile; std::string relativeFile = pszRelativeFile;
CCString *pRet = new CCString(); CCString *pRet = new CCString();
pRet->autorelease(); pRet->autorelease();
@ -93,15 +94,21 @@ const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const
return pRet->m_sString.c_str(); return pRet->m_sString.c_str();
} }
unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize) { unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* pszMode, unsigned long * pSize)
{
string fullPath = pszFileName; string fullPath = pszFileName;
unsigned char * pData = 0; unsigned char * pData = 0;
if (!pszFileName || !pszMode)
{
return 0;
}
do do
{ {
fullPath = fullPathFromRelativePath(fullPath.c_str());
// read rrom other path than user set it // read rrom other path than user set it
FILE *fp = fopen(pszFileName, pszMode); FILE *fp = fopen(fullPath.c_str(), pszMode);
CC_BREAK_IF(!fp); CC_BREAK_IF(!fp);
fseek(fp,0,SEEK_END); fseek(fp,0,SEEK_END);
@ -123,7 +130,8 @@ unsigned char* CCFileUtils::getFileData(const char* pszFileName, const char* psz
} }
string CCFileUtils::getWriteablePath() { string CCFileUtils::getWriteablePath()
{
//return current resource path //return current resource path
return CCApplication::sharedApplication()->getResourceRootPath(); return CCApplication::sharedApplication()->getResourceRootPath();
} }

View File

@ -235,7 +235,7 @@ static bool _initPremultipliedATextureWithImage(CGImageRef image, NSUInteger POT
CGContextRelease(context); CGContextRelease(context);
return true; return true;
} }
// TODO: rename _initWithImage, it also makes a draw call.
static bool _initWithImage(CGImageRef CGImage, tImageInfo *pImageinfo, double scaleX, double scaleY) static bool _initWithImage(CGImageRef CGImage, tImageInfo *pImageinfo, double scaleX, double scaleY)
{ {
NSUInteger POTWide, POTHigh; NSUInteger POTWide, POTHigh;
@ -258,10 +258,8 @@ static bool _initWithImage(CGImageRef CGImage, tImageInfo *pImageinfo, double sc
} }
// always load premultiplied images // load and draw image
_initPremultipliedATextureWithImage(CGImage, POTWide, POTHigh, pImageinfo); return _initPremultipliedATextureWithImage(CGImage, POTWide, POTHigh, pImageinfo);
return true;
} }
static bool _initWithFile(const char* path, tImageInfo *pImageinfo) static bool _initWithFile(const char* path, tImageInfo *pImageinfo)
@ -283,11 +281,13 @@ static bool _initWithFile(const char* path, tImageInfo *pImageinfo)
//[png release]; //[png release];
[jpg release]; [jpg release];
if (CGImage) CFRelease(CGImage);
if (source) CFRelease(source);
return ret; return ret;
} }
// TODO: rename _initWithData, it also makes a draw call.
static bool _initWithData(void * pBuffer, int length, tImageInfo *pImageinfo, double scaleX, double scaleY) static bool _initWithData(void * pBuffer, int length, tImageInfo *pImageinfo, double scaleX, double scaleY)
{ {
bool ret = false; bool ret = false;
@ -302,8 +302,9 @@ static bool _initWithData(void * pBuffer, int length, tImageInfo *pImageinfo, do
CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL); CGImage = CGImageSourceCreateImageAtIndex(source, 0, NULL);
ret = _initWithImage(CGImage, pImageinfo, scaleX, scaleY); ret = _initWithImage(CGImage, pImageinfo, scaleX, scaleY);
if (CGImage) CFRelease(CGImage);
if (source) CFRelease(source);
} }
return ret; return ret;
} }
@ -462,12 +463,8 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl
NSUInteger textureSize = POTWide*POTHigh*4; NSUInteger textureSize = POTWide*POTHigh*4;
unsigned char* dataNew = new unsigned char[textureSize]; unsigned char* dataNew = new unsigned char[textureSize];
CC_BREAK_IF(!dataNew); if (dataNew) {
memcpy(dataNew, data, textureSize); memcpy(dataNew, data, textureSize);
[bitmap release];
[image release];
// output params // output params
pInfo->width = POTWide; pInfo->width = POTWide;
pInfo->height = POTHigh; pInfo->height = POTHigh;
@ -475,8 +472,10 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl
pInfo->hasAlpha = true; pInfo->hasAlpha = true;
pInfo->isPremultipliedAlpha = true; pInfo->isPremultipliedAlpha = true;
pInfo->bitsPerComponent = 8; pInfo->bitsPerComponent = 8;
bRet = true; bRet = true;
}
[bitmap release];
[image release];
} while (0); } while (0);
return bRet; return bRet;
} }

View File

@ -75,7 +75,7 @@ void CCFileUtils::purgeCachedEntries()
const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
{ {
bool bFileExist = true; bool bFileExist = true;
const char* resDir = CCFileUtils::sharedFileUtils()->getResourceDirectory(); const char* resDir = m_obDirectory.c_str();
CCString* pRet = CCString::create(""); CCString* pRet = CCString::create("");
if ((strlen(pszRelativePath) > 1 && pszRelativePath[1] == ':')) if ((strlen(pszRelativePath) > 1 && pszRelativePath[1] == ':'))

View File

@ -196,10 +196,10 @@ int CCBReader::readInt(bool pSigned) {
long long current = 0; long long current = 0;
for(int a = numBits - 1; a >= 0; a--) { for(int a = numBits - 1; a >= 0; a--) {
if(this->getBit()) { if(this->getBit()) {
current |= 1 << a; current |= 1LL << a;
} }
} }
current |= 1 << numBits; current |= 1LL << numBits;
int num; int num;
if(pSigned) { if(pSigned) {

View File

@ -220,7 +220,7 @@ public:
void addTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent); void addTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
void removeTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent); void removeTargetWithActionForControlEvent(CCObject* target, SEL_CCControlHandler action, CCControlEvent controlEvent);
LAYER_CREATE_FUNC(CCControl); CREATE_FUNC(CCControl);
}; };

View File

@ -16,7 +16,7 @@ public:
void menuCloseCallback(CCObject* pSender); void menuCloseCallback(CCObject* pSender);
// implement the "static node()" method manually // implement the "static node()" method manually
LAYER_CREATE_FUNC(HelloWorld); CREATE_FUNC(HelloWorld);
}; };
#endif // __HELLOWORLD_SCENE_H__ #endif // __HELLOWORLD_SCENE_H__

View File

@ -68,7 +68,7 @@
</option> </option>
<option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/> <option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths"> <option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Release}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Debug}&quot;"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/>
<listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/> <listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/>
@ -97,7 +97,7 @@
<externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> <externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">
<externalSetting> <externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Release"/> <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Debug"/>
<entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/> <entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/>
</externalSetting> </externalSetting>
</externalSettings> </externalSettings>

View File

@ -9,7 +9,7 @@
<!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications. <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. --> Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.example.HelloCpp</id> <id>org.cocos2dx.HelloCpp</id>
<!-- The name that is displayed in the BlackBerry Tablet OS application installer. <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. --> May have multiple values for each language. See samples or xsd schema file. Optional. -->

View File

@ -42,15 +42,19 @@ STATICLIBS = $(STATICLIBS_DIR)/libfreetype.a \
# $(STATICLIBS_DIR)/libGLEW.a \ # $(STATICLIBS_DIR)/libGLEW.a \
SHAREDLIBS = -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../lib/linux/Debug/ SHAREDLIBS = -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/
SHAREDLIBS += -lglfw -lcurl SHAREDLIBS += -lglfw -lcurl
SHAREDLIBS += -Wl,-rpath,../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib SHAREDLIBS += -Wl,-rpath,../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib
SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW
#$(shell ../../build-linux.sh $<) #$(shell ../../build-linux.sh $<)
BIN_DIR=bin
####### Build rules ####### Build rules
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) test -d $(BIN_DIR) || mkdir $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS)
####### Compile ####### Compile
%.o: %.cpp %.o: %.cpp
@ -61,3 +65,4 @@ $(TARGET): $(OBJECTS)
clean: clean:
rm -f $(OBJECTS) $(TARGET) core rm -f $(OBJECTS) $(TARGET) core
rm -r $(BIN_DIR)

View File

@ -24,7 +24,7 @@ int main(int argc, char **argv)
std::string resourcePath = fullpath; std::string resourcePath = fullpath;
resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/"));
resourcePath += "/../Resources/"; resourcePath += "/../../Resources/";
// create the application instance // create the application instance
AppDelegate app; AppDelegate app;

View File

@ -30,7 +30,6 @@ import org.cocos2dx.lib.Cocos2dxRenderer;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.content.Context; import android.content.Context;
import android.content.pm.ConfigurationInfo; import android.content.pm.ConfigurationInfo;
import android.opengl.GLSurfaceView;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;

View File

@ -76,7 +76,7 @@
</option> </option>
<option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/> <option id="com.qnx.qcc.option.linker.security.1794064552" name="Enhanced Security (-Wl,-z,relro -Wl,-z,now)" superClass="com.qnx.qcc.option.linker.security" value="true" valueType="boolean"/>
<option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths"> <option id="com.qnx.qcc.option.linker.libraryPaths.1757627798" name="Library Paths (-L)" superClass="com.qnx.qcc.option.linker.libraryPaths" valueType="libPaths">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Release}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/cocos2dx/Device-Debug}&quot;"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/lib"/>
<listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/> <listOptionValue builtIn="false" value="${QNX_TARGET}/../target-override/${CPUVARDIR}/usr/lib"/>
<listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/> <listOptionValue builtIn="false" value="../../../../cocos2dx/proj.blackberry/${ConfigName}"/>
@ -108,7 +108,7 @@
<externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"> <externalSettings containerId="cocos2dx;" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier">
<externalSetting> <externalSetting>
<entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/> <entry flags="VALUE_WORKSPACE_PATH" kind="includePath" name="/cocos2dx"/>
<entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Release"/> <entry flags="VALUE_WORKSPACE_PATH" kind="libraryPath" name="/cocos2dx/Device-Debug"/>
<entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/> <entry flags="RESOLVED" kind="libraryFile" name="cocos2dx"/>
</externalSetting> </externalSetting>
</externalSettings> </externalSettings>

View File

@ -9,7 +9,7 @@
<!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications. <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. --> Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.example.HelloLua</id> <id>org.cocos2dx.HelloLua</id>
<!-- The name that is displayed in the BlackBerry Tablet OS application installer. <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. --> May have multiple values for each language. See samples or xsd schema file. Optional. -->

View File

@ -876,7 +876,7 @@ std::string ActionCallFuncND::subtitle()
void ActionCallFuncND::removeFromParentAndCleanup(CCNode* pSender, void* data) void ActionCallFuncND::removeFromParentAndCleanup(CCNode* pSender, void* data)
{ {
bool bCleanUp = (bool)data; bool bCleanUp = data != NULL;
m_grossini->removeFromParentAndCleanup(bCleanUp); m_grossini->removeFromParentAndCleanup(bCleanUp);
} }

View File

@ -11,7 +11,7 @@ public:
static CCScene* scene(); static CCScene* scene();
void callBack(CCObject* pSender); void callBack(CCObject* pSender);
LAYER_CREATE_FUNC(Bug1159Layer); CREATE_FUNC(Bug1159Layer);
}; };
#endif // __BUG_1159_H__ #endif // __BUG_1159_H__

View File

@ -10,7 +10,7 @@ public:
void switchLayer(float dt); void switchLayer(float dt);
virtual void didAccelerate(CCAcceleration* pAccelerationValue); virtual void didAccelerate(CCAcceleration* pAccelerationValue);
LAYER_CREATE_FUNC(Bug624Layer); CREATE_FUNC(Bug624Layer);
}; };
class Bug624Layer2 : public BugsTestBaseLayer class Bug624Layer2 : public BugsTestBaseLayer
@ -20,7 +20,7 @@ public:
void switchLayer(float dt); void switchLayer(float dt);
virtual void didAccelerate(CCAcceleration* pAccelerationValue); virtual void didAccelerate(CCAcceleration* pAccelerationValue);
LAYER_CREATE_FUNC(Bug624Layer2); CREATE_FUNC(Bug624Layer2);
}; };
#endif // __BUG_624_H__ #endif // __BUG_624_H__

View File

@ -13,7 +13,7 @@ public:
void ccTouchesBegan(CCSet *touches, CCEvent * event); void ccTouchesBegan(CCSet *touches, CCEvent * event);
void restart(CCObject* sender); void restart(CCObject* sender);
LAYER_CREATE_FUNC(Bug914Layer); CREATE_FUNC(Bug914Layer);
}; };
#endif // __BUG_914_H__ #endif // __BUG_914_H__

View File

@ -168,7 +168,7 @@ void HttpClientTest::onHttpRequestCompleted(cocos2d::CCNode *sender, void *data)
// dump data // dump data
std::vector<char> *buffer = response->getResponseData(); std::vector<char> *buffer = response->getResponseData();
printf("Http Test, dump data: "); printf("Http Test, dump data: ");
for (int i = 0; i < buffer->size(); i++) for (unsigned int i = 0; i < buffer->size(); i++)
{ {
printf("%c", (*buffer)[i]); printf("%c", (*buffer)[i]);
} }

View File

@ -21,7 +21,7 @@ public:
void backCallback(CCObject* pSender); void backCallback(CCObject* pSender);
virtual std::string title(); virtual std::string title();
LAYER_CREATE_FUNC(FontTest); CREATE_FUNC(FontTest);
}; };
#endif // _FONT_TEST_H_ #endif // _FONT_TEST_H_

View File

@ -14,7 +14,7 @@ public:
virtual void ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent); virtual void ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
virtual void ccTouchesCancelled(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent); virtual void ccTouchesCancelled(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent);
LAYER_CREATE_FUNC(MutiTouchTestLayer) CREATE_FUNC(MutiTouchTestLayer)
}; };
class MutiTouchTestScene : public TestScene class MutiTouchTestScene : public TestScene

View File

@ -421,7 +421,7 @@ void performanceActions(CCSprite* pSprite)
float growDuration = 0.5f + (rand() % 1000) / 500.0f; float growDuration = 0.5f + (rand() % 1000) / 500.0f;
CCActionInterval *grow = CCScaleBy::create(growDuration, 0.5f, 0.5f); CCActionInterval *grow = CCScaleBy::create(growDuration, 0.5f, 0.5f);
CCAction *permanentScaleLoop = CCRepeatForever::create((CCActionInterval *)CCSequence::create(grow, grow->reverse())); CCAction *permanentScaleLoop = CCRepeatForever::create((CCActionInterval *)CCSequence::create(grow, grow->reverse(), NULL));
pSprite->runAction(permanentScaleLoop); pSprite->runAction(permanentScaleLoop);
} }

View File

@ -13,7 +13,7 @@ class SpriteLayer : public CCLayer
{ {
public: public:
virtual void onEnter(); virtual void onEnter();
LAYER_CREATE_FUNC(SpriteLayer) CREATE_FUNC(SpriteLayer)
}; };
class TestLayer : public CCLayer class TestLayer : public CCLayer
@ -21,7 +21,7 @@ class TestLayer : public CCLayer
public: public:
virtual void onEnter(); virtual void onEnter();
LAYER_CREATE_FUNC(TestLayer) CREATE_FUNC(TestLayer)
}; };
class RotateWorldMainLayer : public CCLayer class RotateWorldMainLayer : public CCLayer
@ -29,7 +29,7 @@ class RotateWorldMainLayer : public CCLayer
public: public:
virtual void onEnter(); virtual void onEnter();
LAYER_CREATE_FUNC(RotateWorldMainLayer) CREATE_FUNC(RotateWorldMainLayer)
}; };
#endif #endif

View File

@ -44,7 +44,7 @@ public:
void item0Clicked(CCObject* pSender); void item0Clicked(CCObject* pSender);
void item1Clicked(CCObject* pSender); void item1Clicked(CCObject* pSender);
void item2Clicked(CCObject* pSender); void item2Clicked(CCObject* pSender);
LAYER_CREATE_FUNC(SceneTestLayer3) CREATE_FUNC(SceneTestLayer3)
} ; } ;
class SceneTestScene : public TestScene class SceneTestScene : public TestScene

View File

@ -19,7 +19,7 @@ public:
void nextCallback(CCObject* pSender); void nextCallback(CCObject* pSender);
void backCallback(CCObject* pSender); void backCallback(CCObject* pSender);
LAYER_CREATE_FUNC(ShaderTestDemo); CREATE_FUNC(ShaderTestDemo);
}; };
class ShaderMonjori : public ShaderTestDemo class ShaderMonjori : public ShaderTestDemo

View File

@ -38,7 +38,7 @@ class ZwoptexTestScene : public TestScene
public: public:
virtual void runThisTest(); virtual void runThisTest();
SCENE_CREATE_FUNC(ZwoptexTestScene); CREATE_FUNC(ZwoptexTestScene);
}; };
#endif // __ZWOPTEX_TEST_H__ #endif // __ZWOPTEX_TEST_H__

View File

@ -9,7 +9,7 @@
<!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications. <!-- A universally unique application identifier. Must be unique across all BlackBerry Tablet OS applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. --> Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. -->
<id>com.example.TestCpp</id> <id>org.cocos2dx.TestCpp</id>
<!-- The name that is displayed in the BlackBerry Tablet OS application installer. <!-- The name that is displayed in the BlackBerry Tablet OS application installer.
May have multiple values for each language. See samples or xsd schema file. Optional. --> May have multiple values for each language. See samples or xsd schema file. Optional. -->

View File

@ -147,18 +147,21 @@ endif
SHAREDLIBS += -lglfw -lGL SHAREDLIBS += -lglfw -lGL
#SHAREDLIBS += -lGLEW #SHAREDLIBS += -lGLEW
SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../lib/linux/Debug/ SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/
SHAREDLIBS += -Wl,-rpath,$(SHAREDLIBS_DIR) SHAREDLIBS += -Wl,-rpath,../$(SHAREDLIBS_DIR)
SHAREDLIBS += -Wl,-rpath,../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib SHAREDLIBS += -Wl,-rpath,../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib
SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW
SHAREDLIBS += -Wl,-rpath,$(STATICLIBS_DIR) SHAREDLIBS += -Wl,-rpath,../$(STATICLIBS_DIR)
SHAREDLIBS += -lcurl SHAREDLIBS += -lcurl
BIN_DIR=bin
####### Build rules ####### Build rules
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) $(LIBS) test -d $(BIN_DIR) || mkdir $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS) $(LIBS)
####### Compile ####### Compile
%.o: %.cpp %.o: %.cpp
@ -167,5 +170,7 @@ $(TARGET): $(OBJECTS)
%.o: %.c %.o: %.c
$(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@ $(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) $(VISIBILITY) -c $< -o $@
clean: clean:
rm -f $(OBJECTS) $(TARGET) core rm -f $(OBJECTS) $(TARGET) core
rm -r $(BIN_DIR)

View File

@ -24,7 +24,7 @@ int main(int argc, char **argv)
std::string resourcePath = fullpath; std::string resourcePath = fullpath;
resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/"));
resourcePath += "/../Resources/"; resourcePath += "/../../Resources/";
// create the application instance // create the application instance
AppDelegate app; AppDelegate app;

View File

@ -55,17 +55,21 @@ SHAREDLIBS_DIR = ../../../CocosDenshion/third_party/fmod/api/lib
SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex SHAREDLIBS = -L$(SHAREDLIBS_DIR) -lfmodex
endif endif
SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../lib/linux/Debug/ SHAREDLIBS += -L../../../lib/linux/Debug -lcocos2d -lrt -lz -lcocosdenshion -Wl,-rpath,../../../../lib/linux/Debug/
SHAREDLIBS += -lglfw -lcurl SHAREDLIBS += -lglfw -lcurl
#SHAREDLIBS += -lGLEW #SHAREDLIBS += -lGLEW
SHAREDLIBS += -Wl,-rpath,$(SHAREDLIBS_DIR) SHAREDLIBS += -Wl,-rpath,../$(SHAREDLIBS_DIR)
SHAREDLIBS += -Wl,-rpath,../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib SHAREDLIBS += -Wl,-rpath,../../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib
SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW SHAREDLIBS += -L../../../cocos2dx/platform/third_party/linux/glew-1.7.0/glew-1.7.0/lib -lGLEW
#$(shell ../../build-linux.sh $<) #$(shell ../../build-linux.sh $<)
BIN_DIR=bin
####### Build rules ####### Build rules
$(TARGET): $(OBJECTS) $(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(TARGET) $(SHAREDLIBS) $(STATICLIBS) test -d $(BIN_DIR) || mkdir $(BIN_DIR)
$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) $(OBJECTS) -o $(BIN_DIR)/$(TARGET) $(SHAREDLIBS) $(STATICLIBS)
####### Compile ####### Compile
%.o: %.cpp %.o: %.cpp
@ -76,3 +80,4 @@ $(TARGET): $(OBJECTS)
clean: clean:
rm -f $(OBJECTS) $(TARGET) core rm -f $(OBJECTS) $(TARGET) core
rm -r $(BIN_DIR)

View File

@ -24,7 +24,7 @@ int main(int argc, char **argv)
std::string resourcePath = fullpath; std::string resourcePath = fullpath;
resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/")); resourcePath = resourcePath.substr(0, resourcePath.find_last_of("/"));
resourcePath += "/../Resources/"; resourcePath += "/../../Resources/";
// create the application instance // create the application instance
AppDelegate app; AppDelegate app;

View File

@ -3,14 +3,59 @@ local SceneIdx = -1
local MAX_LAYER = 7 local MAX_LAYER = 7
local s = CCDirector:sharedDirector():getWinSize() local s = CCDirector:sharedDirector():getWinSize()
local function nextAction()
SceneIdx = SceneIdx + 1
SceneIdx = math.mod(SceneIdx, MAX_LAYER)
return CreateActionProgressLayer(SceneIdx)
end
local function restartAction()
return CreateActionProgressLayer(SceneIdx)
end
local function backAction()
SceneIdx = SceneIdx - 1
if SceneIdx < 0 then
SceneIdx = SceneIdx + MAX_LAYER
end
return CreateActionProgressLayer(SceneIdx)
end
local function nextCallback(sender)
local scene = CCScene:create()
scene:addChild(CreateBackMenuItem())
scene:addChild(nextAction())
CCDirector:sharedDirector():replaceScene(scene)
end
local function restartCallback(sender)
local scene = CCScene:create()
scene:addChild(CreateBackMenuItem())
scene:addChild(restartAction())
CCDirector:sharedDirector():replaceScene(scene)
end
local function backCallback(sender)
local scene = CCScene:create()
scene:addChild(backAction())
scene:addChild(CreateBackMenuItem())
CCDirector:sharedDirector():replaceScene(scene)
end
local function initWithLayer(layer) local function initWithLayer(layer)
titleLabel = CCLabelTTF:create("ActionsProgressTest", "Arial", 18) titleLabel = CCLabelTTF:create("ActionsProgressTest", "Arial", 18)
layer:addChild(titleLabel, 1) layer:addChild(titleLabel, 1)
titleLabel:setPosition(CCPointMake(s.width / 2, s.height - 50)) titleLabel:setPosition(s.width / 2, s.height - 50)
subtitleLabel = CCLabelTTF:create("", "Thonburi", 22) subtitleLabel = CCLabelTTF:create("", "Thonburi", 22)
layer:addChild(subtitleLabel, 1) layer:addChild(subtitleLabel, 1)
subtitleLabel:setPosition( CCPointMake(s.width / 2, s.height - 80)) subtitleLabel:setPosition(s.width / 2, s.height - 80)
-- menu -- menu
local item1 = CCMenuItemImage:create(s_pPathB1, s_pPathB2) local item1 = CCMenuItemImage:create(s_pPathB1, s_pPathB2)
@ -34,51 +79,6 @@ local function initWithLayer(layer)
layer:addChild(background, -10) layer:addChild(background, -10)
end end
local function nextAction()
SceneIdx = SceneIdx + 1
SceneIdx = math.mod(SceneIdx, MAX_LAYER)
return CreateActionProgressLayer(SceneIdx)
end
local function restartAction()
return CreateActionProgressLayer(SceneIdx)
end
local function backAction()
SceneIdx = SceneIdx - 1
if SceneIdx < 0 then
SceneIdx = SceneIdx + MAX_LAYER
end
return CreateActionProgressLayer(SceneIdx)
end
local function nextCallback()
local scene = CCScene:create()
scene:addChild(CreateBackMenuItem())
scene:addChild(nextAction())
CCDirector:sharedDirector():replaceScene(scene)
end
local function restartCallback()
local scene = CCScene:create()
scene:addChild(CreateBackMenuItem())
scene:addChild(restartAction())
CCDirector:sharedDirector():replaceScene(scene)
end
local function backCallback()
local scene = CCScene:create()
scene:addChild(CreateBackMenuItem())
scene:addChild(backAction())
CCDirector:sharedDirector():replaceScene(scene)
end
------------------------------------ ------------------------------------
-- SpriteProgressToRadial -- SpriteProgressToRadial
------------------------------------ ------------------------------------
@ -390,8 +390,8 @@ function ProgressActionsTest()
cclog("ProgressActionsTest") cclog("ProgressActionsTest")
local scene = CCScene:create() local scene = CCScene:create()
scene:addChild(CreateBackMenuItem())
scene:addChild(nextAction()) scene:addChild(nextAction())
scene:addChild(CreateBackMenuItem())
CCDirector:sharedDirector():replaceScene(scene) CCDirector:sharedDirector():replaceScene(scene)
end end

View File

@ -27,7 +27,7 @@ local function NextAction()
return CreateActionTestLayer(ActionIdx) return CreateActionTestLayer(ActionIdx)
end end
local function backCallback() local function backCallback(sender)
local scene = CCScene:create() local scene = CCScene:create()
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
scene:addChild(BackAction()) scene:addChild(BackAction())
@ -35,7 +35,7 @@ local function backCallback()
CCDirector:sharedDirector():replaceScene(scene) CCDirector:sharedDirector():replaceScene(scene)
end end
local function restartCallback() local function restartCallback(sender)
local scene = CCScene:create() local scene = CCScene:create()
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
scene:addChild(RestartAction()) scene:addChild(RestartAction())
@ -43,7 +43,7 @@ local function restartCallback()
CCDirector:sharedDirector():replaceScene(scene) CCDirector:sharedDirector():replaceScene(scene)
end end
local function nextCallback() local function nextCallback(sender)
local scene = CCScene:create() local scene = CCScene:create()
scene:addChild(CreateBackMenuItem()) scene:addChild(CreateBackMenuItem())
scene:addChild(NextAction()) scene:addChild(NextAction())
@ -998,18 +998,20 @@ end
-------------------------------------- --------------------------------------
local pausedTargets = nil local pausedTargets = nil
local function ActionPause() local function ActionPause(dt)
cclog("Pausing") cclog("Pausing")
local director = CCDirector:sharedDirector() local director = CCDirector:sharedDirector()
pausedTargets = director:getActionManager():pauseAllRunningActions() pausedTargets = director:getActionManager():pauseAllRunningActions()
pausedTargets:retain()
end end
local function ActionResume() local function ActionResume(dt)
cclog("Resuming") cclog("Resuming")
local director = CCDirector:sharedDirector() local director = CCDirector:sharedDirector()
if pausedTargets ~= nil then if pausedTargets ~= nil then
director:getActionManager():resumeTargets(pausedTargets) -- director:getActionManager():resumeTargets(pausedTargets)
end end
pausedTargets:release()
end end
local function PauseResumeActions() local function PauseResumeActions()

View File

@ -2,13 +2,72 @@ require "luaScript/EffectsTest/EffectsName"
local ActionIdx = 0 local ActionIdx = 0
local size = CCDirector:sharedDirector():getWinSize() local s = CCDirector:sharedDirector():getWinSize()
local kTagTextLayer = 1 local kTagTextLayer = 1
local kTagBackground = 1 local kTagBackground = 1
local kTagLabel = 2 local kTagLabel = 2
function initWithLayer(layer) local titleLabel = nil
local function checkAnim(dt)
end
local function getAction()
return CreateEffect(ActionIdx, 3)
end
local function initWithLayer(layer)
x, y = s.width, s.height
local node = CCNode:create()
local effect = getAction()
node:runAction(effect)
addChild(node, 0, kTagBackground)
local bg = CCSprite:create(s_back3)
node:addChild(bg, 0)
bg:setPosition(CCPointMake(s.width / 2, s.height / 2))
local grossini = CCSprite:create(s_pPathSister2)
node:addChild(grossini, 1)
grossini:setPosition( CCPointMake(x / 3, y / 2) )
local sc = CCScaleBy:create(2, 5)
local sc_back = sc:reverse()
grossini:runAction(CCRepeatForever:create(CCSequence:createWithTwoActions(sc, sc_back)))
local tamara = CCSprite:create(s_pPathSister1)
node:addChild(tamara, 1)
tamara:setPosition(CCPointMake(2 * x / 3, y / 2))
local sc2 = CCScaleBy:create(2, 5)
local sc2_back = sc2:reverse()
tamara:runAction(CCRepeatForever:create(CCSequence:createWithTwoActions(sc2, sc2_back)))
titleLabel = CCLabelTTF:create(EffectsList[ActionIdx], "Marker Felt", 32)
titleLabel:setPosition(CCPointMake(x / 2, y - 80))
addChild(titleLabel)
titleLabel:setTag(kTagLabel)
local item1 = CCMenuItemImage:create(s_pPathB1, s_pPathB2)
local item2 = CCMenuItemImage:create(s_pPathR1, s_pPathR2)
local item3 = CCMenuItemImage:create(s_pPathF1, s_pPathF2)
item1:registerScriptHandler(backCallback)
item2:registerScriptHandler(restartCallback)
item3:registerScriptHandler(nextCallback)
local menu = CCMenu:create()
menu:addChild(item1)
menu:addChild(item2)
menu:addChild(item3)
menu:setPosition(CCPointMake(0, 0))
item1:setPosition(CCPointMake( s.width/2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2))
item2:setPosition(CCPointMake( s.width/2, item2:getContentSize().height / 2))
item3:setPosition(CCPointMake( s.width/2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2))
layer:addChild(menu, 1)
--schedule( schedule_selector(TextLayer:checkAnim) )
end end
@ -22,8 +81,8 @@ function EffectsTest()
initWithLayer(layer) initWithLayer(layer)
scene:addChild(CreateBackMenuItem())
scene:addChild(layer) scene:addChild(layer)
scene:addChild(CreateBackMenuItem())
return scene return scene
end end

View File

@ -0,0 +1,550 @@
local kMaxNodes = 50000
local kBasicZOrder = 10
local kNodesIncrease = 250
local TEST_COUNT = 7
local s = CCDirector:sharedDirector():getWinSize()
-----------------------------------
-- For test functions
-----------------------------------
local function performanceActions(sprite)
sprite:setPosition(CCPointMake(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
local period = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
local rot = CCRotateBy:create(period, 360.0 * math.random())
local rot = CCRotateBy:create(period, 360.0 * math.random())
local permanentRotation = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot:reverse()))
sprite:runAction(permanentRotation)
local growDuration = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
local grow = CCScaleBy:create(growDuration, 0.5, 0.5)
local permanentScaleLoop = CCRepeatForever:create(CCSequence:createWithTwoActions(grow, grow:reverse()))
sprite:runAction(permanentScaleLoop)
end
local function performanceActions20(sprite)
if math.random() < 0.2 then
sprite:setPosition(CCPointMake(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
else
sprite:setPosition(CCPointMake(-1000, -1000))
end
local period = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
local rot = CCRotateBy:create(period, 360.0 * math.random())
local permanentRotation = CCRepeatForever:create(CCSequence:createWithTwoActions(rot, rot:reverse()))
sprite:runAction(permanentRotation)
local growDuration = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
local grow = CCScaleBy:create(growDuration, 0.5, 0.5)
local permanentScaleLoop = CCRepeatForever:create(CCSequence:createWithTwoActions(grow, grow:reverse()))
sprite:runAction(permanentScaleLoop)
end
local function performanceRotationScale(sprite)
sprite:setPosition(CCPointMake(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
sprite:setRotation(math.random() * 360)
sprite:setScale(math.random() * 2)
end
local function performancePosition(sprite)
sprite:setPosition(CCPointMake(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
end
local function performanceout20(sprite)
if math.random() < 0.2 then
sprite:setPosition(CCPointMake(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
else
sprite:setPosition(CCPointMake(-1000, -1000))
end
end
local function performanceOut100(sprite)
sprite:setPosition(CCPointMake( -1000, -1000))
end
local function performanceScale(sprite)
sprite:setPosition(CCPointMake(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
sprite:setScale(math.random() * 100 / 50)
end
-----------------------------------
-- Subtest
-----------------------------------
local subtestNumber = 1
local batchNode = nil -- CCSpriteBatchNode
local parent = nil -- CCNode
local function initWithSubTest(nSubTest, p)
subtestNumber = nSubTest
parent = p
batchNode = nil
local mgr = CCTextureCache:sharedTextureCache()
-- remove all texture
mgr:removeTexture(mgr:addImage("Images/grossinis_sister1.png"))
mgr:removeTexture(mgr:addImage("Images/grossini_dance_atlas.png"))
mgr:removeTexture(mgr:addImage("Images/spritesheet1.png"))
if subtestNumber == 2 then
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888)
batchNode = CCSpriteBatchNode:create("Images/grossinis_sister1.png", 100)
p:addChild(batchNode, 0)
elseif subtestNumber == 3 then
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444)
batchNode = CCSpriteBatchNode:create("Images/grossinis_sister1.png", 100)
p:addChild(batchNode, 0)
elseif subtestNumber == 5 then
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888)
batchNode = CCSpriteBatchNode:create("Images/grossini_dance_atlas.png", 100)
p:addChild(batchNode, 0)
elseif subtestNumber == 6 then
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444)
batchNode = CCSpriteBatchNode:create("Images/grossini_dance_atlas.png", 100)
p:addChild(batchNode, 0)
elseif subtestNumber == 8 then
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888)
batchNode = CCSpriteBatchNode:create("Images/spritesheet1.png", 100)
p:addChild(batchNode, 0)
elseif subtestNumber == 9 then
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA4444)
batchNode = CCSpriteBatchNode:create("Images/spritesheet1.png", 100)
p:addChild(batchNode, 0)
end
-- todo
if batchNode ~= nil then
batchNode:retain()
end
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_Default)
end
local function createSpriteWithTag(tag)
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_RGBA8888)
local sprite = nil
if subtestNumber == 1 then
sprite = CCSprite:create("Images/grossinis_sister1.png")
parent:addChild(sprite, -1, tag + 100)
elseif subtestNumber == 2 then
sprite = CCSprite:createWithTexture(batchNode:getTexture(), CCRectMake(0, 0, 52, 139))
batchNode:addChild(sprite, 0, tag + 100)
elseif subtestNumber == 3 then
sprite = CCSprite:createWithTexture(batchNode:getTexture(), CCRectMake(0, 0, 52, 139))
batchNode:addChild(sprite, 0, tag + 100)
elseif subtestNumber == 4 then
local idx = math.floor((math.random() * 1400 / 100)) + 1
local num
if idx < 10 then
num = "0" .. idx
else
num = idx
end
local str = "Images/grossini_dance_" .. num .. ".png"
sprite = CCSprite:create(str)
parent:addChild(sprite, -1, tag + 100)
elseif subtestNumber == 5 then
local y, x
local r = math.floor(math.random() * 1400 / 100)
y = math.floor(r / 5)
x = math.mod(r, 5)
x = x * 85
y = y * 121
sprite = CCSprite:createWithTexture(batchNode:getTexture(), CCRectMake(x, y, 85, 121))
batchNode:addChild(sprite, 0, tag + 100)
elseif subtestNumber == 6 then
local y, x
local r = math.floor(math.random() * 1400 / 100)
y = math.floor(r / 5)
x = math.mod(r, 5)
x = x * 85
y = y * 121
sprite = CCSprite:createWithTexture(batchNode:getTexture(), CCRectMake(x, y, 85, 121))
batchNode:addChild(sprite, 0, tag + 100)
elseif subtestNumber == 7 then
local y, x
local r = math.floor(math.random() * 6400 / 100)
y = math.floor(r / 8)
x = math.mod(r, 8)
local str = "Images/sprites_test/sprite-"..x.."-"..y..".png"
sprite = CCSprite:create(str)
parent:addChild(sprite, -1, tag + 100)
elseif subtestNumber == 8 then
local y, x
local r = math.floor(math.random() * 6400 / 100)
y = math.floor(r / 8)
x = math.mod(r, 8)
x = x * 32
y = y * 32
sprite = CCSprite:createWithTexture(batchNode:getTexture(), CCRectMake(x, y, 32, 32))
batchNode:addChild(sprite, 0, tag + 100)
elseif subtestNumber == 9 then
local y, x
local r = math.floor(math.random() * 6400 / 100)
y = math.floor(r / 8)
x = math.mod(r, 8)
x = x * 32
y = y * 32
sprite = CCSprite:createWithTexture(batchNode:getTexture(), CCRectMake(x, y, 32, 32))
batchNode:addChild(sprite, 0, tag + 100)
end
CCTexture2D:setDefaultAlphaPixelFormat(kCCTexture2DPixelFormat_Default)
return sprite
end
local function removeByTag(tag)
if subtestNumber == 1 then
parent:removeChildByTag(tag + 100, true)
elseif subtestNumber == 4 then
parent:removeChildByTag(tag + 100, true)
elseif subtestNumber == 7 then
parent:removeChildByTag(tag + 100, true)
else
batchNode:removeChildAtIndex(tag, true)
end
end
-----------------------------------
-- PerformBasicLayer
-----------------------------------
local curCase = 0
local maxCases = 7
local function showThisTest()
local scene = CreateSpriteTestScene()
CCDirector:sharedDirector():replaceScene(scene)
end
local function backCallback(sender)
subtestNumber = 1
curCase = curCase - 1
if curCase < 0 then
curCase = curCase + maxCases
end
showThisTest()
end
local function restartCallback(sender)
subtestNumber = 1
showThisTest()
end
local function nextCallback(sender)
subtestNumber = 1
curCase = curCase + 1
curCase = math.mod(curCase, maxCases)
showThisTest()
end
local function toPerformanceMainLayer(sender)
CCDirector:sharedDirector():replaceScene(PerformanceTest())
end
local function initWithLayer(layer, controlMenuVisible)
CCMenuItemFont:setFontName("Arial")
CCMenuItemFont:setFontSize(24)
local mainItem = CCMenuItemFont:create("Back")
mainItem:registerScriptHandler(toPerformanceMainLayer)
mainItem:setPosition(s.width - 50, 25)
local menu = CCMenu:create()
menu:addChild(mainItem)
menu:setPosition(CCPointMake(0, 0))
if controlMenuVisible == true then
local item1 = CCMenuItemImage:create(s_pPathB1, s_pPathB2)
local item2 = CCMenuItemImage:create(s_pPathR1, s_pPathR2)
local item3 = CCMenuItemImage:create(s_pPathF1, s_pPathF2)
item1:registerScriptHandler(backCallback)
item2:registerScriptHandler(restartCallback)
item3:registerScriptHandler(nextCallback)
item1:setPosition(s.width / 2 - 100, 30)
item2:setPosition(s.width / 2, 30)
item3:setPosition(s.width / 2 + 100, 30)
menu:addChild(item1, kItemTagBasic)
menu:addChild(item2, kItemTagBasic)
menu:addChild(item3, kItemTagBasic)
end
layer:addChild(menu)
end
-----------------------------------
-- SpriteMainScene
-----------------------------------
local lastRenderedCount = nil
local quantityNodes = nil
local infoLabel = nil
local titleLabel = nil
local function testNCallback(tag)
subtestNumber = tag - kBasicZOrder
showThisTest()
end
local function updateNodes()
if quantityNodes ~= lastRenderedCount then
local str = quantityNodes .. " nodes"
infoLabel:setString(str)
lastRenderedCount = quantityNodes
end
end
local function onDecrease(sender)
if quantityNodes <= 0 then
return
end
for i = 0, kNodesIncrease - 1 do
quantityNodes = quantityNodes - 1
removeByTag(quantityNodes)
end
updateNodes()
end
local function onIncrease(sender)
if quantityNodes >= kMaxNodes then
return
end
for i = 0, kNodesIncrease - 1 do
local sprite = createSpriteWithTag(quantityNodes)
if curCase == 0 then
doPerformSpriteTest1(sprite)
elseif curCase == 1 then
doPerformSpriteTest2(sprite)
elseif curCase == 2 then
doPerformSpriteTest3(sprite)
elseif curCase == 3 then
doPerformSpriteTest4(sprite)
elseif curCase == 4 then
doPerformSpriteTest5(sprite)
elseif curCase == 5 then
doPerformSpriteTest6(sprite)
elseif curCase == 6 then
doPerformSpriteTest7(sprite)
end
quantityNodes = quantityNodes + 1
end
updateNodes()
end
local function initWithMainTest(scene, asubtest, nNodes)
subtestNumber = asubtest
initWithSubTest(asubtest, scene)
lastRenderedCount = 0
quantityNodes = 0
CCMenuItemFont:setFontSize(65)
local decrease = CCMenuItemFont:create(" - ")
decrease:registerScriptHandler(onDecrease)
decrease:setColor(ccc3(0, 200, 20))
local increase = CCMenuItemFont:create(" + ")
increase:registerScriptHandler(onIncrease)
increase:setColor(ccc3(0, 200, 20))
local menu = CCMenu:create()
menu:addChild(decrease)
menu:addChild(increase)
menu:alignItemsHorizontally()
menu:setPosition(s.width / 2, s.height - 65)
scene:addChild(menu, 1)
infoLabel = CCLabelTTF:create("0 nodes", "Marker Felt", 30)
infoLabel:setColor(ccc3(0, 200, 20))
infoLabel:setPosition(s.width / 2, s.height - 90)
scene:addChild(infoLabel, 1)
maxCases = TEST_COUNT
-- Sub Tests
CCMenuItemFont:setFontSize(32)
subMenu = CCMenu:create()
for i = 1, 9 do
local str = i .. " "
local itemFont = CCMenuItemFont:create(str)
itemFont:registerScriptHandler(testNCallback)
--itemFont:setTag(i)
subMenu:addChild(itemFont, kBasicZOrder + i, kBasicZOrder + i)
if i <= 3 then
itemFont:setColor(ccc3(200, 20, 20))
elseif i <= 6 then
itemFont:setColor(ccc3(0, 200, 20))
else
itemFont:setColor(ccc3(0, 20, 200))
end
end
subMenu:alignItemsHorizontally()
subMenu:setPosition(CCPointMake(s.width / 2, 80))
scene:addChild(subMenu, 1)
-- add title label
titleLabel = CCLabelTTF:create("No title", "Arial", 40)
scene:addChild(titleLabel, 1)
titleLabel:setPosition(s.width / 2, s.height - 32)
titleLabel:setColor(ccc3(255, 255, 40))
while quantityNodes < nNodes do
onIncrease()
end
end
-----------------------------------
-- SpritePerformTest1
-----------------------------------
function doPerformSpriteTest1(sprite)
performancePosition(sprite)
end
local function SpriteTestLayer1()
local layer = CCLayer:create()
initWithLayer(layer, true)
local str = "A (" .. subtestNumber .. ") position"
titleLabel:setString(str)
return layer
end
-----------------------------------
-- SpritePerformTest2
-----------------------------------
function doPerformSpriteTest2(sprite)
performanceScale(sprite)
end
local function SpriteTestLayer2()
local layer = CCLayer:create()
initWithLayer(layer, true)
local str = "B (" .. subtestNumber .. ") scale"
titleLabel:setString(str)
return layer
end
-----------------------------------
-- SpritePerformTest3
-----------------------------------
function doPerformSpriteTest3(sprite)
performanceRotationScale(sprite)
end
local function SpriteTestLayer3()
local layer = CCLayer:create()
initWithLayer(layer, true)
local str = "C (" .. subtestNumber .. ") scale + rot"
titleLabel:setString(str)
return layer
end
-----------------------------------
-- SpritePerformTest4
-----------------------------------
function doPerformSpriteTest4(sprite)
performanceOut100(sprite)
end
local function SpriteTestLayer4()
local layer = CCLayer:create()
initWithLayer(layer, true)
local str = "D (" .. subtestNumber .. ") 100% out"
titleLabel:setString(str)
return layer
end
-----------------------------------
-- SpritePerformTest5
-----------------------------------
function doPerformSpriteTest5(sprite)
performanceout20(sprite)
end
local function SpriteTestLayer5()
local layer = CCLayer:create()
initWithLayer(layer, true)
local str = "E (" .. subtestNumber .. ") 80% out"
titleLabel:setString(str)
return layer
end
-----------------------------------
-- SpritePerformTest6
-----------------------------------
function doPerformSpriteTest6(sprite)
performanceActions(sprite)
end
local function SpriteTestLayer6()
local layer = CCLayer:create()
initWithLayer(layer, true)
local str = "F (" .. subtestNumber .. ") actions"
titleLabel:setString(str)
return layer
end
-----------------------------------
-- SpritePerformTest7
-----------------------------------
function doPerformSpriteTest7(sprite)
performanceActions20(sprite)
end
local function SpriteTestLayer7()
local layer = CCLayer:create()
initWithLayer(layer, true)
local str = "G (" .. subtestNumber .. ") actions 80% out"
titleLabel:setString(str)
return layer
end
-----------------------------------
-- PerformanceSpriteTest
-----------------------------------
function CreateSpriteTestScene()
local scene = CCScene:create()
initWithMainTest(scene, subtestNumber, kNodesIncrease)
if curCase == 0 then
scene:addChild(SpriteTestLayer1())
elseif curCase == 1 then
scene:addChild(SpriteTestLayer2())
elseif curCase == 2 then
scene:addChild(SpriteTestLayer3())
elseif curCase == 3 then
scene:addChild(SpriteTestLayer4())
elseif curCase == 4 then
scene:addChild(SpriteTestLayer5())
elseif curCase == 5 then
scene:addChild(SpriteTestLayer6())
elseif curCase == 6 then
scene:addChild(SpriteTestLayer7())
end
return scene
end
function PerformanceSpriteTest()
curCase = 0
return CreateSpriteTestScene()
end

View File

@ -0,0 +1,70 @@
require "luaScript/PerformanceTest/PerformanceSpriteTest"
local MAX_COUNT = 1
local LINE_SPACE = 40
local kItemTagBasic = 1000
local testsName =
{
[0] = "PerformanceSpriteTest",
"PerformanceParticleTest",
"PerformanceNodeChildrenTest",
"PerformanceTextureTest",
"PerformanceTouchesTest"
}
local s = CCDirector:sharedDirector():getWinSize()
----------------------------------
-- PerformanceMainLayer
----------------------------------
local function menuCallback(tag)
local scene = nil
tag = tag - kItemTagBasic
if tag == 0 then
scene = PerformanceSpriteTest()
elseif tag == 1 then
elseif tag == 2 then
elseif tag == 3 then
elseif tag == 4 then
end
if scene ~= nil then
CCDirector:sharedDirector():replaceScene(scene)
end
end
local function PerformanceMainLayer()
local layer = CCLayer:create()
local menu = CCMenu:create()
menu:setPosition(CCPointMake(0, 0))
CCMenuItemFont:setFontName("Arial")
CCMenuItemFont:setFontSize(24)
for i = 0, MAX_COUNT - 1 do
local item = CCMenuItemFont:create(testsName[i])
item:registerScriptHandler(menuCallback)
item:setPosition(s.width / 2, s.height - (i + 1) * LINE_SPACE)
menu:addChild(item, kItemTagBasic + i, kItemTagBasic + i)
end
layer:addChild(menu)
return layer
end
-------------------------------------
-- Performance Test
-------------------------------------
function PerformanceTest()
local scene = CCScene:create()
scene:addChild(PerformanceMainLayer())
scene:addChild(CreateBackMenuItem())
return scene
end

View File

@ -236,8 +236,8 @@ function generateTranScene(sceneType)
layer = createLayer2() layer = createLayer2()
end end
scene:addChild(CreateBackMenuItem())
scene:addChild(layer) scene:addChild(layer)
scene:addChild(CreateBackMenuItem())
local tranScene = createTransition(SceneIdx, TRANSITION_DURATION, scene) local tranScene = createTransition(SceneIdx, TRANSITION_DURATION, scene)
if tranScene ~= nil then if tranScene ~= nil then
@ -249,8 +249,8 @@ function TransitionsTest()
cclog("TransitionsTest") cclog("TransitionsTest")
local scene = CCScene:create() local scene = CCScene:create()
scene:addChild(CreateBackMenuItem())
scene:addChild(createLayer1()) scene:addChild(createLayer1())
scene:addChild(CreateBackMenuItem())
return scene return scene
end end

View File

@ -90,7 +90,7 @@ local function CreateTestScene(nIdx)
elseif nIdx == Test_Table.TEST_COCOSDENSHION then elseif nIdx == Test_Table.TEST_COCOSDENSHION then
elseif nIdx == Test_Table.TEST_PERFORMANCE then elseif nIdx == Test_Table.TEST_PERFORMANCE then
scene = PerformanceTest()
elseif nIdx == Test_Table.TEST_ZWOPTEX then elseif nIdx == Test_Table.TEST_ZWOPTEX then
--#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE) --#if (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
@ -130,9 +130,9 @@ function CreateTestMenu()
CCDirector:sharedDirector():endToLua() CCDirector:sharedDirector():endToLua()
end end
local function menuCallback(menuTag) local function menuCallback(tag)
cclog(menuTag) local Idx = tag - 10000
local Idx = 0 -- menuTag - 10000 cclog("tag: " .. tag)
local testScene = CreateTestScene(Idx) local testScene = CreateTestScene(Idx)
if testScene then if testScene then
CCDirector:sharedDirector():replaceScene(testScene) CCDirector:sharedDirector():replaceScene(testScene)
@ -155,11 +155,11 @@ function CreateTestMenu()
for index, labelName in pairs(Test_Name) do for index, labelName in pairs(Test_Name) do
local testLabel = CCLabelTTF:create(labelName, "Arial", 24) local testLabel = CCLabelTTF:create(labelName, "Arial", 24)
local testMenuItem = CCMenuItemLabel:create(testLabel) local testMenuItem = CCMenuItemLabel:create(testLabel)
testMenuItem:setTag(index + 10000) --testMenuItem:setTag(index + 10000)
testMenuItem:registerScriptHandler(menuCallback) testMenuItem:registerScriptHandler(menuCallback)
testMenuItem:setPosition(s.width / 2, (s.height - (index + 1) * LINE_SPACE)) testMenuItem:setPosition(s.width / 2, (s.height - (index + 1) * LINE_SPACE))
MainMenu:addChild(testMenuItem, index + 10000) MainMenu:addChild(testMenuItem, index + 10000, index + 10000)
end end
MainMenu:setContentSize(CCSizeMake(s.width, (Test_Table.TESTS_COUNT + 1) * (LINE_SPACE))) MainMenu:setContentSize(CCSizeMake(s.width, (Test_Table.TESTS_COUNT + 1) * (LINE_SPACE)))

View File

@ -6,7 +6,7 @@ require "luaScript/ActionsProgressTest/ActionsProgressTest"
require "luaScript/EffectsTest/EffectsTest" require "luaScript/EffectsTest/EffectsTest"
require "luaScript/ClickAndMoveTest/ClickAndMoveTest" require "luaScript/ClickAndMoveTest/ClickAndMoveTest"
require "luaScript/RotateWorldTest/RotateWorldTest" require "luaScript/RotateWorldTest/RotateWorldTest"
require "luaScript/PerformanceTest/PerformanceTest"
---------------------------------------------------- ----------------------------------------------------

View File

@ -1,4 +1,4 @@
APPNAME="HelloLua" APPNAME="TestLua"
# options # options
@ -30,16 +30,23 @@ done
# paths # paths
if [ -z "${NDK_ROOT+aaa}" ];then if [ -z "${NDK_ROOT+aaa}" ]; then
echo "please define NDK_ROOT" # ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
exit 1 NDK_ROOT="$HOME/bin/android-ndk"
fi fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
# ... if COCOS2DX_ROOT is not set
# ... find current working directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# ... use paths relative to current directory # ... use paths relative to current directory
COCOS2DX_ROOT="$DIR/../../.." COCOS2DX_ROOT="$DIR/../../.."
APP_ROOT="$DIR/.." APP_ROOT="$DIR/.."
APP_ANDROID_ROOT="$DIR" APP_ANDROID_ROOT="$DIR"
else
APP_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"
APP_ANDROID_ROOT="$COCOS2DX_ROOT"/samples/"$APPNAME"/proj.android
fi
echo "NDK_ROOT = $NDK_ROOT" echo "NDK_ROOT = $NDK_ROOT"
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT" echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
@ -54,6 +61,18 @@ fi
mkdir "$APP_ANDROID_ROOT"/assets mkdir "$APP_ANDROID_ROOT"/assets
# copy resources # copy resources
for file in "$APP_ROOT"/../TestCpp/Resources/*
do
if [ -d "$file" ]; then
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
fi
if [ -f "$file" ]; then
cp "$file" "$APP_ANDROID_ROOT"/assets
fi
done
# copy luaScript
for file in "$APP_ROOT"/Resources/* for file in "$APP_ROOT"/Resources/*
do do
if [ -d "$file" ]; then if [ -d "$file" ]; then
@ -65,6 +84,13 @@ if [ -f "$file" ]; then
fi fi
done done
# remove test_image_rgba4444.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_image_rgba4444.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba8888.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgb888.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba4444.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_a8.pvr.gz
if [[ "$buildexternalsfromsource" ]]; then if [[ "$buildexternalsfromsource" ]]; then
echo "Building external dependencies from source" echo "Building external dependencies from source"
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \

View File

@ -230,7 +230,7 @@ bool ScriptingCore::evalString(const char *string, jsval *outVal)
CCLog("error evaluating script:\n%s", string); CCLog("error evaluating script:\n%s", string);
} }
str = JS_ValueToString(cx, rval); str = JS_ValueToString(cx, rval);
return ok; return ok!=0;
} }
void ScriptingCore::runScript(const char *path) void ScriptingCore::runScript(const char *path)

View File

@ -1 +1 @@
c3a4fa7cf2bdc8ce0bd3cbd98b7829bcdd253a2e 092a4fc2dae615c23d2a1b327c514193718f8a93

View File

@ -75,7 +75,7 @@ JSBool S_CCSequence::jsactions(JSContext *cx, uint32_t argc, jsval *vp) {
// get first element // get first element
S_CCSequence* prev; S_CCSequence* prev;
JSGET_PTRSHELL(S_CCSequence, prev, JSVAL_TO_OBJECT(argv[0])); JSGET_PTRSHELL(S_CCSequence, prev, JSVAL_TO_OBJECT(argv[0]));
for (int i=1; i < argc; i++) { for (unsigned int i=1; i < argc; i++) {
CCFiniteTimeAction *next; JSGET_PTRSHELL(CCFiniteTimeAction, next, JSVAL_TO_OBJECT(argv[i])); CCFiniteTimeAction *next; JSGET_PTRSHELL(CCFiniteTimeAction, next, JSVAL_TO_OBJECT(argv[i]));
prev = (S_CCSequence *)CCSequence::actionOneTwo(prev, next); prev = (S_CCSequence *)CCSequence::actionOneTwo(prev, next);
} }

View File

@ -160,7 +160,7 @@ JSBool S_SimpleAudioEngine::jsplayBackgroundMusic(JSContext *cx, uint32_t argc,
JSBool arg1; JSBool arg1;
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1); JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1);
char *narg0 = JS_EncodeString(cx, arg0); char *narg0 = JS_EncodeString(cx, arg0);
self->playBackgroundMusic(narg0, arg1); self->playBackgroundMusic(narg0, arg1!=0);
JS_SET_RVAL(cx, vp, JSVAL_TRUE); JS_SET_RVAL(cx, vp, JSVAL_TRUE);
return JS_TRUE; return JS_TRUE;
@ -175,7 +175,7 @@ JSBool S_SimpleAudioEngine::jsstopBackgroundMusic(JSContext *cx, uint32_t argc,
if (argc == 1) { if (argc == 1) {
JSBool arg0; JSBool arg0;
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "b", &arg0); JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "b", &arg0);
self->stopBackgroundMusic(arg0); self->stopBackgroundMusic(arg0!=0);
JS_SET_RVAL(cx, vp, JSVAL_TRUE); JS_SET_RVAL(cx, vp, JSVAL_TRUE);
return JS_TRUE; return JS_TRUE;
@ -262,7 +262,7 @@ JSBool S_SimpleAudioEngine::jsplayEffect(JSContext *cx, uint32_t argc, jsval *vp
JSBool arg1; JSBool arg1;
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1); JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1);
char *narg0 = JS_EncodeString(cx, arg0); char *narg0 = JS_EncodeString(cx, arg0);
unsigned int ret = self->playEffect(narg0, arg1); unsigned int ret = self->playEffect(narg0, arg1!=0);
do { jsval tmp; JS_NewNumberValue(cx, ret, &tmp); JS_SET_RVAL(cx, vp, tmp); } while (0); do { jsval tmp; JS_NewNumberValue(cx, ret, &tmp); JS_SET_RVAL(cx, vp, tmp); } while (0);
return JS_TRUE; return JS_TRUE;

View File

@ -1 +1 @@
1e35e173502d72efb4912d2ef6688d25618f881d ddd3a33e065db39b993e002dac4521ac04f16151

View File

@ -116,7 +116,7 @@ TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err)
} }
/* the equivalent of lua_is* for usertable */ /* the equivalent of lua_is* for usertable */
static int lua_isusertable (lua_State* L, int lo, const const char* type) static int lua_isusertable (lua_State* L, int lo, const char* type)
{ {
int r = 0; int r = 0;
if (lo < 0) lo = lua_gettop(L)+lo+1; if (lo < 0) lo = lua_gettop(L)+lo+1;

View File

@ -18,7 +18,7 @@ bool AppDelegate::applicationDidFinishLaunching()
{ {
// initialize director // initialize director
CCDirector *pDirector = CCDirector::sharedDirector(); CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView()); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
// pDirector->enableRetinaDisplay(true); // pDirector->enableRetinaDisplay(true);

View File

@ -134,4 +134,5 @@ if [ $compileresult != 0 ]; then
else else
# git checkout -f # git checkout -f
# git clean -df -x # git clean -df -x
exit 0
fi fi

View File

@ -92,4 +92,5 @@ if [ $compileresult != 0 ]; then
else else
# git checkout -f # git checkout -f
# git clean -df -x # git clean -df -x
exit 0
fi fi

View File

@ -138,4 +138,5 @@ if [ $compileresult != 0 ]; then
else else
# git checkout -f # git checkout -f
# git clean -df -x # git clean -df -x
exit 0
fi fi

View File

@ -96,4 +96,5 @@ if [ $compileresult != 0 ]; then
else else
# git checkout -f # git checkout -f
# git clean -df -x # git clean -df -x
exit 0
fi fi

View File

@ -13,11 +13,11 @@ cd samples/TestCpp/proj.android/bin
#Copy test apk to tools directory. #Copy test apk to tools directory.
CUR=$(pwd) CUR=$(pwd)
cp $CUR/Tests-debug-8.apk $ANDROID_HOME/tools cp $CUR/TestCpp-debug-8.apk $ANDROID_HOME/tools
cp $CUR/Tests-debug-10.apk $ANDROID_HOME/tools cp $CUR/TestCpp-debug-10.apk $ANDROID_HOME/tools
cp $CUR/Tests-debug-11.apk $ANDROID_HOME/tools cp $CUR/TestCpp-debug-11.apk $ANDROID_HOME/tools
cp $CUR/Tests-debug-12.apk $ANDROID_HOME/tools cp $CUR/TestCpp-debug-12.apk $ANDROID_HOME/tools
cp $CUR/Tests-debug-13.apk $ANDROID_HOME/tools cp $CUR/TestCpp-debug-13.apk $ANDROID_HOME/tools
#Enter tools directory. #Enter tools directory.
cd $ANDROID_HOME cd $ANDROID_HOME
@ -25,29 +25,29 @@ cd $ANDROID_HOME
#If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. #If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
#Running monkeyrunner test(debug,API level:8) #Running monkeyrunner test(debug,API level:8)
mv Tests-debug-8.apk Tests-debug.apk mv TestCpp-debug-8.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk rm TestCpp-debug.apk
#Running monkeyrunner test(debug,API level:10) #Running monkeyrunner test(debug,API level:10)
mv Tests-debug-10.apk Tests-debug.apk mv TestCpp-debug-10.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk rm TestCpp-debug.apk
#Running monkeyrunner test(debug,API level:11) #Running monkeyrunner test(debug,API level:11)
mv Tests-debug-11.apk Tests-debug.apk mv TestCpp-debug-11.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk rm TestCpp-debug.apk
#Running monkeyrunner test(debug,API level:12) #Running monkeyrunner test(debug,API level:12)
mv Tests-debug-12.apk Tests-debug.apk mv TestCpp-debug-12.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk rm TestCpp-debug.apk
#Running monkeyrunner test(debug,API level:13) #Running monkeyrunner test(debug,API level:13)
mv Tests-debug-13.apk Tests-debug.apk mv TestCpp-debug-13.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk rm TestCpp-debug.apk
rm Monkeyrunner_TestsCpp.py rm Monkeyrunner_TestsCpp.py

View File

@ -13,8 +13,8 @@ cd samples/TestCpp/proj.android/bin
#Copy test apk to tools directory. #Copy test apk to tools directory.
CUR=$(pwd) CUR=$(pwd)
cp $CUR/Tests-debug-14.apk $ANDROID_HOME/tools cp $CUR/TestCpp-debug-14.apk $ANDROID_HOME/tools
cp $CUR/Tests-debug-15.apk $ANDROID_HOME/tools cp $CUR/TestCpp-debug-15.apk $ANDROID_HOME/tools
#Enter tools directory. #Enter tools directory.
cd $ANDROID_HOME cd $ANDROID_HOME
@ -22,14 +22,14 @@ cd $ANDROID_HOME
#If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. #If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
#Running monkeyrunner test(debug,API level:14) #Running monkeyrunner test(debug,API level:14)
mv Tests-debug-14.apk Tests-debug.apk mv TestCpp-debug-14.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk rm TestCpp-debug.apk
#Running monkeyrunner test(debug,API level:15) #Running monkeyrunner test(debug,API level:15)
mv Tests-debug-15.apk Tests-debug.apk mv TestCpp-debug-15.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-debug.apk rm TestCpp-debug.apk
rm Monkeyrunner_TestsCpp.py rm Monkeyrunner_TestsCpp.py

View File

@ -13,11 +13,11 @@ cd samples/TestCpp/proj.android/bin
#Copy test apk to tools directory. #Copy test apk to tools directory.
CUR=$(pwd) CUR=$(pwd)
cp $CUR/Tests-release-8.apk $ANDROID_HOME/tools cp $CUR/TestCpp-release-8.apk $ANDROID_HOME/tools
cp $CUR/Tests-release-10.apk $ANDROID_HOME/tools cp $CUR/TestCpp-release-10.apk $ANDROID_HOME/tools
cp $CUR/Tests-release-11.apk $ANDROID_HOME/tools cp $CUR/TestCpp-release-11.apk $ANDROID_HOME/tools
cp $CUR/Tests-release-12.apk $ANDROID_HOME/tools cp $CUR/TestCpp-release-12.apk $ANDROID_HOME/tools
cp $CUR/Tests-release-13.apk $ANDROID_HOME/tools cp $CUR/TestCpp-release-13.apk $ANDROID_HOME/tools
#Enter tools directory. #Enter tools directory.
cd $ANDROID_HOME cd $ANDROID_HOME
@ -25,29 +25,29 @@ cd $ANDROID_HOME
#If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. #If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
#Running monkeyrunner test(release,API level:8) #Running monkeyrunner test(release,API level:8)
mv Tests-release-8.apk Tests-release.apk mv TestCpp-release-8.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk rm TestCpp-release.apk
#Running monkeyrunner test(release,API level:10) #Running monkeyrunner test(release,API level:10)
mv Tests-release-10.apk Tests-release.apk mv TestCpp-release-10.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk rm TestCpp-release.apk
#Running monkeyrunner test(release,API level:11) #Running monkeyrunner test(release,API level:11)
mv Tests-release-11.apk Tests-release.apk mv TestCpp-release-11.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk rm TestCpp-release.apk
#Running monkeyrunner test(release,API level:12) #Running monkeyrunner test(release,API level:12)
mv Tests-release-12.apk Tests-release.apk mv TestCpp-release-12.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk rm TestCpp-release.apk
#Running monkeyrunner test(release,API level:13) #Running monkeyrunner test(release,API level:13)
mv Tests-release-13.apk Tests-release.apk mv TestCpp-release-13.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk rm TestCpp-release.apk
rm Monkeyrunner_TestsCpp.py rm Monkeyrunner_TestsCpp.py

View File

@ -13,8 +13,8 @@ cd samples/TestCpp/proj.android/bin
#Copy test apk to tools directory. #Copy test apk to tools directory.
CUR=$(pwd) CUR=$(pwd)
cp $CUR/Tests-release-14.apk $ANDROID_HOME/tools cp $CUR/TestCpp-release-14.apk $ANDROID_HOME/tools
cp $CUR/Tests-release-15.apk $ANDROID_HOME/tools cp $CUR/TestCpp-release-15.apk $ANDROID_HOME/tools
#Enter tools directory. #Enter tools directory.
cd $ANDROID_HOME cd $ANDROID_HOME
@ -22,14 +22,14 @@ cd $ANDROID_HOME
#If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. #If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
#Running monkeyrunner test(release,API level:14) #Running monkeyrunner test(release,API level:14)
mv Tests-release-14.apk Tests-release.apk mv TestCpp-release-14.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk rm TestCpp-release.apk
#Running monkeyrunner test(release,API level:15) #Running monkeyrunner test(release,API level:15)
mv Tests-release-15.apk Tests-release.apk mv TestCpp-release-15.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py
rm Tests-release.apk rm TestCpp-release.apk
rm Monkeyrunner_TestsCpp.py rm Monkeyrunner_TestsCpp.py

View File

@ -2,7 +2,7 @@
#This script is used to finish a ios automated compiler. #This script is used to finish a ios automated compiler.
compileresult=0 compileresult=0
cd ../../samples cd ../../../../samples
#List simulator sdks #List simulator sdks
xcodebuild -showsdks > tmp.txt xcodebuild -showsdks > tmp.txt
@ -61,12 +61,12 @@ cd ../../..
if [ $compileresult != 0 ]; then if [ $compileresult != 0 ]; then
echo Error. echo Error.
echo $compilesult echo $compilesult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
exit 1 exit 1
else else
echo Success. echo Success.
echo $compileresult echo $compileresult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
fi fi

View File

@ -2,7 +2,7 @@
#This script is used to finish a ios automated compiler. #This script is used to finish a ios automated compiler.
compileresult=0 compileresult=0
cd ../../samples cd ../../../../samples
#List simulator sdks #List simulator sdks
xcodebuild -showsdks > tmp.txt xcodebuild -showsdks > tmp.txt
@ -61,12 +61,12 @@ cd ../../..
if [ $compileresult != 0 ]; then if [ $compileresult != 0 ]; then
echo Error. echo Error.
echo $compilesult echo $compilesult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
exit 1 exit 1
else else
echo Success. echo Success.
echo $compileresult echo $compileresult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
fi fi

View File

@ -2,7 +2,7 @@
#This script is used to finish a mac automated compiler. #This script is used to finish a mac automated compiler.
compileresult=0 compileresult=0
cd ../../samples cd ../../../../samples
#List simulator sdks #List simulator sdks
xcodebuild -showsdks > tmp.txt xcodebuild -showsdks > tmp.txt
@ -45,12 +45,12 @@ cd ../../..
if [ $compileresult != 0 ]; then if [ $compileresult != 0 ]; then
echo Error. echo Error.
echo $compilesult echo $compilesult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
exit 1 exit 1
else else
echo Success. echo Success.
echo $compileresult echo $compileresult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
fi fi

View File

@ -2,7 +2,7 @@
#This script is used to finish a mac automated compiler. #This script is used to finish a mac automated compiler.
compileresult=0 compileresult=0
cd ../../samples cd ../../../../samples
#List simulator sdks #List simulator sdks
xcodebuild -showsdks > tmp.txt xcodebuild -showsdks > tmp.txt
@ -45,12 +45,12 @@ cd ../../..
if [ $compileresult != 0 ]; then if [ $compileresult != 0 ]; then
echo Error. echo Error.
echo $compilesult echo $compilesult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
exit 1 exit 1
else else
echo Success. echo Success.
echo $compileresult echo $compileresult
git checkout -f # git checkout -f
git clean -df -x # git clean -df -x
fi fi

View File

@ -16,11 +16,11 @@ else:
# Installs the Android package. Notice that this method returns a boolean, so you can test # Installs the Android package. Notice that this method returns a boolean, so you can test
# to see if the installation worked. # to see if the installation worked.
#if device.installPackage('Tests-debug.apk'): if device.installPackage(sys.argv[1]):
# print "Install success!" print "Install success!"
#else: else:
# print "Install failed,please make sure you have put apk in the right places" print "Install failed,please make sure you have put apk in the right places"
# sys.exit(1) sys.exit(1)
# sets a variable with the package's internal name # sets a variable with the package's internal name
package = 'org.cocos2dx.testcpp' package = 'org.cocos2dx.testcpp'
@ -66,8 +66,8 @@ def random_drag(a,b,c):
device.drag((drag_x,drag_y),(drop_x,drop_y)) device.drag((drag_x,drag_y),(drop_x,drop_y))
def check_activity(a): def check_activity(a):
subprocess.call("adb shell ps > running_activities.txt") subprocess.call("adb shell ps > running_activities.txt",shell=True)
subprocess.call("adb pull running_activities.txt") subprocess.call("adb pull running_activities.txt",shell=True)
f1 = open('running_activities.txt') f1 = open('running_activities.txt')
while True: while True:

View File

@ -52,7 +52,7 @@ set result8=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_10 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_10
if %result8% NEQ 0 goto API_10 if %result8% NEQ 0 goto API_10
cd bin cd bin
ren Tests-debug.apk Tests-debug-8.apk ren TestCpp-debug.apk TestCpp-debug-8.apk
cd .. cd ..
:API_10 :API_10
@ -68,7 +68,7 @@ set result10=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_11 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_11
if %result10% NEQ 0 goto API_11 if %result10% NEQ 0 goto API_11
cd bin cd bin
ren Tests-debug.apk Tests-debug-10.apk ren TestCpp-debug.apk TestCpp-debug-10.apk
cd .. cd ..
:API_11 :API_11
@ -84,7 +84,7 @@ set result11=%ERRORlEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_12 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_12
if %result11% NEQ 0 goto API_12 if %result11% NEQ 0 goto API_12
cd bin cd bin
ren Tests-debug.apk Tests-debug-11.apk ren TestCpp-debug.apk TestCpp-debug-11.apk
cd .. cd ..
:API_12 :API_12
@ -100,7 +100,7 @@ set result12=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_13 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_13
if %result12% NEQ 0 goto API_13 if %result12% NEQ 0 goto API_13
cd bin cd bin
ren Tests-debug.apk Tests-debug-12.apk ren TestCpp-debug.apk TestCpp-debug-12.apk
cd .. cd ..
:API_13 :API_13
@ -116,7 +116,7 @@ set result13=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ
if %result13% NEQ 0 goto NEXTPROJ if %result13% NEQ 0 goto NEXTPROJ
cd bin cd bin
ren Tests-debug.apk Tests-debug-13.apk ren TestCpp-debug.apk TestCpp-debug-13.apk
cd .. cd ..
:NEXTPROJ :NEXTPROJ

View File

@ -57,7 +57,7 @@ set result14=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_15 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_15
if %result14% NEQ 0 goto API_15 if %result14% NEQ 0 goto API_15
cd bin cd bin
ren Tests-debug.apk Tests-debug-14.apk ren TestCpp-debug.apk TestCpp-debug-14.apk
cd .. cd ..
:API_15 :API_15
@ -73,7 +73,7 @@ set result15=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ
if %result15% NEQ 0 goto NEXTPROJ if %result15% NEQ 0 goto NEXTPROJ
cd bin cd bin
ren Tests-debug.apk Tests-debug-15.apk ren TestCpp-debug.apk TestCpp-debug-15.apk
cd .. cd ..
:NEXTPROJ :NEXTPROJ

View File

@ -55,7 +55,7 @@ set result8=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_10 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_10
if %result8% NEQ 0 goto API_10 if %result8% NEQ 0 goto API_10
cd bin cd bin
ren Tests-release.apk Tests-release-8.apk ren TestCpp-release.apk TestCpp-release-8.apk
cd .. cd ..
:API_10 :API_10
@ -74,7 +74,7 @@ set result10=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_11 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_11
if %result10% NEQ 0 goto API_11 if %result10% NEQ 0 goto API_11
cd bin cd bin
ren Tests-release.apk Tests-release-10.apk ren TestCpp-release.apk TestCpp-release-10.apk
cd .. cd ..
:API_11 :API_11
@ -93,7 +93,7 @@ set result11=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_12 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_12
if %result11% NEQ 0 goto API_12 if %result11% NEQ 0 goto API_12
cd bin cd bin
ren Tests-release.apk Tests-release-11.apk ren TestCpp-release.apk TestCpp-release-11.apk
cd .. cd ..
:API_12 :API_12
@ -112,7 +112,7 @@ set result12=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_13 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_13
if %result12% NEQ 0 goto API_13 if %result12% NEQ 0 goto API_13
cd bin cd bin
ren Tests-release.apk Tests-release-12.apk ren TestCpp-release.apk TestCpp-release-12.apk
cd .. cd ..
:API_13 :API_13
@ -131,7 +131,7 @@ set result13=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ
if %result13% NEQ 0 goto NEXTPROJ if %result13% NEQ 0 goto NEXTPROJ
cd bin cd bin
ren Tests-release.apk Tests-release-13.apk ren TestCpp-release.apk TestCpp-release-13.apk
cd .. cd ..
:NEXTPROJ :NEXTPROJ

View File

@ -60,7 +60,7 @@ set result14=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto API_15 if "%_PROJECTNAME%" NEQ "TestCpp" goto API_15
if %result14% NEQ 0 goto API_15 if %result14% NEQ 0 goto API_15
cd bin cd bin
ren Tests-release.apk Tests-release-14.apk ren TestCpp-release.apk TestCpp-release-14.apk
cd .. cd ..
:API_15 :API_15
@ -79,7 +79,7 @@ set result15=%ERRORLEVEL%
if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ if "%_PROJECTNAME%" NEQ "TestCpp" goto NEXTPROJ
if %result15% NEQ 0 goto NEXTPROJ if %result15% NEQ 0 goto NEXTPROJ
cd bin cd bin
ren Tests-release.apk Tests-release-15.apk ren TestCpp-release.apk TestCpp-release-15.apk
cd .. cd ..
:NEXTPROJ :NEXTPROJ

View File

@ -10,11 +10,11 @@ cd ..\..
cd samples\TestCpp\proj.android\bin cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory. ::Copy test apk to tools directory.
copy %cd%\Tests-debug-8.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-debug-8.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-10.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-debug-10.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-11.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-debug-11.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-12.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-debug-12.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-13.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-debug-13.apk %ANDROID_HOME%\tools
::Enter tools directory. ::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2% set ANDROID_ROOT=%ANDROID_HOME:~0,2%
@ -24,29 +24,29 @@ cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. ::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(debug,API level:8). ::Running monkeyrunner test(debug,API level:8).
ren Tests-debug-8.apk Tests-debug.apk ren TestCpp-debug-8.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py TestCpp-debug.apk
rm Tests-debug.apk rm TestCpp-debug.apk
::Running monkeyrunner test(debug,API level:10). ::Running monkeyrunner test(debug,API level:10).
ren Tests-debug-10.apk Tests-debug.apk ren TestCpp-debug-10.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-debug.apk
rm Tests-debug.apk rm TestCpp-debug.apk
::Running monkeyrunner test(debug,API level:11). ::Running monkeyrunner test(debug,API level:11).
ren Tests-debug-11.apk Tests-debug.apk ren TestCpp-debug-11.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-debug.apk
rm Tests-debug.apk rm TestCpp-debug.apk
::Running monkeyrunner test(debug,API level:12). ::Running monkeyrunner test(debug,API level:12).
ren Tests-debug-12.apk Tests-debug.apk ren TestCpp-debug-12.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-debug.apk
rm Tests-debug.apk rm TestCpp-debug.apk
::Running monkeyrunner test(debug,API level:13). ::Running monkeyrunner test(debug,API level:13).
ren Tests-debug-13.apk Tests-debug.apk ren TestCpp-debug-13.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-debug.apk
rm Tests-debug.apk rm TestCpp-debug.apk
rm Monkeyrunner_TestCpp.py rm Monkeyrunner_TestCpp.py

View File

@ -10,8 +10,8 @@ cd ..\..
cd samples\TestCpp\proj.android\bin cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory. ::Copy test apk to tools directory.
copy %cd%\Tests-debug-14.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-debug-14.apk %ANDROID_HOME%\tools
copy %cd%\Tests-debug-15.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-debug-15.apk %ANDROID_HOME%\tools
::Enter tools directory. ::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2% set ANDROID_ROOT=%ANDROID_HOME:~0,2%
@ -21,14 +21,14 @@ cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. ::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(debug,API level:14). ::Running monkeyrunner test(debug,API level:14).
ren Tests-debug-14.apk Tests-debug.apk ren TestCpp-debug-14.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-debug.apk
rm Tests-debug.apk rm TestCpp-debug.apk
::Running monkeyrunner test(debug,API level:15). ::Running monkeyrunner test(debug,API level:15).
ren Tests-debug-15.apk Tests-debug.apk ren TestCpp-debug-15.apk TestCpp-debug.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-debug.apk
rm Tests-debug.apk rm TestCpp-debug.apk
rm Monkeyrunner_TestCpp.py rm Monkeyrunner_TestCpp.py

View File

@ -10,11 +10,11 @@ cd ..\..
cd samples\TestCpp\proj.android\bin cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory. ::Copy test apk to tools directory.
copy %cd%\Tests-release-8.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-release-8.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-10.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-release-10.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-11.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-release-11.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-12.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-release-12.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-13.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-release-13.apk %ANDROID_HOME%\tools
::Enter tools directory. ::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2% set ANDROID_ROOT=%ANDROID_HOME:~0,2%
@ -24,29 +24,29 @@ cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. ::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(release,API level:8). ::Running monkeyrunner test(release,API level:8).
ren Tests-release-8.apk Tests-release.apk ren TestCpp-release-8.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestsCpp.py monkeyrunner Monkeyrunner_TestsCpp.py TestCpp-release.apk
rm Tests-release.apk rm TestCpp-release.apk
::Running monkeyrunner test(release,API level:10). ::Running monkeyrunner test(release,API level:10).
ren Tests-release-10.apk Tests-release.apk ren TestCpp-release-10.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-release.apk
rm Tests-release.apk rm TestCpp-release.apk
::Running monkeyrunner test(release,API level:11). ::Running monkeyrunner test(release,API level:11).
ren Tests-release-11.apk Tests-release.apk ren TestCpp-release-11.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-release.apk
rm Tests-release.apk rm TestCpp-release.apk
::Running monkeyrunner test(release,API level:12). ::Running monkeyrunner test(release,API level:12).
ren Tests-release-12.apk Tests-release.apk ren TestCpp-release-12.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-release.apk
rm Tests-release.apk rm TestCpp-release.apk
::Running monkeyrunner test(release,API level:13). ::Running monkeyrunner test(release,API level:13).
ren Tests-release-13.apk Tests-release.apk ren TestCpp-release-13.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-release.apk
rm Tests-release.apk rm TestCpp-release.apk
rm Monkeyrunner_TestCpp.py rm Monkeyrunner_TestCpp.py

View File

@ -10,8 +10,8 @@ cd ..\..
cd samples\TestCpp\proj.android\bin cd samples\TestCpp\proj.android\bin
::Copy test apk to tools directory. ::Copy test apk to tools directory.
copy %cd%\Tests-release-14.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-release-14.apk %ANDROID_HOME%\tools
copy %cd%\Tests-release-15.apk %ANDROID_HOME%\tools copy %cd%\TestCpp-release-15.apk %ANDROID_HOME%\tools
::Enter tools directory. ::Enter tools directory.
set ANDROID_ROOT=%ANDROID_HOME:~0,2% set ANDROID_ROOT=%ANDROID_HOME:~0,2%
@ -21,14 +21,14 @@ cd %ANDROID_HOME%\tools
::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero. ::If monkeyrunner test failed,it automatically exit and make ERRORLEVEL nonzero.
::Running monkeyrunner test(release,API level:14). ::Running monkeyrunner test(release,API level:14).
ren Tests-release-14.apk Tests-release.apk ren TestCpp-release-14.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-release.apk
rm Tests-release.apk rm TestCpp-release.apk
::Running monkeyrunner test(release,API level:15). ::Running monkeyrunner test(release,API level:15).
ren Tests-release-15.apk Tests-release.apk ren TestCpp-release-15.apk TestCpp-release.apk
monkeyrunner Monkeyrunner_TestCpp.py monkeyrunner Monkeyrunner_TestCpp.py TestCpp-release.apk
rm Tests-release.apk rm TestCpp-release.apk
rm Monkeyrunner_TestCpp.py rm Monkeyrunner_TestCpp.py

View File

@ -25,7 +25,7 @@ sed -i '13d' $CUR/project.properties
#Modify the project name #Modify the project name
if [ $1 = TestCpp ]; then if [ $1 = TestCpp ]; then
sed -i '2d' $CUR/build.xml sed -i '2d' $CUR/build.xml
sed -i '2 i\<project name="Tests" default="help">' $CUR/build.xml sed -i '2 i\<project name="TestCpp" default="help">' $CUR/build.xml
elif [ $1 = HelloCpp ]; then elif [ $1 = HelloCpp ]; then
sed -i '2d' $CUR/build.xml sed -i '2d' $CUR/build.xml
sed -i '2 i\<project name="HelloCpp" default="help">' $CUR/build.xml sed -i '2 i\<project name="HelloCpp" default="help">' $CUR/build.xml

View File

@ -37,7 +37,7 @@ class CCMenuItemLabel : public CCMenuItem
static CCMenuItemLabel* create(CCNode* label); static CCMenuItemLabel* create(CCNode* label);
}; };
class CCMenuItemAtlasFont : public CCMenuItem class CCMenuItemAtlasFont : public CCMenuItemLabel
{ {
static CCMenuItemAtlasFont* create(const char* value, static CCMenuItemAtlasFont* create(const char* value,
const char* charMapFile, const char* charMapFile,
@ -46,7 +46,7 @@ class CCMenuItemAtlasFont : public CCMenuItem
char startCharMap); char startCharMap);
}; };
class CCMenuItemFont : public CCMenuItem class CCMenuItemFont : public CCMenuItemLabel
{ {
static void setFontSize(int s); static void setFontSize(int s);
static unsigned int fontSize(); static unsigned int fontSize();
@ -88,7 +88,7 @@ class CCMenuItemSprite : public CCMenuItem
CCNode* disabledSprite); CCNode* disabledSprite);
}; };
class CCMenuItemImage : public CCMenuItem class CCMenuItemImage : public CCMenuItemSprite
{ {
void setColor(ccColor3B color); void setColor(ccColor3B color);
ccColor3B getColor(); ccColor3B getColor();

View File

@ -109,12 +109,8 @@ class CCNode : public CCObject
unsigned int numberOfRunningActions(void); unsigned int numberOfRunningActions(void);
void scheduleUpdate(void); unsigned int scheduleScriptFunc(LUA_FUNCTION funcID, float fInterval, bool bPaused);
void scheduleUpdateWithPriority(int priority); void unscheduleScriptEntry(unsigned int uScheduleScriptEntryID);
void unscheduleUpdate(void);
void unscheduleAllSelectors(void);
void resumeSchedulerAndActions(void);
void pauseSchedulerAndActions(void);
CCAffineTransform nodeToParentTransform(void); CCAffineTransform nodeToParentTransform(void);
CCAffineTransform parentToNodeTransform(void); CCAffineTransform parentToNodeTransform(void);