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 / [b]How to use function[/b]

Author
Message
xmen
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 18th Feb 2003 21:56
this is a example how to use function hope it helps



`------------------------------------------------------
`
`
`--------------------BY XMEN---------------------------
` FUNCTION EXAMPLE
`
`------------------------------------------------------
set display mode 800,600,16

dim colorit(1)
dim Clicked(1)
dim tool$(6)

tool$(1)="Box"
tool$(2)="Circle"
tool$(3)="Ellipse"
tool$(4)="Line"
tool$(5)="Bar"
tool$(6)="color"

sync on
create bitmap 1,bitmap width(0),bitmap height(0)

set current bitmap 0
colorit(1)=255

do

zone(1,9,10,"Box")
zone(2,42,10,"Circle")
zone(3,86,10,"Ellipse")
zone(4,137,10,"Line")
zone(5,171,10,"Bar")
zone(6,200,10,"color")



ink rgb(rgbr(colorit(1)),rgbg(colorit(1)),rgbb(colorit(1))),1

box 430,10,500,30
ink rgb(255,255,255),1
text 370,10,"USEING....... "+tool$(Clicked(0))

ink rgb(rgbr(colorit(1)),rgbg(colorit(1)),rgbb(colorit(1))),1

x=mousex():y=mousey()

if y>30
if Clicked(1)=1 and mouseclick()=1

box(x,y)
endif

if Clicked(1)=2 and mouseclick()=1

Circle(x,y)
endif

if Clicked(1)=3 and mouseclick()=1
Ellipse(x,y)
endif

if Clicked(1)=4 and mouseclick()=1
Line(x,y)
endif

if Clicked(1)=5 and mouseclick()=1
Bar(x,y)
endif

endif
if Clicked(1)=6 and mouseclick()=1

color
Clicked(1)=Clicked(0)
endif



sync
loop

`................................DRAW...EMPTY..BOX......................

FUNCTION BOX(x,y)

repeat
copy bitmap 1,0

x2=mousex():y2=mousey()
line x,y,x2,y
line x,y,x,y2
line x2,y,x2,y2
line x,y2,x2,y2
sync
until mouseclick()=0

copy bitmap 0,1

ENDFUNCTION

`................................DRAW.....CIRCLE.....................


FUNCTION CIRCLE(x,y)

repeat
copy bitmap 1,0

x2=mousex():y2=mousey()

CIRCLE x,y2,x2/3
sync
until mouseclick()=0
copy bitmap 0,1

ENDFUNCTION

`................................DRAW.....ELLIPSE.....................

FUNCTION ELLIPSE(x,y)
repeat
copy bitmap 1,0

x2=mousex():y2=mousey()

ELLIPSE X,Y,X2/3,Y2/3
sync
until mouseclick()=0
copy bitmap 0,1

ENDFUNCTION
`................................DRAW..LINE...........................

FUNCTION LINE(x,y)

repeat
copy bitmap 1,0

x2=mousex():y2=mousey()

LINE x,y,x2,y2
sync
until mouseclick()=0
copy bitmap 0,1

ENDFUNCTION

`.................................DRAW....BAR........................

FUNCTION BAR(x,y)

repeat
copy bitmap 1,0

x2=mousex():y2=mousey()

BOX x,y,x2,y2
sync
until mouseclick()=0
copy bitmap 0,1

ENDFUNCTION


`........................................COLOUR...................
FUNCTION COLOR()
ok=0
ink rgb(170,170,140),1
box 200,90,503,300
ink rgb(140,140,50),1
box 201,91,502,299

ink rgb(255,255,255),1

box 221,110,481,130

box 221,150,481,170

box 221,190,481,210

`............min...............

box 205,115,216,126

box 205,155,216,166

box 205,195,216,206

`............max..........

box 486,115,498,126

box 486,155,498,166

box 486,195,498,206


ink rgb(0,0,0),1

text 210,113,"-"

text 210,153,"-"

text 210,193,"-"

text 489,113,"+"

text 489,153,"+"

text 489,193,"+"


ink rgb(255,0,0),1:text 330,92,"Red"

ink rgb(0,255,0),1:text 327,132,"Green"

ink rgb(0,0,255),1:text 331,173,"Blue"


ink rgb(0,0,255),1:text 331,278,"Use"

ink rgb(0,0,0),1

ink rgb(0,0,0),1
box 291,214,391,271


repeat


ink rgb(0,0,0),1

box 222,111,480,129

box 222,151,480,169

box 222,191,480,209
mx=mousex()
my=mousey()

if mouseclick()=1 and mx>=331 and mx=278 and my=205 and mx=115 and my0
red=red-1
endif

if mouseclick()=1 and mx>=205 and mx=155 and my0
green=green-1
endif

if mouseclick()=1 and mx>=205 and mx=195 and my0
blue=blue-1
endif



`.................................Max..........
if mouseclick()=1 and mx>=486 and mx=115 and my=486 and mx=155 and my=486 and mx=195 and my0
ink rgb(red,0,0),1
box 223,112,223+red,129
endif

if green>0
ink rgb(0,green,0),1
box 223,152,223+green,169
endif

if blue>0
ink rgb(0,0,blue),1
box 223,192,223+blue,208
endif

ink rgb(255,255,255),1:

text 340,113,str$(red)
text 340,153,str$(green)
text 340,193,str$(blue)
sync
until ok=1
copy bitmap 1,0
ENDFUNCTION


`........................................MOUSE ZONE..............

FUNCTION ZONE(zonenum,x1,y1,zone$)

if zonenumx1 and mousex()y1 and mousey()

Login to post a reply

Server time is: 2024-11-24 01:36:01
Your offset time is: 2024-11-24 01:36:01