[SOLVED] Dynamic Loading Process (Keeping up with percentages)

Hello JGO on occasion I get rather bored so I’ll choose something to program ;D

Tonight I’m trying to program a loading system for my game that will do the following:
Load my games resources (Textures, Maps, Objects etc…)

I would like to make this loading system ‘dynamic’, and by dynamic I mean I can always calculate the percentage of the loading process. (Which will hopefully depend on the # of objects being loaded)

Pseudo-code:


public void load() {
     while(percentage < 100) {
          // object by object, image by image load them
          // all into memory.
          percentage += some_formula;
     }
}

So my question is:
How should I go about writing a dynamic loading system?

Notes:

of objects needing loading are predefined.

The loading process is occurring via a SwingWorker to update the GUI while loading.

If anybody could give me some advice or a snippet / pseudo code on how to go about this that would be great!
Thanks JGO :slight_smile: