JPPackLoader is an AIModel that will allow you to load .stk files in your games. It will be useful for all packages offered below.
Once the AIModel is added to your game, the process to add a pack to your game is as follows:
- Add the .stk files you want to load to the root directory of your ShiVa project.
- Send an event to JPPackLoader.
- Activate your packs
Here is an example of loading and activation, with the JPAnimation pack (who must have been placed in your project root directory):
Note that if the pack is stored locally, you can use the pack directly because it is loaded instantly when "onLoadLocalPacks" is called. However, some games may require to store the pack on a distant server, so the pack has to be downloaded and this process may take several frames. JPPackLoader is able to do it, and this is now a 2 steps process: download request made by you to JPPackLoader, and callback event sent to you by JPPackLoader when all the packs have been downloaded and are ready to be used. Here are the steps to follow:
Simply send the "onLoadPacksEnd" event to inform JPPackLoader that all the pack requests have been made. JPPackLoader will notify you when they are all downloaded and ready to use with the "onPacksLoadingDidEnd" handler. You can start using your packs in this handler, starting with the activation: