wouldn't this be a better way, btw looks very useful all we need now is DBpro.
remstart
This information was inbedded from Dark Snippet Pro - universal source info
Real Name: Richard Nash
DarkBASIC Username: Lagmasteruk
E-Mail: [email protected]
Website: http://www.lagmaster.net
remend
sync on
sync rate 0
` set the button x,y,width and height
XA = 0 : `start x position
XB = 180 : ` end x position
YA = 0 : ` start y position
YB = 70 : ` end y position
CreateButton(XA,YA,XB,YB,"Start Game",200,200,200,150,150,150,255,200,100,"Tahoma",20,1,1)
` grab the button to a image then convert it to a sprite so it can stay on the screen
get image 1, XA,YA,XA+XB+1,YA+YB+1
Sprite 1, Xa, Ya, 1
do
cls
mx = mousex()
my = mousey()
`do a check if the mouse is over the sprite/button's position
if mx => xa and mx =< xa+xb and my => ya and my =< ya+yb
over = 1
else
over = 0
endif
` check if the mouse has click on the button/sprite and end the demo
if mouseclick() and over = 1 then end
sync
loop
Function CreateButton(x,y,width,height,text$,edgered,edgegreen,edgeblue,centerred,centergreen,centreblue,textred,textgreen,textblue,textfont$,textsize,transparent,bolditalicorbothornone)
`put a border round the button
ink rgb(edgered,edgegreen,edgeblue),0
a = x+width
b = x-width
c = y+height
d = y-height
line x, y, A, y : `works
line x, y+height, x, y : `works
line A, C, x, C : `works
line A, y, A, C : `works
` fill the button with a color
ink rgb(centerred,centergreen,centreblue),0
box x+1,y+1,a-1,c-1
`put into the box some text
remstart
bolditalicorbothornone results
1 = Bold
2 = Italic
3 = BoldItalic
0 = None
remend
E = width/2
F = height/2
G = xa/2
H = ya/2
ink rgb(textred,textgreen,textblue),0
set text font textfont$
set text size textsize
if transparent = 1
SET TEXT TRANSPARENT
else
SET TEXT OPAQUE
endif
if bolditalicorbothornone = 0 then set text to normal
if bolditalicorbothornone = 1 then set text to bold
if bolditalicorbothornone = 2 then set text to italic
if bolditalicorbothornone = 3 then set text to bolditalic
center text A-E,Height/3,text$ : `centers
endfunction
Specs:- 1GHZ athlon, Radeon8500, 192mb ram