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 {
static GUIReader* sharedReader = NULL;
static GUIReader* sharedReader = nullptr;
GUIReader::GUIReader():
m_strFilePath("")
@ -122,26 +122,26 @@ const cocos2d::Size GUIReader::getFileDesignSize(const char* fileName) const
UIWidget* GUIReader::widgetFromJsonFile(const char *fileName)
{
DictionaryHelper* dicHelper = DICTOOL;
const char *des = NULL;
const char *des = nullptr;
std::string jsonpath;
JsonDictionary *jsonDict = NULL;
JsonDictionary *jsonDict = nullptr;
jsonpath = CCFileUtils::getInstance()->fullPathForFilename(fileName);
int pos = jsonpath.find_last_of('/');
m_strFilePath = jsonpath.substr(0,pos+1);
long size = 0;
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);
return NULL;
return nullptr;
}
std::string strDes(des);
jsonDict = new JsonDictionary();
jsonDict->initWithDescription(strDes.c_str());
UIWidget* widget = NULL;
UIWidget* widget = nullptr;
const char* fileVersion = dicHelper->getStringValue_json(jsonDict, "version");
WidgetPropertiesReader * pReader = NULL;
WidgetPropertiesReader * pReader = nullptr;
if (fileVersion)
{
int versionInteger = getVersionInteger(fileVersion);
@ -221,7 +221,7 @@ UIWidget* WidgetPropertiesReader0250::createWidget(JsonDictionary* data, const c
UIWidget* WidgetPropertiesReader0250::widgetFromJsonDictionary(JsonDictionary *data)
{
DictionaryHelper* dicHelper = DICTOOL;
UIWidget* widget = NULL;
UIWidget* widget = nullptr;
const char* classname = dicHelper->getStringValue_json(data, "classname");
JsonDictionary* uiOptions = dicHelper->getSubDictionary_json(data, "options");
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* disabledFileName = dicHelper->getStringValue_json(options, "disabled");
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL;
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL;
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).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():nullptr;
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture");
if (scale9Enable)
{
@ -484,11 +484,11 @@ void WidgetPropertiesReader0250::setPropsForCheckBoxFromJsonDictionary(UIWidget*
std::string tp_bd = 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* backGroundSelectedFileName_tp = (backGroundSelectedFileName && (strcmp(backGroundSelectedFileName, "") != 0))?tp_bs.append(backGroundSelectedFileName).c_str():NULL;
const char* frontCrossFileName_tp = (frontCrossFileName && (strcmp(frontCrossFileName, "") != 0))?tp_c.append(frontCrossFileName).c_str():NULL;
const char* backGroundDisabledFileName_tp = (backGroundDisabledFileName && (strcmp(backGroundDisabledFileName, "") != 0))?tp_bd.append(backGroundDisabledFileName).c_str():NULL;
const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).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():nullptr;
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():nullptr;
const char* frontCrossDisabledFileName_tp = (frontCrossDisabledFileName && (strcmp(frontCrossDisabledFileName, "") != 0))?tp_cd.append(frontCrossDisabledFileName).c_str():nullptr;
bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture");
if (useMergedTexture)
@ -519,7 +519,7 @@ void WidgetPropertiesReader0250::setPropsForImageViewFromJsonDictionary(UIWidget
imageView->setScale9Enabled(scale9Enable);
std::string tp_i = m_strFilePath;
const char* imageFileName_tp = NULL;
const char* imageFileName_tp = nullptr;
if (imageFileName && (strcmp(imageFileName, "") != 0))
{
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))
{
std::string tp_c = m_strFilePath;
const char* cmf_tp = NULL;
const char* cmf_tp = nullptr;
const char* cmft = dicHelper->getStringValue_json(options, "charMapFile");
cmf_tp = tp_c.append(cmft).c_str();
@ -668,7 +668,7 @@ void WidgetPropertiesReader0250::setPropsForLayoutFromJsonDictionary(UIWidget*wi
std::string tp_b = m_strFilePath;
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");
if (backGroundScale9Enable)
{
@ -732,7 +732,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_b = m_strFilePath;
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)
{
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
@ -747,7 +747,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_b = m_strFilePath;
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)
{
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* disabledFileName = dicHelper->getStringValue_json(options, "ballDisabled");
const char* normalFileName_tp = (normalFileName && (strcmp(normalFileName, "") != 0))?tp_n.append(normalFileName).c_str():NULL;
const char* pressedFileName_tp = (pressedFileName && (strcmp(pressedFileName, "") != 0))?tp_p.append(pressedFileName).c_str():NULL;
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).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():nullptr;
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
if (useMergedTexture)
{
slider->loadSlidBallTextures(normalFileName,pressedFileName,disabledFileName,UI_TEX_TYPE_PLIST);
@ -781,7 +781,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(UIWidget*wi
std::string tp_b = m_strFilePath;
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)
{
slider->loadProgressBarTexture(imageFileName, UI_TEX_TYPE_PLIST);
@ -852,7 +852,7 @@ void WidgetPropertiesReader0250::setPropsForLoadingBarFromJsonDictionary(UIWidge
bool useMergedTexture = dicHelper->getBooleanValue_json(options, "useMergedTexture");
std::string tp_b = m_strFilePath;
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)
{
loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
@ -875,7 +875,7 @@ void WidgetPropertiesReader0250::setPropsForLabelBMFontFromJsonDictionary(UIWidg
UILabelBMFont* labelBMFont = (UILabelBMFont*)widget;
std::string tp_c = m_strFilePath;
const char* cmf_tp = NULL;
const char* cmf_tp = nullptr;
const char* cmft = dicHelper->getStringValue_json(options, "fileName");
cmf_tp = tp_c.append(cmft).c_str();
@ -940,7 +940,7 @@ UIWidget* WidgetPropertiesReader0300::createWidget(JsonDictionary* data, const c
UIWidget* WidgetPropertiesReader0300::widgetFromJsonDictionary(JsonDictionary *data)
{
DictionaryHelper* dicHelper = DICTOOL;
UIWidget* widget = NULL;
UIWidget* widget = nullptr;
const char* classname = dicHelper->getStringValue_json(data, "classname");
JsonDictionary* uiOptions = dicHelper->getSubDictionary_json(data, "options");
if (classname && strcmp(classname, "Button") == 0)
@ -1099,7 +1099,7 @@ void WidgetPropertiesReader0300::setPropsForWidgetFromJsonDictionary(UIWidget*wi
if (layoutParameterDic)
{
int paramType = dicHelper->getIntValue_json(layoutParameterDic, "type");
UILayoutParameter* parameter = NULL;
UILayoutParameter* parameter = nullptr;
switch (paramType)
{
case 0:
@ -1178,7 +1178,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(UIWidget*wi
{
std::string tp_n = m_strFilePath;
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);
break;
}
@ -1200,7 +1200,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(UIWidget*wi
{
std::string tp_p = m_strFilePath;
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);
break;
}
@ -1222,7 +1222,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(UIWidget*wi
{
std::string tp_d = m_strFilePath;
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);
break;
}
@ -1297,7 +1297,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{
std::string tp_b = m_strFilePath;
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);
break;
}
@ -1320,7 +1320,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{
std::string tp_bs = m_strFilePath;
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);
break;
}
@ -1343,7 +1343,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{
std::string tp_c = m_strFilePath;
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);
break;
}
@ -1366,7 +1366,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{
std::string tp_bd = m_strFilePath;
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);
break;
}
@ -1389,7 +1389,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(UIWidget*
{
std::string tp_cd = m_strFilePath;
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);
break;
}
@ -1422,7 +1422,7 @@ void WidgetPropertiesReader0300::setPropsForImageViewFromJsonDictionary(UIWidget
{
std::string tp_i = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path");
const char* imageFileName_tp = NULL;
const char* imageFileName_tp = nullptr;
if (imageFileName && (strcmp(imageFileName, "") != 0))
{
imageFileName_tp = tp_i.append(imageFileName).c_str();
@ -1592,7 +1592,7 @@ void WidgetPropertiesReader0300::setPropsForLayoutFromJsonDictionary(UIWidget*wi
{
std::string tp_b = m_strFilePath;
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);
break;
}
@ -1656,7 +1656,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_b = m_strFilePath;
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);
break;
}
@ -1683,7 +1683,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_b = m_strFilePath;
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);
break;
}
@ -1708,7 +1708,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_n = m_strFilePath;
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);
break;
}
@ -1731,7 +1731,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_p = m_strFilePath;
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);
break;
}
@ -1754,7 +1754,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_d = m_strFilePath;
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);
break;
}
@ -1779,7 +1779,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(UIWidget*wi
{
std::string tp_b = m_strFilePath;
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);
break;
}
@ -1860,7 +1860,7 @@ void WidgetPropertiesReader0300::setPropsForLoadingBarFromJsonDictionary(UIWidge
{
std::string tp_i = m_strFilePath;
const char* imageFileName = dicHelper->getStringValue_json(imageFileNameDic, "path");
const char* imageFileName_tp = NULL;
const char* imageFileName_tp = nullptr;
if (imageFileName && (strcmp(imageFileName, "") != 0))
{
imageFileName_tp = tp_i.append(imageFileName).c_str();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ UICCLabelAtlas* UICCLabelAtlas::create()
}
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)
@ -79,7 +79,7 @@ void UICCLabelAtlas::updateDisplayedOpacity(GLubyte opacity)
UILabelAtlas::UILabelAtlas():
_laberAtlasRenderer(NULL),
_laberAtlasRenderer(nullptr),
_stringValue(""),
_charMapFileName(""),
_itemWidth(0),
@ -103,7 +103,7 @@ UILabelAtlas* UILabelAtlas::create()
return widget;
}
CC_SAFE_DELETE(widget);
return NULL;
return nullptr;
}
void UILabelAtlas::initRenderer()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,7 @@ UIRootWidget* UIRootWidget::create()
return widget;
}
CC_SAFE_DELETE(widget);
return NULL;
return nullptr;
}
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);
UIScrollView::UIScrollView():
_innerContainer(NULL),
_innerContainer(nullptr),
_direction(SCROLLVIEW_DIR_VERTICAL),
_touchBeganPoint(cocos2d::Point::ZERO),
_touchMovedPoint(cocos2d::Point::ZERO),
@ -69,15 +69,15 @@ _bouncing(false),
_bounceDir(cocos2d::Point::ZERO),
_bounceOriginalSpeed(0.0f),
_inertiaScrollEnabled(true),
_scrollViewEventListener(NULL),
_scrollViewEventSelector(NULL)
_scrollViewEventListener(nullptr),
_scrollViewEventSelector(nullptr)
{
}
UIScrollView::~UIScrollView()
{
_scrollViewEventListener = NULL;
_scrollViewEventSelector = NULL;
_scrollViewEventListener = nullptr;
_scrollViewEventSelector = nullptr;
}
UIScrollView* UIScrollView::create()
@ -89,7 +89,7 @@ UIScrollView* UIScrollView::create()
return widget;
}
CC_SAFE_DELETE(widget);
return NULL;
return nullptr;
}
bool UIScrollView::init()

View File

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

View File

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

View File

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