DEKI/ENGINE 文档
手册 API 参考
Deki 0.40.1
带可视化编辑器的模块化 C++ 引擎,支持 2D 和 3D
载入中...
搜索中...
未找到
Assets

本指南尚未翻译。

An asset is a file your game uses: an image, a font, a scene, an animation.

Add one

Drag the file onto the Asset Browser, or copy it into the project's assets folder. The editor imports it on its own.

File Becomes
.png An image. See Sprites
.ttf, .bdf A font. See Text
.scene A scene
.anim An animation. See Animation

Keep the .data file with it

Beside each asset is a file of the same name ending in .data. It holds the asset's settings and its id, and fields point at that id. Move and rename assets in the Asset Browser, so the two stay together and nothing that uses them breaks.

Use one

Choose it in the Inspector. A field like Sprite or Font offers the assets of that kind.

For your own components, add a field:

DEKI_EXPORT
Deki::AssetRef<Deki2D::Sprite> hurtSprite;

Use it like a pointer. The asset loads the first time your code needs it.

if (hurtSprite)
{
sprite->sprite = hurtSprite.Get();
}

Different settings per device

An image's settings can differ per device, such as a smaller Max Size where memory is short: see Sprites. Each device's build gets its own copy, so your other targets are not affected.

The Memory panel shows what a scene will take on a device before you run it.

How assets are stored and found is covered under Working on Deki, in Asset System.