lal7777
Posts
if all.knowledge = orange then: seed = mankind.knowledge: grow(seed,time): endif
Posts: 88
|
Post by lal7777 on May 2, 2011 1:14:53 GMT -5
Ever want a loading bar for your program? This is a very simple loading bar function that allows the programmer(s) to specify the display location, width, and percent (loaded of whatever is being loaded in their program). The folder containing the file and textures is uploaded as an attachment. Attachments:
|
|
|
Post by Nicky Peter Hollyoake on May 2, 2011 16:57:14 GMT -5
Nice idea but using image's isn't an idea everyone will use. How about making functions that will help makng percentage bars? Here's something I came up with. 'percentage of number 'returns the number of the percentage function PON(Number#, per#) as double return Number# * (per#/100.0) endfunction
'Number of percentage 'returns the percentage of the number function NOP(Num#, Total#) as double return (Num#/Total#)*100.0 endfunction
'Size depending on percentage function SOP(Per#, Size#) as double return (Per# / 100.0) * Size# endfunction
'counts a files max lines function CountFileLines(File$) dim f=OpenFileRead(File$) dim c do until EndOfFile(f) ReadLine(f) c=c+1 loop CloseFile(f) return c endfunction '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' TextMode(TEXT_OVERLAID) ResizeText(50, 30) glMatrixMode(GL_PROJECTION) glLoadidentity() glOrTho(0, textcols(), textrows(), 0, 0, 1) glMatrixMode(GL_MODELVIEW) glLoadidentity() glColor3f(0, 0.7, 0)
''' dim l = CountFileLines("AsteroidDemo2.gb") dim n dim p# dim s#
'main loop while TRUE glClear(GL_COLOR_BUFFER_BIT) cls p# = NOP(n, l) s# = SOP(p#, 12) printr int(p#) ; "%" print n ; "/" ; l
glBegin(GL_QUADS) glVertex2f(0 , 0) glVertex2f(0 , 1) glVertex2f(s#, 1) glVertex2f(s#, 0) glEnd() DrawText() Swapbuffers() sleep(10) n = n + 1 if n > l then END endif wend Got 4 functions, ain't got time to explain them, thier pretty much straight forward though. - Nicky
|
|
lal7777
Posts
if all.knowledge = orange then: seed = mankind.knowledge: grow(seed,time): endif
Posts: 88
|
Post by lal7777 on May 3, 2011 15:46:19 GMT -5
Nice idea Nicky. Either way provides a shortcut for people who've made a program, that tells the user there's something is happening while they're waiting. No longer will people have to waste time on such a small detail of their program when it's still in the making. However your idea seems a little smarter, because it actually does part of the calculations.
If anybody has more suggestions feel free to post.
|
|
lal7777
Posts
if all.knowledge = orange then: seed = mankind.knowledge: grow(seed,time): endif
Posts: 88
|
Post by lal7777 on May 13, 2011 7:30:06 GMT -5
However I did find one time when your loading bar wouldn't work, and that would be when someone was creating a display list. The quads used for the bar would be stored into the list. (i.e.Whenever anyone would call the list, the quads would be there.) Other than that your method works perfectly.
|
|