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.

Newcomers DBPro Corner / loading bar

Author
Message
Gjl
20
Years of Service
User Offline
Joined: 28th Dec 2003
Location:
Posted: 18th Jan 2004 20:16
How do I make a progress bar to show how much of my game has loaded?
It would be nice to have a text displaying the object currently being loaded as well as a graphical bar.
Teh Go0rfmeister
21
Years of Service
User Offline
Joined: 17th Aug 2003
Location:
Posted: 18th Jan 2004 20:19
ok- to have the loadscreen say the object being loaded:


www.tinnedhead.tk watch this space for the first ever calculator to show the working out. also look out for our first game- ww.exor-mk1.tk
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 18th Jan 2004 20:40
just make a box using the BOX command and make it bigger everytime something is laoded . example:





Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
Ralen
21
Years of Service
User Offline
Joined: 22nd Jul 2003
Location:
Posted: 18th Jan 2004 22:52
Gjl,

Here is what you have to do. First you have to know how many objects you need to load. Then you have to know how many objects are loaded. That gives you your first first set of variables.

TotalObjects# = 1000
TotalObjectsLoaded# = 123

Now you get the percentage of TotalObjectsLoaded which is
TotalObjectsLoaded# / TotalObjects#

That gives us our third variable.

TotalObjectsPercent# = TotalObjectsLoaded# / TotalObjects#

The reason you convert it to a percent is because that is is all a bargraph shows is a percentage of something.

Now to draw the actual bar graph.

These here are the basic variables to draw the actual Box

`Defines the upper lefthand corner of the box
`Adjust these two numbers to change the location of where
` your Graph shows up on the screen
BarX# = 100
BarY# = 100
`Defines the height and length of the box
Barlength# = 100
Barheight# = 10

Okay, so how do we adjust the size of the bar to represent the size the box should be? Simple

`How much of the bar to fill
Barfill# = Barlength# * TotalObjectsPercent#

`draws your graph
box BarX#, BarY#, BarX# + Barfill#, boxY# + Barheight#
`This line represents 100% box filled
line BarX#, Bary#, BarX# + Barlength#, bary# + barheight#


Snippet one is Just the Basics to draw the bar



Code Two Allows you to resize the bar using the Left and right Arrow Keys...



Ralen
Gjl
20
Years of Service
User Offline
Joined: 28th Dec 2003
Location:
Posted: 19th Jan 2004 00:24
Thanks for the replies all, especially Ralen. That was a great help
Gjl
20
Years of Service
User Offline
Joined: 28th Dec 2003
Location:
Posted: 19th Jan 2004 00:44 Edited at: 19th Jan 2004 00:46
Ok I'm guessing this would work out:
Ralen
21
Years of Service
User Offline
Joined: 22nd Jul 2003
Location:
Posted: 19th Jan 2004 04:11
That would work, but you need to change this line

Barfill# = Barlength# * TotalObjectsPercent#

to

Barfill# = Barlength# * percentloaded#


As for the way you are loading them I'm going to make a quick suggestion I would actually save the object information to a file, or at least use data statements...




Hope that helps. There is a lot of differant ways you can go about doing things.

If I was you, I wouldn't hardcode that kind of thing. I would save information like that in an external file to your engine. That way you can build your engine up, then add stuff later view your external files. If you hardcode your game it makes it harder to reuse your code in other projects.

Ralen
walaber
20
Years of Service
User Offline
Joined: 22nd Oct 2003
Location: Los Angeles, CA
Posted: 19th Jan 2004 05:21
Ralen's suggestion is a good one... if you make a simple file that includes what files to load, you can put your entire load system into a convenient loop!

[PSEUDO CODE]

open file "stufftoload.txt"
read from file "num_of_files_to_load

for i=1 to num_of_files_to_load
read from file filename$
load object filename$,i
update your loadbar here!
next i

[/PSEUDO CODE]

of course you might want more detailed information in your load file, but I think that's the general idea!

Go Go Gadget DBPRO!
Gjl
20
Years of Service
User Offline
Joined: 28th Dec 2003
Location:
Posted: 20th Jan 2004 01:20
Thanks for that! Although I'm not sure what exactly I should include in the file ie. how it should be laid out. Also what does the b$ string do in Ralen's code?
Ralen
21
Years of Service
User Offline
Joined: 22nd Jul 2003
Location:
Posted: 20th Jan 2004 05:02
Its part of the data statements at the bottem.

It reads a string from one of the file names at the bottom and puts it in the b$

Ralen
greenlig
21
Years of Service
User Offline
Joined: 30th Aug 2003
Location: Melbourne
Posted: 20th Jan 2004 11:41
lol, B$

Good advice Ralen

I got best and fairest for soccer WHOOHOOO!

Login to post a reply

Server time is: 2024-09-21 18:02:12
Your offset time is: 2024-09-21 18:02:12