SkillAgentSearch skills...

CCLabelBMFontMultiline

Adds center-alignment, auto word-wrap, and dimension constraint support for multiline CCLabelBMFont

Install / Use

/learn @pingpongboss/CCLabelBMFontMultiline
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

These patches have been integrated into version 2.0 of cocos2d-iphone https://github.com/cocos2d/cocos2d-iphone/pull/124

This repository contains old code before being merged into cocos2d-iphone. For the latest changes, please use https://github.com/cocos2d/cocos2d-iphone/tree/gles20

A replacement for CCLabelBMFont. Useful if you want:

  • Left, Center, and Right alignments for single and multi line labels
  • Auto word wrap for inserting line breaks intelligently based on given width

To use, download both CCLabelBMFont.h and CCLabelBMFont.m, and replace the 2 files under the cocos2d folder with the new modified files.

In your code, do:

CCLabelBMFont *label = [CCLabelBMFont labelWithString:@"My Label" fntFile:@"my-font-file.fnt" width:200 alignment:CenterAlignment];

The included demo project has an sample .fnt file made using GlyphDesigner, and examples on how to use CCLabelBMFont.

Discussion thread is here http://www.cocos2d-iphone.org/forum/topic/16242 Applied for inclusion in cocos2d-extensions here http://www.cocos2d-iphone.org/forum/topic/17106#post-119860

View on GitHub
GitHub Stars19
CategoryCustomer
Updated2y ago
Forks5

Languages

Objective-C

Security Score

75/100

Audited on Dec 22, 2023

No findings