Hi!
Don't know if this is the right section, but here's something for the community :)
I noticed I haven't seen a resource manager around (maybe there is, but I haven't seen it) so I thought of writing one. Also, I remembered about the multi-threading in the SVN version, so I wanted to give it a try.
This is what I came up with:
*** Click here to download ***
Features:
- Loads a configuration file that contains paths categorized in groups
- Loads all resources in a folder (no subfolders yet)
- (Nice one) It's threaded!!! You can display a nice animation, mesage, video or whatever while loading your resources in a different thread.
Well, that's pretty cool, but not awesome... This should fix it:
- Custom resource loading: you define your own file extensions and your loading function for it. The manager handles the rest.
It's still in "beta" if I can say so (started working on it yesterday morning) so there might be a few bugs in there to squish.
I did this for my own use, so I may have missed some important features. If so, please point them out and I'll see what I can do :)
If you like this and you use it, some credits would be nice.
Edit:
test file:
resources.cfg
I'm affraid you'll have to use your own bunch of images :) You can read the comments in the .bmx file for more info.
Don't know if this is the right section, but here's something for the community :)
I noticed I haven't seen a resource manager around (maybe there is, but I haven't seen it) so I thought of writing one. Also, I remembered about the multi-threading in the SVN version, so I wanted to give it a try.
This is what I came up with:
*** Click here to download ***
Features:
- Loads a configuration file that contains paths categorized in groups
- Loads all resources in a folder (no subfolders yet)
- (Nice one) It's threaded!!! You can display a nice animation, mesage, video or whatever while loading your resources in a different thread.
Well, that's pretty cool, but not awesome... This should fix it:
- Custom resource loading: you define your own file extensions and your loading function for it. The manager handles the rest.
It's still in "beta" if I can say so (started working on it yesterday morning) so there might be a few bugs in there to squish.
I did this for my own use, so I may have missed some important features. If so, please point them out and I'll see what I can do :)
If you like this and you use it, some credits would be nice.
Edit:
test file:
Import jim.resman Graphics 640,480 Global RM:RMResourceManager = New RMResourceManager RM.Init("Data\resources.cfg") RM.AddCustomType("txt,text",CustomLoad) Global RL:RMResourceLoader = RM.CreateLoader("main",1,1) RL.LoadAll() Repeat Cls DrawText "Loaded: " + ((RL.Loaded() / Float(RL.Total())) * 100) + "%",0,0 Flip Until RL.IsLoaded() Cls Local img:TImage = RM.GetImage("test1") DrawImage img,0,0 DrawText "Loaded!",0,0 Flip WaitKey() Function CustomLoad:Object(pth:String) Print "I am a custom loading function!" Return Null EndFunction
resources.cfg
[main] Data\Images\
I'm affraid you'll have to use your own bunch of images :) You can read the comments in the .bmx file for more info.