mirror of https://github.com/axmolengine/axmol.git
issue #5057, refactor WidgetType to strong typed enum
This commit is contained in:
parent
6a7277c38f
commit
762e8d9249
|
@ -412,9 +412,9 @@ void WidgetPropertiesReader0250::setColorPropsForWidgetFromJsonDictionary(Widget
|
||||||
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
||||||
widget->setColor(Color3B(colorR, colorG, colorB));
|
widget->setColor(Color3B(colorR, colorG, colorB));
|
||||||
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
||||||
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == Widget::Type::ELEMENT) ? 0.5f : 0.0f);
|
||||||
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
||||||
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == Widget::Type::ELEMENT) ? 0.5f : 0.0f);
|
||||||
widget->setAnchorPoint(Vector2(apxf, apyf));
|
widget->setAnchorPoint(Vector2(apxf, apyf));
|
||||||
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
||||||
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
||||||
|
@ -450,7 +450,7 @@ void WidgetPropertiesReader0250::setPropsForButtonFromJsonDictionary(Widget*widg
|
||||||
|
|
||||||
if (useMergedTexture)
|
if (useMergedTexture)
|
||||||
{
|
{
|
||||||
button->loadTextures(normalFileName, pressedFileName, disabledFileName,UI_TEX_TYPE_PLIST);
|
button->loadTextures(normalFileName, pressedFileName, disabledFileName,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -470,7 +470,7 @@ void WidgetPropertiesReader0250::setPropsForButtonFromJsonDictionary(Widget*widg
|
||||||
{
|
{
|
||||||
if (useMergedTexture)
|
if (useMergedTexture)
|
||||||
{
|
{
|
||||||
button->loadTextures(normalFileName, pressedFileName, disabledFileName,UI_TEX_TYPE_PLIST);
|
button->loadTextures(normalFileName, pressedFileName, disabledFileName,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -531,7 +531,7 @@ void WidgetPropertiesReader0250::setPropsForCheckBoxFromJsonDictionary(Widget*wi
|
||||||
|
|
||||||
if (useMergedTexture)
|
if (useMergedTexture)
|
||||||
{
|
{
|
||||||
checkBox->loadTextures(backGroundFileName, backGroundSelectedFileName, frontCrossFileName,backGroundDisabledFileName,frontCrossDisabledFileName,UI_TEX_TYPE_PLIST);
|
checkBox->loadTextures(backGroundFileName, backGroundSelectedFileName, frontCrossFileName,backGroundDisabledFileName,frontCrossDisabledFileName,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -566,7 +566,7 @@ void WidgetPropertiesReader0250::setPropsForImageViewFromJsonDictionary(Widget*w
|
||||||
{
|
{
|
||||||
if (useMergedTexture)
|
if (useMergedTexture)
|
||||||
{
|
{
|
||||||
imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
imageView->loadTexture(imageFileName,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -593,7 +593,7 @@ void WidgetPropertiesReader0250::setPropsForImageViewFromJsonDictionary(Widget*w
|
||||||
{
|
{
|
||||||
if (useMergedTexture)
|
if (useMergedTexture)
|
||||||
{
|
{
|
||||||
imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
imageView->loadTexture(imageFileName,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -711,7 +711,7 @@ void WidgetPropertiesReader0250::setPropsForLayoutFromJsonDictionary(Widget*widg
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
||||||
if (useMergedTexture)
|
if (useMergedTexture)
|
||||||
{
|
{
|
||||||
panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST);
|
panel->setBackGroundImage(imageFileName,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -724,7 +724,7 @@ void WidgetPropertiesReader0250::setPropsForLayoutFromJsonDictionary(Widget*widg
|
||||||
|
|
||||||
if (useMergedTexture)
|
if (useMergedTexture)
|
||||||
{
|
{
|
||||||
panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST);
|
panel->setBackGroundImage(imageFileName,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -766,7 +766,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
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,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -781,7 +781,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
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,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -802,7 +802,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
const char* disabledFileName_tp = (disabledFileName && (strcmp(disabledFileName, "") != 0))?tp_d.append(disabledFileName).c_str():nullptr;
|
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,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -815,7 +815,7 @@ void WidgetPropertiesReader0250::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
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, TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -884,7 +884,7 @@ void WidgetPropertiesReader0250::setPropsForLoadingBarFromJsonDictionary(Widget
|
||||||
const char* imageFileName_tp = (imageFileName && (strcmp(imageFileName, "") != 0))?tp_b.append(imageFileName).c_str():nullptr;
|
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,TextureResType::PLIST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1234,9 +1234,9 @@ void WidgetPropertiesReader0300::setColorPropsForWidgetFromJsonDictionary(Widget
|
||||||
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
||||||
widget->setColor(Color3B(colorR, colorG, colorB));
|
widget->setColor(Color3B(colorR, colorG, colorB));
|
||||||
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
||||||
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == Widget::Type::ELEMENT) ? 0.5f : 0.0f);
|
||||||
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
||||||
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == Widget::Type::ELEMENT) ? 0.5f : 0.0f);
|
||||||
widget->setAnchorPoint(Vector2(apxf, apyf));
|
widget->setAnchorPoint(Vector2(apxf, apyf));
|
||||||
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
||||||
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
||||||
|
@ -1266,7 +1266,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
||||||
button->loadTextureNormal(normalFileName,UI_TEX_TYPE_PLIST);
|
button->loadTextureNormal(normalFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1287,7 +1287,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
||||||
button->loadTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST);
|
button->loadTexturePressed(pressedFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1308,7 +1308,7 @@ void WidgetPropertiesReader0300::setPropsForButtonFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
||||||
button->loadTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST);
|
button->loadTextureDisabled(disabledFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1381,7 +1381,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(Widget*wi
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path");
|
const char* backGroundFileName = DICTOOL->getStringValue_json(backGroundDic, "path");
|
||||||
checkBox->loadTextureBackGround(backGroundFileName,UI_TEX_TYPE_PLIST);
|
checkBox->loadTextureBackGround(backGroundFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1403,7 +1403,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(Widget*wi
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path");
|
const char* backGroundSelectedFileName = DICTOOL->getStringValue_json(backGroundSelectedDic, "path");
|
||||||
checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName,UI_TEX_TYPE_PLIST);
|
checkBox->loadTextureBackGroundSelected(backGroundSelectedFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1425,7 +1425,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(Widget*wi
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path");
|
const char* frontCrossFileName = DICTOOL->getStringValue_json(frontCrossDic, "path");
|
||||||
checkBox->loadTextureFrontCross(frontCrossFileName,UI_TEX_TYPE_PLIST);
|
checkBox->loadTextureFrontCross(frontCrossFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1447,7 +1447,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(Widget*wi
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path");
|
const char* backGroundDisabledFileName = DICTOOL->getStringValue_json(backGroundDisabledDic, "path");
|
||||||
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName,UI_TEX_TYPE_PLIST);
|
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1469,7 +1469,7 @@ void WidgetPropertiesReader0300::setPropsForCheckBoxFromJsonDictionary(Widget*wi
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path");
|
const char* frontCrossDisabledFileName = DICTOOL->getStringValue_json(options, "path");
|
||||||
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName,UI_TEX_TYPE_PLIST);
|
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1504,7 +1504,7 @@ void WidgetPropertiesReader0300::setPropsForImageViewFromJsonDictionary(Widget*w
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
||||||
imageView->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
imageView->loadTexture(imageFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1679,7 +1679,7 @@ void WidgetPropertiesReader0300::setPropsForLayoutFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
||||||
panel->setBackGroundImage(imageFileName,UI_TEX_TYPE_PLIST);
|
panel->setBackGroundImage(imageFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1740,7 +1740,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
||||||
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
slider->loadBarTexture(imageFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1766,7 +1766,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
const char*imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
||||||
slider->loadBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
slider->loadBarTexture(imageFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1790,7 +1790,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
const char* normalFileName = DICTOOL->getStringValue_json(normalDic, "path");
|
||||||
slider->loadSlidBallTextureNormal(normalFileName,UI_TEX_TYPE_PLIST);
|
slider->loadSlidBallTextureNormal(normalFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1812,7 +1812,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
const char* pressedFileName = DICTOOL->getStringValue_json(pressedDic, "path");
|
||||||
slider->loadSlidBallTexturePressed(pressedFileName,UI_TEX_TYPE_PLIST);
|
slider->loadSlidBallTexturePressed(pressedFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1834,7 +1834,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
const char* disabledFileName = DICTOOL->getStringValue_json(disabledDic, "path");
|
||||||
slider->loadSlidBallTextureDisabled(disabledFileName,UI_TEX_TYPE_PLIST);
|
slider->loadSlidBallTextureDisabled(disabledFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1858,7 +1858,7 @@ void WidgetPropertiesReader0300::setPropsForSliderFromJsonDictionary(Widget*widg
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path");
|
const char* imageFileName = DICTOOL->getStringValue_json(progressBarDic, "path");
|
||||||
slider->loadProgressBarTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
slider->loadProgressBarTexture(imageFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1941,7 +1941,7 @@ void WidgetPropertiesReader0300::setPropsForLoadingBarFromJsonDictionary(Widget
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
const char* imageFileName = DICTOOL->getStringValue_json(imageFileNameDic, "path");
|
||||||
loadingBar->loadTexture(imageFileName,UI_TEX_TYPE_PLIST);
|
loadingBar->loadTexture(imageFileName,TextureResType::PLIST);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -163,9 +163,9 @@ namespace cocostudio
|
||||||
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
||||||
widget->setColor(Color3B(colorR, colorG, colorB));
|
widget->setColor(Color3B(colorR, colorG, colorB));
|
||||||
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
bool apx = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
||||||
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
float apxf = apx ? DICTOOL->getFloatValue_json(options, "anchorPointX") : ((widget->getWidgetType() == Widget::Type::ELEMENT) ? 0.5f : 0.0f);
|
||||||
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
bool apy = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
||||||
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == WidgetTypeWidget) ? 0.5f : 0.0f);
|
float apyf = apy ? DICTOOL->getFloatValue_json(options, "anchorPointY") : ((widget->getWidgetType() == Widget::Type::ELEMENT) ? 0.5f : 0.0f);
|
||||||
widget->setAnchorPoint(Vector2(apxf, apyf));
|
widget->setAnchorPoint(Vector2(apxf, apyf));
|
||||||
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
||||||
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
||||||
|
|
|
@ -39,10 +39,14 @@ CC_DEPRECATED_ATTRIBUTE const Widget::SizeType SIZE_ABSOLUTE = Widget::SizeType:
|
||||||
CC_DEPRECATED_ATTRIBUTE const Widget::SizeType SIZE_PERCENT = Widget::SizeType::PERCENT;
|
CC_DEPRECATED_ATTRIBUTE const Widget::SizeType SIZE_PERCENT = Widget::SizeType::PERCENT;
|
||||||
CC_DEPRECATED_ATTRIBUTE const Widget::TextureResType UI_TEX_TYPE_LOCAL = Widget::TextureResType::LOCAL;
|
CC_DEPRECATED_ATTRIBUTE const Widget::TextureResType UI_TEX_TYPE_LOCAL = Widget::TextureResType::LOCAL;
|
||||||
CC_DEPRECATED_ATTRIBUTE const Widget::TextureResType UI_TEX_TYPE_PLIST = Widget::TextureResType::PLIST;
|
CC_DEPRECATED_ATTRIBUTE const Widget::TextureResType UI_TEX_TYPE_PLIST = Widget::TextureResType::PLIST;
|
||||||
|
CC_DEPRECATED_ATTRIBUTE const Widget::Type WidgetTypeWidget = Widget::Type::ELEMENT;
|
||||||
|
CC_DEPRECATED_ATTRIBUTE const Widget::Type WidgetTypeContainer = Widget::Type::CONTAINER;
|
||||||
|
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE typedef Widget::TextureResType TextureResType;
|
CC_DEPRECATED_ATTRIBUTE typedef Widget::TextureResType TextureResType;
|
||||||
CC_DEPRECATED_ATTRIBUTE typedef Widget::PositionType PositionType;
|
CC_DEPRECATED_ATTRIBUTE typedef Widget::PositionType PositionType;
|
||||||
CC_DEPRECATED_ATTRIBUTE typedef Widget::SizeType SizeType;
|
CC_DEPRECATED_ATTRIBUTE typedef Widget::SizeType SizeType;
|
||||||
|
CC_DEPRECATED_ATTRIBUTE typedef Widget::Type WidgetType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -608,7 +608,7 @@ _curLayoutExecutant(nullptr),
|
||||||
_passFocusToChild(true),
|
_passFocusToChild(true),
|
||||||
_loopFocus(false)
|
_loopFocus(false)
|
||||||
{
|
{
|
||||||
_widgetType = WidgetTypeContainer;
|
_widgetType = Type::CONTAINER;
|
||||||
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
onPassFocusToChild = CC_CALLBACK_2(Layout::findNearestChildWidgetIndex, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ void PageView::addPage(Layout* page)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (page->getWidgetType() != WidgetTypeContainer)
|
if (page->getWidgetType() != Widget::Type::CONTAINER)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ void PageView::insertPage(Layout* page, int idx)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (page->getWidgetType() != WidgetTypeContainer)
|
if (page->getWidgetType() != Widget::Type::CONTAINER)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ _touchEndPos(Vector2::ZERO),
|
||||||
_touchEventListener(nullptr),
|
_touchEventListener(nullptr),
|
||||||
_touchEventSelector(nullptr),
|
_touchEventSelector(nullptr),
|
||||||
_name("default"),
|
_name("default"),
|
||||||
_widgetType(WidgetTypeWidget),
|
_widgetType(Type::ELEMENT),
|
||||||
_actionTag(0),
|
_actionTag(0),
|
||||||
_size(Size::ZERO),
|
_size(Size::ZERO),
|
||||||
_customSize(Size::ZERO),
|
_customSize(Size::ZERO),
|
||||||
|
@ -840,7 +840,7 @@ const char* Widget::getName() const
|
||||||
return _name.c_str();
|
return _name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetType Widget::getWidgetType() const
|
Widget::Type Widget::getWidgetType() const
|
||||||
{
|
{
|
||||||
return _widgetType;
|
return _widgetType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,6 @@ typedef enum
|
||||||
BRIGHT_HIGHLIGHT
|
BRIGHT_HIGHLIGHT
|
||||||
}BrightStyle;
|
}BrightStyle;
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
WidgetTypeWidget, //control
|
|
||||||
WidgetTypeContainer //container
|
|
||||||
}WidgetType;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE typedef enum
|
CC_DEPRECATED_ATTRIBUTE typedef enum
|
||||||
|
@ -102,6 +96,12 @@ public:
|
||||||
PLIST = 1
|
PLIST = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class Type
|
||||||
|
{
|
||||||
|
ELEMENT,
|
||||||
|
CONTAINER
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef std::function<void(Ref*,Widget::TouchEventType)> ccWidgetTouchCallback;
|
typedef std::function<void(Ref*,Widget::TouchEventType)> ccWidgetTouchCallback;
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return A WidgetType
|
* @return A WidgetType
|
||||||
*/
|
*/
|
||||||
WidgetType getWidgetType() const;
|
Type getWidgetType() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the size that is widget's size
|
* Changes the size that is widget's size
|
||||||
|
@ -662,7 +662,7 @@ protected:
|
||||||
ccWidgetTouchCallback _touchEventCallback;
|
ccWidgetTouchCallback _touchEventCallback;
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
WidgetType _widgetType;
|
Type _widgetType;
|
||||||
int _actionTag;
|
int _actionTag;
|
||||||
Size _size;
|
Size _size;
|
||||||
Size _customSize;
|
Size _customSize;
|
||||||
|
|
Loading…
Reference in New Issue