godot导出html,导出自定义HTML页面

导出自定义HTML页面¶

While Web export templates provide a default HTML page fully capable of launching

the project without any further customization, it may be beneficial to create a custom

HTML page. While the game itself cannot easily be directly controlled from the outside yet,

such page allows to customize the initialization process for the engine.

自定义默认页面有用的一些用例包括:

从其他目录加载文件;

加载 .zip 文件而不是 .pck 文件作为主资源包;

从主资源包文件以外的目录中加载引擎文件;

添加一个"即点即玩"按钮,使游戏可以在全屏模式下启动;

在引擎启动之前加载一些额外的文件,以便稍后在文件系统中可用;

传递自定义"命令行"参数,例如 -s 启动``MainLoop``脚本.

The default HTML page is available in the Godot Engine repository at

/misc/dist/html/full-size.html

but the following template can be used as a much simpler example:

My Template

var engine = new Engine($GODOT_CONFIG);

engine.startGame();

场景布置¶

As shown by the example above, it is mostly a regular HTML document, with few placeholders

which needs to be replaced during export, an html element, and some simple

JavaScript code that calls the Engine() class.

The only required placeholders are:

$GODOT_URL:

The name of the main JavaScript file, which provides the Engine() class required

to start the engine and that must be included in the HTML as a .

The name is generated from the Export Path during the export process.

$GODOT_CONFIG:

A JavaScript object, containing the export options and can be later overridden.

See EngineConfig for the full

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值