OnLoading ?

Monkey Archive Forums/Monkey Discussion/OnLoading ?

Paul - Taiphoz(Posted 2012) [#1]
when does this get called, seems to me like its getting called AFTER everything is loaded up. ?


matty(Posted 2012) [#2]
Yes it's a bit of a wasted method...


therevills(Posted 2012) [#3]
If you check the Mojo's native code, you will see:

GFLW
OnLoading is never called.

Flash
Calls OnLoading if "loading" variable is true and it has IncLoading and DecLoading which sets "loading", but I cant find where these are called from.

Android
OnLoading is never called.

HTML5
Calls OnLoading if "loading" variable is true and it has IncLoading and DecLoading which sets "loading", these are called from LoadSurface (LoadImage).

iOS
OnLoading is never called.

PSS
OnLoading is never called.

XNA
OnLoading is never called.

---------

So it is only really used in HTML5, but the issue is that the Javascript takes too long to load into the browser and that loading images isnt that slow.

I think Mark was just trying to see if he could do a preloader, but it didnt work out.


AdamRedwoods(Posted 2012) [#4]
Right. I mentioned in another thread that monkey could use a preloader routine for loading assets (think html, android, ios), and OnLoading() seemed to be a good place to do it.

Flash is a little trickier since assets are bundled into the swf, but for the others it would seem a good idea.


Samah(Posted 2012) [#5]
Except that on some platforms, images aren't fully loaded until the first call to DrawImage, and you can't call rendering functions outside of OnRender.

Clarification: LoadImage reads the image from disk into RAM, and is pretty much instantaneous. In OpenGL, you still need to upload it to the GPU, which is SLOW. That's why the first call to DrawImage will lag (per image).