Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Loading bar the easy way, real simple

Author
Message
Daniel wright 2311
User Banned
Posted: 20th Apr 2011 18:44 Edited at: 24th Apr 2011 21:28
first load your loading bar texture

load image "entitybank\user\bar.png",5001,0
we make a sprite then scale it to our loading bars size
SPRITE 5000, 498, 847, 5001
scale sprite 5000,197
hide sprite 5000

then here is the main bar code, put this in between your loading objects every once in a while to show the changes.

EDIT: YOU DONT EVEN NEED THE SPRITE FOR THIS TO WORK, THE SPRITE IS JUST FOR A BETTER LOOKING FILL TO THE BARS,BUT THE IMAGE i USED IS IN THE DOWNLOAD, ENJOY.



here is the code with no explinations



And here is a full working example with no media



my signature keeps being erased by a mod So this is my new signature.

Attachments

Login to view attachments
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 22nd Apr 2011 08:16
Sorry, but this is useless . Everyone can make something like this one in a second.

French gui
19
Years of Service
User Offline
Joined: 11th May 2004
Location: France
Posted: 22nd Apr 2011 20:35
@Daniel wright 2311: Simple, but thanks for sharing

@kamac: Your comment is useless... Of course the code is simple but I'm sure it will be useful for someone.
Daniel wright 2311
User Banned
Posted: 22nd Apr 2011 21:21 Edited at: 22nd Apr 2011 21:23
Quote: "Sorry, but this is useless . Everyone can make something like this one in a second."


Realy? So you are saying someone who just stared using dark basic pro would know how to make this simple bar code here? I put this here for people just starting dark basic pro, not for you if you already know how to do it,lol. But thanks for the comment, this is for beginers, but I must say, in my tital I do say easy way, real simple.

my signature keeps being erased by a mod So this is my new signature.
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Apr 2011 01:03
Maybe not the most useful comment, but he brings up a point. First of all, the code has errors. You load image as 5001 but try to paste 5000. And I never saw any loading bar, the image only flashes on screen for a second then closes. You also call 'sync' without ever calling 'sync on'. Is the code useful to someone who has never used DB before? I'll have to say no because the code doesn't work without without a small fix and it uses commands improperly. Nothing really display's a 'loading' bar, just a picture of one. Your code just doesn't make that much sense.

Maybe rework the demo to show the loading bar actually progress.

The Internet: Where men are men, women are men, and children are federal agents
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 23rd Apr 2011 16:48
I thought the same what does it do, did not want to download the picture so I made my own, and like the above states flash it gone.

Even messing around I could not get it to do as you describe.

why not upload the working copy, so we can see what it is that you made.

Dark Physics makes any hot drink go cold.
Daniel wright 2311
User Banned
Posted: 24th Apr 2011 03:25 Edited at: 24th Apr 2011 03:28
Quote: "You load image as 5001 but try to paste 5000."


image 5001 is the IMAGE OF THE bar
SPRITE 5001 is the bar
paste image 5000,50,80,1 rem -we paste our loading screen image
show sprite 5000 rem- we show the loading bar sprite

the other image is not part of the code its the back ground picture for the loading screen, if you want a back ground picture for your loading screen this would be it.

Quote: "You also call 'sync' without ever calling 'sync on'"


this is evident, in my program sync is on, im shure any one program will also have synce turned to on.


Quote: "Maybe rework the demo to show the loading bar actually progress."


right, good idea, I left that part out.

Quote: "why not upload the working copy, so we can see what it is that you made."


You have to update the code every other load, here is an example.


put this in first at the bigining of the load.



THEN WE UPDATE IT WHEN WE LOAD IN ANOTHER OBJECT



ONE MORE TIME TO SHOW IT LOADING MORE



my signature keeps being erased by a mod So this is my new signature.
Daniel wright 2311
User Banned
Posted: 24th Apr 2011 06:06 Edited at: 24th Apr 2011 06:09
AND JUST BECOUSE, ANY ONE CAN USE IT NOW,JUST COPPY THE CODE AND PUT IT IN A EMPTY PROJECT AND RUN, YOU WILL SEE IT WORK IF YOU DONT BELIVE.




my signature keeps being erased by a mod So this is my new signature.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Apr 2011 10:12
Now it all make sense, I see what you were trying to say above.

If you had posted this the first time you would not have had any of the above comments.

Dark Physics makes any hot drink go cold.
Daniel wright 2311
User Banned
Posted: 24th Apr 2011 19:39
Quote: "Now it all make sense, I see what you were trying to say above.

If you had posted this the first time you would not have had any of the above comments."


I agree, I should have thought to a beginer this example should have been included so I am sorry guys, but here it is so if any beginer needs a simple loading bar here it is, the first ever in the Code Snippets board.
.

my signature keeps being erased by a mod So this is my new signature.
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Apr 2011 22:07 Edited at: 24th Apr 2011 22:11
Quote: "
image 5001 is the IMAGE OF THE bar
SPRITE 5001 is the bar
paste image 5000,50,80,1 rem -we paste our loading screen image
show sprite 5000 rem- we show the loading bar sprite

the other image is not part of the code its the back ground picture for the loading screen, if you want a back ground picture for your loading screen this would be it.
"

Your code only loaded image number 5000, then attempted to paste image 5001. Nowhere did your code load that image number.

You should have posted that full example from the beginning, not bits and pieces of fragmented code. Also, you can really condense the code more.

This can replace pretty much the whole thing:


And a better alternative that shows progress of loading multiple objects is to use an array. Let's say you have several bad guys and need to load their models. Store their file paths into an array.



Daniel wright 2311
User Banned
Posted: 24th Apr 2011 22:28
@ Phaelax

yes you are right, thanks for the help here and this will also help others with the code above, I only wish some one would have posted something like this 5 years agl when I first started with dark basic pro.

my signature keeps being erased by a mod So this is my new signature.
Stormwire
13
Years of Service
User Offline
Joined: 3rd Sep 2010
Location:
Posted: 6th May 2011 07:30
Nice job. This is handy for beginners
Daniel wright 2311
User Banned
Posted: 8th May 2011 07:58
Quote: "Nice job. This is handy for beginners"


thanks, I figured there is not one example for any loading bars like this so i figured why not.

enjoy

my signature keeps being erased by a mod So this is my new signature.
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 9th May 2011 00:36 Edited at: 9th May 2011 00:54
Quote: "AND JUST BECOUSE, ANY ONE CAN USE IT NOW,JUST COPPY THE CODE AND PUT IT IN A EMPTY PROJECT AND RUN, YOU WILL SEE IT WORK IF YOU DONT BELIVE."


Uh, why you use capslock ?

Quote: "@kamac: Your comment is useless... Of course the code is simple but I'm sure it will be useful for someone."


Look now then:

I made 2 functions that create a box and a filler for it.

I'll describe filler.

It simply grabs the providen percent out of the box's width, then stores it into a variable and executes line-drawings the percised amount of time.




Much more useful in my opinion. Doesn't use sprites. If someone wants i can make sprites version too. Now example:




Hope you
Quote: "enjoy"
it.

Daniel wright 2311
User Banned
Posted: 9th May 2011 02:56
Quote: "Uh, why you use capslock"


I dont know, why do you care so much?

Quote: "I made 2 functions that create a box and a filler for it."


Great thing, we all will use them Im shure, thank you

Quote: "Much more useful in my opinion. Doesn't use sprites. If someone wants i can make sprites version too. Now example:"


I want to see one with sprites if its not to much of a problem

I will
Quote: "enjoy"

thanks

my signature keeps being erased by a mod So this is my new signature.
Quel
15
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 9th May 2011 03:22
We care because nobody in their right mind write text to the Internet in full capital style...

I'm totally not into this Netiquette crap which is going on for some reason though the Internet differs in nothing to the real world communication, anyway the point is that it was horrible to look at even though i wasn't considering it as 'shouting' like it may be, as any average text looking like that.

Instead of "problem with that?!?!" -ing around, just look at it and say to yourself yepp, it was ugly, i'm not doing that one again.

-In.Dev.X: A unique heavy story based shoot'em ~25%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%
Daniel wright 2311
User Banned
Posted: 9th May 2011 03:45
I was not shouting I was typing and thinking,the full caps was not meant when I wrote that, I was doing two thinga at once so I left my caps on is all.

But Its not my fault People look more into text then they really should. On you tube some times I Write in full caps just becouse people takes text to seriously really, to me it so funny. But here It was not on purpess.

my signature keeps being erased by a mod So this is my new signature.
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th May 2011 08:31
Why are you guys responding to a thread from nearly 2 weeks ago only to nitpick about things that are irrelevant?


As for the use of all caps, it just makes it a little harder to read.

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 19th May 2011 17:18
One suggestion I would have, is to store the amount of memory before loading anything, then compare that after loading everything, so you can work out how much memory your media uses.
Then with that info, you could make the progress bar fill up according to memory usage. Then, after loading each model, image, sound etc, you could update the progress bar, based on physical memory, the amount of memory you started with, and the amount of memory you need. Ideally you'd pass the memory requirement to the progress bar function, so it can decide itself what it's progress is. The main thing though is that you wouldn't really need to increment a percentage, just call the function and show the true progress. I would make the function take a text string, the current value, and the amount needed. Maybe not ideal for beginners with all that added of course.

Health, Ammo, and bacon and eggs!
Mudbud Productions
12
Years of Service
User Offline
Joined: 1st May 2011
Location: Cloud 9
Posted: 24th May 2011 07:51
@Van B, dude, thats really awesome! I never thought of that!
BTW, This idea is awesome, I can actually find a use for this in my app im making! Thanks bro

Your signature has been erased by a mod - no affiliate links thanks
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 27th May 2011 03:01 Edited at: 27th May 2011 03:06
Here, I played around with it quite a bit! I hope it works because I can't test it on this PC.



Your memory has been erased by a mod - Your new name is Brian.

Login to post a reply

Server time is: 2024-03-29 11:18:39
Your offset time is: 2024-03-29 11:18:39