Does anyone know what OnLoading() is meant to do?

Monkey Forums/Monkey Programming/Does anyone know what OnLoading() is meant to do?

GfK(Posted 2011) [#1]
A working example would be nice. I cannot get a peep out of it.

How is it meant to be used?


Xaron(Posted 2011) [#2]
That's what version.txt says:

OnLoading now called instead of OnUpdate/OnRender if app is still Loading stuff.

So OnUpdate and OnRender are not called as long as the loading isn't finished yet...


GfK(Posted 2011) [#3]
But.... how often is it called? Once? 30 times a second? How does it know stuff is loading? Can this be used for a progress bar etc?


Xaron(Posted 2011) [#4]
Indeed good questions! Actually I don't knowp but would be very interested in the answers, too.


therevills(Posted 2011) [#5]
I based MojoMax off on the Flash version of Mojo, which calls OnLoading in the InvokeRender, which is called in the main loop, so it gets called the same number of times as OnRender ;)

Basically there is a variable called "loading", this is increased in LoadImage (LoadSurface in native), once it has finished loading a image it decreases, the call to OnLoading only happens if the "loading" variable is "true".


skid(Posted 2011) [#6]
It's target specific.

For some, like iOS it is not used/needed as Apple already provides a standard mechanism for displaying a splash screen while your app loads.

Mojo on Flash now uses embedded graphics so the OnLoading mechanism is also redundant.


therevills(Posted 2011) [#7]
It's target specific.


Yep this is correct, looking in the mojo.ios.cpp and mojo.android.java code, OnLoading is never called....

OnLoading is not called for the following targets:
* iOS
* Android
* GLFW
* XNA

Mojo on Flash now uses embedded graphics so the OnLoading mechanism is also redundant.


But the code is there in Flash???


GfK(Posted 2011) [#8]
>>For some, like iOS it is not used/needed as Apple already provides a standard mechanism for displaying a splash screen while your app loads

really? How's that then?


skid(Posted 2011) [#9]
It just is.

[edit]

Google ios splash or some such if you want more information.

If you are going to publish for iOS you really should be familiar with the getting started docs Apple provides, they really are quite well written.


therevills(Posted 2011) [#10]
Or if you want you can just do a loading screen yourself without messing with the XCode stuff...

http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/BuildTimeConfiguration/BuildTimeConfiguration.html#//apple_ref/doc/uid/TP40007072-CH7-SW12


Dabz(Posted 2011) [#11]
I just put me logo up, and let it get on with it!

I'd probably change it if there was enough media, but, Logic Battleships and Nags take about 3 seconds, which is an adequate amount of time to display a logo IMO.

Dabz


therevills(Posted 2011) [#12]
I added a splash screen and do the loading whilst it is displayed, I then "cache" the images to the GPU (really need this with Android) at the same time...