本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
cocos2d-X 节点(UILabel.h)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记
///cocos2d-x-3.0alpha0/extensions/CocoStudio/GUI/UIWidgets
#ifndef __UILABEL_H__
#define __UILABEL_H__
#include "../BaseClasses/UIWidget.h"
NS_CC_EXT_BEGIN
class UILabel : public UIWidget
{
public:
/**
* Default constructor
*/
UILabel();
/**
* Default destructor
*/
virtual ~UILabel();
/**
* Allocates and initializes.
*/
static UILabel* create();
/**
* Changes the string value of label.
*
* @param text string value.
*/
void setText(const char* text);
/**
* Gets the string value of label.
*
* @return text string value.
*/
const char* getStringValue();
/**
* Gets the string length of label.
*
* @return string length.
*/
int getStringLength();
/**
* Sets the font size of label.
*
* @param font size.
*/
void setFontSize(int size);
/**
* Sets the font name of label.
*
* @param font name.
*/
void setFontName(const char* name);
/**
* Sets the touch scale enabled of label.
*
* @param touch scale enabled of label.
*/
void setTouchScaleChangeEnabled(bool enabled);
/**
* Gets the touch scale enabled of label.
*
* @return touch scale enabled of label.
*/
bool isTouchScaleChangeEnabled();
//override "setFlipX" method of widget.
virtual void setFlipX(bool flipX);
//override "setFlipY" method of widget.
virtual void setFlipY(bool flipY);
//override "isFlipX" method of widget.
virtual bool isFlipX();
//override "isFlipY" method of widget.
virtual bool isFlipY();
//override "setAnchorPoint" method of widget.
virtual void setAnchorPoint(const Point &pt);
//override "getContentSize" method of widget.
virtual const Size& getContentSize() const;
//override "getVirtualRenderer" method of widget.
virtual Node* getVirtualRenderer();
/**
* Returns the "class name" of widget. //返回 widget的 名字
*/
virtual const char* getDescription() const;
void setTextAreaSize(const Size &size);
void setTextHorizontalAlignment(TextHAlignment alignment);
void setTextVerticalAlignment(TextVAlignment alignment);
void setTouchScaleChangeAble(bool able){setTouchScaleChangeEnabled(able);};
bool getTouchScaleChangeAble(){return isTouchScaleChangeEnabled();};
protected:
virtual bool init();
virtual void initRenderer();
virtual void onPressStateChangedToNormal();
virtual void onPressStateChangedToPressed();
virtual void onPressStateChangedToDisabled();
virtual void onSizeChanged();
void clickScale(float scale);
void labelScaleChangedWithSize();
protected:
bool _touchScaleChangeEnabled;
float _normalScaleValue;
std::string _fontName;
int _fontSize;
float _onSelectedScaleOffset;
LabelTTF* _labelRenderer;
};
NS_CC_EXT_END
#endif /* defined(__CocoGUI__Label__) */