Computer Science Canada

Basic Volume bar

Author:  copthesaint [ Sat Nov 08, 2008 3:47 pm ]
Post subject:  Basic Volume bar

Here is a volume adjustment bar
simply press up or down to increase or decrease volume
very basic tool
enjoy

%by pressing up or down you can increase or decrease the volume

View.Set ("graphics:800;600;offscreenonly;nocursor")

var fnt1:= Font.New ("Ariel:18x12")
var volume:= 200
var chars : array char of boolean


loop

Input.KeyDown (chars)
if chars (KEY_UP_ARROW)and volume< 200 then
for i: 1..2
cls
drawbox (294,149,506,171,black)
drawfillbox (((volume+i)+5)+300,150,((volume+i)-5)+300,170,black)
drawbox (((volume+i)+5)+300,150,((volume+i)-5)+300,170,grey)
Font.Draw ("Volume",337,173,fnt1,black)
Font.Draw ("Min",235,152,fnt1,black)
Font.Draw ("Max",507,152,fnt1,black)
Font.Draw(intstr(volume div 2), 373, 153, fnt1, grey)

View.Update
delay (15)
end for
cls
volume:= volume+2

end if
if chars (KEY_DOWN_ARROW) and volume> 0 then
for i: 1..2
cls
drawbox (294,149,506,171,black)
drawfillbox (((volume-i)+5)+300,150,((volume-i)-5)+300,170,black)
drawbox (((volume-i)+5)+300,150,((volume-i)-5)+300,170,grey)
Font.Draw ("Volume",337,173,fnt1,black)
Font.Draw ("Min",235,152,fnt1,black)
Font.Draw ("Max",507,152,fnt1,black)
Font.Draw(intstr(volume div 2), 373, 153, fnt1, grey)

delay (15)
end for
cls
volume:= volume-2

end if
Font.Draw ("Volume",337,173,fnt1,black)
Font.Draw ("Min",235,152,fnt1,black)
Font.Draw ("Max",507,152,fnt1,black)
drawbox (294,149,506,171,black)
drawfillbox (((volume)+5)+300,150,((volume)-5)+300,170,black)
drawbox (((volume)+5)+300,150,((volume)-5)+300,170,grey)
Font.Draw(intstr(volume div 2), 373, 153, fnt1, grey)

View.Update
delay(1)
cls
end loop

Author:  Insectoid [ Sat Nov 08, 2008 4:11 pm ]
Post subject:  RE:Basic Volume bar

What good is volume control without sound? You should implement a sound file, because right now, this does nothing. Oh, and next time, don't bold, use syntax tags.

Author:  copthesaint [ Sat Nov 08, 2008 4:20 pm ]
Post subject:  RE:Basic Volume bar

Obviously you don't get the point of this thread it's just a basic bar that users can use for their games and it doesn't just have to be a volume bar... it could be used just to change any variable. like have a sence of imagination.

Author:  Insectoid [ Sat Nov 08, 2008 4:23 pm ]
Post subject:  RE:Basic Volume bar

Can you post a complete program that uses it? Why not say 'it's a sidebar that changes a variable' rather than 'it controls volume'?

Author:  copthesaint [ Sat Nov 08, 2008 4:31 pm ]
Post subject:  Re: Basic Volume bar

Omg NO imagination For example You could use it as this:
happy now? god ur anoying. like are you just trying to critize me just for the point of critising? that how I feel
%by pressing up or down you can increase or decrease the size

View.Set ("graphics:800;600;offscreenonly;cursor,title:Matrix,")

var fnt1:= Font.New ("Ariel:18x12")
var volume:= 200
var chars : array char of boolean


loop

Input.KeyDown (chars)
if chars (KEY_UP_ARROW)and volume< 200 then
for i: 1..2
cls
drawbox (294,149,506,171,black)
drawfillbox (((volume+i)+5)+300,150,((volume+i)-5)+300,170,black)
drawbox (((volume+i)+5)+300,150,((volume+i)-5)+300,170,grey)
Font.Draw ("Size",360,173,fnt1,black)
Font.Draw ("Min",235,152,fnt1,black)
Font.Draw ("Max",507,152,fnt1,black)
Font.Draw(intstr(volume div 2), 373, 153, fnt1, grey)
drawbox ((maxx div 2)-(volume div 2),(maxy div 2)-(volume div 2),(maxx div 2)+(volume div 2),(maxy div 2)+(volume div 2),volume )

View.Update
delay (15)
end for
cls
volume:= volume+2

end if
if chars (KEY_DOWN_ARROW) and volume> 0 then
for i: 1..2
cls
drawbox (294,149,506,171,black)
drawfillbox (((volume-i)+5)+300,150,((volume-i)-5)+300,170,black)
drawbox (((volume-i)+5)+300,150,((volume-i)-5)+300,170,grey)
Font.Draw ("Size",360,173,fnt1,black)
Font.Draw ("Min",235,152,fnt1,black)
Font.Draw ("Max",507,152,fnt1,black)
Font.Draw(intstr(volume div 2), 373, 153, fnt1, grey)
drawbox ((maxx div 2)-(volume div 2),(maxy div 2)-(volume div 2),(maxx div 2)+(volume div 2),(maxy div 2)+(volume div 2),volume )

delay (15)
end for
cls
volume:= volume-2

end if
Font.Draw ("Size",360,173,fnt1,black)
Font.Draw ("Min",235,152,fnt1,black)
Font.Draw ("Max",507,152,fnt1,black)
drawbox (294,149,506,171,black)
drawfillbox (((volume)+5)+300,150,((volume)-5)+300,170,black)
drawbox (((volume)+5)+300,150,((volume)-5)+300,170,grey)
Font.Draw(intstr(volume div 2), 373, 153, fnt1, grey)
drawbox ((maxx div 2)-(volume div 2),(maxy div 2)-(volume div 2),(maxx div 2)+(volume div 2),(maxy div 2)+(volume div 2),volume)

View.Update
delay(1)
cls
end loop

Author:  Nova [ Sat Nov 08, 2008 6:27 pm ]
Post subject:  RE:Basic Volume bar

I can see potetial as a bar for a fight battle.
Instead of being modified by the user it increases as time goes by till you can attack.
Or as a scroll between a list of objects that are within a range.
Making the values into variables that determine the size of the bar could add fliexibility.

Author:  Insectoid [ Sun Nov 09, 2008 10:57 am ]
Post subject:  RE:Basic Volume bar

I have an imagination (If I didn't, I wouldn't love programming so much). It's just that I feel that this program is useless unless you provide an example to show off what's so good about it. I'm sorry if I offended you, I just wanted to see it do something useful (without having to write my own program). And remember what I said about code tags?

Author:  SNIPERDUDE [ Sun Nov 09, 2008 7:22 pm ]
Post subject:  Re: Basic Volume bar

Let's stop the anger here.

I don't think volume can be controlled in Turing. Not the point. Anywho this is just a custom GUI part (can't think of the term right now - brain's fried Razz ).

And yes - do use code tags next time.
code:
[syntax="turing"] [/syntax]


: