add function for ui button

This commit is contained in:
Liam 2015-01-19 16:58:46 +08:00
parent a456a3b917
commit 90df276067
2 changed files with 6 additions and 2 deletions

View File

@ -24,11 +24,11 @@ THE SOFTWARE.
#include "ui/UIButton.h" #include "ui/UIButton.h"
#include "ui/UIScale9Sprite.h" #include "ui/UIScale9Sprite.h"
#include "ui/UIHelper.h"
#include "2d/CCLabel.h" #include "2d/CCLabel.h"
#include "2d/CCSprite.h" #include "2d/CCSprite.h"
#include "2d/CCActionInterval.h" #include "2d/CCActionInterval.h"
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
#include "ui/UIHelper.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -842,7 +842,6 @@ Size Button::getNormalSize() const
{ {
titleSize = _titleRenderer->getContentSize(); titleSize = _titleRenderer->getContentSize();
} }
Size imageSize; Size imageSize;
if (_buttonNormalRenderer != nullptr) if (_buttonNormalRenderer != nullptr)
{ {
@ -854,6 +853,10 @@ Size Button::getNormalSize() const
return Size(width,height); return Size(width,height);
} }
Size Button::getNormalTextureSize() const
{
return _normalTextureSize;
}
} }
NS_CC_END NS_CC_END

View File

@ -212,6 +212,7 @@ CC_CONSTRUCTOR_ACCESS:
const std::string& disableImage = "", const std::string& disableImage = "",
TextureResType texType = TextureResType::LOCAL); TextureResType texType = TextureResType::LOCAL);
virtual Size getNormalTextureSize() const;
protected: protected:
virtual void initRenderer() override; virtual void initRenderer() override;