Loading Bar

This topic contains 2 replies, has 3 voices, and was last updated by  jihem 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #15860



    I’m not an expert in programming. My concern is as follows. I want to create a load bar that shows how resources are loaded in the background in a parallel thread. But the big drawback I have is that I don’t know how to evaluate the total percentage of the load with the total of the resources that are loaded.

    What I have written is that I have an algorithm that every time I load a resource an id increases its value, 1,2,3 etc, in addition they are added to a list where you can recover its value at any time. But the problem is that my load progress bar measures 200 units, and for example currently do not load 200 resources, rather an average of 46. The fact is that if I put those data in the progress bar, would reach 46 and load the level, but I would occupy 100% of the bar that are 200 units, regardless of the amount of resources that are loaded. Any suggestions?

    Translated with http://www.DeepL.com/Translator




    If I’m reading it right, I think you want something like this ?

    max_pixels * number_loaded / number_total

    That will give you the pixel width of the bar rectangle to draw

    200 * 1 / 46 = 4 (rounded down) pixels width of bar when you load one thing

    halfway done with 23 things loaded ?

    200 * 23 / 46 = 100 pixels




    Reading the title reminds me of the Dalston loading games bar (London). And I thought it was a good idea to meet and share some beers …
    But just after clicking, I realized it was not the subject. Now I’m disappointed and thirsty… lol

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.