-
-
Notifications
You must be signed in to change notification settings - Fork 169
Managing Your Assets
To use assets in kha first you need to include them into your proyect(khafile.js) so khamake can find them during the build stage. By default the folder Assets is created and linked in khafile.js, but you can add other folders by adding project.addAssets('OtherAssetFolder/**'); in your khafiles.js.
one of the responsibilities of khamake beside building your proyect, is to transform your assets into more optimize format depending on your target. So for example you add a .wav in your assets folder and you want to build to windows or mac it will generate a .ogg file. If you target html5 and add the --mpeg command (node Kha/make html5--ffmpeg "/path/to/ffmpeg.exe need the .exe) it will generate a .mp4 or in flash a .mp3. The same analogy works for image files.
khamake expects the assets to be in this formats:
- Images: png
- Sound: wav
- Video: ?
Any other format will not be change and will be available in your code through Assets.blobs as Bytes.
Befoure you can use an asset you need to load it into memory, to do so you need to use one of the loading method under the class Assets. If you want to load everything you can call loadEverything, but its only recomended if you dont use many assets, otherwise you will fill your memory.
To use your assets after they are loaded into memory, you just need to call Assets..nameOfAsset.
Every time you add more assets you need to call make command. ##Assets names The names shown in Assets are loaded using a macro and a json file in the "-resources" folder, so all assets names must respect variable/function naming rules.
- Introduction
- Getting Started
- Breaking Changes
- FAQ
- System targets
- Graphics targets
- Documentation
- API package descriptions