Jump to content

Recommended Posts

Posted

How do I do a black screen with the word "Loading" and load in all the assets while this screen is on?

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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.

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.

×
×
  • Create New...