Loading Progress?

Blitz3D Forums/Blitz3D Programming/Loading Progress?

Yue(Posted 2010) [#1]
Hi, if someone gives me an idea, I have an animated image that flashes while loading resources. The problem is that I need that is always active, but at the time of loading an object, more specifically the field, the image remains static and I need is that the burden of the objects in the first level but do not affect charging indicator.

Any suggestions?




GfK(Posted 2010) [#2]
Can't. Need threading support for that.


_PJ_(Posted 2010) [#3]
The best you can do, is have something animated in-between the individual resource being loaded.

for (very simple) example:

BBank=CreateBank(512)
Sound=LoadSound("Sound.wav")
AnimateLoadingImage(0.1)
Picture=LoadImage("Pic.bmp")
AnimateLoadingImage(0.2)
Datafile=ReadFile("Data.dat")
AnimateLoadingImage(0.3)
D1%=ReadInt(Datafile)
D2%=ReadString(Datafile)
For IterData=1 to 512
   D_Stream=ReadByte(Datafile)
   PokeByte DBank,IterData-1,D_Stream
   AnimateLoadingImage(1.0-(0.97/512.0)*IterData)
Next

Function AnimateLoadingImage(fRatio#)
   Rect 0,50,GraphicsWidth(),100,False
   Rect 0,50,GraphicsWidth()*fRatio,100,True
End Function



ClayPigeon(Posted 2010) [#4]
There is another way, but it only works for images and data. (not sounds or fonts etc.) But, you have to make your own image loader. When loading an image, progress the image by the amount of time since the last image update. Do this between each pixel loaded. The same goes for custom data files, just update the image every byte instead of every pixel. Hopefully this helps.