Async image loading with mojo2

Monkey Forums/Monkey Programming/Async image loading with mojo2

itto(Posted 2016) [#1]
I checked the documentation and the forums and what I understand is that async image loading basically works only for mojo1 images, is that so? If yes, has anyone managed to implement async image loading across all targets with mojo2 images?

I was thinking about creating a loader class where queued assets would be loaded once at a time synchronously, then delaying the loading of the next item in the queue until the next frame, but was hoping for a cleaner and non-blocking solution.


Soap(Posted 2016) [#2]
Find a solution?


itto(Posted 2016) [#3]
Nope, I didn't want to waste too much time on it.

I ended up implementing a loading queue and updating the gui the frame after every rrsource loaded. Works ok for a loading screen, but it's extremely limited anyway.


Soap(Posted 2016) [#4]
Anyone willing to do work to make Mojo2 work with the async image loading as a paid commission?

If not I'll do it myself as soon as I have time and post the changes.


ImmutableOctet(SKNG)(Posted 2016) [#5]
I actually added this to 'regal.mojoinmojo2' last year. Here's the relevant code. When the operation finishes, it constructs an image like this; in other words, it uses 'Image.WritePixels'.


ImmutableOctet(SKNG)(Posted 2016) [#6]
I decided to say screw it, and I wrote a demo. That should do exactly what you're looking for.


Soap(Posted 2016) [#7]
Awesome! I'll take a look soon and report results.


Soap(Posted 2017) [#8]
Think I forgot to report that it worked great.

I was loading all JPEGs until now. It seems images with transparent backgrounds do not load right?


ImmutableOctet(SKNG)(Posted 2017) [#9]
Okay, this should be fixed now. Download the latest version from GitHub.


Soap(Posted February) [#10]
Awesome! Works! Thank you!