Reference Codebot.Render.Assets.pas
Part of the Codebot Render package
The Codebot.Render.Assets unit finds the assets of your program, the fonts, images, sounds, and other files it loads while it runs. An asset is named by its path below the assets folder, with forward slashes, such as fonts/roboto.ttf. On macOS the folders above your program are searched for the assets folder too.
Normally assets are files in the assets folder beside your program. If you set an AssetKey on your host, your program keeps its assets in one dat file beside it instead, named after the program, such as cardgames.dat, whenever that file is there. An asset that isn't in the dat file is still looked for in the assets folder. Every byte of a dat file is changed with xor by the four bytes of the key, so it can't be read without the key. Your program builds its own dat file when you start it with --build-dat, which the hosts handle before opening a window.
AssetOpen opens an asset from either place as a stream, AssetExists tells you whether there is one, and AssetText reads one as text. The canvas, textures, and audio each have a method that loads from an asset by name.
Items 18 items
| Name | Kind | Line |
|---|---|---|
| AssetBuildRequested | function | 121 |
| AssetBuildSwitch | constant | 57 |
| AssetExists | function | 94 |
| AssetFindFile | function | 89 |
| AssetFindFolder | function | 91 |
| AssetFolder | variable | 65 |
| AssetKey | variable | 63 |
| AssetNotFound | procedure | 104 |
| AssetOpen | function | 97 |
| AssetPackActive | function | 82 |
| AssetPackBuild | function | 109 |
| AssetPackData | function | 86 |
| AssetPackFileName | function | 80 |
| AssetProgramFileName | function | 78 |
| AssetRequire | function | 100 |
| AssetText | function | 102 |
| AssetXor | procedure | 75 |
| EAssetError | class | 53 |