Modify code criterion

This commit is contained in:
CaiWenzhi 2013-11-14 11:37:46 +08:00
parent c1ccfc5cea
commit 611ba9e9f5
20 changed files with 180 additions and 180 deletions

View File

@ -34,7 +34,7 @@
namespace cocostudio { namespace cocostudio {
static GUIReader* sharedReader = NULL; static GUIReader* sharedReader = nullptr;
GUIReader::GUIReader(): GUIReader::GUIReader():
m_strFilePath("") m_strFilePath("")
@ -122,26 +122,26 @@ const cocos2d::Size GUIReader::getFileDesignSize(const char* fileName) const
UIWidget* GUIReader::widgetFromJsonFile(const char *fileName) UIWidget* GUIReader::widgetFromJsonFile(const char *fileName)
{ {
DictionaryHelper* dicHelper = DICTOOL; DictionaryHelper* dicHelper = DICTOOL;
const char *des = NULL; const char *des = nullptr;
std::string jsonpath; std::string jsonpath;
JsonDictionary *jsonDict = NULL; JsonDictionary *jsonDict = nullptr;
jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName); jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
int pos = jsonpath.find_last_of('/'); int pos = jsonpath.find_last_of('/');
m_strFilePath = jsonpath.substr(0,pos+1); m_strFilePath = jsonpath.substr(0,pos+1);
long size = 0; long size = 0;
des = (char*)(CCFileUtils::getInstance()->getFileData(jsonpath.c_str(),"r" , &size)); des = (char*)(CCFileUtils::getInstance()->getFileData(jsonpath.c_str(),"r" , &size));
if(NULL == des || strcmp(des, "") == 0) if(nullptr == des || strcmp(des, "") == 0)
{ {
printf("read json file[%s] error!\n", fileName); printf("read json file[%s] error!\n", fileName);
return NULL; return nullptr;
} }
std::string strDes(des); std::string strDes(des);
jsonDict = new JsonDictionary(); jsonDict = new JsonDictionary();
jsonDict->initWithDescription(strDes.c_str()); jsonDict->initWithDescription(strDes.c_str());
UIWidget* widget = NULL; UIWidget* widget = nullptr;
const char* fileVersion = dicHelper->getStringValue_json(jsonDict, "version"); const char* fileVersion = dicHelper->getStringValue_json(jsonDict, "version");
WidgetPropertiesReader * pReader = NULL; WidgetPropertiesReader * pReader = nullptr;
if (fileVersion) if (fileVersion)
{ {
int versionInteger = getVersionInteger(fileVersion); int versionInteger = getVersionInteger(fileVersion);
@ -221,7 +221,7 @@ UIWidget* WidgetPropertiesReader0250::createWidget(JsonDictionary* data, const c
UIWidget* WidgetPropertiesReader0250::widgetFromJsonDictionary(JsonDictionary *data) UIWidget* WidgetPropertiesReader0250::widgetFromJsonDictionary(JsonDictionary *data)
{ {
DictionaryHelper* dicHelper = DICTOOL; DictionaryHelper* dicHelper = DICTOOL;
UIWidget* widget = NULL; UIWidget* widget = nullptr;
const char* classname = dicHelper->getStringValue_json(data, "classname"); const char* classname = dicHelper->getStringValue_json(data, "classname");
JsonDictionary* uiOptions = dicHelper->getSubDictionary_json(data, "options"); JsonDictionary* uiOptions = dicHelper->getSubDictionary_json(data, "options");
if (classname && strcmp(classname, "Button") == 0) if (classname && strcmp(classname, "Button") == 0)
@ -397,9 +397,9 @@ void WidgetPropertiesReader0250::setPropsForButtonFromJsonDictionary(UIWidget*wi
const char* pressedFileName = dicHelper->getStringValue_json(options, "pressed"); const char* pressedFileName = dicHelper->getStringValue_json(options, "pressed");
const char* disabledFileName = dicHelper->getStringValue_json(options, "disabled"); const char* disabledFileName = dicHelper->getStringValue_json(options, "disabled");
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL; const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr;
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL; const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr;
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL; const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture"); bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture");
if (scale9Enable) if (scale9Enable)
{ {
@ -484,11 +484,11 @@ void WidgetPropertiesReader0250::setPropsForCheckBoxFromJsonDictionary(UIWidget*
std::string tp_bd = m_strFilePath; std::string tp_bd = m_strFilePath;
std::string tp_cd = m_strFilePath; std::string tp_cd = m_strFilePath;
const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():NULL; const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():nullptr;
const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():NULL; const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():nullptr;
const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():NULL; const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():nullptr;
const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():NULL; const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():nullptr;
const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():NULL; const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():nullptr;
bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture"); bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture");
if (useMergedTexture) if (useMergedTexture)
@ -519,7 +519,7 @@ void WidgetPropertiesReader0250::setPropsForImageViewFromJsonDictionary(UIWidget
imageView->setScale9Enabled(scale9Enable); imageView->setScale9Enabled(scale9Enable);
std::string tp_i = m_strFilePath; std::string tp_i = m_strFilePath;
const char* imageFileName_tp = NULL; const char* imageFileName_tp = nullptr;
if (imageFileName && (strcmp(imageFileName, "") != 0)) if (imageFileName && (strcmp(imageFileName, "") != 0))
{ {
imageFileName_tp = tp_i.append(imageFileName).c_str(); imageFileName_tp = tp_i.append(imageFileName).c_str();
@ -619,7 +619,7 @@ void WidgetPropertiesReader0250::setPropsForLabelAtlasFromJsonDictionary(UIWidge
if (sv && cmf && iw && ih && scm && (strcmp(dicHelper->getStringValue_json(options, "charMapFile"), "") != 0)) if (sv && cmf && iw && ih && scm && (strcmp(dicHelper->getStringValue_json(options, "charMapFile"), "") != 0))
{ {
std::string tp_c = m_strFilePath; std::string tp_c = m_strFilePath;
const char* cmf_tp = NULL; const char* cmf_tp = nullptr;
const char* cmft = dicHelper->getStringValue_json(options, "charMapFile"); const char* cmft = dicHelper->getStringValue_json(options, "charMapFile");
cmf_tp = tp_c.append(cmft).c_str(); cmf_tp = tp_c.append(cmft).c_str();
@ -668,7 +668,7 @@ void WidgetPropertiesReader0250::setPropsForLayoutFromJsonDictionary(UIWidget*wi
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(options, "backGroundImage"); const char* imageFileName = dicHelper->getStringValue_json(options, "backGroundImage");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture"); bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture");
if (backGroundScale9Enable) if (backGroundScale9Enable)
{ {
@ -732,7 +732,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(options, "barFileName"); const char* imageFileName = dicHelper->getStringValue_json(options, "barFileName");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
if (useMergedTexture) if (useMergedTexture)
{ {
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST); slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
@ -747,7 +747,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(options, "barFileName"); const char* imageFileName = dicHelper->getStringValue_json(options, "barFileName");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
if (useMergedTexture) if (useMergedTexture)
{ {
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST); slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
@ -766,9 +766,9 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(UIWidget*wi
const char* pressedFileName = dicHelper->getStringValue_json(options, "ballPressed"); const char* pressedFileName = dicHelper->getStringValue_json(options, "ballPressed");
const char* disabledFileName = dicHelper->getStringValue_json(options, "ballDisabled"); const char* disabledFileName = dicHelper->getStringValue_json(options, "ballDisabled");
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL; const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr;
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL; const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr;
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL; const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
if (useMergedTexture) if (useMergedTexture)
{ {
slider->loadSlidBallTextures(normalFileName,pressedFileName,disabledFileName,UI_TEX_TYPE_PLIST); slider->loadSlidBallTextures(normalFileName,pressedFileName,disabledFileName,UI_TEX_TYPE_PLIST);
@ -781,7 +781,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(UIWidget*wi
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(options, "progressBarFileName"); const char* imageFileName = dicHelper->getStringValue_json(options, "progressBarFileName");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
if (useMergedTexture) if (useMergedTexture)
{ {
slider->loadProgressBarTexture(imageFileName, UI_TEX_TYPE_PLIST); slider->loadProgressBarTexture(imageFileName, UI_TEX_TYPE_PLIST);
@ -852,7 +852,7 @@ void WidgetPropertiesReader0250::setPropsForLoadingBarFromJsonDictionary(UIWidge
bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture"); bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture");
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char*imageFileName = dicHelper->getStringValue_json(options, "texture"); const char*imageFileName = dicHelper->getStringValue_json(options, "texture");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
if (useMergedTexture) if (useMergedTexture)
{ {
loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST); loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
@ -875,7 +875,7 @@ void WidgetPropertiesReader0250::setPropsForLabelBMFontFromJsonDictionary(UIWidg
UILabelBMFont* labelBMFont = (UILabelBMFont*)widget; UILabelBMFont* labelBMFont = (UILabelBMFont*)widget;
std::string tp_c = m_strFilePath; std::string tp_c = m_strFilePath;
const char* cmf_tp = NULL; const char* cmf_tp = nullptr;
const char* cmft = dicHelper->getStringValue_json(options, "fileName"); const char* cmft = dicHelper->getStringValue_json(options, "fileName");
cmf_tp = tp_c.append(cmft).c_str(); cmf_tp = tp_c.append(cmft).c_str();
@ -940,7 +940,7 @@ UIWidget* WidgetPropertiesReader0300::createWidget(JsonDictionary* data, const c
UIWidget* WidgetPropertiesReader0300::widgetFromJsonDictionary(JsonDictionary *data) UIWidget* WidgetPropertiesReader0300::widgetFromJsonDictionary(JsonDictionary *data)
{ {
DictionaryHelper* dicHelper = DICTOOL; DictionaryHelper* dicHelper = DICTOOL;
UIWidget* widget = NULL; UIWidget* widget = nullptr;
const char* classname = dicHelper->getStringValue_json(data, "classname"); const char* classname = dicHelper->getStringValue_json(data, "classname");
JsonDictionary* uiOptions = dicHelper->getSubDictionary_json(data, "options"); JsonDictionary* uiOptions = dicHelper->getSubDictionary_json(data, "options");
if (classname && strcmp(classname, "Button") == 0) if (classname && strcmp(classname, "Button") == 0)
@ -1099,7 +1099,7 @@ void WidgetPropertiesReader0300::setPropsForWidgetFromJsonDictionary(UIWidget*wi
if (layoutParameterDic) if (layoutParameterDic)
{ {
int paramType = dicHelper->getIntValue_json(layoutParameterDic, "type"); int paramType = dicHelper->getIntValue_json(layoutParameterDic, "type");
UILayoutParameter* parameter = NULL; UILayoutParameter* parameter = nullptr;
switch (paramType) switch (paramType)
{ {
case 0: case 0:
@ -1178,7 +1178,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(UIWidget*wi
{ {
std::string tp_n = m_strFilePath; std::string tp_n = m_strFilePath;
const char* normalFileName = dicHelper->getStringValue_json(normalDic, "path"); const char* normalFileName = dicHelper->getStringValue_json(normalDic, "path");
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL; const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr;
button->loadTextureNormal(normalFileName_tp); button->loadTextureNormal(normalFileName_tp);
break; break;
} }
@ -1200,7 +1200,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(UIWidget*wi
{ {
std::string tp_p = m_strFilePath; std::string tp_p = m_strFilePath;
const char* pressedFileName = dicHelper->getStringValue_json(pressedDic, "path"); const char* pressedFileName = dicHelper->getStringValue_json(pressedDic, "path");
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL; const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr;
button->loadTexturePressed(pressedFileName_tp); button->loadTexturePressed(pressedFileName_tp);
break; break;
} }
@ -1222,7 +1222,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(UIWidget*wi
{ {
std::string tp_d = m_strFilePath; std::string tp_d = m_strFilePath;
const char* disabledFileName = dicHelper->getStringValue_json(disabledDic, "path"); const char* disabledFileName = dicHelper->getStringValue_json(disabledDic, "path");
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL; const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
button->loadTextureDisabled(disabledFileName_tp); button->loadTextureDisabled(disabledFileName_tp);
break; break;
} }
@ -1297,7 +1297,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{ {
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* backGroundFileName = dicHelper->getStringValue_json(backGroundDic, "path"); const char* backGroundFileName = dicHelper->getStringValue_json(backGroundDic, "path");
const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():NULL; const char* backGroundFileName_tp = (backGroundFileName && (strcmp(backGroundFileName, "") != 0))?tp_b.append(backGroundFileName).c_str():nullptr;
checkBox->loadTextureBackGround(backGroundFileName_tp); checkBox->loadTextureBackGround(backGroundFileName_tp);
break; break;
} }
@ -1320,7 +1320,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{ {
std::string tp_bs = m_strFilePath; std::string tp_bs = m_strFilePath;
const char* backGroundSelectedFileName = dicHelper->getStringValue_json(backGroundSelectedDic, "path"); const char* backGroundSelectedFileName = dicHelper->getStringValue_json(backGroundSelectedDic, "path");
const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():NULL; const char* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():nullptr;
checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName_tp); checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName_tp);
break; break;
} }
@ -1343,7 +1343,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{ {
std::string tp_c = m_strFilePath; std::string tp_c = m_strFilePath;
const char* frontCrossFileName = dicHelper->getStringValue_json(frontCrossDic, "path"); const char* frontCrossFileName = dicHelper->getStringValue_json(frontCrossDic, "path");
const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():NULL; const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():nullptr;
checkBox->loadTextureFrontCross(frontCrossFileName_tp); checkBox->loadTextureFrontCross(frontCrossFileName_tp);
break; break;
} }
@ -1366,7 +1366,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{ {
std::string tp_bd = m_strFilePath; std::string tp_bd = m_strFilePath;
const char* backGroundDisabledFileName = dicHelper->getStringValue_json(backGroundDisabledDic, "path"); const char* backGroundDisabledFileName = dicHelper->getStringValue_json(backGroundDisabledDic, "path");
const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():NULL; const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():nullptr;
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName_tp); checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName_tp);
break; break;
} }
@ -1389,7 +1389,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{ {
std::string tp_cd = m_strFilePath; std::string tp_cd = m_strFilePath;
const char* frontCrossDisabledFileName = dicHelper->getStringValue_json(options, "path"); const char* frontCrossDisabledFileName = dicHelper->getStringValue_json(options, "path");
const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():NULL; const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():nullptr;
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName_tp); checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName_tp);
break; break;
} }
@ -1422,7 +1422,7 @@ void WidgetPropertiesReader0300::setPropsForImageViewFromJsonDictionary(UIWidget
{ {
std::string tp_i = m_strFilePath; std::string tp_i = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path"); const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path");
const char* imageFileName_tp = NULL; const char* imageFileName_tp = nullptr;
if (imageFileName && (strcmp(imageFileName, "") != 0)) if (imageFileName && (strcmp(imageFileName, "") != 0))
{ {
imageFileName_tp = tp_i.append(imageFileName).c_str(); imageFileName_tp = tp_i.append(imageFileName).c_str();
@ -1592,7 +1592,7 @@ void WidgetPropertiesReader0300::setPropsForLayoutFromJsonDictionary(UIWidget*wi
{ {
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path"); const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
panel->setBackGroundImage(imageFileName_tp); panel->setBackGroundImage(imageFileName_tp);
break; break;
} }
@ -1656,7 +1656,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path"); const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
slider->loadBarTexture(imageFileName_tp); slider->loadBarTexture(imageFileName_tp);
break; break;
} }
@ -1683,7 +1683,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char*imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path"); const char*imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
slider->loadBarTexture(imageFileName_tp); slider->loadBarTexture(imageFileName_tp);
break; break;
} }
@ -1708,7 +1708,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_n = m_strFilePath; std::string tp_n = m_strFilePath;
const char* normalFileName = dicHelper->getStringValue_json(normalDic, "path"); const char* normalFileName = dicHelper->getStringValue_json(normalDic, "path");
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL; const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():nullptr;
slider->loadSlidBallTextureNormal(normalFileName_tp); slider->loadSlidBallTextureNormal(normalFileName_tp);
break; break;
} }
@ -1731,7 +1731,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_p = m_strFilePath; std::string tp_p = m_strFilePath;
const char* pressedFileName = dicHelper->getStringValue_json(pressedDic, "path"); const char* pressedFileName = dicHelper->getStringValue_json(pressedDic, "path");
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL; const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():nullptr;
slider->loadSlidBallTexturePressed(pressedFileName_tp); slider->loadSlidBallTexturePressed(pressedFileName_tp);
break; break;
} }
@ -1754,7 +1754,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_d = m_strFilePath; std::string tp_d = m_strFilePath;
const char* disabledFileName = dicHelper->getStringValue_json(disabledDic, "path"); const char* disabledFileName = dicHelper->getStringValue_json(disabledDic, "path");
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():NULL; const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
slider->loadSlidBallTextureDisabled(disabledFileName_tp); slider->loadSlidBallTextureDisabled(disabledFileName_tp);
break; break;
} }
@ -1779,7 +1779,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{ {
std::string tp_b = m_strFilePath; std::string tp_b = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(progressBarDic, "path"); const char* imageFileName = dicHelper->getStringValue_json(progressBarDic, "path");
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():NULL; const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
slider->loadProgressBarTexture(imageFileName_tp); slider->loadProgressBarTexture(imageFileName_tp);
break; break;
} }
@ -1860,7 +1860,7 @@ void WidgetPropertiesReader0300::setPropsForLoadingBarFromJsonDictionary(UIWidge
{ {
std::string tp_i = m_strFilePath; std::string tp_i = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path"); const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path");
const char* imageFileName_tp = NULL; const char* imageFileName_tp = nullptr;
if (imageFileName && (strcmp(imageFileName, "") != 0)) if (imageFileName && (strcmp(imageFileName, "") != 0))
{ {
imageFileName_tp = tp_i.append(imageFileName).c_str(); imageFileName_tp = tp_i.append(imageFileName).c_str();

View File

@ -33,10 +33,10 @@ namespace gui {
#define TITLERENDERERZ (1) #define TITLERENDERERZ (1)
UIButton::UIButton(): UIButton::UIButton():
_buttonNormalRenderer(NULL), _buttonNormalRenderer(nullptr),
_buttonClickedRenderer(NULL), _buttonClickedRenderer(nullptr),
_buttonDisableRenderer(NULL), _buttonDisableRenderer(nullptr),
_titleRenderer(NULL), _titleRenderer(nullptr),
_normalFileName(""), _normalFileName(""),
_clickedFileName(""), _clickedFileName(""),
_disabledFileName(""), _disabledFileName(""),
@ -70,7 +70,7 @@ UIButton* UIButton::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UIButton::init() bool UIButton::init()
@ -109,9 +109,9 @@ void UIButton::setScale9Enabled(bool able)
_renderer->removeChild(_buttonClickedRenderer, true); _renderer->removeChild(_buttonClickedRenderer, true);
_renderer->removeChild(_buttonDisableRenderer, true); _renderer->removeChild(_buttonDisableRenderer, true);
_buttonNormalRenderer = NULL; _buttonNormalRenderer = nullptr;
_buttonClickedRenderer = NULL; _buttonClickedRenderer = nullptr;
_buttonDisableRenderer = NULL; _buttonDisableRenderer = nullptr;
if (_scale9Enabled) if (_scale9Enabled)
{ {
_buttonNormalRenderer = cocos2d::extension::Scale9Sprite::create(); _buttonNormalRenderer = cocos2d::extension::Scale9Sprite::create();
@ -457,7 +457,7 @@ cocos2d::Node* UIButton::getVirtualRenderer()
case BRIGHT_HIGHLIGHT: case BRIGHT_HIGHLIGHT:
return _buttonClickedRenderer; return _buttonClickedRenderer;
default: default:
return NULL; return nullptr;
} }
} }
else else

View File

@ -28,14 +28,14 @@ namespace gui {
UICheckBox::UICheckBox(): UICheckBox::UICheckBox():
_backGroundBoxRenderer(NULL), _backGroundBoxRenderer(nullptr),
_backGroundSelectedBoxRenderer(NULL), _backGroundSelectedBoxRenderer(nullptr),
_frontCrossRenderer(NULL), _frontCrossRenderer(nullptr),
_backGroundBoxDisabledRenderer(NULL), _backGroundBoxDisabledRenderer(nullptr),
_frontCrossDisabledRenderer(NULL), _frontCrossDisabledRenderer(nullptr),
_isSelected(true), _isSelected(true),
_checkBoxEventListener(NULL), _checkBoxEventListener(nullptr),
_checkBoxEventSelector(NULL), _checkBoxEventSelector(nullptr),
_backGroundTexType(UI_TEX_TYPE_LOCAL), _backGroundTexType(UI_TEX_TYPE_LOCAL),
_backGroundSelectedTexType(UI_TEX_TYPE_LOCAL), _backGroundSelectedTexType(UI_TEX_TYPE_LOCAL),
_frontCrossTexType(UI_TEX_TYPE_LOCAL), _frontCrossTexType(UI_TEX_TYPE_LOCAL),
@ -51,8 +51,8 @@ _frontCrossDisabledFileName("")
UICheckBox::~UICheckBox() UICheckBox::~UICheckBox()
{ {
_checkBoxEventListener = NULL; _checkBoxEventListener = nullptr;
_checkBoxEventSelector = NULL; _checkBoxEventSelector = nullptr;
} }
UICheckBox* UICheckBox::create() UICheckBox* UICheckBox::create()
@ -64,7 +64,7 @@ UICheckBox* UICheckBox::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UICheckBox::init() bool UICheckBox::init()

View File

@ -30,7 +30,7 @@ UIWidget* UIHelper::seekWidgetByTag(UIWidget* root, int tag)
{ {
if (!root) if (!root)
{ {
return NULL; return nullptr;
} }
if (root->getTag() == tag) if (root->getTag() == tag)
{ {
@ -42,19 +42,19 @@ UIWidget* UIHelper::seekWidgetByTag(UIWidget* root, int tag)
{ {
UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]); UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]);
UIWidget* res = seekWidgetByTag(child,tag); UIWidget* res = seekWidgetByTag(child,tag);
if (res != NULL) if (res != nullptr)
{ {
return res; return res;
} }
} }
return NULL; return nullptr;
} }
UIWidget* UIHelper::seekWidgetByName(UIWidget* root, const char *name) UIWidget* UIHelper::seekWidgetByName(UIWidget* root, const char *name)
{ {
if (!root) if (!root)
{ {
return NULL; return nullptr;
} }
if (strcmp(root->getName(), name) == 0) if (strcmp(root->getName(), name) == 0)
{ {
@ -66,19 +66,19 @@ UIWidget* UIHelper::seekWidgetByName(UIWidget* root, const char *name)
{ {
UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]); UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]);
UIWidget* res = seekWidgetByName(child,name); UIWidget* res = seekWidgetByName(child,name);
if (res != NULL) if (res != nullptr)
{ {
return res; return res;
} }
} }
return NULL; return nullptr;
} }
UIWidget* UIHelper::seekWidgetByRelativeName(UIWidget *root, const char *name) UIWidget* UIHelper::seekWidgetByRelativeName(UIWidget *root, const char *name)
{ {
if (!root) if (!root)
{ {
return NULL; return nullptr;
} }
cocos2d::ccArray* arrayRootChildren = root->getChildren()->data; cocos2d::ccArray* arrayRootChildren = root->getChildren()->data;
int length = arrayRootChildren->num; int length = arrayRootChildren->num;
@ -91,7 +91,7 @@ UIWidget* UIHelper::seekWidgetByRelativeName(UIWidget *root, const char *name)
return child; return child;
} }
} }
return NULL; return nullptr;
} }
/*temp action*/ /*temp action*/
@ -99,7 +99,7 @@ UIWidget* UIHelper::seekActionWidgetByActionTag(UIWidget* root, int tag)
{ {
if (!root) if (!root)
{ {
return NULL; return nullptr;
} }
if (root->getActionTag() == tag) if (root->getActionTag() == tag)
{ {
@ -111,12 +111,12 @@ UIWidget* UIHelper::seekActionWidgetByActionTag(UIWidget* root, int tag)
{ {
UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]); UIWidget* child = (UIWidget*)(arrayRootChildren->arr[i]);
UIWidget* res = seekActionWidgetByActionTag(child,tag); UIWidget* res = seekActionWidgetByActionTag(child,tag);
if (res != NULL) if (res != nullptr)
{ {
return res; return res;
} }
} }
return NULL; return nullptr;
} }
} }

View File

@ -40,7 +40,7 @@ _doubleClickEnabled(false),
_scale9Enabled(false), _scale9Enabled(false),
_prevIgnoreSize(true), _prevIgnoreSize(true),
_capInsets(cocos2d::Rect::ZERO), _capInsets(cocos2d::Rect::ZERO),
_imageRenderer(NULL), _imageRenderer(nullptr),
_textureFile(""), _textureFile(""),
_imageTexType(UI_TEX_TYPE_LOCAL), _imageTexType(UI_TEX_TYPE_LOCAL),
_imageTextureSize(_size) _imageTextureSize(_size)
@ -62,7 +62,7 @@ UIImageView* UIImageView::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
void UIImageView::initRenderer() void UIImageView::initRenderer()
@ -275,7 +275,7 @@ void UIImageView::setScale9Enabled(bool able)
_scale9Enabled = able; _scale9Enabled = able;
_renderer->removeChild(_imageRenderer, true); _renderer->removeChild(_imageRenderer, true);
_imageRenderer = NULL; _imageRenderer = nullptr;
if (_scale9Enabled) if (_scale9Enabled)
{ {
_imageRenderer = cocos2d::extension::Scale9Sprite::create(); _imageRenderer = cocos2d::extension::Scale9Sprite::create();

View File

@ -30,12 +30,12 @@
namespace gui { namespace gui {
UIInputManager::UIInputManager(): UIInputManager::UIInputManager():
_manageredWidget(NULL), _manageredWidget(nullptr),
_touchDown(false), _touchDown(false),
_longClickTime(0.0), _longClickTime(0.0),
_longClickRecordTime(0.0), _longClickRecordTime(0.0),
_checkedDoubleClickWidget(NULL), _checkedDoubleClickWidget(nullptr),
_rootWidget(NULL) _rootWidget(nullptr)
{ {
_manageredWidget = Array::create(); _manageredWidget = Array::create();
_manageredWidget->retain(); _manageredWidget->retain();

View File

@ -34,7 +34,7 @@ _normalScaleValueY(1.0f),
_fontName("Thonburi"), _fontName("Thonburi"),
_fontSize(10), _fontSize(10),
_onSelectedScaleOffset(0.5), _onSelectedScaleOffset(0.5),
_labelRenderer(NULL) _labelRenderer(nullptr)
{ {
} }
@ -52,7 +52,7 @@ UILabel* UILabel::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UILabel::init() bool UILabel::init()

View File

@ -47,7 +47,7 @@ UICCLabelAtlas* UICCLabelAtlas::create()
} }
CC_SAFE_DELETE(pRet); CC_SAFE_DELETE(pRet);
return NULL; return nullptr;
} }
void UICCLabelAtlas::setProperty(const std::string& string, const std::string& charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap) void UICCLabelAtlas::setProperty(const std::string& string, const std::string& charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap)
@ -79,7 +79,7 @@ void UICCLabelAtlas::updateDisplayedOpacity(GLubyte opacity)
UILabelAtlas::UILabelAtlas(): UILabelAtlas::UILabelAtlas():
_laberAtlasRenderer(NULL), _laberAtlasRenderer(nullptr),
_stringValue(""), _stringValue(""),
_charMapFileName(""), _charMapFileName(""),
_itemWidth(0), _itemWidth(0),
@ -103,7 +103,7 @@ UILabelAtlas* UILabelAtlas::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
void UILabelAtlas::initRenderer() void UILabelAtlas::initRenderer()

View File

@ -27,7 +27,7 @@
namespace gui { namespace gui {
UILabelBMFont::UILabelBMFont(): UILabelBMFont::UILabelBMFont():
_labelBMFontRenderer(NULL), _labelBMFontRenderer(nullptr),
_fntFileHasInit(false), _fntFileHasInit(false),
_fntFileName(""), _fntFileName(""),
_stringValue("") _stringValue("")
@ -48,7 +48,7 @@ UILabelBMFont* UILabelBMFont::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
void UILabelBMFont::initRenderer() void UILabelBMFont::initRenderer()

View File

@ -30,8 +30,8 @@
namespace gui { namespace gui {
UILayer::UILayer(): UILayer::UILayer():
_rootWidget(NULL), _rootWidget(nullptr),
_inputManager(NULL) _inputManager(nullptr)
{ {
} }
@ -67,7 +67,7 @@ UILayer* UILayer::create(void)
else else
{ {
CC_SAFE_DELETE(pRet); CC_SAFE_DELETE(pRet);
return NULL; return nullptr;
} }
} }
@ -118,7 +118,7 @@ UIWidget* UILayer::getWidgetByTag(int tag)
{ {
if (!_rootWidget) if (!_rootWidget)
{ {
return NULL; return nullptr;
} }
return UIHelper::seekWidgetByTag(_rootWidget, tag); return UIHelper::seekWidgetByTag(_rootWidget, tag);
} }
@ -127,7 +127,7 @@ UIWidget* UILayer::getWidgetByName(const char* name)
{ {
if (!_rootWidget) if (!_rootWidget)
{ {
return NULL; return nullptr;
} }
return UIHelper::seekWidgetByName(_rootWidget, name); return UIHelper::seekWidgetByName(_rootWidget, name);
} }

View File

@ -35,13 +35,13 @@ namespace gui {
UILayout::UILayout(): UILayout::UILayout():
_clippingEnabled(false), _clippingEnabled(false),
_backGroundScale9Enabled(false), _backGroundScale9Enabled(false),
_backGroundImage(NULL), _backGroundImage(nullptr),
_backGroundImageFileName(""), _backGroundImageFileName(""),
_backGroundImageCapInsets(cocos2d::Rect::ZERO), _backGroundImageCapInsets(cocos2d::Rect::ZERO),
_colorType(LAYOUT_COLOR_NONE), _colorType(LAYOUT_COLOR_NONE),
_bgImageTexType(UI_TEX_TYPE_LOCAL), _bgImageTexType(UI_TEX_TYPE_LOCAL),
_colorRender(NULL), _colorRender(nullptr),
_gradientRender(NULL), _gradientRender(nullptr),
_cColor(cocos2d::Color3B::WHITE), _cColor(cocos2d::Color3B::WHITE),
_gStartColor(cocos2d::Color3B::WHITE), _gStartColor(cocos2d::Color3B::WHITE),
_gEndColor(cocos2d::Color3B::WHITE), _gEndColor(cocos2d::Color3B::WHITE),
@ -66,7 +66,7 @@ UILayout* UILayout::create()
return layout; return layout;
} }
CC_SAFE_DELETE(layout); CC_SAFE_DELETE(layout);
return NULL; return nullptr;
} }
bool UILayout::init() bool UILayout::init()
@ -165,7 +165,7 @@ void UILayout::setBackGroundImageScale9Enabled(bool able)
return; return;
} }
_renderer->removeChild(_backGroundImage, true); _renderer->removeChild(_backGroundImage, true);
_backGroundImage = NULL; _backGroundImage = nullptr;
_backGroundScale9Enabled = able; _backGroundScale9Enabled = able;
if (_backGroundScale9Enabled) if (_backGroundScale9Enabled)
{ {
@ -188,7 +188,7 @@ void UILayout::setBackGroundImage(const char* fileName,TextureResType texType)
{ {
return; return;
} }
if (_backGroundImage == NULL) if (_backGroundImage == nullptr)
{ {
addBackGroundImage(); addBackGroundImage();
} }
@ -305,7 +305,7 @@ void UILayout::removeBackGroundImage()
return; return;
} }
_renderer->removeChild(_backGroundImage, true); _renderer->removeChild(_backGroundImage, true);
_backGroundImage = NULL; _backGroundImage = nullptr;
_backGroundImageFileName = ""; _backGroundImageFileName = "";
_backGroundImageTextureSize = cocos2d::Size::ZERO; _backGroundImageTextureSize = cocos2d::Size::ZERO;
} }
@ -322,26 +322,26 @@ void UILayout::setBackGroundColorType(LayoutBackGroundColorType type)
if (_colorRender) if (_colorRender)
{ {
_renderer->removeChild(_colorRender, true); _renderer->removeChild(_colorRender, true);
_colorRender = NULL; _colorRender = nullptr;
} }
if (_gradientRender) if (_gradientRender)
{ {
_renderer->removeChild(_gradientRender, true); _renderer->removeChild(_gradientRender, true);
_gradientRender = NULL; _gradientRender = nullptr;
} }
break; break;
case LAYOUT_COLOR_SOLID: case LAYOUT_COLOR_SOLID:
if (_colorRender) if (_colorRender)
{ {
_renderer->removeChild(_colorRender, true); _renderer->removeChild(_colorRender, true);
_colorRender = NULL; _colorRender = nullptr;
} }
break; break;
case LAYOUT_COLOR_GRADIENT: case LAYOUT_COLOR_GRADIENT:
if (_gradientRender) if (_gradientRender)
{ {
_renderer->removeChild(_gradientRender, true); _renderer->removeChild(_gradientRender, true);
_gradientRender = NULL; _gradientRender = nullptr;
} }
break; break;
default: default:
@ -596,8 +596,8 @@ void UILayout::doLayout()
cocos2d::Size cs = child->getSize(); cocos2d::Size cs = child->getSize();
UIRelativeAlign align = layoutParameter->getAlign(); UIRelativeAlign align = layoutParameter->getAlign();
const char* relativeName = layoutParameter->getRelativeToWidgetName(); const char* relativeName = layoutParameter->getRelativeToWidgetName();
UIWidget* relativeWidget = NULL; UIWidget* relativeWidget = nullptr;
UIRelativeLayoutParameter* relativeWidgetLP = NULL; UIRelativeLayoutParameter* relativeWidgetLP = nullptr;
float finalPosX = 0.0f; float finalPosX = 0.0f;
float finalPosY = 0.0f; float finalPosY = 0.0f;
if (relativeName && strcmp(relativeName, "")) if (relativeName && strcmp(relativeName, ""))
@ -927,7 +927,7 @@ void UILayout::copySpecialProperties(UIWidget *widget)
} }
UIRectClippingNode::UIRectClippingNode(): UIRectClippingNode::UIRectClippingNode():
_innerStencil(NULL), _innerStencil(nullptr),
_enabled(true), _enabled(true),
_clippingSize(cocos2d::Size(50.0f, 50.0f)), _clippingSize(cocos2d::Size(50.0f, 50.0f)),
_clippingEnabled(false) _clippingEnabled(false)

View File

@ -37,7 +37,7 @@ UILayoutParameter* UILayoutParameter::create()
return parameter; return parameter;
} }
CC_SAFE_DELETE(parameter); CC_SAFE_DELETE(parameter);
return NULL; return nullptr;
} }
void UILayoutParameter::setMargin(const UIMargin &margin) void UILayoutParameter::setMargin(const UIMargin &margin)
@ -64,7 +64,7 @@ UILinearLayoutParameter* UILinearLayoutParameter::create()
return parameter; return parameter;
} }
CC_SAFE_DELETE(parameter); CC_SAFE_DELETE(parameter);
return NULL; return nullptr;
} }
void UILinearLayoutParameter::setGravity(UILinearGravity gravity) void UILinearLayoutParameter::setGravity(UILinearGravity gravity)
@ -86,7 +86,7 @@ UIRelativeLayoutParameter* UIRelativeLayoutParameter::create()
return parameter; return parameter;
} }
CC_SAFE_DELETE(parameter); CC_SAFE_DELETE(parameter);
return NULL; return nullptr;
} }
void UIRelativeLayoutParameter::setAlign(UIRelativeAlign align) void UIRelativeLayoutParameter::setAlign(UIRelativeAlign align)

View File

@ -29,12 +29,12 @@
namespace gui { namespace gui {
UIListView::UIListView(): UIListView::UIListView():
_model(NULL), _model(nullptr),
_items(NULL), _items(nullptr),
_gravity(LISTVIEW_GRAVITY_CENTER_HORIZONTAL), _gravity(LISTVIEW_GRAVITY_CENTER_HORIZONTAL),
_itemsMargin(0.0f), _itemsMargin(0.0f),
_listViewEventListener(NULL), _listViewEventListener(nullptr),
_listViewEventSelector(NULL), _listViewEventSelector(nullptr),
_curSelectedIndex(0) _curSelectedIndex(0)
{ {
@ -44,8 +44,8 @@ UIListView::~UIListView()
{ {
_items->removeAllObjects(); _items->removeAllObjects();
CC_SAFE_RELEASE(_items); CC_SAFE_RELEASE(_items);
_listViewEventListener = NULL; _listViewEventListener = nullptr;
_listViewEventSelector = NULL; _listViewEventSelector = nullptr;
} }
UIListView* UIListView::create() UIListView* UIListView::create()
@ -57,7 +57,7 @@ UIListView* UIListView::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UIListView::init() bool UIListView::init()
@ -303,7 +303,7 @@ UIWidget* UIListView::getItem(unsigned int index)
{ {
if ((int)index < 0 || index >= _items->count()) if ((int)index < 0 || index >= _items->count())
{ {
return NULL; return nullptr;
} }
return (UIWidget*)(_items->data->arr[index]); return (UIWidget*)(_items->data->arr[index]);
} }

View File

@ -34,7 +34,7 @@ UILoadingBar::UILoadingBar():
_barType(LoadingBarTypeLeft), _barType(LoadingBarTypeLeft),
_percent(100), _percent(100),
_totalLength(0), _totalLength(0),
_barRenderer(NULL), _barRenderer(nullptr),
_renderBarTexType(UI_TEX_TYPE_LOCAL), _renderBarTexType(UI_TEX_TYPE_LOCAL),
_barRendererTextureSize(cocos2d::Size::ZERO), _barRendererTextureSize(cocos2d::Size::ZERO),
_scale9Enabled(false), _scale9Enabled(false),
@ -58,7 +58,7 @@ UILoadingBar* UILoadingBar::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
void UILoadingBar::initRenderer() void UILoadingBar::initRenderer()
@ -179,7 +179,7 @@ void UILoadingBar::setScale9Enabled(bool enabled)
} }
_scale9Enabled = enabled; _scale9Enabled = enabled;
_renderer->removeChild(_barRenderer, true); _renderer->removeChild(_barRenderer, true);
_barRenderer = NULL; _barRenderer = nullptr;
if (_scale9Enabled) if (_scale9Enabled)
{ {
_barRenderer = cocos2d::extension::Scale9Sprite::create(); _barRenderer = cocos2d::extension::Scale9Sprite::create();

View File

@ -28,13 +28,13 @@ namespace gui {
UIPageView::UIPageView(): UIPageView::UIPageView():
_curPageIdx(0), _curPageIdx(0),
_pages(NULL), _pages(nullptr),
_touchMoveDir(PAGEVIEW_TOUCHLEFT), _touchMoveDir(PAGEVIEW_TOUCHLEFT),
_touchStartLocation(0.0f), _touchStartLocation(0.0f),
_touchMoveStartLocation(0.0f), _touchMoveStartLocation(0.0f),
_movePagePoint(cocos2d::Point::ZERO), _movePagePoint(cocos2d::Point::ZERO),
_leftChild(NULL), _leftChild(nullptr),
_rightChild(NULL), _rightChild(nullptr),
_leftBoundary(0.0f), _leftBoundary(0.0f),
_rightBoundary(0.0f), _rightBoundary(0.0f),
_isAutoScrolling(false), _isAutoScrolling(false),
@ -42,8 +42,8 @@ _autoScrollDistance(0.0f),
_autoScrollSpeed(0.0f), _autoScrollSpeed(0.0f),
_autoScrollDir(0), _autoScrollDir(0),
_childFocusCancelOffset(5.0f), _childFocusCancelOffset(5.0f),
_pageViewEventListener(NULL), _pageViewEventListener(nullptr),
_pageViewEventSelector(NULL) _pageViewEventSelector(nullptr)
{ {
} }
@ -51,8 +51,8 @@ UIPageView::~UIPageView()
{ {
_pages->removeAllObjects(); _pages->removeAllObjects();
CC_SAFE_RELEASE(_pages); CC_SAFE_RELEASE(_pages);
_pageViewEventListener = NULL; _pageViewEventListener = nullptr;
_pageViewEventSelector = NULL; _pageViewEventSelector = nullptr;
} }
UIPageView* UIPageView::create() UIPageView* UIPageView::create()
@ -64,7 +64,7 @@ UIPageView* UIPageView::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UIPageView::init() bool UIPageView::init()
@ -229,8 +229,8 @@ void UIPageView::updateBoundaryPages()
{ {
if (_pages->count() <= 0) if (_pages->count() <= 0)
{ {
_leftChild = NULL; _leftChild = nullptr;
_rightChild = NULL; _rightChild = nullptr;
return; return;
} }
_leftChild = dynamic_cast<UIWidget*>(_pages->getObjectAtIndex(0)); _leftChild = dynamic_cast<UIWidget*>(_pages->getObjectAtIndex(0));
@ -595,7 +595,7 @@ UILayout* UIPageView::getPage(int index)
{ {
if (index < 0 || index >= (int)(_pages->count())) if (index < 0 || index >= (int)(_pages->count()))
{ {
return NULL; return nullptr;
} }
return (UILayout*)_pages->getObjectAtIndex(index); return (UILayout*)_pages->getObjectAtIndex(index);
} }

View File

@ -43,7 +43,7 @@ UIRootWidget* UIRootWidget::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UIRootWidget::init() bool UIRootWidget::init()

View File

@ -34,7 +34,7 @@ const cocos2d::Point SCROLLDIR_LEFT = cocos2d::Point(-1.0f, 0.0f);
const cocos2d::Point SCROLLDIR_RIGHT = cocos2d::Point(1.0f, 0.0f); const cocos2d::Point SCROLLDIR_RIGHT = cocos2d::Point(1.0f, 0.0f);
UIScrollView::UIScrollView(): UIScrollView::UIScrollView():
_innerContainer(NULL), _innerContainer(nullptr),
_direction(SCROLLVIEW_DIR_VERTICAL), _direction(SCROLLVIEW_DIR_VERTICAL),
_touchBeganPoint(cocos2d::Point::ZERO), _touchBeganPoint(cocos2d::Point::ZERO),
_touchMovedPoint(cocos2d::Point::ZERO), _touchMovedPoint(cocos2d::Point::ZERO),
@ -69,15 +69,15 @@ _bouncing(false),
_bounceDir(cocos2d::Point::ZERO), _bounceDir(cocos2d::Point::ZERO),
_bounceOriginalSpeed(0.0f), _bounceOriginalSpeed(0.0f),
_inertiaScrollEnabled(true), _inertiaScrollEnabled(true),
_scrollViewEventListener(NULL), _scrollViewEventListener(nullptr),
_scrollViewEventSelector(NULL) _scrollViewEventSelector(nullptr)
{ {
} }
UIScrollView::~UIScrollView() UIScrollView::~UIScrollView()
{ {
_scrollViewEventListener = NULL; _scrollViewEventListener = nullptr;
_scrollViewEventSelector = NULL; _scrollViewEventSelector = nullptr;
} }
UIScrollView* UIScrollView::create() UIScrollView* UIScrollView::create()
@ -89,7 +89,7 @@ UIScrollView* UIScrollView::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UIScrollView::init() bool UIScrollView::init()

View File

@ -28,13 +28,13 @@
namespace gui { namespace gui {
UISlider::UISlider(): UISlider::UISlider():
_barRenderer(NULL), _barRenderer(nullptr),
_progressBarRenderer(NULL), _progressBarRenderer(nullptr),
_progressBarTextureSize(cocos2d::Size::ZERO), _progressBarTextureSize(cocos2d::Size::ZERO),
_slidBallNormalRenderer(NULL), _slidBallNormalRenderer(nullptr),
_slidBallPressedRenderer(NULL), _slidBallPressedRenderer(nullptr),
_slidBallDisabledRenderer(NULL), _slidBallDisabledRenderer(nullptr),
_slidBallRenderer(NULL), _slidBallRenderer(nullptr),
_barLength(0.0), _barLength(0.0),
_percent(0), _percent(0),
_scale9Enabled(false), _scale9Enabled(false),
@ -46,8 +46,8 @@ _slidBallPressedTextureFile(""),
_slidBallDisabledTextureFile(""), _slidBallDisabledTextureFile(""),
_capInsetsBarRenderer(cocos2d::Rect::ZERO), _capInsetsBarRenderer(cocos2d::Rect::ZERO),
_capInsetsProgressBarRenderer(cocos2d::Rect::ZERO), _capInsetsProgressBarRenderer(cocos2d::Rect::ZERO),
_sliderEventListener(NULL), _sliderEventListener(nullptr),
_sliderEventSelector(NULL), _sliderEventSelector(nullptr),
_barTexType(UI_TEX_TYPE_LOCAL), _barTexType(UI_TEX_TYPE_LOCAL),
_progressBarTexType(UI_TEX_TYPE_LOCAL), _progressBarTexType(UI_TEX_TYPE_LOCAL),
_ballNTexType(UI_TEX_TYPE_LOCAL), _ballNTexType(UI_TEX_TYPE_LOCAL),
@ -58,8 +58,8 @@ _ballDTexType(UI_TEX_TYPE_LOCAL)
UISlider::~UISlider() UISlider::~UISlider()
{ {
_sliderEventListener = NULL; _sliderEventListener = nullptr;
_sliderEventSelector = NULL; _sliderEventSelector = nullptr;
} }
UISlider* UISlider::create() UISlider* UISlider::create()
@ -71,7 +71,7 @@ UISlider* UISlider::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
void UISlider::initRenderer() void UISlider::initRenderer()
@ -198,8 +198,8 @@ void UISlider::setScale9Enabled(bool able)
_scale9Enabled = able; _scale9Enabled = able;
_renderer->removeChild(_barRenderer, true); _renderer->removeChild(_barRenderer, true);
_renderer->removeChild(_progressBarRenderer, true); _renderer->removeChild(_progressBarRenderer, true);
_barRenderer = NULL; _barRenderer = nullptr;
_progressBarRenderer = NULL; _progressBarRenderer = nullptr;
if (_scale9Enabled) if (_scale9Enabled)
{ {
_barRenderer = cocos2d::extension::Scale9Sprite::create(); _barRenderer = cocos2d::extension::Scale9Sprite::create();

View File

@ -57,7 +57,7 @@ UICCTextField * UICCTextField::create(const char *placeholder, const char *fontN
} }
CC_SAFE_DELETE(pRet); CC_SAFE_DELETE(pRet);
return NULL; return nullptr;
} }
void UICCTextField::onEnter() void UICCTextField::onEnter()
@ -271,20 +271,20 @@ bool UICCTextField::getDeleteBackward()
UITextField::UITextField(): UITextField::UITextField():
_textFieldRenderer(NULL), _textFieldRenderer(nullptr),
_touchWidth(0.0f), _touchWidth(0.0f),
_touchHeight(0.0f), _touchHeight(0.0f),
_useTouchArea(false), _useTouchArea(false),
_textFieldEventListener(NULL), _textFieldEventListener(nullptr),
_textFieldEventSelector(NULL), _textFieldEventSelector(nullptr),
_passwordStyleText("") _passwordStyleText("")
{ {
} }
UITextField::~UITextField() UITextField::~UITextField()
{ {
_textFieldEventListener = NULL; _textFieldEventListener = nullptr;
_textFieldEventSelector = NULL; _textFieldEventSelector = nullptr;
} }
UITextField* UITextField::create() UITextField* UITextField::create()
@ -296,7 +296,7 @@ UITextField* UITextField::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UITextField::init() bool UITextField::init()

View File

@ -44,46 +44,46 @@ _touchPassedEnabled(false),
_focus(false), _focus(false),
_widgetZOrder(0), _widgetZOrder(0),
_anchorPoint(cocos2d::Point(0.5f, 0.5f)), _anchorPoint(cocos2d::Point(0.5f, 0.5f)),
_widgetParent(NULL), _widgetParent(nullptr),
_brightStyle(BRIGHT_NONE), _brightStyle(BRIGHT_NONE),
_updateEnabled(false), _updateEnabled(false),
_renderer(NULL), _renderer(nullptr),
_touchStartPos(cocos2d::Point::ZERO), _touchStartPos(cocos2d::Point::ZERO),
_touchMovePos(cocos2d::Point::ZERO), _touchMovePos(cocos2d::Point::ZERO),
_touchEndPos(cocos2d::Point::ZERO), _touchEndPos(cocos2d::Point::ZERO),
_touchEventListener(NULL), _touchEventListener(nullptr),
_touchEventSelector(NULL), _touchEventSelector(nullptr),
_widgetTag(-1), _widgetTag(-1),
_name("default"), _name("default"),
_widgetType(WidgetTypeWidget), _widgetType(WidgetTypeWidget),
_actionTag(0), _actionTag(0),
_size(cocos2d::Size::ZERO), _size(cocos2d::Size::ZERO),
_customSize(cocos2d::Size::ZERO), _customSize(cocos2d::Size::ZERO),
_layoutParameterDictionary(NULL), _layoutParameterDictionary(nullptr),
_ignoreSize(false), _ignoreSize(false),
_children(NULL), _children(nullptr),
_affectByClipping(false), _affectByClipping(false),
_scheduler(NULL), _scheduler(nullptr),
_sizeType(SIZE_ABSOLUTE), _sizeType(SIZE_ABSOLUTE),
_sizePercent(cocos2d::Point::ZERO), _sizePercent(cocos2d::Point::ZERO),
_positionType(POSITION_ABSOLUTE), _positionType(POSITION_ABSOLUTE),
_positionPercent(cocos2d::Point::ZERO), _positionPercent(cocos2d::Point::ZERO),
_isRunning(false), _isRunning(false),
_userObject(NULL) _userObject(nullptr)
{ {
} }
UIWidget::~UIWidget() UIWidget::~UIWidget()
{ {
_touchEventListener = NULL; _touchEventListener = nullptr;
_touchEventSelector = NULL; _touchEventSelector = nullptr;
removeAllChildren(); removeAllChildren();
_children->release(); _children->release();
_renderer->removeAllChildrenWithCleanup(true); _renderer->removeAllChildrenWithCleanup(true);
_renderer->removeFromParentAndCleanup(true); _renderer->removeFromParentAndCleanup(true);
_renderer->release(); _renderer->release();
setParent(NULL); setParent(nullptr);
_layoutParameterDictionary->removeAllObjects(); _layoutParameterDictionary->removeAllObjects();
CC_SAFE_RELEASE(_layoutParameterDictionary); CC_SAFE_RELEASE(_layoutParameterDictionary);
CC_SAFE_RELEASE(_scheduler); CC_SAFE_RELEASE(_scheduler);
@ -99,7 +99,7 @@ UIWidget* UIWidget::create()
return widget; return widget;
} }
CC_SAFE_DELETE(widget); CC_SAFE_DELETE(widget);
return NULL; return nullptr;
} }
bool UIWidget::init() bool UIWidget::init()
@ -210,7 +210,7 @@ bool UIWidget::removeChild(UIWidget *child)
child->onExit(); child->onExit();
} }
child->setUpdateEnabled(false); child->setUpdateEnabled(false);
child->setParent(NULL); child->setParent(nullptr);
_renderer->removeChild(child->getRenderer()); _renderer->removeChild(child->getRenderer());
_children->removeObject(child); _children->removeObject(child);
return true; return true;
@ -334,7 +334,7 @@ void UIWidget::setSize(const cocos2d::Size &size)
} }
if (_isRunning) if (_isRunning)
{ {
_sizePercent = (_widgetParent == NULL) ? cocos2d::Point::ZERO : cocos2d::Point(_customSize.width / _widgetParent->getSize().width, _customSize.height / _widgetParent->getSize().height); _sizePercent = (_widgetParent == nullptr) ? cocos2d::Point::ZERO : cocos2d::Point(_customSize.width / _widgetParent->getSize().width, _customSize.height / _widgetParent->getSize().height);
} }
onSizeChanged(); onSizeChanged();
} }
@ -345,7 +345,7 @@ void UIWidget::setSizePercent(const cocos2d::Point &percent)
cocos2d::Size cSize = _customSize; cocos2d::Size cSize = _customSize;
if (_isRunning) if (_isRunning)
{ {
cSize = (_widgetParent == NULL) ? cocos2d::Size::ZERO : cocos2d::Size(_widgetParent->getSize().width * percent.x , _widgetParent->getSize().height * percent.y); cSize = (_widgetParent == nullptr) ? cocos2d::Size::ZERO : cocos2d::Size(_widgetParent->getSize().width * percent.x , _widgetParent->getSize().height * percent.y);
} }
if (_ignoreSize) if (_ignoreSize)
{ {
@ -372,11 +372,11 @@ void UIWidget::updateSizeAndPosition()
{ {
_size = _customSize; _size = _customSize;
} }
_sizePercent = (_widgetParent == NULL) ? cocos2d::Point::ZERO : cocos2d::Point(_customSize.width / _widgetParent->getSize().width, _customSize.height / _widgetParent->getSize().height); _sizePercent = (_widgetParent == nullptr) ? cocos2d::Point::ZERO : cocos2d::Point(_customSize.width / _widgetParent->getSize().width, _customSize.height / _widgetParent->getSize().height);
break; break;
case SIZE_PERCENT: case SIZE_PERCENT:
{ {
cocos2d::Size cSize = (_widgetParent == NULL) ? cocos2d::Size::ZERO : cocos2d::Size(_widgetParent->getSize().width * _sizePercent.x , _widgetParent->getSize().height * _sizePercent.y); cocos2d::Size cSize = (_widgetParent == nullptr) ? cocos2d::Size::ZERO : cocos2d::Size(_widgetParent->getSize().width * _sizePercent.x , _widgetParent->getSize().height * _sizePercent.y);
if (_ignoreSize) if (_ignoreSize)
{ {
_size = getContentSize(); _size = getContentSize();
@ -396,7 +396,7 @@ void UIWidget::updateSizeAndPosition()
switch (_positionType) switch (_positionType)
{ {
case POSITION_ABSOLUTE: case POSITION_ABSOLUTE:
_positionPercent = (_widgetParent == NULL) ? cocos2d::Point::ZERO : cocos2d::Point(absPos.x / _widgetParent->getSize().width, absPos.y / _widgetParent->getSize().height); _positionPercent = (_widgetParent == nullptr) ? cocos2d::Point::ZERO : cocos2d::Point(absPos.x / _widgetParent->getSize().width, absPos.y / _widgetParent->getSize().height);
break; break;
case POSITION_PERCENT: case POSITION_PERCENT:
{ {
@ -740,7 +740,7 @@ bool UIWidget::clippingParentAreaContainPoint(const cocos2d::Point &pt)
{ {
_affectByClipping = false; _affectByClipping = false;
UIWidget* parent = getParent(); UIWidget* parent = getParent();
UIWidget* clippingParent = NULL; UIWidget* clippingParent = nullptr;
while (parent) while (parent)
{ {
UILayout* layoutParent = dynamic_cast<UILayout*>(parent); UILayout* layoutParent = dynamic_cast<UILayout*>(parent);
@ -790,7 +790,7 @@ void UIWidget::setPosition(const cocos2d::Point &pos)
{ {
if (_isRunning) if (_isRunning)
{ {
_positionPercent = (_widgetParent == NULL) ? cocos2d::Point::ZERO : cocos2d::Point(pos.x / _widgetParent->getSize().width, pos.y / _widgetParent->getSize().height); _positionPercent = (_widgetParent == nullptr) ? cocos2d::Point::ZERO : cocos2d::Point(pos.x / _widgetParent->getSize().width, pos.y / _widgetParent->getSize().height);
} }
_renderer->setPosition(pos); _renderer->setPosition(pos);
} }