PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Loading system and OnNextFrame

Hi,

I am making a class (a module) which loads the assets of my game for a specific "screen".
While the screen's assets are being loaded, I would like to have a loading screen (with some animated/translated/rotated/whatever surfaces) that plays all along. My EdgeMain/ClassMain class deals with all the logic (animating, translating, etc.), so I would have to call it everytime a number (1 to 10 for example) of assets have been loaded.

I was wondering what was the way to do so ? Should I call by hand the OnNextFrame of my ClassMain class ? The problem is I would have to give a timedelta (see the function's declaration) and I would have to give a timedelta (which would have to be 0 or an arbitrary number as my Asset Loading Module doesn't keep track of the timedelta).

Is this timedelta overwritten by the EdgeLib ? (I which would be great, because I use it for my time-based animation and rotation).
Do I have to (and must) use my module's OnNextFrame function of my Asset Loading Module(which I would rather avoid) to do the loading of my assets so as to have a timedelta to give to my ClassMain ?

Well, that's pretty much all, and oh, I hope I've been clear. :)

Thank you very much
Hi,

The best way to handle this is to use an array of loading tasks. Each frame you will handle one of these tasks and update the progress bar. The task list could be an enum, and handling each task can be handled by a list of switch/case statements.
Thank you, but this does not really answe my question unfortunately.
What I was asking was : am I obliged to do all my loading in the OnNextFrame method of my LoaderModule (so as to have a timedelta to give) that will in turn call my ClassMain's OnNextFrame function (with the timedelta).
Isn't it possible just to call the ClassMain's OnNextFrame function without a timedelta ?
I'd like to limit the OnNextFrame method only to Run() stuff, not to also Load() it. That's the principal goal of a "main loop".

Looking forward for your answer,
Thanks again.
totoch wrote:am I obliged to do all my loading in the OnNextFrame method of my LoaderModule (so as to have a timedelta to give) that will in turn call my ClassMain's OnNextFrame function (with the timedelta).
Isn't it possible just to call the ClassMain's OnNextFrame function without a timedelta ?
I'd like to limit the OnNextFrame method only to Run() stuff, not to also Load() it. That's the principal goal of a "main loop".


Yes, you need to do a bit of loading in the OnNextFrame loop of the framework (and forward it to your loader module) and not the other way around. Otherwise you're stalling the UI system that owns the framework which may terminate your app while running (this will happen on iOS).

Johan