Loading progress...
BlitzMax Forums/BlitzMax Programming/Loading progress...
| ||
Hi people, i have problem to implement a loading feature. I have my process to load resources, thats consist in a couple of lines reading the resources, imgs, sounds, and fonts. I update my progress bar on each loaded resources, but now i want to make another load screen with some dinamics animations. So i want to have a real progress of my loads and in the same screen while loading have a sprites animations. What can be the best way to implement it? |
| ||
You need to load your resources in a separate thread, whilst running the loading animation or whatever in the main thread until the 'loading' thread ends. Apparently graphics contexts are not thread-safe so you shouldn't do it the other way around, i.e. don't load graphics in the main thread and run the loading anim in a sub thread. |
| ||
Assuming you have the latest version of BlitzMax installed, check \samples\threads\background_loading.bmx for an example. |
| ||
Assuming you have the latest version of BlitzMax installed, check \samples\threads\background_loading.bmx for an example. I didn't understand that bit of code last time you told me about it. Its a cracking bit of code, now that I understand Tmaps! |
| ||
Looking at it again, that code was really confusing, given it was only meant to be a simple example. I tried to make it too generic when I should have just hard-coded a bunch of global filenames. I've just done a quick hack-job to make it work with simple arrays of pixmaps/images/filenames -- save this into the \samples\threads folder and run: This should make the basic loading process easier to follow anyway. |
| ||
Thanks for all the answers, thanks BlitzSupport for the example. |
| ||
So how would you implement a simple int loading counter in this example? |
| ||
If you have the amount of resources to load in a global variable and you update that when you load each resource you can make a int loader or percent loader if you want to have more realistic progress bar. |