Class cc.MenuItemFont

Class Summary
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

Method Detail

  • <static> {cc.MenuItemFont} cc.MenuItemFont.create(value, callback, target)
    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}
  • {String} fontName()
    Returns:
    {String}
  • <static> {String} cc.MenuItemFont.fontName()
    a shared function to get the font name for menuitem font
    Returns:
    {String}
  • {Number} fontSize()
    Returns:
    {Number}
  • <static> {Number} cc.MenuItemFont.fontSize()
    a shared function to get the font size for menuitem font
    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