Jump to content

Any way to check if game is loading in C++?


tomis13lack
 Share

Recommended Posts

You should be able to find a thread or two about this (search the forums for loading screen or similar) but my method (I'm also on C++) is to load everything myself and then load the map afterwards.  Because you already have the models in memory, the map should then load very quickly.  You can increment a counter for each model you load and you'll know how far along you are in the process.  Something like:

//  Pseudocode
temporaryentity[counter++]->load("tree1.mdl");
DisplayProgressbar();

temporaryentity[counter++]->load("tree2.mdl");
DisplayProgressbar();

etc. but coded nicer.

At the end you'll know how big your counter is and you can use that as a total to divide by to get a percent loaded.

Link to comment
Share on other sites

Sorry.  It was pseudo code for a function you could create, not an actual function in Leadwerks.  It would just display your progress bar based on the counter count (so the bar would get longer with each call).  The function would look something like this, assuming counter is global.

void DisplayProgressbar()
{
	context->SetColor(0.0, 0.0, 1.0);
	context->DrawRect(0, 0, counter / totalcounter * 500, 50);
	context->Sync();
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...