Skip to main content
GameDev.net gamedev.net
🔒 Locked

How do you make a loading bar?

Started by glhf Jul 8, 2012 at 6:28 PM 1 replies 2k views
Original Post
glhf
glhf
I want to make a loading bar for while the game is checking for updates and downloading them.
How do I get started on this?
Alex Melbourne
Alex Melbourne
All loading bars to is present the internal state of the program to the player. Store the percentage of completion in a variable somewhere and then read this when your rendering the bar to see how much you should fill in.
khagin
khagin
Make a texture for your loading bar and then when drawing it, multiply the width of the bar at 100% completion by the current percentage. Like so:

[source lang="csharp"]Texture loadingTexture = LoadTexture("loadingBar");

float completionPercent = loader.PercentComplete;

Draw(loadingTexture, x, y, loadingTexture.Width * completionPercent, loadingTexture.Height);[/source]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.