cocos2d-X 节点(UIButton.h)API
来源:互联网 发布:数据冗余是什么意思 编辑:程序博客网 时间:2024/05/14 15:19
本文来自http://blog.csdn.net/runaying ,引用必须注明出处!
cocos2d-X 节点(UIButton.h)API
温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记
///cocos2d-x-3.0alpha0/extensions/CocoStudio/GUI/UIWidgets#ifndef __UIBUTTON_H__#define __UIBUTTON_H__#include "../BaseClasses/UIWidget.h"NS_CC_EXT_BEGINclass UIButton : public UIWidget{public: /** * Default constructor */ UIButton(); /** * Default destructor */ virtual ~UIButton(); /** * Allocates and initializes. */ static UIButton* create(); /** * Load textures for button. //为 button 加载 textures * * @param normal 正常状态下的 texture. * * @param selected 选择状态下的 texture. * * @param disabled dark state texture. //禁用状态下的 texture * * @param texType @see UI_TEX_TYPE_LOCAL */ void loadTextures(const char* normal,const char* selected,const char* disabled,TextureResType texType = UI_TEX_TYPE_LOCAL); /** * Load normal state texture for button. 为 button 加载正常状态下的 texture * * @param normal 正常状态下的 texture. * * @param texType @see UI_TEX_TYPE_LOCAL */ void loadTextureNormal(const char* normal, TextureResType texType = UI_TEX_TYPE_LOCAL); /** * Load selected state texture for button. 为button 加载选择状态下的 texture * * @param selected selected state texture. * * @param texType @see UI_TEX_TYPE_LOCAL */ void loadTexturePressed(const char* selected, TextureResType texType = UI_TEX_TYPE_LOCAL); /** * Load dark state texture for button. //为 button 加载 禁用状态下的 texture * * @param disabled dark state texture. * * @param texType @see UI_TEX_TYPE_LOCAL */ void loadTextureDisabled(const char* disabled, TextureResType texType = UI_TEX_TYPE_LOCAL); /** * 如果 button使用 scale9 渲染, 设置 button 的 capinsets * * @param capInsets capinsets for button */ void setCapInsets(const Rect &capInsets); /** * 如果 button使用 scale9 渲染, 设置 button 的 capinsets * * @param capInsets capinsets for button */ void setCapInsetsNormalRenderer(const Rect &capInsets); /** * 如果 button使用 scale9 渲染, 设置 button 的 capinsets * * @param capInsets capinsets for button */ void setCapInsetsPressedRenderer(const Rect &capInsets); /** * 如果 button使用 scale9 渲染, 设置 button 的 capinsets * * @param capInsets capinsets for button */ void setCapInsetsDisabledRenderer(const Rect &capInsets); //override "setAnchorPoint" of widget. 重载 widget 的 setAnchorPoint 方法 virtual void setAnchorPoint(const Point &pt); /** * 如果 button使用 scale9 渲染 那么就设置 * * @param true 使用了 scale9 渲染, false otherwise. */ virtual void setScale9Enabled(bool able); //override "setFlipX" of widget. virtual void setFlipX(bool flipX); //override "setFlipY" of widget. virtual void setFlipY(bool flipY); //override "isFlipX" of widget. virtual bool isFlipX(); //override "isFlipY" of widget. virtual bool isFlipY(); /** * 如果 button 有点击放大效果,那么就使用该效果 * * @param true 有 clicked 放大效果, false otherwise. */ void setPressedActionEnabled(bool enabled); //override "ignoreContentAdaptWithSize" method of widget. virtual void ignoreContentAdaptWithSize(bool ignore); //override "getContentSize" method of widget. virtual const Size& getContentSize() const; //override "getVirtualRenderer" method of widget. virtual Node* getVirtualRenderer(); /** * Sets color to widget 设置 widget 的颜色 * 默认情况下也改变 widget's children 的颜色 * * * @param color */ virtual void setColor(const Color3B &color); void setTitleText(const char* text); const char* getTitleText() const; void setTitleColor(const Color3B& color); const Color3B& getTitleColor() const; void setTitleFontSize(float size); float getTitleFontSize() const; void setTitleFontName(const char* fontName); const char* getTitleFontName() const; /** * Returns the "class name" of widget. //返回 widget的 名字 */ virtual const char* getDescription() const;protected: virtual bool init(); virtual void initRenderer(); virtual void onPressStateChangedToNormal(); virtual void onPressStateChangedToPressed(); virtual void onPressStateChangedToDisabled(); virtual void onSizeChanged(); void normalTextureScaleChangedWithSize(); void pressedTextureScaleChangedWithSize(); void disabledTextureScaleChangedWithSize();protected: Node* _buttonNormalRenderer; Node* _buttonClickedRenderer; Node* _buttonDisableRenderer; LabelTTF* _titleRenderer; std::string _normalFileName; std::string _clickedFileName; std::string _disabledFileName; bool _prevIgnoreSize; bool _scale9Enabled; Rect _capInsetsNormal; Rect _capInsetsPressed; Rect _capInsetsDisabled; TextureResType _normalTexType; TextureResType _pressedTexType; TextureResType _disabledTexType; Size _normalTextureSize; Size _pressedTextureSize; Size _disabledTextureSize; bool _pressedActionEnabled; Color3B _titleColor;};NS_CC_EXT_END#endif /* defined(__CocoGUI__UIButton__) */
- cocos2d-X 节点(UIButton.h)API
- cocos2d-X 节点(CCNode.h)API
- cocos2d-X 节点(CCLayer.h)API
- cocos2d-X 节点(CCMenu.h)API
- cocos2d-X 节点(CCMenuItem.h)API
- cocos2d-X 节点(CCSprite.h)API
- cocos2d-X 节点(CCTexture2D.h)API
- cocos2d-X 节点(SpriteBatchNode.h.)API
- cocos2d-X 节点(CCSpriteFrame.h..)API
- cocos2d-X 节点(CCAnimationCache.h)API
- cocos2d-X 节点(CCCamera.h.)API
- cocos2d-X 节点(CCAction.h)API
- cocos2d-X 节点(CCActionManager.h)API
- cocos2d-X 节点(CCIMEDelegate.h)API
- cocos2d-X 节点(CCLabelAtlas.h)API
- cocos2d-X 节点(CCLabelBMFont.h)API
- cocos2d-X 节点(CCLabelTTF.h)API
- cocos2d-X 节点(CCTileMapAtlas.h)API
- ubuntu wiki-FrameBuffer
- 【COCOS2DX-ANDROID-游戏开发之二十】停止手打所有cpp文件到android.mk
- POJ--1700--Crossing River--过河问题
- 转一个很好的视频编解码博客
- 八皇后问题
- cocos2d-X 节点(UIButton.h)API
- cocos2d-X 节点(UICheckBox.h)API
- cocos2d-X 节点(UIImageView.h)API
- cocos2d-X 节点(UILabel.h)API
- MySQL 修改UTF-8字符集
- cocos2d-X 节点(UILabelAtlas.h)API
- cocos2d-X 节点(UILabelBMFont.h)API
- cocos2d-X 节点(UILoadingBar.h)API
- c++中的Date &operator++(); Date operator++(int);