惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

博客园 - 昕

Egret飞行模拟-开发记录03-LoadingUI界面 Egret飞行模拟-开发记录02 python学习笔记之五 中岛美雪——疑似穿越人物 tensorflow学习001——MNIST 机器学习笔记之三-yolov3+win7+vs2017+gpu+opencv编译 机器学习笔记之二-win10+cuda9.1+CUDNN7+Anaconda3+VS2017+tensorflow1.5+opencv3.4 机器学习笔记之一 python网页爬虫开发之七-多线程爬虫示例01 python学习笔记之四-多进程&多线程&异步非阻塞 python网页爬虫开发之六-Selenium使用 python网页爬虫开发之五-反爬 python网页爬虫开发之四-串行爬虫代码示例 python学习笔记之三-计算运行时间 python网页爬虫开发之三 python网页爬虫开发之二 U3D学习14-一阶段学习总结 U3D学习13-数据存储 U3D学习12-黑暗之光实例
Egret飞行模拟-开发记录01
· 2018-11-29 · via 博客园 - 昕

 1、项目结构简介

1.1 index.html:应用入口文件,我们可以在这里面配置项目的旋转缩放模式背景颜色等。

1.2 egretProperties.json:这个文件里面进行项目配置,包括模块和第三方库的配置,发布和native相关配置,比较常用的设置就是添加模块和第三方库。

1.3 manifest.json:清单文件

1.4 tsconfig.json:typescript 编译配置文件。

1.5 wingProperties.json:Egret Wing 项目配置文件

2、egret 自定义字体 

2.1 ttf字体库引入

首先在样式表中添加外部字体:

@font-face { font-family:"ziti1"; src: url("kaiti.ttf"); }

其次添加侦听,使得进入游戏之前完成字体加载: 

 <script> document.fonts.ready.then(success, fail); function success(){ egret.runEgret({renderMode:"webgl", audioType:0}); } function fail(){ } </script>

最后在程序中调用即可:

label.fontFamily ="ziti1";

2.2 位图字体

2.2.1使用Texture Merger工具,编辑文字,导出一张位图和一个.fnt文件。

2.2.2资源加载配置

 

2.2.3代码实现

module demo{

    export class BitMapTextView extends egret.DisplayObjectContainer{

        private _bitmapText : egret.BitmapText = null;

        private _bitmapFont : egret.BitmapFont = null;

        public constructor(){

            super();

            this._bitmapText = new egret.BitmapText();

            this._bitmapFont = RES.getRes("cartoon-font_fnt");

            this._bitmapText.font = this._bitmapFont;

            this._bitmapText.x = this._bitmapText.y = 150;

            this.addChild( this._bitmapText ); 

        }

        /**

         * 显示文本

         */

        public showText( $str : string ) : void{

            this._bitmapText.text = $str;

        }

    }

}

调用:

            let $demo : BitMapTextView = new BitMapTextView();

            this.addChild($demo);

            $demo.showText("I am Aonaufly!");