Modify renderers draw order define.

This commit is contained in:
CaiWenzhi 2014-01-03 15:46:42 +08:00
parent 9c0e669e09
commit 767bf81e90
11 changed files with 52 additions and 52 deletions

View File

@ -29,10 +29,10 @@ NS_CC_BEGIN
namespace gui {
#define NORMALRENDERERZ (-2)
#define PRESSEDRENDERERZ (-2)
#define DISABLEDRENDERERZ (-2)
#define TITLERENDERERZ (-1)
static const int NORMAL_RENDERER_Z = (-2);
static const int PRESSED_RENDERER_Z = (-2);
static const int DISABLED_RENDERER_Z = (-2);
static const int TITLE_RENDERER_Z = (-1);
Button::Button():
_buttonNormalRenderer(nullptr),
@ -98,10 +98,10 @@ void Button::initRenderer()
_buttonDisableRenderer = Sprite::create();
_titleRenderer = LabelTTF::create();
Node::addChild(_buttonNormalRenderer, NORMALRENDERERZ, -1);
Node::addChild(_buttonClickedRenderer, PRESSEDRENDERERZ, -1);
Node::addChild(_buttonDisableRenderer, DISABLEDRENDERERZ, -1);
Node::addChild(_titleRenderer, TITLERENDERERZ, -1);
Node::addChild(_buttonNormalRenderer, NORMAL_RENDERER_Z, -1);
Node::addChild(_buttonClickedRenderer, PRESSED_RENDERER_Z, -1);
Node::addChild(_buttonDisableRenderer, DISABLED_RENDERER_Z, -1);
Node::addChild(_titleRenderer, TITLE_RENDERER_Z, -1);
}
void Button::setScale9Enabled(bool able)
@ -134,9 +134,9 @@ void Button::setScale9Enabled(bool able)
loadTextureNormal(_normalFileName.c_str(), _normalTexType);
loadTexturePressed(_clickedFileName.c_str(), _pressedTexType);
loadTextureDisabled(_disabledFileName.c_str(), _disabledTexType);
Node::addChild(_buttonNormalRenderer, NORMALRENDERERZ, -1);
Node::addChild(_buttonClickedRenderer, PRESSEDRENDERERZ, -1);
Node::addChild(_buttonDisableRenderer, DISABLEDRENDERERZ, -1);
Node::addChild(_buttonNormalRenderer, NORMAL_RENDERER_Z, -1);
Node::addChild(_buttonClickedRenderer, PRESSED_RENDERER_Z, -1);
Node::addChild(_buttonDisableRenderer, DISABLED_RENDERER_Z, -1);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;

View File

@ -28,11 +28,11 @@ NS_CC_BEGIN
namespace gui {
#define BACKGROUNDBOXRENDERERZ (-1)
#define BACKGROUNDSELECTEDBOXRENDERERZ (-1)
#define FRONTCROSSRENDERERZ (-1)
#define BACKGROUNDBOXDISABLEDRENDERERZ (-1)
#define FRONTCROSSDISABLEDRENDERERZ (-1)
static const int BACKGROUNDBOX_RENDERER_Z = (-1);
static const int BACKGROUNDSELECTEDBOX_RENDERER_Z = (-1);
static const int FRONTCROSS_RENDERER_Z = (-1);
static const int BACKGROUNDBOXDISABLED_RENDERER_Z = (-1);
static const int FRONTCROSSDISABLED_RENDERER_Z = (-1);
CheckBox::CheckBox():
_backGroundBoxRenderer(nullptr),
@ -92,11 +92,11 @@ void CheckBox::initRenderer()
_backGroundBoxDisabledRenderer = Sprite::create();
_frontCrossDisabledRenderer = Sprite::create();
Node::addChild(_backGroundBoxRenderer, BACKGROUNDBOXRENDERERZ, -1);
Node::addChild(_backGroundSelectedBoxRenderer, BACKGROUNDSELECTEDBOXRENDERERZ, -1);
Node::addChild(_frontCrossRenderer, FRONTCROSSRENDERERZ, -1);
Node::addChild(_backGroundBoxDisabledRenderer, BACKGROUNDBOXDISABLEDRENDERERZ, -1);
Node::addChild(_frontCrossDisabledRenderer, FRONTCROSSDISABLEDRENDERERZ, -1);
Node::addChild(_backGroundBoxRenderer, BACKGROUNDBOX_RENDERER_Z, -1);
Node::addChild(_backGroundSelectedBoxRenderer, BACKGROUNDSELECTEDBOX_RENDERER_Z, -1);
Node::addChild(_frontCrossRenderer, FRONTCROSS_RENDERER_Z, -1);
Node::addChild(_backGroundBoxDisabledRenderer, BACKGROUNDBOXDISABLED_RENDERER_Z, -1);
Node::addChild(_frontCrossDisabledRenderer, FRONTCROSSDISABLED_RENDERER_Z, -1);
}
void CheckBox::loadTextures(const char *backGround, const char *backGroundSelected, const char *cross,const char* backGroundDisabled,const char* frontCrossDisabled,TextureResType texType)

View File

@ -33,7 +33,7 @@ namespace gui {
#define STATIC_CAST_CCSPRITE static_cast<Sprite*>(_imageRenderer)
#define STATIC_CAST_SCALE9SPRITE static_cast<extension::Scale9Sprite*>(_imageRenderer)
#define IMAGERENDERERZ (-1)
static const int IMAGE_RENDERER_Z = (-1);
ImageView::ImageView():
_scale9Enabled(false),
@ -67,7 +67,7 @@ ImageView* ImageView::create()
void ImageView::initRenderer()
{
_imageRenderer = Sprite::create();
Node::addChild(_imageRenderer, IMAGERENDERERZ, -1);
Node::addChild(_imageRenderer, IMAGE_RENDERER_Z, -1);
}
void ImageView::loadTexture(const char *fileName, TextureResType texType)
@ -193,7 +193,7 @@ void ImageView::setScale9Enabled(bool able)
_imageRenderer = Sprite::create();
}
loadTexture(_textureFile.c_str(),_imageTexType);
Node::addChild(_imageRenderer, IMAGERENDERERZ, -1);
Node::addChild(_imageRenderer, IMAGE_RENDERER_Z, -1);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;

View File

@ -30,8 +30,8 @@ NS_CC_BEGIN
namespace gui {
#define BACKGROUNDIMAGEZ (-1)
#define BCAKGROUNDCOLORRENDERERZ (-2)
static const int BACKGROUNDIMAGE_Z = (-1);
static const int BCAKGROUNDCOLORRENDERER_Z = (-2);
static GLint g_sStencilBits = -1;
@ -428,12 +428,12 @@ void Layout::setBackGroundImageScale9Enabled(bool able)
if (_backGroundScale9Enabled)
{
_backGroundImage = extension::Scale9Sprite::create();
Node::addChild(_backGroundImage, BACKGROUNDIMAGEZ, -1);
Node::addChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
}
else
{
_backGroundImage = Sprite::create();
Node::addChild(_backGroundImage, BACKGROUNDIMAGEZ, -1);
Node::addChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
}
setBackGroundImage(_backGroundImageFileName.c_str(),_bgImageTexType);
setBackGroundImageCapInsets(_backGroundImageCapInsets);
@ -546,14 +546,14 @@ void Layout::addBackGroundImage()
{
_backGroundImage = extension::Scale9Sprite::create();
_backGroundImage->setZOrder(-1);
Node::addChild(_backGroundImage, BACKGROUNDIMAGEZ, -1);
Node::addChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
static_cast<extension::Scale9Sprite*>(_backGroundImage)->setPreferredSize(_size);
}
else
{
_backGroundImage = Sprite::create();
_backGroundImage->setZOrder(-1);
Node::addChild(_backGroundImage, BACKGROUNDIMAGEZ, -1);
Node::addChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
}
_backGroundImage->setPosition(Point(_size.width/2.0f, _size.height/2.0f));
}
@ -617,7 +617,7 @@ void Layout::setBackGroundColorType(LayoutBackGroundColorType type)
_colorRender->setContentSize(_size);
_colorRender->setOpacity(_cOpacity);
_colorRender->setColor(_cColor);
Node::addChild(_colorRender, BACKGROUNDIMAGEZ, -1);
Node::addChild(_colorRender, BCAKGROUNDCOLORRENDERER_Z, -1);
break;
case LAYOUT_COLOR_GRADIENT:
_gradientRender = LayerGradient::create();
@ -626,7 +626,7 @@ void Layout::setBackGroundColorType(LayoutBackGroundColorType type)
_gradientRender->setStartColor(_gStartColor);
_gradientRender->setEndColor(_gEndColor);
_gradientRender->setVector(_alongVector);
Node::addChild(_gradientRender, BACKGROUNDIMAGEZ, -1);
Node::addChild(_gradientRender, BCAKGROUNDCOLORRENDERER_Z, -1);
break;
default:
break;

View File

@ -29,7 +29,7 @@ NS_CC_BEGIN
namespace gui {
#define BARRENDERERZ (-1)
static const int BAR_RENDERER_Z = (-1);
LoadingBar::LoadingBar():
_barType(LoadingBarTypeLeft),
@ -65,7 +65,7 @@ LoadingBar* LoadingBar::create()
void LoadingBar::initRenderer()
{
_barRenderer = Sprite::create();
Node::addChild(_barRenderer, BARRENDERERZ, -1);
Node::addChild(_barRenderer, BAR_RENDERER_Z, -1);
_barRenderer->setAnchorPoint(Point(0.0,0.5));
}
@ -182,7 +182,7 @@ void LoadingBar::setScale9Enabled(bool enabled)
_barRenderer = Sprite::create();
}
loadTexture(_textureFile.c_str(),_renderBarTexType);
Node::addChild(_barRenderer, BARRENDERERZ, -1);
Node::addChild(_barRenderer, BAR_RENDERER_Z, -1);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;

View File

@ -28,7 +28,7 @@ NS_CC_BEGIN
namespace gui {
#define AUTOSCROLLMAXSPEED 1000.0f
static const float AUTOSCROLLMAXSPEED = 1000.0f;
const Point SCROLLDIR_UP = Point(0.0f, 1.0f);
const Point SCROLLDIR_DOWN = Point(0.0f, -1.0f);

View File

@ -29,9 +29,9 @@ NS_CC_BEGIN
namespace gui {
#define BASEBARRENDERERZ (-2)
#define PROGRESSBARRENDERERZ (-2)
#define SLIDBALLRENDERERZ (-1)
static const int BASEBAR_RENDERER_Z = (-2);
static const int PROGRESSBAR_RENDERER_Z = (-2);
static const int SLIDBALL_RENDERER_Z = (-1);
Slider::Slider():
_barRenderer(nullptr),
@ -85,8 +85,8 @@ void Slider::initRenderer()
_barRenderer = Sprite::create();
_progressBarRenderer = Sprite::create();
_progressBarRenderer->setAnchorPoint(Point(0.0f, 0.5f));
Node::addChild(_barRenderer, BASEBARRENDERERZ, -1);
Node::addChild(_progressBarRenderer, PROGRESSBARRENDERERZ, -1);
Node::addChild(_barRenderer, BASEBAR_RENDERER_Z, -1);
Node::addChild(_progressBarRenderer, PROGRESSBAR_RENDERER_Z, -1);
_slidBallNormalRenderer = Sprite::create();
_slidBallPressedRenderer = Sprite::create();
_slidBallPressedRenderer->setVisible(false);
@ -96,7 +96,7 @@ void Slider::initRenderer()
_slidBallRenderer->addChild(_slidBallNormalRenderer);
_slidBallRenderer->addChild(_slidBallPressedRenderer);
_slidBallRenderer->addChild(_slidBallDisabledRenderer);
Node::addChild(_slidBallRenderer, SLIDBALLRENDERERZ, -1);
Node::addChild(_slidBallRenderer, SLIDBALL_RENDERER_Z, -1);
}
void Slider::loadBarTexture(const char* fileName, TextureResType texType)
@ -201,8 +201,8 @@ void Slider::setScale9Enabled(bool able)
}
loadBarTexture(_textureFile.c_str(), _barTexType);
loadProgressBarTexture(_progressBarTextureFile.c_str(), _progressBarTexType);
Node::addChild(_barRenderer, BASEBARRENDERERZ, -1);
Node::addChild(_progressBarRenderer, PROGRESSBARRENDERERZ, -1);
Node::addChild(_barRenderer, BASEBAR_RENDERER_Z, -1);
Node::addChild(_progressBarRenderer, PROGRESSBAR_RENDERER_Z, -1);
if (_scale9Enabled)
{
bool ignoreBefore = _ignoreSize;

View File

@ -28,7 +28,7 @@ NS_CC_BEGIN
namespace gui {
#define LABELRENDERERZ (-1)
static const int LABEL_RENDERER_Z = (-1);
Text::Text():
_touchScaleChangeEnabled(false),
@ -70,7 +70,7 @@ bool Text::init()
void Text::initRenderer()
{
_labelRenderer = LabelTTF::create();
Node::addChild(_labelRenderer, LABELRENDERERZ, -1);
Node::addChild(_labelRenderer, LABEL_RENDERER_Z, -1);
}
void Text::setText(const std::string& text)

View File

@ -28,7 +28,7 @@ NS_CC_BEGIN
namespace gui {
#define LABELATLASRENDERERZ (-1)
static const int LABELATLAS_RENDERER_Z = (-1);
UICCLabelAtlas::UICCLabelAtlas()
@ -107,7 +107,7 @@ TextAtlas* TextAtlas::create()
void TextAtlas::initRenderer()
{
_labelAtlasRenderer = UICCLabelAtlas::create();
Node::addChild(_labelAtlasRenderer, LABELATLASRENDERERZ, -1);
Node::addChild(_labelAtlasRenderer, LABELATLAS_RENDERER_Z, -1);
}
void TextAtlas::setProperty(const std::string& stringValue, const std::string& charMapFile, int itemWidth, int itemHeight, const std::string& startCharMap)

View File

@ -28,7 +28,7 @@ NS_CC_BEGIN
namespace gui {
#define LABELBMFONTRENDERERZ (-1)
static const int LABELBMFONT_RENDERER_Z = (-1);
TextBMFont::TextBMFont():
_labelBMFontRenderer(nullptr),
@ -58,7 +58,7 @@ TextBMFont* TextBMFont::create()
void TextBMFont::initRenderer()
{
_labelBMFontRenderer = cocos2d::LabelBMFont::create();
Node::addChild(_labelBMFontRenderer, LABELBMFONTRENDERERZ, -1);
Node::addChild(_labelBMFontRenderer, LABELBMFONT_RENDERER_Z, -1);
}
void TextBMFont::setFntFile(const char *fileName)

View File

@ -269,7 +269,7 @@ bool UICCTextField::getDeleteBackward()
return _deleteBackward;
}
#define TEXTFIELDRENDERERZ (-1)
static const int TEXTFIELD_RENDERER_Z = (-1);
TextField::TextField():
@ -314,7 +314,7 @@ bool TextField::init()
void TextField::initRenderer()
{
_textFieldRenderer = UICCTextField::create("input words here", "Thonburi", 20);
Node::addChild(_textFieldRenderer, TEXTFIELDRENDERERZ, -1);
Node::addChild(_textFieldRenderer, TEXTFIELD_RENDERER_Z, -1);
}
void TextField::setTouchSize(const Size &size)