Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / How to implement a "loading..." screen

Author
Message
Eqqman
9
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 6th Mar 2017 07:39 Edited at: 6th Mar 2017 07:40
Imagine I have some high-level code like this:

So if InitGame() involves a lot of costly processes that could take many seconds to run, I might want to have some kind of loading screen generated that updates itself in some fashion. How exactly do I do this if the call to InitGame() is still running? Do I have to set up the screen first and then bury additional calls to Sync() strategically around inside the InitGame() process?
Goo Goo G\'Joob!
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 6th Mar 2017 07:44
Yes
AGK V2 user - Tier 1 (mostly)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 6th Mar 2017 09:04 Edited at: 6th Mar 2017 09:04
Eqqman wrote: "Do I have to set up the screen first and then bury additional calls to Sync() strategically around inside the InitGame() process?"

Scraggle wrote: "Yes"
Signature removed by mod because it's larger than 600x120... please resize and try again.
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 6th Mar 2017 11:12
Yes. However the easiest way would be something like this (more or less)

Where UpdateLoadingScreen() will animate the loading bar/indicator in a short loop. Alternatively you could replace each of those loading functions simply with blocks of code (ie disperse UpdateLoadingScreen() throughout your existing init function). Another alternative is to store all your images and sounds in a massive array, have the filenames as consecutive numbers (1.png, 2.png etc) and load them all in a for/next loop, calling updateLoadingScreen() in each loop.

Hope that's a bit helpful I mean anything goes, just so long as you don't go placing sync commands and loops all throughout your code. Keep all your loading screen animation stuff separate from your other code.

My Games - Latest WIP - My Website: Immortal.Digital - FB - Twitter
130,000 installs with AppGameKit and counting
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 6th Mar 2017 12:29
same easter bunny wrote
functions that create and remove the progressbar and one for next step
init the progress with max steps value
then just call Progress() for a step or update
i suggest also using a progress part name and show it at screen.
AGK (Steam) V2017.02.28 : Windows 10 Pro 64 Bit : AMD (17.2.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
Eqqman
9
Years of Service
User Offline
Joined: 15th Jul 2015
Location:
Posted: 6th Mar 2017 20:02
Ok, sounds about like I thought then. Thank you!
Goo Goo G\'Joob!

Login to post a reply

Server time is: 2024-11-24 19:24:34
Your offset time is: 2024-11-24 19:24:34