public static CCMenuItem CreateScaledMenuItemLabel(CCSize buttonSize, int labelPadding, float strokeSize, CCColor3B textColor, CCColor3B strokeColor, CCColor3B backColor, string labelText, Action action) { var menuItem = action != null ? new CCMenuItem(o => action()) : new CCMenuItem(); var labelSize = new CCSize(buttonSize.Width - labelPadding, buttonSize.Height - labelPadding); // Add background var blockSprite = new CCSprite("images/Block_Back"); blockSprite.ScaleTo(buttonSize); blockSprite.Color = backColor; menuItem.AddChild(blockSprite); menuItem.ContentSize = buttonSize; // Add label var labelTtf = new CCLabelTTF(labelText, "arial-24", 10); labelTtf.Color = textColor; // Add Stroke to label // if (strokeSize > 0) labelTtf.AddStroke(strokeSize, strokeColor); if (labelTtf.ContentSize.Width > labelSize.Width) { labelTtf.ScaleTo(labelSize); } menuItem.AddChild(labelTtf); return(menuItem); }