BMFont使用链接--->>  http://blog.csdn.net/qiurisuixiang/article/details/8984288

这里要注意.fnt文件可通过BMFont工具进行创建,该代码于init函数中:

auto label1 = Label::createWithSystemFont("Hello World1", "Arial", );
label1->setPosition(Vec2(origin.x + visibleSize.width/, origin.y + visibleSize.height - ));
this->addChild(label1, ); auto label2 = Label::createWithTTF("Hello World2", "fonts/Marker Felt.ttf", );
label2->setPosition(Vec2(origin.x + visibleSize.width/, origin.y + visibleSize.height - ));
this->addChild(label2, ); auto label3 = Label::createWithBMFont("fonts/t2.fnt", "Hello World3");
label3->setPosition(Vec2(origin.x + visibleSize.width/, origin.y + visibleSize.height - ));
this->addChild(label3, ); TTFConfig ttfConfig("fonts/Marker Felt.ttf", , GlyphCollection::DYNAMIC);
auto label4 = Label::createWithTTF(ttfConfig, "Hello World4");
label4->setPosition(Vec2(origin.x + visibleSize.width/, origin.y + visibleSize.height - ));
this->addChild(label4, ); ttfConfig.outlineSize = ;
auto label5 = Label::createWithTTF(ttfConfig, "Hello World5");
label5->setPosition(Vec2(origin.x + visibleSize.width/, origin.y + visibleSize.height - ));
// Enable shadow for the label
label5->enableShadow(Color4B(,,,), Size(, -));
label5->setColor(Color3B::RED);
this->addChild(label5, );

运行结果如下:

Cocos2d-x学习笔记(六)Label字体控制的更多相关文章

  1. java之jvm学习笔记六-十二(实践写自己的安全管理器)(jar包的代码认证和签名) (实践对jar包的代码签名) (策略文件)(策略和保护域) (访问控制器) (访问控制器的栈校验机制) (jvm基本结构)

    java之jvm学习笔记六(实践写自己的安全管理器) 安全管理器SecurityManager里设计的内容实在是非常的庞大,它的核心方法就是checkPerssiom这个方法里又调用 AccessCo ...

  2. Typescript 学习笔记六:接口

    中文网:https://www.tslang.cn/ 官网:http://www.typescriptlang.org/ 目录: Typescript 学习笔记一:介绍.安装.编译 Typescrip ...

  3. Go语言学习笔记六: 循环语句

    Go语言学习笔记六: 循环语句 今天学了一个格式化代码的命令:gofmt -w chapter6.go for循环 for循环有3种形式: for init; condition; increment ...

  4. Learning ROS for Robotics Programming Second Edition学习笔记(六) indigo xtion pro live

    中文译著已经出版,详情请参考:http://blog.csdn.net/ZhangRelay/article/category/6506865 Learning ROS for Robotics Pr ...

  5. .NET MVC 学习笔记(七)— 控制input控件

    .NET MVC 学习笔记(七)— 控制input控件 画面中有时候需要输入数字,这时就需要控制input的输入.以下为保留两位有效数字. /* * 初始化数字输入 */ function initD ...

  6. python3.4学习笔记(六) 常用快捷键使用技巧,持续更新

    python3.4学习笔记(六) 常用快捷键使用技巧,持续更新 安装IDLE后鼠标右键点击*.py 文件,可以看到Edit with IDLE 选择这个可以直接打开编辑器.IDLE默认不能显示行号,使 ...

  7. 【opencv学习笔记六】图像的ROI区域选择与复制

    图像的数据量还是比较大的,对整张图片进行处理会影响我们的处理效率,因此常常只对图像中我们需要的部分进行处理,也就是感兴趣区域ROI.今天我们来看一下如何设置图像的感兴趣区域ROI.以及对ROI区域图像 ...

  8. Linux学习笔记(六) 进程管理

    1.进程基础 当输入一个命令时,shell 会同时启动一个进程,这种任务与进程分离的方式是 Linux 系统上重要的概念 每个执行的任务都称为进程,在每个进程启动时,系统都会给它指定一个唯一的 ID, ...

  9. # go微服务框架kratos学习笔记六(kratos 服务发现 discovery)

    目录 go微服务框架kratos学习笔记六(kratos 服务发现 discovery) http api register 服务注册 fetch 获取实例 fetchs 批量获取实例 polls 批 ...

  10. Spring Boot 学习笔记(六) 整合 RESTful 参数传递

    Spring Boot 学习笔记 源码地址 Spring Boot 学习笔记(一) hello world Spring Boot 学习笔记(二) 整合 log4j2 Spring Boot 学习笔记 ...

随机推荐

  1. 安装selenium python

    https://pypi.org/project/selenium/#files selenium-3.13.0-py2.py3-none-any.whl 安装成功后才能用 from selenium ...

  2. [LeetCode] 844. Backspace String Compare_Easy tag: Stack **Two pointers

    Given two strings S and T, return if they are equal when both are typed into empty text editors. # m ...

  3. Python 之 os.walk()

    原文地址https://www.cnblogs.com/JetpropelledSnake/p/8982495.html          http://www.runoob.com/python/o ...

  4. Django中的admin组件分析

    admin的使用介绍 django-admin的使用 Django 提供了基于 web 的管理工具. Django 自动管理工具是 django.contrib 的一部分.可以在项目的 setting ...

  5. HDU 1392 Surround the Trees(几何 凸包模板)

    http://acm.hdu.edu.cn/showproblem.php?pid=1392 题目大意: 二维平面给定n个点,用一条最短的绳子将所有的点都围在里面,求绳子的长度. 解题思路: 凸包的模 ...

  6. Maven的常用功能

    一.jar包管理(仓库) 最佳实践: 1:排除依赖 pom中依赖了某个第三方API,此API又依赖其它API,有可能出问题.(必须申明排除该第三方依赖) Spring-core又隐式的依赖了commo ...

  7. 174. Dungeon Game(动态规划)

    The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...

  8. Rpgmakermv(5) MiniLabel插件介绍

    ============================================================================ Introduction ========== ...

  9. Groovy中的闭包

    Closures(闭包) 本节主要讲groovy中的一个核心语法:closurs,也叫闭包.闭包在groovy中是一个处于代码上下文中的开放的,匿名代码块.它可以访问到其外部的变量或方法. 1. 句法 ...

  10. Python: 正则表达式匹配反斜杠 "\"

    Python正则表达式匹配反斜杠 "\" eg: >>>a='w\w\w' 'w\\w\\w' #  打印出来的 "\\" 被转义成 一个反斜 ...