Jump to content

loading....[c++]


cassius
 Share

Recommended Posts

Assuming you're loading stuff in one big chunk, you can do something like:

 

Texture *background = Texture::Load("./path");
context->SetColor(Vec4(1));
context->DrawTexture(background);
context->DrawText("Loading...", 25, 25);
context->Sync();
LoadAssets();

 

But if you want to have a progress bar for loading, you can seperate the loading part into functions like LoadModel(std::string path) and do:

void LoadModel(std::string path)
{
  models[ modelIndex ] = LoadModel(path);
  modelIndex += 1;
  RedrawScreen();
}

void RedrawScreen()
{
  itemsLoaded += 1;
  // Draw background here
  context->DrawRect(startX, startY, barLength / totalItems * itemsLoaded, barHeight);
  context->Sync();
}

 

With the above code I'm assuming you pre-load your assets in a class where you can retrieve them from later. You could make the class static so that every class can reach it without having a reference, but that's kinda ugly :P

  • Upvote 2

Using Leadwerks Professional Edition (Beta), mainly using C++.

Windows 10 / Linux Mint, Visual Studio 2017. GPU: NVidia GeForce GTX970, CPU: Intel i7 7700K @ 4.20 GHz

Previously known as Evayr.

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...