Egret基础

作者: PaulLuv | 来源:发表于2018-03-12 11:32 被阅读121次

    命令行

    egret common [-v]

    create

    egret create project_name --type
    project_name 项目名称
    --type 要创建的项目类型empty、game、gui、eui。 
    

    create_app

    从h5游戏生成app

    egret create_app app_name -f h5_game_path -t template_path
    

    startserver

    egret startserver [project_name] [--port 3000] [-ip] [-serveronly]
    
    egret run [project_name] -a 
    这个命令在实际中也可以使用。
    (control + c 退出startserver终端模式)
    

    项目结构

    如口文件说明

    1. 库文件
      manifest.json 文件下的 “initial” 中是库文件列表,包括 Egret 核心库和其他扩展库。

    2. 项目代码文件
      manifest.json 文件下的 “game” 中是项目代码文件列表。

    3. 运行配置
      在index.html文件中。

    • data-entry-class:入口文件类名称。
    • data-orientation:旋转模式。
    • data-scale-mode:适配模式。
    • data-frame-rate:帧频数。
    • data-content-width:游戏内stage宽。
    • data-content-height:游戏内stage高。
    • data-show-pain-rect:是否显示脏矩形区域。
    • data-multi-fingered:多指最大数量。
    • data-show-fps:是否显示fps。
    • data-show-log:是否显示egret.log的输出信息。
    • data-show-fps-style:fps面板的样式。支持5种属性,x:0, y:0, size:30, textColor:0xffffff, bgAlpha:0.9
    1. 启动项目
      egret.runEgret({ renderMode: "webgl", audioType: 0 })启动项目。
      参数是一个对象,包括一下4个可选属性“
    • “renderMode”: 引擎渲染模式,”canvas” 或者 “webgl”
    • “audioType”: 使用的音频类型,0:默认,2:web audio,3:audio
    • “antialias”: WebGL模式下是否开启抗锯齿,true:开启,false:关闭,默认为false
    • “retina”: 是否基于devicePixelRatio缩放画布
    1. 项目配置
      项目的根文件夹下有名为egretProperties.json的配置文件,引擎所涉及的配置均存储在此。

    2. tsconfig 配置文件
      tsconfig.json是 Typescript 项目的配置文件,TypeScript 编译器编译代码之前,会首先读取这个配置文件,并根据其中的属性来设置 TypeScript 项目的编译参数。

    相关文章

      网友评论

        本文标题:Egret基础

        本文链接:https://www.haomeiwen.com/subject/zzqnfftx.html