Cocos study notes-Menu
来源:互联网 发布:java中字符串转json 编辑:程序博客网 时间:2024/06/08 19:52
cocos study notes-Menu
reference: jellythink
In cocos-2d-x, its menu UI system can be divided to three catageries:
- MenuItemLabel
- MenuItemSprite
- MenuItemToggle
Now, let’t talk about them in detail.
1.MenuItemLabel
It is a MenuItem
which was defined by typeface, or we can say this is a MenuItem
which can be used to write words on it. MenuItemLabel
includes MenuItemAtlasFont
and MenuItemFont
. MenuItemFont
is a class which can set the size and name of typeface. This is its member functions:
static MenuItemFont *create(const std::string& value="start");static MenuItemFont *create(const std::string& value,const MenuCallback& callback);//the size of typefacestatic void setFontSize(int size);static int getFontSize();//the name of typefacestatic void setFontName(const std::string& name);static const std::string& getFontName();
MenuItemAlasFont
is created by typeface file,something alike plist file.
2.MenuItemSprite
MenuItemSprite
is a class which can load picture.First, let’s see its member functions:
static MenuItemSprite *create(Node* normalSprite,Node* selectedSprite,Node* disabledSprite=nullptr); static MenuSprite *create(Node* normalSprite,Node* selectSprite,Node* disabledSprite,const MenuCallback* callback); //sometimes we can omit the disabledSpriteinline Node* getNormalImage()cosnt {return _normalImage;};void setNormalImage(Node* image);//the other two can be inferred by the functions above.
3.MenuItemToggle
You can pass any MenuItem
to the MenuItemToggle
,which can be treated as a button.And its member function:
//create with a vector containing MenuItemstatic MenuItemToggle *createWithCallback(const MenuCallback& callback,const Vector<MenuItem*>&menuItem);//create with plenty of MenuItemstatic MenuItemToggle* createWithCallback(const MenuCallback& callback,MenuItem* item,...,NULL);//create an empty MenuItemTogglestatic MenuItemToggle* create();//add MenuItem to itvoid addSubItem(MenuItem *item);MenuItem* getSelectedItem();
0 0
- Cocos study notes-Menu
- cocos study notes-Sprite
- cocos study notes-Scene
- study notes
- JQuery Study Notes— A small demo for Smooth Animated Menu
- MySql study notes [1]
- Portlet Study Notes (1)
- IBM Director study notes
- lucene study notes
- lucene study notes (2)
- Legacy Study notes(Servlet)
- C++ Study Notes
- System Architect Study notes
- flex study notes (2)
- scm515 study notes
- Java API Study Notes
- Webkit Timer study notes
- Webkit JNI study notes
- Myeclipse2016-ci-7 安装以及破解记录(先记录有精力再拓展)
- 最小表示法
- 排序算法总览
- 十四、处理自动装配的歧义性
- java编写service详细笔记
- Cocos study notes-Menu
- 打开一个Activity, 关闭之前所有的Activity.
- Tomcat7源码下载及导入eclipse
- 用AOP捕捉 Service中调用Dao的异常
- 官网学习django
- 51nod1344
- centos下彻底删除MYSQL 和重新安装MYSQL的解压缩版
- 【上机笔试之十七】A的B次方
- 位运算