Special Effect Characters in cocos2d

Source: Internet
Author: User

The project has a countdown function. This function is easy to implement. However, it is required that the time number displayed on the page must be a special effect number produced by the artist.

This is the function for displaying FPS values in cocos2d. Find the source code in cocos2d to see how to use it. Simple

1) Name the characters required by the artist

Some articles on the Internet mentioned that the character should be placed first in the image. However, after my experiment, there is no difference between putting it in front and following. However, you must note that the width of each number, including characters, must be fixed and must be the Npower of 2. If it is an odd number, it will display unexpectedly.

2) in the code, call

Cclabelatlas * timenumber = [cclabelatlaslabelwithstring: @ "00:00" charmapfile: @ "numbers.png" itemwidth: 20 itemheight: 26 startcharmap: '0'];

Labelwithstring is the initial display status of characters.

Charmapfile is an image of the corresponding number

Itemwidth is the width of a character or number, which must be an even number.

Itemheight is the height of a character or number, preferably an even number, or a base number.

Startcharmap is the start character or number of the string. Here it is "0"

3) The content of the modified text is the same as that of cclabelttf.

[Clocklabel setstring: @ "12:56"]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.