This commit is contained in:
zhangbin 2013-04-27 11:35:54 +08:00
commit 30a2e55adf
44 changed files with 264 additions and 228 deletions

View File

@ -89,6 +89,7 @@ Developers:
Some improvements for CCScrollView and CCTableView.
Touch priority can't be set to the value specified by a call to CCMenu::setTouchPriority(int).
CCTableView crashes if a CCTableViewDelegate is not provided.
Fixing a bug that _realOpacity isn't assigned in CCLayerColor::initWithColor.
Weeds (Andre Rudlaff)
Used fontconfig to enhance font rendering on linux.

View File

@ -709,7 +709,7 @@ bool CCLayerColor::initWithColor(const ccColor4B& color, GLfloat w, GLfloat h)
_displayedColor.r = _realColor.r = color.r;
_displayedColor.g = _realColor.g = color.g;
_displayedColor.b = _realColor.b = color.b;
_displayedOpacity = color.a;
_displayedOpacity = _realOpacity = color.a;
for (size_t i = 0; i<sizeof(m_pSquareVertices) / sizeof( m_pSquareVertices[0]); i++ )
{

View File

@ -62,6 +62,11 @@ bool CCFileUtilsAndroid::init()
bool CCFileUtilsAndroid::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
bool bFound = false;
// Check whether file exists in apk.

View File

@ -53,6 +53,11 @@ bool CCFileUtilsBlackberry::isAbsolutePath(const std::string& strPath)
bool CCFileUtilsBlackberry::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
std::string strPath = strFilePath;
if (strPath[0] != '/')
{ // Not absolute path, add the default root path at the beginning.

View File

@ -161,23 +161,33 @@ std::string CCFileUtilsIOS::getWritablePath()
bool CCFileUtilsIOS::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
bool bRet = false;
if (strFilePath[0] != '/')
{
std::string path = strFilePath;
std::string path;
std::string file;
size_t pos = path.find_last_of("/");
size_t pos = strFilePath.find_last_of("/");
if (pos != std::string::npos)
{
file = path.substr(pos+1);
path = path.substr(0, pos+1);
NSString* fullpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:file.c_str()]
ofType:nil
inDirectory:[NSString stringWithUTF8String:path.c_str()]];
if (fullpath != nil) {
bRet = true;
}
file = strFilePath.substr(pos+1);
path = strFilePath.substr(0, pos+1);
}
else
{
file = strFilePath;
}
NSString* fullpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:file.c_str()]
ofType:nil
inDirectory:[NSString stringWithUTF8String:path.c_str()]];
if (fullpath != nil) {
bRet = true;
}
}
else

View File

@ -75,6 +75,11 @@ string CCFileUtilsLinux::getWritablePath()
bool CCFileUtilsLinux::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
std::string strPath = strFilePath;
if (!isAbsolutePath(strPath))
{ // Not absolute path, add the default root path at the beginning.

View File

@ -158,6 +158,11 @@ std::string CCFileUtilsMac::getWritablePath()
bool CCFileUtilsMac::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
bool bRet = false;
if (strFilePath[0] != '/')

View File

@ -30,6 +30,11 @@ string CCFileUtilsMarmalade::getWritablePath()
bool CCFileUtilsMarmalade::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
return s3eFileCheckExists(strFilePath.c_str()) == S3E_TRUE ? true : false;
}

View File

@ -48,6 +48,11 @@ std::string CCFileUtilsNaCl::getWritablePath()
bool CCFileUtilsNaCl::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
std::string strPath = strFilePath;
if (!isAbsolutePath(strPath))
{ // Not absolute path, add the default root path at the beginning.

View File

@ -66,6 +66,11 @@ bool CCFileUtilsWin32::init()
bool CCFileUtilsWin32::isFileExist(const std::string& strFilePath)
{
if (0 == strFilePath.length())
{
return false;
}
std::string strPath = strFilePath;
if (!isAbsolutePath(strPath))
{ // Not absolute path, add the default root path at the beginning.

View File

@ -58,7 +58,7 @@ Skeleton* Skeleton_create (SkeletonData* data) {
SlotData *slotData = data->slots[i];
/* Find bone for the slotData's boneData. */
Bone *bone;
Bone *bone = NULL;
for (ii = 0; ii < self->boneCount; ++ii) {
if (data->bones[ii] == slotData->boneData) {
bone = self->bones[ii];

View File

@ -59,8 +59,9 @@ char* _readFile (const char* path, int* length) {
fseek(file, 0, SEEK_SET);
char* data = MALLOC(char, *length);
fread(data, 1, *length, file);
int rtn = fread(data, 1, *length, file);
fclose(file);
if (rtn != *length) return 0;
return data;
}

View File

@ -81,6 +81,7 @@ Classes/RotateWorldTest/RotateWorldTest.cpp \
Classes/SceneTest/SceneTest.cpp \
Classes/SchedulerTest/SchedulerTest.cpp \
Classes/ShaderTest/ShaderTest.cpp \
Classes/SpineTest/SpineTest.cpp \
Classes/SpriteTest/SpriteTest.cpp \
Classes/TextureCacheTest/TextureCacheTest.cpp \
Classes/Texture2dTest/Texture2dTest.cpp \

View File

@ -731,7 +731,7 @@ void RawStencilBufferTest3::setupStencilForClippingOnPlane(GLint plane)
void RawStencilBufferTest3::setupStencilForDrawingOnPlane(GLint plane)
{
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
//glEnable(GL_DEPTH_TEST);
RawStencilBufferTest::setupStencilForDrawingOnPlane(plane);
}
@ -797,7 +797,7 @@ void RawStencilBufferTest5::setupStencilForDrawingOnPlane(GLint plane)
glDisable(GL_ALPHA_TEST);
#endif
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
//glEnable(GL_DEPTH_TEST);
RawStencilBufferTest::setupStencilForDrawingOnPlane(plane);
}
@ -863,7 +863,7 @@ void RawStencilBufferTest6::setupStencilForDrawingOnPlane(GLint plane)
glDisable(GL_ALPHA_TEST);
#endif
glDepthMask(GL_TRUE);
glEnable(GL_DEPTH_TEST);
//glEnable(GL_DEPTH_TEST);
RawStencilBufferTest::setupStencilForDrawingOnPlane(plane);
glFlush();
}

View File

@ -913,7 +913,7 @@
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"$(SRCROOT)/../../../../extensions",
"$(SRCROOT)/../../../../cocos2dx/include",
"$(SRCROOT)/../../../../cocos2dx/platform/ios",
"$(SRCROOT)/../../../../external/chipmunk/include/chipmunk",
@ -954,7 +954,7 @@
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"$(SRCROOT)/../../../../extensions",
"$(SRCROOT)/../../../../cocos2dx/include",
"$(SRCROOT)/../../../../cocos2dx/platform/ios",
"$(SRCROOT)/../../../../external/chipmunk/include/chipmunk",

View File

@ -1120,9 +1120,9 @@
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"$(SRCROOT)/../../../../cocos2dx/include",
"$(SRCROOT)/../../../../cocos2dx/platform/ios",
"$(SRCROOT)/../../../../extensions",
"$(SRCROOT)/../../../../external/chipmunk/include/chipmunk",
"$(SRCROOT)/../../../../scripting/javascript/spidermonkey-ios/include",
"$(SRCROOT)/../../../../scripting/javascript/bindings",
@ -1161,9 +1161,9 @@
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"$(SRCROOT)/../../../../cocos2dx/include",
"$(SRCROOT)/../../../../cocos2dx/platform/ios",
"$(SRCROOT)/../../../../extensions",
"$(SRCROOT)/../../../../external/chipmunk/include/chipmunk",
"$(SRCROOT)/../../../../scripting/javascript/spidermonkey-ios/include",
"$(SRCROOT)/../../../../scripting/javascript/bindings",

View File

@ -47,13 +47,6 @@
15A3D2DE1682EF08002FB0C5 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 15A3D0C71682EDB7002FB0C5 /* libcocos2dx.a */; };
15A3D2E41682EF31002FB0C5 /* main.js in Resources */ = {isa = PBXBuildFile; fileRef = 15A3D2D81682EEEA002FB0C5 /* main.js */; };
15A3D2E51682EF31002FB0C5 /* MoonWarriors-jsb.js in Resources */ = {isa = PBXBuildFile; fileRef = 15A3D2D91682EEEA002FB0C5 /* MoonWarriors-jsb.js */; };
1A177EB71698261C00C9AC27 /* jsb_chipmunk.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EB01698261C00C9AC27 /* jsb_chipmunk.js */; };
1A177EB81698261C00C9AC27 /* jsb_cocos2d.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EB11698261C00C9AC27 /* jsb_cocos2d.js */; };
1A177EB91698261C00C9AC27 /* jsb_cocosbuilder.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EB21698261C00C9AC27 /* jsb_cocosbuilder.js */; };
1A177EBA1698261C00C9AC27 /* jsb_debugger.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EB31698261C00C9AC27 /* jsb_debugger.js */; };
1A177EBB1698261C00C9AC27 /* jsb_opengl.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EB41698261C00C9AC27 /* jsb_opengl.js */; };
1A177EBC1698261C00C9AC27 /* jsb_sys.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EB51698261C00C9AC27 /* jsb_sys.js */; };
1A177EBD1698261C00C9AC27 /* jsb.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EB61698261C00C9AC27 /* jsb.js */; };
1A177EBE1698262E00C9AC27 /* jsb_chipmunk.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A177EB01698261C00C9AC27 /* jsb_chipmunk.js */; };
1A177EBF1698262E00C9AC27 /* jsb_cocos2d.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A177EB11698261C00C9AC27 /* jsb_cocos2d.js */; };
1A177EC01698262E00C9AC27 /* jsb_cocosbuilder.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A177EB21698261C00C9AC27 /* jsb_cocosbuilder.js */; };
@ -63,16 +56,12 @@
1A177EC41698262E00C9AC27 /* jsb.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A177EB61698261C00C9AC27 /* jsb.js */; };
1A177ECA1698271700C9AC27 /* js_bindings_system_functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EC61698271700C9AC27 /* js_bindings_system_functions.cpp */; };
1A177ECB1698271700C9AC27 /* js_bindings_system_registration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A177EC81698271700C9AC27 /* js_bindings_system_registration.cpp */; };
1A3F8833170A7FD2000159E1 /* jsb_opengl_constants.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A3F8832170A7FD2000159E1 /* jsb_opengl_constants.js */; };
1A3F8834170A7FDB000159E1 /* jsb_opengl_constants.js in Resources */ = {isa = PBXBuildFile; fileRef = 1A3F8832170A7FD2000159E1 /* jsb_opengl_constants.js */; };
1A82F5E7169AC86100C4B13A /* LocalStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A82F5E4169AC86100C4B13A /* LocalStorage.cpp */; };
1A82F5E8169AC86100C4B13A /* LocalStorageAndroid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A82F5E6169AC86100C4B13A /* LocalStorageAndroid.cpp */; };
1A82F5EA169AC8DD00C4B13A /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A82F5E9169AC8DD00C4B13A /* libsqlite3.dylib */; };
1AA51AD916F71492000FDF05 /* jsb_cocos2d_constants.js in Sources */ = {isa = PBXBuildFile; fileRef = 1AA51AD816F71492000FDF05 /* jsb_cocos2d_constants.js */; };
1AA51ADA16F7149D000FDF05 /* jsb_cocos2d_constants.js in Resources */ = {isa = PBXBuildFile; fileRef = 1AA51AD816F71492000FDF05 /* jsb_cocos2d_constants.js */; };
1AAC795F16EDC7C000B97F83 /* jsb_cocos2dx_auto_api.js in Sources */ = {isa = PBXBuildFile; fileRef = 1AAC795C16EDC7C000B97F83 /* jsb_cocos2dx_auto_api.js */; };
1AAC796016EDC7C000B97F83 /* jsb_cocos2dx_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAC795D16EDC7C000B97F83 /* jsb_cocos2dx_auto.cpp */; };
A9706D8416A0C1FA0090A01D /* main.debug.js in Sources */ = {isa = PBXBuildFile; fileRef = A9706D8316A0C1FA0090A01D /* main.debug.js */; };
A9706D8516A0C3830090A01D /* main.debug.js in Resources */ = {isa = PBXBuildFile; fileRef = A9706D8316A0C1FA0090A01D /* main.debug.js */; };
/* End PBXBuildFile section */
@ -521,22 +510,11 @@
15A3D2D11682EE81002FB0C5 /* js_bindings_core.cpp in Sources */,
15A3D2D21682EE81002FB0C5 /* js_manual_conversions.cpp in Sources */,
15A3D2D31682EE81002FB0C5 /* ScriptingCore.cpp in Sources */,
1A177EB71698261C00C9AC27 /* jsb_chipmunk.js in Sources */,
1A177EB81698261C00C9AC27 /* jsb_cocos2d.js in Sources */,
1A177EB91698261C00C9AC27 /* jsb_cocosbuilder.js in Sources */,
1A177EBA1698261C00C9AC27 /* jsb_debugger.js in Sources */,
1A177EBB1698261C00C9AC27 /* jsb_opengl.js in Sources */,
1A177EBC1698261C00C9AC27 /* jsb_sys.js in Sources */,
1A177EBD1698261C00C9AC27 /* jsb.js in Sources */,
1A177ECA1698271700C9AC27 /* js_bindings_system_functions.cpp in Sources */,
1A177ECB1698271700C9AC27 /* js_bindings_system_registration.cpp in Sources */,
1A82F5E7169AC86100C4B13A /* LocalStorage.cpp in Sources */,
1A82F5E8169AC86100C4B13A /* LocalStorageAndroid.cpp in Sources */,
A9706D8416A0C1FA0090A01D /* main.debug.js in Sources */,
1AAC795F16EDC7C000B97F83 /* jsb_cocos2dx_auto_api.js in Sources */,
1AAC796016EDC7C000B97F83 /* jsb_cocos2dx_auto.cpp in Sources */,
1AA51AD916F71492000FDF05 /* jsb_cocos2d_constants.js in Sources */,
1A3F8833170A7FD2000159E1 /* jsb_opengl_constants.js in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -634,8 +612,8 @@
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../CocosDenshion/include\"",
"\"$(SRCROOT)/usr/include/libxml2\"",
"\"$(SRCROOT)/../../../../cocos2dx/include\"",
"\"$(SRCROOT)/../../../../extensions\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/third_party/ios\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"",
"$(SRCROOT)/../../../../scripting/javascript/spidermonkey-ios/include",
@ -678,8 +656,8 @@
"\"$(SRCROOT)/../../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../../cocos2dx\"",
"\"$(SRCROOT)/../../../../CocosDenshion/include\"",
"\"$(SRCROOT)/usr/include/libxml2\"",
"\"$(SRCROOT)/../../../../cocos2dx/include\"",
"\"$(SRCROOT)/../../../../extensions\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/third_party/ios\"",
"\"$(SRCROOT)/../../../../cocos2dx/platform/ios\"",
"$(SRCROOT)/../../../../scripting/javascript/spidermonkey-ios/include",

@ -1 +1 @@
Subproject commit 53c37689dba36041befbe3bee953383f08505486
Subproject commit 721c3adc5bc3a7d01de39f3d0f50a9cea2c82916

View File

@ -1 +1 @@
ea71fe2a7534446c774678ae4ced20de8fcb5ec8
1478528c3cbe1c3c201a4e9397a7711996131154

View File

@ -1 +1 @@
924cb2abec5c52eca7f76d384e715932da3a023e
8dc22dff7fa76506b4edb4b2b763fd6113a73094

View File

@ -38,17 +38,8 @@ bool AppDelegate::applicationDidFinishLaunching()
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
pEngine->executeString(pstrFileContent->getCString());
}
#else
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
return true;
}

View File

@ -1,10 +1,14 @@
-- cclog
cclog = function(...)
print(string.format(...))
end
-- for CCLuaEngine traceback
function __G__TRACKBACK__(msg)
print("----------------------------------------")
print("LUA ERROR: " .. tostring(msg) .. "\n")
print(debug.traceback())
print("----------------------------------------")
cclog("----------------------------------------")
cclog("LUA ERROR: " .. tostring(msg) .. "\n")
cclog(debug.traceback())
cclog("----------------------------------------")
end
local function main()
@ -12,12 +16,8 @@ local function main()
collectgarbage("setpause", 100)
collectgarbage("setstepmul", 5000)
local cclog = function(...)
print(string.format(...))
end
require "hello2"
cclog("result is " .. myadd(3, 5))
cclog("result is " .. myadd(1, 1))
---------------

View File

@ -551,6 +551,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
USE_FILE32API,
CC_TARGET_OS_IPHONE,
"COCOS2D_DEBUG=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
@ -601,6 +602,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
USE_FILE32API,
CC_TARGET_OS_IPHONE,
"COCOS2D_DEBUG=1",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_TREAT_WARNINGS_AS_ERRORS = NO;

View File

@ -34,17 +34,10 @@ bool AppDelegate::applicationDidFinishLaunching()
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
std::string dirPath = "luaScript";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
CCString* pstrFileContent = CCString::createWithContentsOfFile((dirPath + "/controller.lua").c_str());
if (pstrFileContent)
{
pEngine->executeString(pstrFileContent->getCString());
}
#else
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename((dirPath + "/controller.lua").c_str());
pEngine->addSearchPath(path.substr(0, path.find_last_of("/") - dirPath.length()).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
return true;
}

View File

@ -12,15 +12,6 @@ local testLayer = nil
local titleLabel = nil
local entry = nil
local function onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == "enter" then
entry = scheduler:scheduleScriptFunc(checkAnim, 0, false)
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(entry)
end
end
local function checkAnim(dt)
local s2 = testLayer:getChildByTag(kTagBackground)
if s2 == nil then
@ -34,6 +25,15 @@ local function checkAnim(dt)
end
end
local function onEnterOrExit(tag)
local scheduler = CCDirector:sharedDirector():getScheduler()
if tag == "enter" then
entry = scheduler:scheduleScriptFunc(checkAnim, 0, false)
elseif tag == "exit" then
scheduler:unscheduleScriptEntry(entry)
end
end
local function backAction()
ActionIdx = ActionIdx - 1
if ActionIdx < 0 then

View File

@ -53,7 +53,8 @@ local _allTests = {
{ isSupported = false, name = "DrawPrimitivesTest" , create_func= DrawPrimitivesTest },
{ isSupported = true, name = "NodeTest" , create_func = CocosNodeTest },
{ isSupported = true, name = "TouchesTest" , create_func = TouchesTest },
{ isSupported = true, name = "MenuTest" , create_func = MenuTestMain },
--Many tests in MenuTest will crash, so disable it. Should enable it after all crashes are resolved.
{ isSupported = false, name = "MenuTest" , create_func = MenuTestMain },
{ isSupported = true, name = "ActionManagerTest" , create_func = ActionManagerTestMain },
{ isSupported = true, name = "LayerTest" , create_func = LayerTestMain },
{ isSupported = true, name = "SceneTest" , create_func = SceneTestMain },

View File

@ -1 +1 @@
e31fa2dc525efe1405e5a4e3354ab63f2c1a2844
2df11c451f673012830a4b40578ec2fe9946f768

View File

@ -301,8 +301,8 @@ void registerDefaultClasses(JSContext* cx, JSObject* global) {
JS_DefineFunction(cx, global, "__restartVM", JSB_core_restartVM, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
}
void sc_finalize(JSFreeOp *freeOp, JSObject *obj) {
return;
static void sc_finalize(JSFreeOp *freeOp, JSObject *obj) {
CCLOGINFO("jsbindings: finalizing JS object %p (global class)", obj);
}
static JSClass global_class = {
@ -369,7 +369,7 @@ JSBool ScriptingCore::evalString(const char *string, jsval *outVal, const char *
}
return evaluatedOK;
}
return false;
return JS_FALSE;
}
void ScriptingCore::start() {
@ -396,6 +396,20 @@ void ScriptingCore::removeAllRoots(JSContext *cx) {
HASH_CLEAR(hh, _native_js_global_ht);
}
static JSPrincipals shellTrustedPrincipals = { 1 };
static JSBool
CheckObjectAccess(JSContext *cx, js::HandleObject obj, js::HandleId id, JSAccessMode mode,
js::MutableHandleValue vp)
{
return JS_TRUE;
}
static JSSecurityCallbacks securityCallbacks = {
CheckObjectAccess,
NULL
};
void ScriptingCore::createGlobalContext() {
if (this->cx_ && this->rt_) {
ScriptingCore::removeAllRoots(this->cx_);
@ -404,9 +418,16 @@ void ScriptingCore::createGlobalContext() {
this->cx_ = NULL;
this->rt_ = NULL;
}
// Removed from Spidermonkey 19.
//JS_SetCStringsAreUTF8();
this->rt_ = JS_NewRuntime(10 * 1024 * 1024, JS_NO_HELPER_THREADS);
this->cx_ = JS_NewContext(rt_, 10240);
this->rt_ = JS_NewRuntime(8L * 1024L * 1024L, JS_USE_HELPER_THREADS);
JS_SetGCParameter(rt_, JSGC_MAX_BYTES, 0xffffffff);
JS_SetTrustedPrincipals(rt_, &shellTrustedPrincipals);
JS_SetSecurityCallbacks(rt_, &securityCallbacks);
JS_SetNativeStackQuota(rt_, JSB_MAX_STACK_QUOTA);
this->cx_ = JS_NewContext(rt_, 8192);
JS_SetOptions(this->cx_, JSOPTION_TYPE_INFERENCE);
JS_SetVersion(this->cx_, JSVERSION_LATEST);
JS_SetOptions(this->cx_, JS_GetOptions(this->cx_) & ~JSOPTION_METHODJIT);
@ -608,6 +629,7 @@ JSBool ScriptingCore::dumpRoot(JSContext *cx, uint32_t argc, jsval *vp)
// JSContext *_cx = ScriptingCore::getInstance()->getGlobalContext();
// JSRuntime *rt = JS_GetRuntime(_cx);
// JS_DumpNamedRoots(rt, dumpNamedRoot, NULL);
// JS_DumpHeap(rt, stdout, NULL, JSTRACE_OBJECT, NULL, 2, NULL);
#endif
return JS_TRUE;
}

@ -1 +1 @@
Subproject commit 6e3124f76cde92091615793137dbd2a1c451dac5
Subproject commit 07c06b1537159e3f9828039a14ea0a80df05ec7c

View File

@ -161,11 +161,19 @@ JSAutoCompartment ac(cx, obj)
#define JSB_INCLUDE_SYSTEM 1
#endif // JSB_INCLUDE_SYSTEM
/** @def JSB_INCLUDE_OPENGL
Whether or not it should include bindings for WebGL / OpenGL ES 2.0
*/
#ifndef JSB_INCLUDE_OPENGL
#define JSB_INCLUDE_OPENGL 1
/** @def JSB_INCLUDE_OPENGL
Whether or not it should include bindings for WebGL / OpenGL ES 2.0
*/
#ifndef JSB_INCLUDE_OPENGL
#define JSB_INCLUDE_OPENGL 1
#endif // JSB_INCLUDE_OPENGL
#ifndef JSB_MAX_STACK_QUOTA
#ifdef DEBUG
#define JSB_MAX_STACK_QUOTA 5000000
#else
#define JSB_MAX_STACK_QUOTA 500000
#endif
#endif // JSB_MAX_STACK_QUOTA
#endif // __JS_BINDINGS_CONFIG_H

View File

@ -76,17 +76,23 @@ void CCLuaEngine::removeScriptHandler(int nHandler)
int CCLuaEngine::executeString(const char *codes)
{
return m_stack->executeString(codes);
int ret = m_stack->executeString(codes);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeScriptFile(const char* filename)
{
return m_stack->executeScriptFile(filename);
int ret = m_stack->executeScriptFile(filename);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeGlobalFunction(const char* functionName)
{
return m_stack->executeGlobalFunction(functionName);
int ret = m_stack->executeGlobalFunction(functionName);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeNodeEvent(CCNode* pNode, int nAction)
@ -112,10 +118,16 @@ int CCLuaEngine::executeNodeEvent(CCNode* pNode, int nAction)
m_stack->pushString("exitTransitionStart");
break;
case kCCNodeOnCleanup:
m_stack->pushString("cleanup");
break;
default:
return 0;
}
return m_stack->executeFunctionByHandler(nHandler, 1);
int ret = m_stack->executeFunctionByHandler(nHandler, 1);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeMenuItemEvent(CCMenuItem* pMenuItem)
@ -125,7 +137,9 @@ int CCLuaEngine::executeMenuItemEvent(CCMenuItem* pMenuItem)
m_stack->pushInt(pMenuItem->getTag());
m_stack->pushCCObject(pMenuItem, "CCMenuItem");
return m_stack->executeFunctionByHandler(nHandler, 2);
int ret = m_stack->executeFunctionByHandler(nHandler, 2);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeNotificationEvent(CCNotificationCenter* pNotificationCenter, const char* pszName)
@ -134,7 +148,9 @@ int CCLuaEngine::executeNotificationEvent(CCNotificationCenter* pNotificationCen
if (!nHandler) return 0;
m_stack->pushString(pszName);
return m_stack->executeFunctionByHandler(nHandler, 1);
int ret = m_stack->executeFunctionByHandler(nHandler, 1);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeCallFuncActionEvent(CCCallFunc* pAction, CCObject* pTarget/* = NULL*/)
@ -146,21 +162,24 @@ int CCLuaEngine::executeCallFuncActionEvent(CCCallFunc* pAction, CCObject* pTarg
{
m_stack->pushCCObject(pTarget, "CCNode");
}
return m_stack->executeFunctionByHandler(nHandler, pTarget ? 1 : 0);
int ret = m_stack->executeFunctionByHandler(nHandler, pTarget ? 1 : 0);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeSchedule(int nHandler, float dt, CCNode* pNode/* = NULL*/)
{
if (!nHandler) return 0;
m_stack->pushFloat(dt);
return m_stack->executeFunctionByHandler(nHandler, 1);
int ret = m_stack->executeFunctionByHandler(nHandler, 1);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch *pTouch)
{
CCTouchScriptHandlerEntry* pScriptHandlerEntry = pLayer->getScriptTouchHandlerEntry();
if (!pScriptHandlerEntry)
return 0;
if (!pScriptHandlerEntry) return 0;
int nHandler = pScriptHandlerEntry->getHandler();
if (!nHandler) return 0;
@ -189,14 +208,15 @@ int CCLuaEngine::executeLayerTouchEvent(CCLayer* pLayer, int eventType, CCTouch
const CCPoint pt = CCDirector::sharedDirector()->convertToGL(pTouch->getLocationInView());
m_stack->pushFloat(pt.x);
m_stack->pushFloat(pt.y);
return m_stack->executeFunctionByHandler(nHandler, 3);
int ret = m_stack->executeFunctionByHandler(nHandler, 3);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CCSet *pTouches)
{
CCTouchScriptHandlerEntry* pScriptHandlerEntry = pLayer->getScriptTouchHandlerEntry();
if (!pScriptHandlerEntry)
return 0;
if (!pScriptHandlerEntry) return 0;
int nHandler = pScriptHandlerEntry->getHandler();
if (!nHandler) return 0;
@ -234,8 +254,12 @@ int CCLuaEngine::executeLayerTouchesEvent(CCLayer* pLayer, int eventType, CCSet
lua_rawseti(L, -2, i++);
lua_pushnumber(L, pt.y);
lua_rawseti(L, -2, i++);
lua_pushinteger(L, pTouch->getID());
lua_rawseti(L, -2, i++);
}
return m_stack->executeFunctionByHandler(nHandler, 2);
int ret = m_stack->executeFunctionByHandler(nHandler, 2);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeLayerKeypadEvent(CCLayer* pLayer, int eventType)
@ -259,7 +283,9 @@ int CCLuaEngine::executeLayerKeypadEvent(CCLayer* pLayer, int eventType)
default:
return 0;
}
return m_stack->executeFunctionByHandler(nHandler, 1);
int ret = m_stack->executeFunctionByHandler(nHandler, 1);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeAccelerometerEvent(CCLayer* pLayer, CCAcceleration* pAccelerationValue)
@ -274,7 +300,9 @@ int CCLuaEngine::executeAccelerometerEvent(CCLayer* pLayer, CCAcceleration* pAcc
m_stack->pushFloat(pAccelerationValue->y);
m_stack->pushFloat(pAccelerationValue->z);
m_stack->pushFloat(pAccelerationValue->timestamp);
return m_stack->executeFunctionByHandler(nHandler, 4);
int ret = m_stack->executeFunctionByHandler(nHandler, 4);
m_stack->clean();
return ret;
}
int CCLuaEngine::executeEvent(int nHandler, const char* pEventName, CCObject* pEventSource /* = NULL*/, const char* pEventSourceClassName /* = NULL*/)
@ -284,12 +312,16 @@ int CCLuaEngine::executeEvent(int nHandler, const char* pEventName, CCObject* pE
{
m_stack->pushCCObject(pEventSource, pEventSourceClassName ? pEventSourceClassName : "CCObject");
}
return m_stack->executeFunctionByHandler(nHandler, pEventSource ? 2 : 1);
int ret = m_stack->executeFunctionByHandler(nHandler, pEventSource ? 2 : 1);
m_stack->clean();
return ret;
}
bool CCLuaEngine::executeAssert(bool cond, const char *msg/* = NULL */)
{
return m_stack->executeAssert(cond, msg);
bool ret = m_stack->executeAssert(cond, msg);
m_stack->clean();
return ret;
}
NS_CC_END

View File

@ -41,7 +41,7 @@ extern "C" {
NS_CC_BEGIN
// Lua support for cocos2d-x
class CCLuaEngine : public CCScriptEngineProtocol
class CC_DLL CCLuaEngine : public CCScriptEngineProtocol
{
public:
static CCLuaEngine* defaultEngine(void);

View File

@ -33,11 +33,10 @@ extern "C" {
}
#include "LuaCocos2d.h"
#include "Cocos2dxLuaLoader.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#include "platform/ios/CCLuaObjcBridge.h"
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "Cocos2dxLuaLoader.h"
#endif
namespace {
@ -118,9 +117,11 @@ bool CCLuaStack::init(void)
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
CCLuaObjcBridge::luaopen_luaoc(m_state);
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
addLuaLoader(loader_Android);
#endif
// add cocos2dx loader
addLuaLoader(cocos2dx_lua_loader);
return true;
}
@ -135,10 +136,9 @@ void CCLuaStack::addSearchPath(const char* path)
lua_getglobal(m_state, "package"); /* L: package */
lua_getfield(m_state, -1, "path"); /* get package.path, L: package path */
const char* cur_path = lua_tostring(m_state, -1);
lua_pop(m_state, 1); /* L: package */
lua_pushfstring(m_state, "%s;%s/?.lua", cur_path, path); /* L: package newpath */
lua_setfield(m_state, -2, "path"); /* package.path = newpath, L: package */
lua_pop(m_state, 1); /* L: - */
lua_pushfstring(m_state, "%s;%s/?.lua", cur_path, path); /* L: package path newpath */
lua_setfield(m_state, -3, "path"); /* package.path = newpath, L: package path */
lua_pop(m_state, 2); /* L: - */
}
void CCLuaStack::addLuaLoader(lua_CFunction func)
@ -179,23 +179,18 @@ void CCLuaStack::removeScriptHandler(int nHandler)
int CCLuaStack::executeString(const char *codes)
{
++m_callFromLua;
int nRet = luaL_dostring(m_state, codes);
--m_callFromLua;
CC_ASSERT(m_callFromLua >= 0);
lua_gc(m_state, LUA_GCCOLLECT, 0);
if (nRet != 0)
{
CCLOG("[LUA ERROR] %s", lua_tostring(m_state, -1));
lua_pop(m_state, 1);
return nRet;
}
return 0;
luaL_loadstring(m_state, codes);
return executeFunction(0);
}
int CCLuaStack::executeScriptFile(const char* filename)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
std::string code("require \"");
code.append(filename);
code.append("\"");
return executeString(code.c_str());
#else
++m_callFromLua;
int nRet = luaL_dofile(m_state, filename);
--m_callFromLua;
@ -209,6 +204,7 @@ int CCLuaStack::executeScriptFile(const char* filename)
return nRet;
}
return 0;
#endif
}
int CCLuaStack::executeGlobalFunction(const char* functionName)
@ -220,30 +216,7 @@ int CCLuaStack::executeGlobalFunction(const char* functionName)
lua_pop(m_state, 1);
return 0;
}
++m_callFromLua;
int error = lua_pcall(m_state, 0, 1, 0); /* call function, stack: ret */
--m_callFromLua;
CC_ASSERT(m_callFromLua >= 0);
// lua_gc(m_state, LUA_GCCOLLECT, 0);
if (error)
{
CCLOG("[LUA ERROR] %s", lua_tostring(m_state, - 1));
lua_pop(m_state, 1); // clean error message
return 0;
}
// get return value
if (!lua_isnumber(m_state, -1))
{
lua_pop(m_state, 1);
return 0;
}
int ret = lua_tointeger(m_state, -1);
lua_pop(m_state, 1); /* stack: - */
return ret;
return executeFunction(0);
}
void CCLuaStack::clean(void)
@ -360,6 +333,7 @@ int CCLuaStack::executeFunction(int numArgs)
if (!lua_isfunction(m_state, functionIndex))
{
CCLOG("value at stack [%d] is not function", functionIndex);
lua_pop(m_state, numArgs + 1); // remove function and arguments
return 0;
}
@ -377,7 +351,7 @@ int CCLuaStack::executeFunction(int numArgs)
int error = 0;
++m_callFromLua;
error = lua_pcall(m_state, numArgs, 1, traceback); /* L: ... ret */
error = lua_pcall(m_state, numArgs, 1, traceback); /* L: ... [G] ret */
--m_callFromLua;
if (error)
{
@ -386,6 +360,10 @@ int CCLuaStack::executeFunction(int numArgs)
CCLOG("[LUA ERROR] %s", lua_tostring(m_state, - 1)); /* L: ... error */
lua_pop(m_state, 1); // remove error message from stack
}
else /* L: ... G error */
{
lua_pop(m_state, 2); // remove __G__TRACKBACK__ and error message from stack
}
return 0;
}
@ -399,23 +377,30 @@ int CCLuaStack::executeFunction(int numArgs)
{
ret = lua_toboolean(m_state, -1);
}
lua_pop(m_state, 1); // remove return value from stack
// remove return value from stack
lua_pop(m_state, 1); /* L: ... [G] */
if (traceback)
{
lua_pop(m_state, 1); // remove __G__TRACKBACK__ from stack /* L: ... */
}
return ret;
}
int CCLuaStack::executeFunctionByHandler(int nHandler, int numArgs)
{
int ret = 0;
if (pushFunctionByHandler(nHandler)) /* L: ... arg1 arg2 ... func */
{
if (numArgs > 0)
{
lua_insert(m_state, -(numArgs + 1)); /* L: ... func arg1 arg2 ... */
}
return executeFunction(numArgs);
ret = executeFunction(numArgs);
}
lua_pop(m_state, numArgs); // remove args from stack
return 0;
lua_settop(m_state, 0);
return ret;
}
bool CCLuaStack::executeAssert(bool cond, const char *msg)

View File

@ -35,7 +35,7 @@ extern "C" {
NS_CC_BEGIN
class CCLuaStack : public CCObject
class CC_DLL CCLuaStack : public CCObject
{
public:
static CCLuaStack *create(void);

View File

@ -69,7 +69,7 @@ typedef union {
CCObject* ccobjectValue;
} CCLuaValueField;
class CCLuaValue
class CC_DLL CCLuaValue
{
public:
static const CCLuaValue intValue(const int intValue);

View File

@ -23,31 +23,46 @@ THE SOFTWARE.
****************************************************************************/
#include "Cocos2dxLuaLoader.h"
#include <string>
#include <algorithm>
using namespace cocos2d;
extern "C"
{
int loader_Android(lua_State *L)
int cocos2dx_lua_loader(lua_State *L)
{
std::string filename(luaL_checkstring(L, 1));
filename.append(".lua");
CCString* pFileContent = CCString::createWithContentsOfFile(filename.c_str());
if (pFileContent)
size_t pos = filename.rfind(".lua");
if (pos != std::string::npos)
{
if (luaL_loadstring(L, pFileContent->getCString()) != 0)
filename = filename.substr(0, pos);
}
pos = filename.find_first_of(".");
while (pos != std::string::npos)
{
filename.replace(pos, 1, "/");
pos = filename.find_first_of(".");
}
filename.append(".lua");
unsigned long codeBufferSize = 0;
unsigned char* codeBuffer = CCFileUtils::sharedFileUtils()->getFileData(filename.c_str(), "rb", &codeBufferSize);
if (codeBuffer)
{
if (luaL_loadbuffer(L, (char*)codeBuffer, codeBufferSize, filename.c_str()) != 0)
{
luaL_error(L, "error loading module %s from file %s :\n\t%s",
lua_tostring(L, 1), filename.c_str(), lua_tostring(L, -1));
}
delete []codeBuffer;
}
else
{
CCLog("can not get file data of %s", filename.c_str());
}
return 1;
}
}
}

View File

@ -32,7 +32,7 @@ extern "C"
#include "lualib.h"
#include "lauxlib.h"
extern int loader_Android(lua_State *L);
extern int cocos2dx_lua_loader(lua_State *L);
}
#endif // __COCOS2DX_LUA_LOADER_H__

View File

@ -42,17 +42,9 @@ bool AppDelegate::applicationDidFinishLaunching()
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
pEngine->executeString(pstrFileContent->getCString());
}
#else
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
[! else]
// create a scene. it's an autorelease object
CCScene *pScene = HelloWorld::scene();

View File

@ -5,8 +5,8 @@ TXTCOLOR_RED="\033[0;31m"
TXTCOLOR_GREEN="\033[0;32m"
COCOS2DX20_TRUNK=`pwd`/../../..
OUTPUT_DEBUG=$COCOS2DX20_TRUNK/lib/linux/Debug/
OUTPUT_RELEASE=$COCOS2DX20_TRUNK/lib/linux/Release/
OUTPUT_DEBUG=$COCOS2DX20_TRUNK/lib/linux/debug/
OUTPUT_RELEASE=$COCOS2DX20_TRUNK/lib/linux/release/
check_make_result()
{
@ -40,25 +40,20 @@ done
mkdir -p $OUTPUT_DEBUG
mkdir -p $OUTPUT_RELEASE
make -C $COCOS2DX20_TRUNK/external/Box2D/proj.linux debug
make -C $COCOS2DX20_TRUNK/external/Box2D/proj.linux DEBUG=1
check_make_result
cp $COCOS2DX20_TRUNK/external/Box2D/proj.linux/libbox2d.a $OUTPUT_DEBUG
make -C $COCOS2DX20_TRUNK/external/chipmunk/proj.linux debug
make -C $COCOS2DX20_TRUNK/external/chipmunk/proj.linux DEBUG=1
check_make_result
cp $COCOS2DX20_TRUNK/external/chipmunk/proj.linux/libchipmunk.a $OUTPUT_DEBUG
make -C $COCOS2DX20_TRUNK/cocos2dx/proj.linux debug
make -C $COCOS2DX20_TRUNK/cocos2dx/proj.linux DEBUG=1
check_make_result
cp $COCOS2DX20_TRUNK/cocos2dx/proj.linux/libcocos2d.so $OUTPUT_DEBUG
make -C $COCOS2DX20_TRUNK/CocosDenshion/proj.linux debug
make -C $COCOS2DX20_TRUNK/CocosDenshion/proj.linux DEBUG=1
check_make_result
cp $COCOS2DX20_TRUNK/CocosDenshion/proj.linux/libcocosdenshion.so $OUTPUT_DEBUG
make -C $COCOS2DX20_TRUNK/extensions/proj.linux debug
make -C $COCOS2DX20_TRUNK/extensions/proj.linux DEBUG=1
check_make_result
cp $COCOS2DX20_TRUNK/extensions/proj.linux/libextension.a $OUTPUT_DEBUG
make
make DEBUG=1
check_make_result

View File

@ -33,17 +33,8 @@ bool AppDelegate::applicationDidFinishLaunching()
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
pEngine->executeString(pstrFileContent->getCString());
}
#else
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
return true;
}

View File

@ -36,17 +36,8 @@ bool AppDelegate::applicationDidFinishLaunching()
CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
pEngine->executeString(pstrFileContent->getCString());
}
#else
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
return true;
}

@ -1 +1 @@
Subproject commit 1a84b5e4529b9c37f245953afff8251db7eb9727
Subproject commit f330d3017cc6ee518425159e79c41928851c3e23

View File

@ -37,17 +37,9 @@ bool AppDelegate::applicationDidFinishLaunching()
CCScriptEngineProtocol* pEngine = CCLuaEngine::engine();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
if (pstrFileContent)
{
pEngine->executeString(pstrFileContent->getCString());
}
#else
std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
pEngine->executeScriptFile(path.c_str());
#endif
return true;
}

View File

@ -26,7 +26,7 @@ headers = %(cocosdir)s/cocos2dx/include/cocos2d.h %(cocosdir)s/CocosDenshion/inc
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
classes = CCSprite.* CCScene CCNode.* CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCPointArray CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCCardinal.* CCCatmullRom.* CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCGridBase$ CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit.* CCFollow.* CCBezier.* CCCardinalSpline.* CCCamera.* CCDrawNode CC.*3D$ CCLiquid$ CCWaves$ CCShuffleTiles$ CCTurnOffTiles$ CCSplit.* CCTwirl$ CCFileUtils$ CCGLProgram CCShaderCache CCApplication
classes = CCSprite.* CCScene CCNode.* CCDirector CCLayer.* CCMenu.* CCTouch CC.*Action.* CCMove.* CCRotate.* CCBlink.* CCTint.* CCSequence CCRepeat.* CCFade.* CCEase.* CCScale.* CCTransition.* CCSpawn CCAnimat.* CCFlip.* CCDelay.* CCSkew.* CCJump.* CCPlace.* CCShow.* CCProgress.* CCPointArray CCToggleVisibility.* CCHide CCParticle.* CCLabel.* CCAtlas.* CCTextureCache.* CCTexture2D CCCardinal.* CCCatmullRom.* CCParallaxNode CCTileMap.* CCTMX.* CCCallFunc CCRenderTexture CCGridAction CCGrid3DAction CCGridBase$ CC.+Grid CCShaky3D CCWaves3D CCFlipX3D CCFlipY3D CCSpeed CCActionManager CCSet SimpleAudioEngine CCScheduler CCTimer CCOrbit.* CCFollow.* CCBezier.* CCCardinalSpline.* CCCamera.* CCDrawNode CC.*3D$ CCLiquid$ CCWaves$ CCShuffleTiles$ CCTurnOffTiles$ CCSplit.* CCTwirl$ CCFileUtils$ CCGLProgram CCShaderCache CCApplication
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also