Class cc.MenuItemFont
- Defined in: CCMenuItem.js
- Extends cc.MenuItemLabel
Constructor Attributes | Constructor Name and Description |
---|---|
Helper class that creates a CCMenuItemLabel class with a Label
|
Method Summary
Class Detail
cc.MenuItemFont()
Helper class that creates a CCMenuItemLabel class with a Label
Field Detail
{String}
fontName
- Font name of font item
{Number}
fontSize
- Font size of font item
Method Detail
-
create a menu item from string
// Example var item = cc.MenuItemFont.create("Game start", 'start', Game) //creates a menu item from string "Game start", and when clicked, it will run Game.start() var item = cc.MenuItemFont.create("Game start", game.start, Game)//same as above var item = cc.MenuItemFont.create("i do nothing")//create a text menu item that does nothing //you can set font size and name before or after cc.MenuItemFont.setFontName('my Fancy Font'); cc.MenuItemFont.setFontSize(62);
- Parameters:
- {String} value
- the text to display
- {String|function|Null} callback
- the callback to run, either in function name or pass in the actual function
- {cc.Node|Null} target
- the target to run callback
- Returns:
- {cc.MenuItemFont}
-
<static> {String} cc.MenuItemFont.fontName()a shared function to get the font name for menuitem font
- Returns:
- {String}
-
<static> {Number} cc.MenuItemFont.fontSize()a shared function to get the font size for menuitem font
- Returns:
- {Number}
-
{String} getFontName()
- Returns:
- {String}
-
{Number} getFontSize()
- Returns:
- {Number}
-
{Boolean} initWithString(value, callback, target)
- Parameters:
- {String} value
- text for the menu item
- {function|String} callback
- {cc.Node} target
- Returns:
- {Boolean}
-
<static> cc.MenuItemFont.setFontName(name)a shared function to set the fontsize for menuitem font
- Parameters:
- name
-
setFontName(name)
- Parameters:
- {String} name
-
<static> cc.MenuItemFont.setFontSize(fontSize)a shared function to set the fontSize for menuitem font
- Parameters:
- {Number} fontSize
-
setFontSize(s)
- Parameters:
- {Number} s