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 / Tier2: Loading screen with progress bar

Author
Message
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 6th Sep 2011 15:28
I am trying to do a loading screen with a progress bar in tier 2.

right now I have all my LoadImages in app:Begin()

does agk::Sync() work here?

or do I have to move everything inside app::Loop() ?
Airslide
19
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 7th Sep 2011 03:09
Personally I'd throw it in Loop, because I'm not sure what the app class does behind the scenes (it might check for OS messages, for instance). Blocking in Begin may cause some issues.
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 7th Sep 2011 10:29
Seems like I will end having EVERYTHING in agk:Loop()

It has grown to the extent to become very hard to manage. I would like to see some real-life game example code for Tier 2 to see how people are managing loading, intro, levels, etc...
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Sep 2011 04:01
Your APP::LOOP function can be a very light weight function if you like. Once APP::BEGIN has finished preparing all your variables, data, media loading, e.t.c your loop code can simply be a sequence of high level function calls, i.e:

void app::Loop ( void )
{
switch ( app::m_iState )
{
case 1 : TitleLoop(); break;
case 2 : MoreLoadingLoop(); break;
case 3 : GameLoop(); break;
case 4 : GameOverLoop(); break;
case 5 : GameWinLoop(); break;
case 6 : ResetGame(); break;
}
}

As you can see, the loop becomes a very nice piece of code to read, breaking up your logic as you see fit. The switch case approach of controlling your logic is often called a 'state engine'.

I drink tea, and in my spare time I write software.
bjadams
AGK Backer
15
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 9th Sep 2011 09:23
yes right now I am using the switch case. so basically i am in the right path.

next step would be to move all loading out of app::begin and into app::loop as i would like to make some loading %

thanks a lot.

Login to post a reply

Server time is: 2024-02-23 12:40:32
Your offset time is: 2024-02-23 12:40:32