Hi everyone,
I've made a transition which animates in to fill the screen, performs any heavy tasks, then animates out. I use it for all scene transitions. For most scenes there is virtually no delay when switching screens, but for some it takes a second or so, because I initialise levels etc.
I would like to show a "please wait" message if the delay is longer than n seconds or frames. I guess the only way to do this is with Core.asyncCall? Since this is still a mystery to me, could someone shed light on how I could achieve the above?
Cheers,
Nic
Comments
in the clean after the task
Likes: Apollo14
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Isn't this the kind of thing Async is used for?
https://deluxepixel.com
Likes: totebo
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Likes: totebo, talis
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
use os.time
http://docs.giderosmobile.com/reference/lua/os/time
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
http://giderosmobile.com/forum/discussion/6493/upcoming-background-tasks-support-in-gideros-a-quick-example
Another usage:
http://giderosmobile.com/forum/discussion/comment/48666/#Comment_48666)
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
https://play.google.com/store/apps/developer?id=razorback456
мій блог по гідерос https://simartinfo.blogspot.com
Слава Україні!
Line 1941:
local resetExpeditionSeed
resetExpeditionSeed = self.resetExpeditionSeed
Likes: antix, Apollo14
You could always recode your level generation to be faster to
Likes: SinisterSoft, Apollo14
Likes: antix
Likes: oleg
https://deluxepixel.com
Likes: totebo, antix
Core.yield([number of seconds to wait])
Or is there any way to force Core.asyncCall runs in main thread like coroutine.create does?
So that I can use Core.yield to handle the execute flow ...
Likes: vitalitymobile
http://docs.giderosmobile.com/reference/gideros/Core/asyncCall#Core.asyncCall
"Launch function on separate thread as background task.
Background threads are only executed when main thread is not running"
I used to think Core.asyncCall has low priority and only run in free time.
Can you explain more about "when main thread is not running", what is calculate into the running of "main thread"? And when using Core.asyncCall, how can I ensure it has the high priority to complete the work?
Thank so much!
At Gideros level however, all lua code is run in the same thread, so there is no multicpu handling. First the main code is executed, then when all main code has finished running gideros enters the rendering loop, which does the following:
1. Execute event handlers
2. Draw the frame on backbuffer
3. Execute of chunk of asyncCall'ed functions (which are lua coroutines)
4. Swap backbuffer and frontbuffer and go back to 1
in step 3, we compute the spare time we have before we need to go to 4 (based on fps), and execute has much of 'background' threads as we can, executing them at least once anyhow to ensure they don't stall.
So those background threads have indeed low priority, and you'd not want them to have a higher priority then game rendering anyhow as it would make your game lag.
Likes: vitalitymobile, SinisterSoft