Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_hot_fix

This commit is contained in:
samuele3hu 2014-07-02 14:29:33 +08:00
commit 1271c1b62e
27 changed files with 138 additions and 117 deletions

View File

@ -1,4 +1,4 @@
cocos2d-x-3.2 ???
cocos2d-x-3.2beta0 Jul.2 2014
[NEW] FastTMXTiledMap: added fast tmx, which is much more faster for static tiled map
[NEW] GLProgramState: can use uniform location to get/set uniform values
[NEW] HttpClient: added sendImmediate()

View File

@ -111,10 +111,10 @@ cocos2d::Node* SceneReader::createNodeWithSceneFile(const std::string &fileName,
{
continue;
}
std::string key = subDict[1].GetName(&tCocoLoader);
std::string key1 = subDict[1].GetName(&tCocoLoader);
const char *comName = subDict[1].GetValue();
Component *pCom = nullptr;
if (key == "classname" && comName != nullptr)
if (key1 == "classname" && comName != nullptr)
{
pCom = createComponent(comName);
}
@ -375,10 +375,10 @@ cocos2d::Node* SceneReader::createObject(CocoLoader *cocoLoader, stExpCocoNode *
{
continue;
}
std::string key = subDict[1].GetName(cocoLoader);
const char *comName = subDict[1].GetValue();//DICTOOL->getStringValue_json(subDict, "classname");
std::string key1 = subDict[1].GetName(cocoLoader);
const char *comName = subDict[1].GetValue();
Component *pCom = nullptr;
if (key == "classname" && comName != nullptr)
if (key1 == "classname" && comName != nullptr)
{
pCom = createComponent(comName);
}

View File

@ -199,79 +199,78 @@ bool TriggerMng::isEmpty(void) const
int size = 0;
int extent = 0;
int border = 0;
std::string key;
std::string key0;
stExpCocoNode *pTriggersArray = pCocoNode[13].GetChildArray();
document.SetArray();
rapidjson::Document::AllocatorType& allocator = document.GetAllocator();
for (int i = 0; i < count; ++i)
for (int i0 = 0; i0 < count; ++i0)
{
rapidjson::Value vElemItem(rapidjson::kObjectType);
border = pTriggersArray[i].GetChildNum();
stExpCocoNode *pTriggerArray = pTriggersArray[i].GetChildArray();
for (int i = 0; i < border; ++i)
border = pTriggersArray[i0].GetChildNum();
stExpCocoNode *pTriggerArray = pTriggersArray[i0].GetChildArray();
for (int i1 = 0; i1 < border; ++i1)
{
std::string key = pTriggerArray[i].GetName(pCocoLoader);
const char *str = pTriggerArray[i].GetValue();
rapidjson::Type type = pTriggerArray[i].GetType(pCocoLoader);
std::string key1 = pTriggerArray[i1].GetName(pCocoLoader);
const char *str1 = pTriggerArray[i1].GetValue();
if (key.compare("actions") == 0)
if (key1.compare("actions") == 0)
{
rapidjson::Value actionsItem(rapidjson::kArrayType);
length = pTriggerArray[i].GetChildNum();
stExpCocoNode *pActionsArray = pTriggerArray[i].GetChildArray();
for (int i = 0; i < length; ++i)
length = pTriggerArray[i1].GetChildNum();
stExpCocoNode *pActionsArray = pTriggerArray[i1].GetChildArray();
for (int i2 = 0; i2 < length; ++i2)
{
rapidjson::Value action(rapidjson::kObjectType);
num = pActionsArray[i].GetChildNum();
stExpCocoNode *pActionArray = pActionsArray[i].GetChildArray();
for (int i = 0; i < num; ++i)
num = pActionsArray[i2].GetChildNum();
stExpCocoNode *pActionArray = pActionsArray[i2].GetChildArray();
for (int i3 = 0; i3 < num; ++i3)
{
std::string key = pActionArray[i].GetName(pCocoLoader);
const char *str = pActionArray[i].GetValue();
if (key.compare("classname") == 0)
std::string key2 = pActionArray[i3].GetName(pCocoLoader);
const char *str2 = pActionArray[i3].GetValue();
if (key2.compare("classname") == 0)
{
if (str != NULL)
if (str2 != NULL)
{
action.AddMember("classname", str, allocator);
action.AddMember("classname", str2, allocator);
}
}
else if (key.compare("dataitems") == 0)
else if (key2.compare("dataitems") == 0)
{
rapidjson::Value dataitems(rapidjson::kArrayType);
size = pActionArray[i].GetChildNum();
stExpCocoNode *pDataItemsArray = pActionArray[i].GetChildArray();
for (int i = 0; i < size; ++i)
size = pActionArray[i3].GetChildNum();
stExpCocoNode *pDataItemsArray = pActionArray[i3].GetChildArray();
for (int i4 = 0; i4 < size; ++i4)
{
rapidjson::Value dataitem(rapidjson::kObjectType);
extent = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
for (int i = 0; i < extent; ++i)
extent = pDataItemsArray[i4].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i4].GetChildArray();
for (int i5 = 0; i5 < extent; ++i5)
{
std::string key = pDataItemArray[i].GetName(pCocoLoader);
const char *str = pDataItemArray[i].GetValue();
if (key.compare("key") == 0)
std::string key3 = pDataItemArray[i5].GetName(pCocoLoader);
const char *str3 = pDataItemArray[i5].GetValue();
if (key3.compare("key") == 0)
{
if (str != NULL)
if (str3 != NULL)
{
dataitem.AddMember("key", str, allocator);
dataitem.AddMember("key", str3, allocator);
}
}
else
{
rapidjson::Type type = pDataItemArray[i].GetType(pCocoLoader);
rapidjson::Type type = pDataItemArray[i4].GetType(pCocoLoader);
if (type == rapidjson::kStringType)
{
dataitem.AddMember("value", str, allocator);
dataitem.AddMember("value", str3, allocator);
}
else if(type == rapidjson::kNumberType)
{
int nV = atoi(str);
float fV = atof(str);
int nV = atoi(str3);
float fV = atof(str3);
if (fabs(nV - fV) < 0.0000001)
{
dataitem.AddMember("value", nV, allocator);
@ -293,61 +292,61 @@ bool TriggerMng::isEmpty(void) const
vElemItem.AddMember("actions", actionsItem, allocator);
}
else if (key.compare("conditions") == 0)
else if (key1.compare("conditions") == 0)
{
rapidjson::Value condsItem(rapidjson::kArrayType);
length = pTriggerArray[i].GetChildNum();
stExpCocoNode *pConditionsArray = pTriggerArray[i].GetChildArray();
for (int i = 0; i < length; ++i)
length = pTriggerArray[i1].GetChildNum();
stExpCocoNode *pConditionsArray = pTriggerArray[i1].GetChildArray();
for (int i6 = 0; i6 < length; ++i6)
{
rapidjson::Value cond(rapidjson::kObjectType);
num = pConditionsArray[i].GetChildNum();
stExpCocoNode *pConditionArray = pConditionsArray[i].GetChildArray();
for (int i = 0; i < num; ++i)
num = pConditionsArray[i6].GetChildNum();
stExpCocoNode *pConditionArray = pConditionsArray[i6].GetChildArray();
for (int i7 = 0; i7 < num; ++i7)
{
std::string key = pConditionArray[i].GetName(pCocoLoader);
const char *str = pConditionArray[i].GetValue();
if (key.compare("classname") == 0)
std::string key4 = pConditionArray[i7].GetName(pCocoLoader);
const char *str4 = pConditionArray[i7].GetValue();
if (key4.compare("classname") == 0)
{
if (str != NULL)
if (str4 != NULL)
{
cond.AddMember("classname", str, allocator);
cond.AddMember("classname", str4, allocator);
}
}
else if (key.compare("dataitems") == 0)
else if (key4.compare("dataitems") == 0)
{
rapidjson::Value dataitems(rapidjson::kArrayType);
size = pConditionArray[i].GetChildNum();
stExpCocoNode *pDataItemsArray = pConditionArray[i].GetChildArray();
for (int i = 0; i < size; ++i)
size = pConditionArray[i7].GetChildNum();
stExpCocoNode *pDataItemsArray = pConditionArray[i7].GetChildArray();
for (int i8 = 0; i8 < size; ++i8)
{
rapidjson::Value dataitem(rapidjson::kObjectType);
extent = pDataItemsArray[i].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i].GetChildArray();
for (int i = 0; i < extent; ++i)
extent = pDataItemsArray[i8].GetChildNum();
stExpCocoNode *pDataItemArray = pDataItemsArray[i8].GetChildArray();
for (int i9 = 0; i9 < extent; ++i9)
{
std::string key = pDataItemArray[i].GetName(pCocoLoader);
const char *str = pDataItemArray[i].GetValue();
if (key.compare("key") == 0)
std::string key5 = pDataItemArray[i9].GetName(pCocoLoader);
const char *str5 = pDataItemArray[i9].GetValue();
if (key5.compare("key") == 0)
{
if (str != NULL)
if (str5 != NULL)
{
dataitem.AddMember("key", str, allocator);
dataitem.AddMember("key", str5, allocator);
}
}
else
{
rapidjson::Type type = pDataItemArray[i].GetType(pCocoLoader);
rapidjson::Type type = pDataItemArray[i9].GetType(pCocoLoader);
if (type == rapidjson::kStringType)
{
dataitem.AddMember("value", str, allocator);
dataitem.AddMember("value", str5, allocator);
}
else if(type == rapidjson::kNumberType)
{
int nV = atoi(str);
float fV = atof(str);
int nV = atoi(str5);
float fV = atof(str5);
if (fabs(nV - fV) < 0.0000001)
{
dataitem.AddMember("value", nV, allocator);
@ -369,31 +368,31 @@ bool TriggerMng::isEmpty(void) const
vElemItem.AddMember("conditions", condsItem, allocator);
}
else if (key.compare("events") == 0)
else if (key1.compare("events") == 0)
{
rapidjson::Value eventsItem(rapidjson::kArrayType);
length = pTriggerArray[i].GetChildNum();
stExpCocoNode *pEventsArray = pTriggerArray[i].GetChildArray();
for (int i = 0; i < length; ++i)
length = pTriggerArray[i1].GetChildNum();
stExpCocoNode *pEventsArray = pTriggerArray[i1].GetChildArray();
for (int i10 = 0; i10 < length; ++i10)
{
rapidjson::Value event(rapidjson::kObjectType);
stExpCocoNode *pEventArray = pEventsArray->GetChildArray();
std::string key = pEventArray[0].GetName(pCocoLoader);
const char *str = pEventArray[0].GetValue();
if (key.compare("id") == 0 && str != NULL)
std::string key6 = pEventArray[0].GetName(pCocoLoader);
const char *str6 = pEventArray[0].GetValue();
if (key6.compare("id") == 0 && str6 != NULL)
{
event.AddMember("id", atoi(str), allocator);
event.AddMember("id", atoi(str6), allocator);
eventsItem.PushBack(event, allocator);
}
}
vElemItem.AddMember("events", eventsItem, allocator);
}
else if (key.compare("id") == 0)
else if (key1.compare("id") == 0)
{
if (str != NULL)
if (str1 != NULL)
{
vElemItem.AddMember("id", atoi(str), allocator);
vElemItem.AddMember("id", atoi(str1), allocator);
}
}
}

View File

@ -247,32 +247,32 @@ void TriggerObj::serialize(const rapidjson::Value &val)
int count = 0;
int num = 0;
stExpCocoNode *pTriggerObjArray = pCocoNode->GetChildArray();
for (int i = 0; i < length; ++i)
for (int i0 = 0; i0 < length; ++i0)
{
std::string key = pTriggerObjArray[i].GetName(pCocoLoader);
const char* str = pTriggerObjArray[i].GetValue();
std::string key = pTriggerObjArray[i0].GetName(pCocoLoader);
const char* str0 = pTriggerObjArray[i0].GetValue();
if (key.compare("id") == 0)
{
if (str != NULL)
if (str0 != NULL)
{
_id = atoi(str); //(unsigned int)(DICTOOL->getIntValue_json(val, "id"));
_id = atoi(str0); //(unsigned int)(DICTOOL->getIntValue_json(val, "id"));
}
}
else if (key.compare("conditions") == 0)
{
count = pTriggerObjArray[i].GetChildNum();
stExpCocoNode *pConditionsArray = pTriggerObjArray[i].GetChildArray();
for (int i = 0; i < count; ++i)
count = pTriggerObjArray[i0].GetChildNum();
stExpCocoNode *pConditionsArray = pTriggerObjArray[i0].GetChildArray();
for (int i1 = 0; i1 < count; ++i1)
{
num = pConditionsArray[i].GetChildNum();
stExpCocoNode *pConditionArray = pConditionsArray[i].GetChildArray();
num = pConditionsArray[i1].GetChildNum();
stExpCocoNode *pConditionArray = pConditionsArray[i1].GetChildArray();
const char *classname = pConditionArray[0].GetValue();
if (classname == NULL)
if (classname == nullptr)
{
continue;
}
BaseTriggerCondition *con = dynamic_cast<BaseTriggerCondition*>(ObjectFactory::getInstance()->createObject(classname));
CCAssert(con != NULL, "class named classname can not implement!");
CCAssert(con != nullptr, "class named classname can not implement!");
con->serialize(pCocoLoader, &pConditionArray[1]);
con->init();
_cons.pushBack(con);
@ -280,14 +280,14 @@ void TriggerObj::serialize(const rapidjson::Value &val)
}
else if (key.compare("actions") == 0)
{
count = pTriggerObjArray[i].GetChildNum();
stExpCocoNode *pActionsArray = pTriggerObjArray[i].GetChildArray();
for (int i = 0; i < count; ++i)
count = pTriggerObjArray[i0].GetChildNum();
stExpCocoNode *pActionsArray = pTriggerObjArray[i0].GetChildArray();
for (int i2 = 0; i2 < count; ++i2)
{
num = pActionsArray[i].GetChildNum();
stExpCocoNode *pActionArray = pActionsArray[i].GetChildArray();
num = pActionsArray[i2].GetChildNum();
stExpCocoNode *pActionArray = pActionsArray[i2].GetChildArray();
const char *classname = pActionArray[0].GetValue();
if (classname == NULL)
if (classname == nullptr)
{
continue;
}
@ -300,18 +300,18 @@ void TriggerObj::serialize(const rapidjson::Value &val)
}
else if (key.compare("events") == 0)
{
count = pTriggerObjArray[i].GetChildNum();
stExpCocoNode *pEventsArray = pTriggerObjArray[i].GetChildArray();
for (int i = 0; i < count; ++i)
count = pTriggerObjArray[i0].GetChildNum();
stExpCocoNode *pEventsArray = pTriggerObjArray[i0].GetChildArray();
for (int i3 = 0; i3 < count; ++i3)
{
num = pEventsArray[i].GetChildNum();
stExpCocoNode *pEventArray = pEventsArray[i].GetChildArray();
const char *str = pEventArray[0].GetValue();
if (str == NULL)
num = pEventsArray[i3].GetChildNum();
stExpCocoNode *pEventArray = pEventsArray[i3].GetChildArray();
const char *str1 = pEventArray[0].GetValue();
if (str1 == nullptr)
{
continue;
}
int event = atoi(str);
int event = atoi(str1);
if (event < 0)
{
continue;

View File

@ -48,7 +48,9 @@ namespace cocostudio
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
Text* label = static_cast<Text*>(widget);
std::string jsonPath = GUIReader::getInstance()->getFilePath();
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
std::string key = stChildArray[i].GetName(cocoLoader);
@ -67,7 +69,8 @@ namespace cocostudio
}else if(key == P_FontSize){
label->setFontSize(valueToInt(value));
}else if(key == P_FontName){
label->setFontName(value);
std::string fontFilePath = jsonPath.append(value);
label->setFontName(fontFilePath);
}else if(key == P_AreaWidth){
label->setTextAreaSize(Size(valueToFloat(value), label->getTextAreaSize().height));
}else if(key == P_AreaHeight){

View File

@ -42,10 +42,10 @@ void _spAtlasPage_createTexture (spAtlasPage* self, const char* path) {
textureAtlas->retain();
self->rendererObject = textureAtlas;
// Using getContentSize to make it supports the strategy of loading resources in cocos2d-x.
// self->width = texture->getPixelsWide();
// self->height = texture->getPixelsHigh();
self->width = texture->getContentSize().width;
self->height = texture->getContentSize().height;
self->width = texture->getPixelsWide();
self->height = texture->getPixelsHigh();
// self->width = texture->getContentSize().width;
// self->height = texture->getContentSize().height;
}
void _spAtlasPage_disposeTexture (spAtlasPage* self) {

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module ActionTimelineCache
-- @parent_module ccs
--------------------------------
-- @function [parent=#ActionTimelineCache] createAction

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module Application
-- @parent_module cc
--------------------------------
-- @function [parent=#Application] getTargetPlatform

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module Console
-- @parent_module cc
--------------------------------
-- @function [parent=#Console] stop

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module Director
-- @parent_module cc
--------------------------------
-- @function [parent=#Director] pause

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module FileUtils
-- @parent_module cc
--------------------------------
-- @function [parent=#FileUtils] fullPathForFilename

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module GLViewProtocol
-- @parent_module cc
--------------------------------
-- @function [parent=#GLViewProtocol] setFrameSize

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module Helper
-- @parent_module ccui
--------------------------------
-- @function [parent=#Helper] seekWidgetByTag

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module NodeReader
-- @parent_module ccs
--------------------------------
-- @function [parent=#NodeReader] setJsonPath

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module PhysicsContactPostSolve
-- @parent_module cc
--------------------------------
-- @function [parent=#PhysicsContactPostSolve] getFriction

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module PhysicsContactPreSolve
-- @parent_module cc
--------------------------------
-- @function [parent=#PhysicsContactPreSolve] getFriction

View File

@ -1,5 +1,6 @@
--------------------------------
-- @module PhysicsDebugDraw
-- @parent_module cc
return nil

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module PhysicsJoint
-- @parent_module cc
--------------------------------
-- @function [parent=#PhysicsJoint] getBodyA

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module PhysicsWorld
-- @parent_module cc
--------------------------------
-- @function [parent=#PhysicsWorld] getGravity

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module Ref
-- @parent_module cc
--------------------------------
-- @function [parent=#Ref] release

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module SceneReader
-- @parent_module ccs
--------------------------------
-- @function [parent=#SceneReader] setTarget

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module SimpleAudioEngine
-- @parent_module cc
--------------------------------
-- @function [parent=#SimpleAudioEngine] preloadBackgroundMusic

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module TMXMapInfo
-- @parent_module cc
--------------------------------
-- @function [parent=#TMXMapInfo] setObjectGroups

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module TransitionEaseScene
-- @parent_module cc
--------------------------------
-- @function [parent=#TransitionEaseScene] easeActionWithAction

View File

@ -1,6 +1,7 @@
--------------------------------
-- @module UserDefault
-- @parent_module cc
--------------------------------
-- @function [parent=#UserDefault] setIntegerForKey

View File

@ -852,7 +852,7 @@ bool ScrollView::checkCustomScrollDestination(float* touchOffsetX, float* touchO
bool ScrollView::scrollChildrenVertical(float touchOffsetX, float touchOffsetY)
{
float realOffset = touchOffsetY;
bool scrollEnabled = false;
bool scrollEnabled = true;
if (_bounceEnabled)
{
float icBottomPos = _innerContainer->getBottomBoundary();
@ -894,7 +894,7 @@ bool ScrollView::scrollChildrenVertical(float touchOffsetX, float touchOffsetY)
bool ScrollView::scrollChildrenHorizontal(float touchOffsetX, float touchOffestY)
{
bool scrollenabled = false;
bool scrollenabled = true;
float realOffset = touchOffsetX;
if (_bounceEnabled)
{
@ -936,7 +936,7 @@ bool ScrollView::scrollChildrenHorizontal(float touchOffsetX, float touchOffestY
bool ScrollView::scrollChildrenBoth(float touchOffsetX, float touchOffsetY)
{
bool scrollenabled = false;
bool scrollenabled = true;
float realOffsetX = touchOffsetX;
float realOffsetY = touchOffsetY;
if (_bounceEnabled)

View File

@ -33,7 +33,7 @@ void CurlTest::onTouchesEnded(const std::vector<Touch*>& touches, Event *event)
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, "google.com");
curl_easy_setopt(curl, CURLOPT_URL, "baidu.com");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);