mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6991 from andyque/fixUIFrameColorAndOpacity
fix UI frame cascade color and opacity
This commit is contained in:
commit
ccff80df2f
|
@ -260,7 +260,10 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType)
|
||||||
_normalTextureSize = _buttonNormalRenderer->getContentSize();
|
_normalTextureSize = _buttonNormalRenderer->getContentSize();
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_buttonNormalRenderer);
|
|
||||||
|
_buttonNormalRenderer->setColor(this->getColor());
|
||||||
|
_buttonNormalRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
updateContentSizeWithTextureSize(_normalTextureSize);
|
updateContentSizeWithTextureSize(_normalTextureSize);
|
||||||
_normalTextureLoaded = true;
|
_normalTextureLoaded = true;
|
||||||
_normalTextureAdaptDirty = true;
|
_normalTextureAdaptDirty = true;
|
||||||
|
@ -308,7 +311,10 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy
|
||||||
_pressedTextureSize = _buttonClickedRenderer->getContentSize();
|
_pressedTextureSize = _buttonClickedRenderer->getContentSize();
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_buttonDisableRenderer);
|
|
||||||
|
_buttonDisableRenderer->setColor(this->getColor());
|
||||||
|
_buttonDisableRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
_pressedTextureLoaded = true;
|
_pressedTextureLoaded = true;
|
||||||
_pressedTextureAdaptDirty = true;
|
_pressedTextureAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +361,9 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT
|
||||||
_disabledTextureSize = _buttonDisableRenderer->getContentSize();
|
_disabledTextureSize = _buttonDisableRenderer->getContentSize();
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_buttonDisableRenderer);
|
_buttonDisableRenderer->setColor(this->getColor());
|
||||||
|
_buttonDisableRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
_disabledTextureLoaded = true;
|
_disabledTextureLoaded = true;
|
||||||
_disabledTextureAdaptDirty = true;
|
_disabledTextureAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -432,7 +440,7 @@ void Button::onPressStateChangedToNormal()
|
||||||
{
|
{
|
||||||
if (_scale9Enabled)
|
if (_scale9Enabled)
|
||||||
{
|
{
|
||||||
updateTextureRGBA();
|
updateTexturesRGBA();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -442,6 +450,17 @@ void Button::onPressStateChangedToNormal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Button::updateTexturesRGBA()
|
||||||
|
{
|
||||||
|
_buttonNormalRenderer->setColor(this->getColor());
|
||||||
|
_buttonClickedRenderer->setColor(this->getColor());
|
||||||
|
_buttonDisableRenderer->setColor(this->getColor());
|
||||||
|
|
||||||
|
_buttonNormalRenderer->setOpacity(this->getOpacity());
|
||||||
|
_buttonClickedRenderer->setOpacity(this->getOpacity());
|
||||||
|
_buttonDisableRenderer->setOpacity(this->getOpacity());
|
||||||
|
}
|
||||||
|
|
||||||
void Button::onPressStateChangedToPressed()
|
void Button::onPressStateChangedToPressed()
|
||||||
{
|
{
|
||||||
if (_pressedTextureLoaded)
|
if (_pressedTextureLoaded)
|
||||||
|
@ -733,27 +752,6 @@ std::string Button::getDescription() const
|
||||||
return "Button";
|
return "Button";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_buttonNormalRenderer);
|
|
||||||
updateColorToRenderer(_buttonClickedRenderer);
|
|
||||||
updateColorToRenderer(_buttonDisableRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Button::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_buttonNormalRenderer);
|
|
||||||
updateOpacityToRenderer(_buttonClickedRenderer);
|
|
||||||
updateOpacityToRenderer(_buttonDisableRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Button::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_buttonNormalRenderer);
|
|
||||||
updateRGBAToRenderer(_buttonClickedRenderer);
|
|
||||||
updateRGBAToRenderer(_buttonDisableRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* Button::createCloneInstance()
|
Widget* Button::createCloneInstance()
|
||||||
{
|
{
|
||||||
return Button::create();
|
return Button::create();
|
||||||
|
|
|
@ -201,18 +201,22 @@ protected:
|
||||||
virtual void onPressStateChangedToPressed() override;
|
virtual void onPressStateChangedToPressed() override;
|
||||||
virtual void onPressStateChangedToDisabled() override;
|
virtual void onPressStateChangedToDisabled() override;
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
virtual void updateFlippedX() override;
|
virtual void updateFlippedX() override;
|
||||||
virtual void updateFlippedY() override;
|
virtual void updateFlippedY() override;
|
||||||
|
|
||||||
|
void updateTexturesRGBA();
|
||||||
|
|
||||||
void normalTextureScaleChangedWithSize();
|
void normalTextureScaleChangedWithSize();
|
||||||
void pressedTextureScaleChangedWithSize();
|
void pressedTextureScaleChangedWithSize();
|
||||||
void disabledTextureScaleChangedWithSize();
|
void disabledTextureScaleChangedWithSize();
|
||||||
virtual Widget* createCloneInstance() override;
|
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
|
||||||
virtual void adaptRenderers() override;
|
virtual void adaptRenderers() override;
|
||||||
void updateTitleLocation();
|
void updateTitleLocation();
|
||||||
|
|
||||||
|
virtual Widget* createCloneInstance() override;
|
||||||
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Node* _buttonNormalRenderer;
|
Node* _buttonNormalRenderer;
|
||||||
Node* _buttonClickedRenderer;
|
Node* _buttonClickedRenderer;
|
||||||
|
|
|
@ -184,7 +184,9 @@ void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResTyp
|
||||||
}
|
}
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_backGroundBoxRenderer);
|
_backGroundBoxRenderer->setColor(this->getColor());
|
||||||
|
_backGroundBoxRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize());
|
updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize());
|
||||||
_backGroundBoxRendererAdaptDirty = true;
|
_backGroundBoxRendererAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +212,8 @@ void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelect
|
||||||
}
|
}
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_backGroundSelectedBoxRenderer);
|
_backGroundSelectedBoxRenderer->setColor(this->getColor());
|
||||||
|
_backGroundSelectedBoxRenderer->setOpacity(this->getOpacity());
|
||||||
_backGroundSelectedBoxRendererAdaptDirty = true;
|
_backGroundSelectedBoxRendererAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +238,8 @@ void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType tex
|
||||||
}
|
}
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_frontCrossRenderer);
|
_frontCrossRenderer->setColor(this->getColor());
|
||||||
|
_frontCrossRenderer->setOpacity(this->getOpacity());
|
||||||
_frontCrossRendererAdaptDirty = true;
|
_frontCrossRendererAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +264,9 @@ void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabl
|
||||||
}
|
}
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_backGroundBoxDisabledRenderer);
|
_backGroundBoxDisabledRenderer->setColor(this->getColor());
|
||||||
|
_backGroundBoxDisabledRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
_backGroundBoxDisabledRendererAdaptDirty = true;
|
_backGroundBoxDisabledRendererAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +291,9 @@ void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabl
|
||||||
}
|
}
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_frontCrossDisabledRenderer);
|
_frontCrossDisabledRenderer->setColor(this->getColor());
|
||||||
|
_frontCrossDisabledRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
_frontCrossDisabledRendererAdaptDirty = true;
|
_frontCrossDisabledRendererAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,33 +574,6 @@ std::string CheckBox::getDescription() const
|
||||||
return "CheckBox";
|
return "CheckBox";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckBox::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_backGroundBoxRenderer);
|
|
||||||
updateColorToRenderer(_backGroundSelectedBoxRenderer);
|
|
||||||
updateColorToRenderer(_frontCrossRenderer);
|
|
||||||
updateColorToRenderer(_backGroundBoxDisabledRenderer);
|
|
||||||
updateColorToRenderer(_frontCrossDisabledRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_backGroundBoxRenderer);
|
|
||||||
updateOpacityToRenderer(_backGroundSelectedBoxRenderer);
|
|
||||||
updateOpacityToRenderer(_frontCrossRenderer);
|
|
||||||
updateOpacityToRenderer(_backGroundBoxDisabledRenderer);
|
|
||||||
updateOpacityToRenderer(_frontCrossDisabledRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckBox::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_backGroundBoxRenderer);
|
|
||||||
updateRGBAToRenderer(_backGroundSelectedBoxRenderer);
|
|
||||||
updateRGBAToRenderer(_frontCrossRenderer);
|
|
||||||
updateRGBAToRenderer(_backGroundBoxDisabledRenderer);
|
|
||||||
updateRGBAToRenderer(_frontCrossDisabledRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* CheckBox::createCloneInstance()
|
Widget* CheckBox::createCloneInstance()
|
||||||
{
|
{
|
||||||
return CheckBox::create();
|
return CheckBox::create();
|
||||||
|
|
|
@ -211,16 +211,16 @@ protected:
|
||||||
virtual void releaseUpEvent();
|
virtual void releaseUpEvent();
|
||||||
|
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
virtual void updateFlippedX() override;
|
virtual void updateFlippedX() override;
|
||||||
virtual void updateFlippedY() override;
|
virtual void updateFlippedY() override;
|
||||||
|
|
||||||
void backGroundTextureScaleChangedWithSize();
|
void backGroundTextureScaleChangedWithSize();
|
||||||
void backGroundSelectedTextureScaleChangedWithSize();
|
void backGroundSelectedTextureScaleChangedWithSize();
|
||||||
void frontCrossTextureScaleChangedWithSize();
|
void frontCrossTextureScaleChangedWithSize();
|
||||||
void backGroundDisabledTextureScaleChangedWithSize();
|
void backGroundDisabledTextureScaleChangedWithSize();
|
||||||
void frontCrossDisabledTextureScaleChangedWithSize();
|
void frontCrossDisabledTextureScaleChangedWithSize();
|
||||||
|
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
virtual void adaptRenderers() override;
|
virtual void adaptRenderers() override;
|
||||||
|
|
|
@ -154,7 +154,9 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType)
|
||||||
_imageTextureSize = _imageRenderer->getContentSize();
|
_imageTextureSize = _imageRenderer->getContentSize();
|
||||||
updateFlippedX();
|
updateFlippedX();
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
updateRGBAToRenderer(_imageRenderer);
|
_imageRenderer->setColor(this->getColor());
|
||||||
|
_imageRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
updateContentSizeWithTextureSize(_imageTextureSize);
|
updateContentSizeWithTextureSize(_imageTextureSize);
|
||||||
_imageRendererAdaptDirty = true;
|
_imageRendererAdaptDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -322,21 +324,6 @@ std::string ImageView::getDescription() const
|
||||||
return "ImageView";
|
return "ImageView";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImageView::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_imageRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageView::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_imageRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImageView::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_imageRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* ImageView::createCloneInstance()
|
Widget* ImageView::createCloneInstance()
|
||||||
{
|
{
|
||||||
return ImageView::create();
|
return ImageView::create();
|
||||||
|
|
|
@ -118,15 +118,15 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
protected:
|
protected:
|
||||||
virtual void initRenderer() override;
|
virtual void initRenderer() override;
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
virtual void updateFlippedX() override;
|
virtual void updateFlippedX() override;
|
||||||
virtual void updateFlippedY() override;
|
virtual void updateFlippedY() override;
|
||||||
|
|
||||||
|
virtual void adaptRenderers() override;
|
||||||
|
|
||||||
void imageTextureScaleChangedWithSize();
|
void imageTextureScaleChangedWithSize();
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
virtual void adaptRenderers() override;
|
|
||||||
protected:
|
protected:
|
||||||
bool _scale9Enabled;
|
bool _scale9Enabled;
|
||||||
bool _prevIgnoreSize;
|
bool _prevIgnoreSize;
|
||||||
|
|
|
@ -160,7 +160,9 @@ LoadingBar::Direction LoadingBar::getDirection()const
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateRGBAToRenderer(_barRenderer);
|
_barRenderer->setColor(this->getColor());
|
||||||
|
_barRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
_barRendererTextureSize = _barRenderer->getContentSize();
|
_barRendererTextureSize = _barRenderer->getContentSize();
|
||||||
|
|
||||||
switch (_direction)
|
switch (_direction)
|
||||||
|
@ -359,21 +361,6 @@ std::string LoadingBar::getDescription() const
|
||||||
return "LoadingBar";
|
return "LoadingBar";
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadingBar::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_barRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadingBar::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_barRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LoadingBar::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_barRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* LoadingBar::createCloneInstance()
|
Widget* LoadingBar::createCloneInstance()
|
||||||
{
|
{
|
||||||
return LoadingBar::create();
|
return LoadingBar::create();
|
||||||
|
|
|
@ -141,14 +141,14 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void initRenderer() override;
|
virtual void initRenderer() override;
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
void setScale9Scale();
|
void setScale9Scale();
|
||||||
void barRendererScaleChangedWithSize();
|
void barRendererScaleChangedWithSize();
|
||||||
|
|
||||||
|
virtual void adaptRenderers() override;
|
||||||
|
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
virtual void adaptRenderers() override;
|
|
||||||
protected:
|
protected:
|
||||||
Direction _direction;
|
Direction _direction;
|
||||||
float _percent;
|
float _percent;
|
||||||
|
|
|
@ -147,7 +147,9 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateRGBAToRenderer(_barRenderer);
|
_barRenderer->setColor(this->getColor());
|
||||||
|
_barRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
_barRendererAdaptDirty = true;
|
_barRendererAdaptDirty = true;
|
||||||
_progressBarRendererDirty = true;
|
_progressBarRendererDirty = true;
|
||||||
updateContentSizeWithTextureSize(_barRenderer->getContentSize());
|
updateContentSizeWithTextureSize(_barRenderer->getContentSize());
|
||||||
|
@ -186,7 +188,10 @@ void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateRGBAToRenderer(_progressBarRenderer);
|
|
||||||
|
_progressBarRenderer->setColor(this->getColor());
|
||||||
|
_progressBarRenderer->setOpacity(this->getOpacity());
|
||||||
|
|
||||||
_progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f));
|
_progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f));
|
||||||
_progressBarTextureSize = _progressBarRenderer->getContentSize();
|
_progressBarTextureSize = _progressBarRenderer->getContentSize();
|
||||||
_progressBarRendererDirty = true;
|
_progressBarRendererDirty = true;
|
||||||
|
@ -308,7 +313,8 @@ void Slider::loadSlidBallTextureNormal(const std::string& normal,TextureResType
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateRGBAToRenderer(_slidBallNormalRenderer);
|
_slidBallNormalRenderer->setColor(this->getColor());
|
||||||
|
_slidBallNormalRenderer->setOpacity(this->getOpacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResType texType)
|
void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResType texType)
|
||||||
|
@ -330,7 +336,8 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateRGBAToRenderer(_slidBallPressedRenderer);
|
_slidBallPressedRenderer->setColor(this->getColor());
|
||||||
|
_slidBallPressedRenderer->setOpacity(this->getOpacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType)
|
void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType)
|
||||||
|
@ -352,7 +359,8 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateRGBAToRenderer(_slidBallDisabledRenderer);
|
_slidBallDisabledRenderer->setColor(this->getColor());
|
||||||
|
_slidBallDisabledRenderer->setOpacity(this->getOpacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slider::setPercent(int percent)
|
void Slider::setPercent(int percent)
|
||||||
|
@ -583,33 +591,6 @@ std::string Slider::getDescription() const
|
||||||
return "Slider";
|
return "Slider";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Slider::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_barRenderer);
|
|
||||||
updateColorToRenderer(_progressBarRenderer);
|
|
||||||
updateColorToRenderer(_slidBallNormalRenderer);
|
|
||||||
updateColorToRenderer(_slidBallPressedRenderer);
|
|
||||||
updateColorToRenderer(_slidBallDisabledRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Slider::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_barRenderer);
|
|
||||||
updateOpacityToRenderer(_progressBarRenderer);
|
|
||||||
updateOpacityToRenderer(_slidBallNormalRenderer);
|
|
||||||
updateOpacityToRenderer(_slidBallPressedRenderer);
|
|
||||||
updateOpacityToRenderer(_slidBallDisabledRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Slider::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_barRenderer);
|
|
||||||
updateRGBAToRenderer(_progressBarRenderer);
|
|
||||||
updateRGBAToRenderer(_slidBallNormalRenderer);
|
|
||||||
updateRGBAToRenderer(_slidBallPressedRenderer);
|
|
||||||
updateRGBAToRenderer(_slidBallDisabledRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* Slider::createCloneInstance()
|
Widget* Slider::createCloneInstance()
|
||||||
{
|
{
|
||||||
return Slider::create();
|
return Slider::create();
|
||||||
|
|
|
@ -218,9 +218,7 @@ protected:
|
||||||
virtual void onPressStateChangedToPressed() override;
|
virtual void onPressStateChangedToPressed() override;
|
||||||
virtual void onPressStateChangedToDisabled() override;
|
virtual void onPressStateChangedToDisabled() override;
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
void barRendererScaleChangedWithSize();
|
void barRendererScaleChangedWithSize();
|
||||||
void progressBarRendererScaleChangedWithSize();
|
void progressBarRendererScaleChangedWithSize();
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
|
|
|
@ -324,20 +324,6 @@ std::string Text::getDescription() const
|
||||||
return "Label";
|
return "Label";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_labelRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Text::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_labelRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Text::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_labelRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* Text::createCloneInstance()
|
Widget* Text::createCloneInstance()
|
||||||
{
|
{
|
||||||
|
|
|
@ -172,9 +172,7 @@ protected:
|
||||||
virtual void onPressStateChangedToPressed() override;
|
virtual void onPressStateChangedToPressed() override;
|
||||||
virtual void onPressStateChangedToDisabled() override;
|
virtual void onPressStateChangedToDisabled() override;
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
virtual void updateFlippedX() override;
|
virtual void updateFlippedX() override;
|
||||||
virtual void updateFlippedY() override;
|
virtual void updateFlippedY() override;
|
||||||
void labelScaleChangedWithSize();
|
void labelScaleChangedWithSize();
|
||||||
|
|
|
@ -172,21 +172,6 @@ std::string TextAtlas::getDescription() const
|
||||||
return "TextAtlas";
|
return "TextAtlas";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextAtlas::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_labelAtlasRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextAtlas::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_labelAtlasRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextAtlas::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_labelAtlasRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* TextAtlas::createCloneInstance()
|
Widget* TextAtlas::createCloneInstance()
|
||||||
{
|
{
|
||||||
return TextAtlas::create();
|
return TextAtlas::create();
|
||||||
|
|
|
@ -106,9 +106,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void initRenderer() override;
|
virtual void initRenderer() override;
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
void labelAtlasScaleChangedWithSize();
|
void labelAtlasScaleChangedWithSize();
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
|
|
|
@ -87,7 +87,9 @@ void TextBMFont::setFntFile(const std::string& fileName)
|
||||||
}
|
}
|
||||||
_fntFileName = fileName;
|
_fntFileName = fileName;
|
||||||
_labelBMFontRenderer->setBMFontFilePath(fileName);
|
_labelBMFontRenderer->setBMFontFilePath(fileName);
|
||||||
updateRGBAToRenderer(_labelBMFontRenderer);
|
|
||||||
|
_labelBMFontRenderer->setColor(this->getColor());
|
||||||
|
_labelBMFontRenderer->setOpacity(this->getOpacity());
|
||||||
_fntFileHasInit = true;
|
_fntFileHasInit = true;
|
||||||
setString(_stringValue);
|
setString(_stringValue);
|
||||||
}
|
}
|
||||||
|
@ -166,21 +168,6 @@ std::string TextBMFont::getDescription() const
|
||||||
return "TextBMFont";
|
return "TextBMFont";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBMFont::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_labelBMFontRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextBMFont::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_labelBMFontRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextBMFont::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_labelBMFontRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget* TextBMFont::createCloneInstance()
|
Widget* TextBMFont::createCloneInstance()
|
||||||
{
|
{
|
||||||
return TextBMFont::create();
|
return TextBMFont::create();
|
||||||
|
|
|
@ -89,9 +89,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void initRenderer() override;
|
virtual void initRenderer() override;
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
void labelBMFontScaleChangedWithSize();
|
void labelBMFontScaleChangedWithSize();
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
virtual void copySpecialProperties(Widget* model) override;
|
virtual void copySpecialProperties(Widget* model) override;
|
||||||
|
|
|
@ -800,21 +800,6 @@ std::string TextField::getDescription() const
|
||||||
return "TextField";
|
return "TextField";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextField::updateTextureColor()
|
|
||||||
{
|
|
||||||
updateColorToRenderer(_textFieldRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextField::updateTextureOpacity()
|
|
||||||
{
|
|
||||||
updateOpacityToRenderer(_textFieldRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextField::updateTextureRGBA()
|
|
||||||
{
|
|
||||||
updateRGBAToRenderer(_textFieldRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextField::attachWithIME()
|
void TextField::attachWithIME()
|
||||||
{
|
{
|
||||||
_textFieldRenderer->attachWithIME();
|
_textFieldRenderer->attachWithIME();
|
||||||
|
|
|
@ -197,9 +197,7 @@ protected:
|
||||||
void insertTextEvent();
|
void insertTextEvent();
|
||||||
void deleteBackwardEvent();
|
void deleteBackwardEvent();
|
||||||
virtual void onSizeChanged() override;
|
virtual void onSizeChanged() override;
|
||||||
virtual void updateTextureColor() override;
|
|
||||||
virtual void updateTextureOpacity() override;
|
|
||||||
virtual void updateTextureRGBA() override;
|
|
||||||
void textfieldRendererScaleChangedWithSize();
|
void textfieldRendererScaleChangedWithSize();
|
||||||
|
|
||||||
virtual Widget* createCloneInstance() override;
|
virtual Widget* createCloneInstance() override;
|
||||||
|
|
|
@ -157,8 +157,6 @@ _positionPercent(Vec2::ZERO),
|
||||||
_reorderWidgetChildDirty(true),
|
_reorderWidgetChildDirty(true),
|
||||||
_hitted(false),
|
_hitted(false),
|
||||||
_touchListener(nullptr),
|
_touchListener(nullptr),
|
||||||
_color(Color3B::WHITE),
|
|
||||||
_opacity(255),
|
|
||||||
_flippedX(false),
|
_flippedX(false),
|
||||||
_flippedY(false),
|
_flippedY(false),
|
||||||
_focused(false),
|
_focused(false),
|
||||||
|
@ -212,6 +210,8 @@ bool Widget::init()
|
||||||
setBright(true);
|
setBright(true);
|
||||||
ignoreContentAdaptWithSize(true);
|
ignoreContentAdaptWithSize(true);
|
||||||
setAnchorPoint(Vec2(0.5f, 0.5f));
|
setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||||
|
this->setCascadeColorEnabled(true);
|
||||||
|
this->setCascadeOpacityEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1075,18 +1075,6 @@ void Widget::copyProperties(Widget *widget)
|
||||||
onSizeChanged();
|
onSizeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setColor(const Color3B& color)
|
|
||||||
{
|
|
||||||
_color = color;
|
|
||||||
updateTextureColor();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::setOpacity(GLubyte opacity)
|
|
||||||
{
|
|
||||||
_opacity = opacity;
|
|
||||||
updateTextureOpacity();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::setFlippedX(bool flippedX)
|
void Widget::setFlippedX(bool flippedX)
|
||||||
{
|
{
|
||||||
_flippedX = flippedX;
|
_flippedX = flippedX;
|
||||||
|
@ -1099,21 +1087,6 @@ void Widget::setFlippedY(bool flippedY)
|
||||||
updateFlippedY();
|
updateFlippedY();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::updateColorToRenderer(Node* renderer)
|
|
||||||
{
|
|
||||||
renderer->setColor(_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::updateOpacityToRenderer(Node* renderer)
|
|
||||||
{
|
|
||||||
renderer->setOpacity(_opacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Widget::updateRGBAToRenderer(Node* renderer)
|
|
||||||
{
|
|
||||||
renderer->setColor(_color);
|
|
||||||
renderer->setOpacity(_opacity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*temp action*/
|
/*temp action*/
|
||||||
void Widget::setActionTag(int tag)
|
void Widget::setActionTag(int tag)
|
||||||
|
|
|
@ -335,14 +335,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool isFlippedY()const{return _flippedY;};
|
virtual bool isFlippedY()const{return _flippedY;};
|
||||||
|
|
||||||
virtual void setColor(const Color3B& color) override;
|
|
||||||
|
|
||||||
virtual void setOpacity(GLubyte opacity) override;
|
|
||||||
|
|
||||||
const Color3B& getColor() const override {return _color;};
|
|
||||||
|
|
||||||
GLubyte getOpacity() const override {return _opacity;};
|
|
||||||
|
|
||||||
/** @deprecated Use isFlippedX() instead */
|
/** @deprecated Use isFlippedX() instead */
|
||||||
CC_DEPRECATED_ATTRIBUTE bool isFlipX() { return isFlippedX(); };
|
CC_DEPRECATED_ATTRIBUTE bool isFlipX() { return isFlippedX(); };
|
||||||
/** @deprecated Use setFlippedX() instead */
|
/** @deprecated Use setFlippedX() instead */
|
||||||
|
@ -650,18 +642,10 @@ protected:
|
||||||
virtual void releaseUpEvent();
|
virtual void releaseUpEvent();
|
||||||
virtual void cancelUpEvent();
|
virtual void cancelUpEvent();
|
||||||
|
|
||||||
virtual void updateTextureColor(){};
|
|
||||||
virtual void updateTextureOpacity(){};
|
|
||||||
virtual void updateTextureRGBA(){};
|
|
||||||
virtual void updateFlippedX(){};
|
virtual void updateFlippedX(){};
|
||||||
virtual void updateFlippedY(){};
|
virtual void updateFlippedY(){};
|
||||||
virtual void adaptRenderers(){};
|
virtual void adaptRenderers(){};
|
||||||
|
|
||||||
|
|
||||||
void updateColorToRenderer(Node* renderer);
|
|
||||||
void updateOpacityToRenderer(Node* renderer);
|
|
||||||
void updateRGBAToRenderer(Node* renderer);
|
|
||||||
|
|
||||||
void copyProperties(Widget* model);
|
void copyProperties(Widget* model);
|
||||||
virtual Widget* createCloneInstance();
|
virtual Widget* createCloneInstance();
|
||||||
virtual void copySpecialProperties(Widget* model);
|
virtual void copySpecialProperties(Widget* model);
|
||||||
|
@ -720,8 +704,6 @@ protected:
|
||||||
bool _reorderWidgetChildDirty;
|
bool _reorderWidgetChildDirty;
|
||||||
bool _hitted;
|
bool _hitted;
|
||||||
EventListenerTouchOneByOne* _touchListener;
|
EventListenerTouchOneByOne* _touchListener;
|
||||||
Color3B _color;
|
|
||||||
GLubyte _opacity;
|
|
||||||
bool _flippedX;
|
bool _flippedX;
|
||||||
bool _flippedY;
|
bool _flippedY;
|
||||||
//use map to enble switch back and forth for user layout parameters
|
//use map to enble switch back and forth for user layout parameters
|
||||||
|
|
|
@ -98,7 +98,8 @@ bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rec
|
||||||
{
|
{
|
||||||
this->updateWithBatchNode(batchnode, rect, rotated, capInsets);
|
this->updateWithBatchNode(batchnode, rect, rotated, capInsets);
|
||||||
}
|
}
|
||||||
|
this->setCascadeColorEnabled(true);
|
||||||
|
this->setCascadeOpacityEnabled(true);
|
||||||
this->setAnchorPoint(Vec2(0.5f, 0.5f));
|
this->setAnchorPoint(Vec2(0.5f, 0.5f));
|
||||||
this->_positionsAreDirty = true;
|
this->_positionsAreDirty = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue