Cocos2dx 3.0rc0 漂亮的 数字、英文显示
1、LabelTTF LabelTTF适合于一次性创建文本后基本上不再改变其显示信息的情况。 CCLabelTTF可以使用setString()函数改变文字内容,而这个时候会创建一个新的opengl纹理,需要重新渲染,这就跟重新创建一个新的LabelTTF差不多。 auto lttf = LabelTTF::create
1、LabelTTF
LabelTTF适合于一次性创建文本后基本上不再改变其显示信息的情况。
CCLabelTTF可以使用setString()函数改变文字内容,而这个时候会创建一个新的opengl纹理,需要重新渲染,这就跟重新创建一个新的LabelTTF差不多。
auto lttf = LabelTTF::create("wilker_yun", "arial", 30); lttf->setPosition(Point(200, 200)); this->addChild(lttf); lttf->setString("Good job");
2、LabelAtlas
适合于只显示数字信息,例如计分板,排行榜之类。不用加载大的字符图片
要使用这个类,必须要有一个数字图片(格式:png),并且知道每个字符的宽度、高度、开始的字符,如

auto la = LabelAtlas::create("98635", "DemoLogin/GUI/labelatlasimg.png", 24.0f, 32.0f, '0'); la->setPosition(Point(200, 150)); la->setAnchorPoint(Point(0.5, 0.5));//原来的锚点在(0,0) this->addChild(la); la->setString("159880793792");
3、(推荐)LabelBMFont
LabelBMFont适合于需要频繁更新的文本内容或者显示好看华丽的文字内容。
LabelBMFont是使用图片文件显示文本内容,相当于每次只是改变了图片的坐标,CCLabelBMFont中每个字符都是一个精灵,可以单独获取运行动作。使用这个类的时候,一定要有一个图片文字文件(格式是png)和一个文字坐标文件(格式是fnt)

auto lbmf = LabelBMFont::create("hello yangxuan0261~!", "DemoLogin/Heiti19.fnt"); lbmf->setPosition(Point(200, 100)); this->addChild(lbmf); lbmf->setString("Nice to meet you ! ~ @#$^&*");
4、效果

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











How to change Chinese to English in Google Chrome? Some friends want to set Google Chrome to English so that they can continuously improve their English during use. So how to set it to English? Google Chrome is Chinese by default. Below, I will show you how to set the language of Google Chrome to English. Let’s take a look. Setting steps: 1. Open [Google Chrome], as shown in the figure below. 2. Click the [three dots] menu in the upper right corner of the Google Chrome interface, as shown in the figure below. 3. After entering the menu page, find [Settings], as shown in the figure below. 4. After entering the settings page, click the [Language] option, as shown in the figure below. 5. Select [Add Language] in the language interface, as shown in the figure below.

What happens when the desktop layout is locked? When using the computer, sometimes we may encounter the situation where the desktop layout is locked. This problem means that we cannot freely adjust the position of desktop icons or change the desktop background. So, what exactly is going on when it says that the desktop layout is locked? 1. Understand the desktop layout and locking functions. First, we need to understand the two concepts of desktop layout and desktop locking. Desktop layout refers to the arrangement of various elements on the desktop, including shortcuts, folders, widgets, etc. we can be free

Some friends do not need to use the English keyboard, but only need to use the Chinese keyboard. At this time, they will find the English keyboard very troublesome and want to hide it. However, we cannot hide it, but we can directly delete the English input method. Let’s follow the editor. Take a look. How to hide the English keyboard in win11 1. The English keyboard cannot be hidden, but we can delete it directly in the input method. 2. First enter "Settings" through the start menu 3. Then select "Time & Language" 4. Then enter "Language & Region" and click "Addakeyboard" below to add keyboard shortcuts. 5. Then click on the input method we want, and then click the arrow in the lower left corner to move it to

There are many users using Remote Desktop Connection. Many users will encounter some minor problems when using it, such as the other party's taskbar not being displayed. In fact, it is probably a problem with the other party's settings. Let's take a look at the solutions below. How to display the other party's taskbar during Remote Desktop Connection: 1. First, click "Settings". 2. Then open "Personalization". 3. Then select "Taskbar" on the left. 4. Turn off the Hide Taskbar option in the picture.

In Linux systems, you can use the pwd command to display the current path. The pwd command is the abbreviation of PrintWorkingDirectory and is used to display the path of the current working directory. Enter the following command in the terminal to display the current path: pwd After executing this command, the terminal will display the full path of the current working directory, such as: /home/user/Documents. In addition, you can use some other options to enhance the functionality of the pwd command. For example, the -P option can display

You don’t need to enter the WIFI password often, so it’s normal to forget it. Today I will teach you the simplest way to find the password of your own WIFI. It can be done in 3 seconds. To check the WIFI password, use WeChat to scan it. The premise of this method is: there must be a mobile phone that can connect to WIFI. Okay, let’s start the tutorial: Step 1. We enter the phone, pull down from the top of the phone, bring up the status bar, and the WIFI icon. Step 2. Long press the WIFI icon to enter the WLAN settings; long press the WIFI icon. Step 3. Click Connected. Enter the WIFI name of your home, click Share Password, and a QR code will pop up; Step 4 of sharing WIFI password, we take a screenshot and save this QR code; Step 5, long press the WeChat icon on the desktop, and click Scan

Many friends who work on the computer use the English input method to work. At this time, they need to lock the English input. So how to lock it? Let’s take a look at the detailed methods below. How to lock the input method that comes with win10 in English: 1. Click the input method logo in the lower right corner of the desktop, and then click "Language Preferences". 2. Then click "Add preferred language" under the preferred language. 3. Enter English in the dialog box and click to install the language. 4. After the installation is complete, click "Set as default language".

What is the difference between full-width characters and half-width characters? In our daily life, we often encounter the two concepts of full-width characters and half-width characters, especially in input methods, typesetting, printing, etc., which involve the use of these two characters. So, what is the difference between full-width characters and half-width characters? Let us discuss this issue below. First of all, full-width characters and half-width characters were concepts originally introduced by Chinese typewriters. The so-called half-width characters are characters that occupy half the width of a character, usually referring to English characters and Arabic numerals. Full-width characters occupy
