mirror of https://github.com/axmolengine/axmol.git
Merge pull request #2172 from dumganhar/master
Updating VS2012 solution, CystalCraze project depends on libJSBinding and libExtensions.
This commit is contained in:
commit
2fbd09fe27
|
@ -87,6 +87,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBinding", "scripting\j
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CrystalCraze", "samples\Javascript\CrystalCraze\proj.win32\CrystalCraze.vcxproj", "{9A17D9A4-4B11-4E32-94F6-895FF4909EC5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
|
||||
{39379840-825A-45A0-B363-C09FFEF864BD} = {39379840-825A-45A0-B363-C09FFEF864BD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AssetsManagerTest", "samples\Cpp\AssetsManagerTest\proj.win32\AssetsManagerTest.vcxproj", "{6D37505F-A890-441D-BD3F-A61E2C0469CE}"
|
||||
EndProject
|
||||
|
|
|
@ -1282,45 +1282,46 @@ JSBool jsval_to_ccarray(JSContext* cx, jsval v, CCArray** ret) {
|
|||
jsval ccarray_to_jsval(JSContext* cx, CCArray *arr)
|
||||
{
|
||||
JSObject *jsretArr = JS_NewArrayObject(cx, 0, NULL);
|
||||
if (arr && arr->count() > 0) {
|
||||
for(unsigned int i = 0; i < arr->count(); ++i) {
|
||||
jsval arrElement;
|
||||
CCObject *obj = arr->objectAtIndex(i);
|
||||
|
||||
for(unsigned int i = 0; i < arr->count(); ++i) {
|
||||
jsval arrElement;
|
||||
CCObject *obj = arr->objectAtIndex(i);
|
||||
|
||||
//First, check whether object is associated with js object.
|
||||
js_proxy_t* jsproxy = js_get_or_create_proxy<cocos2d::CCObject>(cx, obj);
|
||||
if (jsproxy) {
|
||||
arrElement = OBJECT_TO_JSVAL(jsproxy->obj);
|
||||
}
|
||||
else {
|
||||
CCString* strVal = NULL;
|
||||
CCDictionary* dictVal = NULL;
|
||||
CCArray* arrVal = NULL;
|
||||
CCDouble* doubleVal = NULL;
|
||||
CCBool* boolVal = NULL;
|
||||
CCFloat* floatVal = NULL;
|
||||
CCInteger* intVal = NULL;
|
||||
|
||||
if((strVal = dynamic_cast<cocos2d::CCString *>(obj))) {
|
||||
arrElement = c_string_to_jsval(cx, strVal->getCString());
|
||||
} else if ((dictVal = dynamic_cast<cocos2d::CCDictionary*>(obj))) {
|
||||
arrElement = ccdictionary_to_jsval(cx, dictVal);
|
||||
} else if ((arrVal = dynamic_cast<cocos2d::CCArray*>(obj))) {
|
||||
arrElement = ccarray_to_jsval(cx, arrVal);
|
||||
} else if ((doubleVal = dynamic_cast<CCDouble*>(obj))) {
|
||||
arrElement = DOUBLE_TO_JSVAL(doubleVal->getValue());
|
||||
} else if ((floatVal = dynamic_cast<CCFloat*>(obj))) {
|
||||
arrElement = DOUBLE_TO_JSVAL(floatVal->getValue());
|
||||
} else if ((intVal = dynamic_cast<CCInteger*>(obj))) {
|
||||
arrElement = INT_TO_JSVAL(intVal->getValue());
|
||||
} else if ((boolVal = dynamic_cast<CCBool*>(obj))) {
|
||||
arrElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE);
|
||||
} else {
|
||||
CCAssert(false, "the type isn't suppored.");
|
||||
//First, check whether object is associated with js object.
|
||||
js_proxy_t* jsproxy = js_get_or_create_proxy<cocos2d::CCObject>(cx, obj);
|
||||
if (jsproxy) {
|
||||
arrElement = OBJECT_TO_JSVAL(jsproxy->obj);
|
||||
}
|
||||
else {
|
||||
CCString* strVal = NULL;
|
||||
CCDictionary* dictVal = NULL;
|
||||
CCArray* arrVal = NULL;
|
||||
CCDouble* doubleVal = NULL;
|
||||
CCBool* boolVal = NULL;
|
||||
CCFloat* floatVal = NULL;
|
||||
CCInteger* intVal = NULL;
|
||||
|
||||
if((strVal = dynamic_cast<cocos2d::CCString *>(obj))) {
|
||||
arrElement = c_string_to_jsval(cx, strVal->getCString());
|
||||
} else if ((dictVal = dynamic_cast<cocos2d::CCDictionary*>(obj))) {
|
||||
arrElement = ccdictionary_to_jsval(cx, dictVal);
|
||||
} else if ((arrVal = dynamic_cast<cocos2d::CCArray*>(obj))) {
|
||||
arrElement = ccarray_to_jsval(cx, arrVal);
|
||||
} else if ((doubleVal = dynamic_cast<CCDouble*>(obj))) {
|
||||
arrElement = DOUBLE_TO_JSVAL(doubleVal->getValue());
|
||||
} else if ((floatVal = dynamic_cast<CCFloat*>(obj))) {
|
||||
arrElement = DOUBLE_TO_JSVAL(floatVal->getValue());
|
||||
} else if ((intVal = dynamic_cast<CCInteger*>(obj))) {
|
||||
arrElement = INT_TO_JSVAL(intVal->getValue());
|
||||
} else if ((boolVal = dynamic_cast<CCBool*>(obj))) {
|
||||
arrElement = BOOLEAN_TO_JSVAL(boolVal->getValue() ? JS_TRUE : JS_FALSE);
|
||||
} else {
|
||||
CCAssert(false, "the type isn't suppored.");
|
||||
}
|
||||
}
|
||||
if(!JS_SetElement(cx, jsretArr, i, &arrElement)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!JS_SetElement(cx, jsretArr, i, &arrElement)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OBJECT_TO_JSVAL(jsretArr);
|
||||
|
|
Loading…
Reference in New Issue