[slightlyofftopic]
eh, i like button functions that return values, so that they're alot more flexible.
also, you could have an init function that creates the images and saves them, then you can paste them later.
init_button(200,23,rgb(255,255,255),rgb(122,122,122),rgb(0,255,0),"Click me",rgb(200,200,200),rgb(255,0,0),"*Click me*",1)
init_button(200,23,rgb(255,255,255),rgb(122,122,122),rgb(0,255,0),"Click me",rgb(200,200,200),rgb(255,0,0),"Click me not",3)
do
if Button(35,25,200,23,1) then text 0,0,"HI!"
if Button(35,60,200,23,3) then end
sync
loop
function init_button(xsize,ysize,linecolor,buttoncolor,textcolor,text$, buttonhovercolor,hovertextcolor,hovertext$,buttonnum)
lock pixels
create bitmap 1,xsize,ysize
set current bitmap 1
x1=1
y1=1
x2=xsize
y2=ysize
INK linecolor, 0
LINE x1, y1, x2, y1
LINE x1, y1, x1, y2
LINE x1, y2, x2, y2
LINE x2, y1, x2, y2
INK buttoncolor, 0
BOX x1+1, y1+1, x2, y2
INK textcolor, 0
CENTER TEXT (x1+x2)/2, (y1+y2)/2-7, text$
get image buttonnum,1,1,xsize,ysize
cls
INK linecolour, 0
LINE x1, y1, x2, y1
LINE x1, y1, x1, y2
LINE x1, y2, x2, y2
LINE x2, y1, x2, y2
INK buttonhovercolor, 0
BOX x1+1, y1+1, x2, y2
INK hovertextcolor, 0
CENTER TEXT (x1+x2)/2, (y1+y2)/2-7, hovertext$
get image buttonnum+1,1,1,xsize,ysize
unlock pixels
set current bitmap 0
endfunction
FUNCTION Button(x1, y1, xsize, ysize,buttonnum)
paste image buttonnum,x1,y1
IF MOUSEX() > x1 AND MOUSEX() < x1+xsize AND MOUSEY() > y1 AND MOUSEY() < y1+ysize
paste image buttonnum+1,x1,y1
IF MOUSECLICK() = 1 then exitfunction 1
ENDIF
ENDFUNCTION 0
[/slightlyofftopic]
Aaaaanyways
the demo loooks good. I'd still reccomend more general functions that you can use for anything though. like, instead of this:
if MX# > 382 and MY# > 419 and MX# < 638 and MY# < 483
clear camera view RGB(0,0,0)
text 0,0,"you pressed button 2"
endif
you could have
button(382,419,638,483,"you pressed button 2"
function button(x,y,x2,y2,text$)
if MX# > 382 and MY# > 419 and MX# < 638 and MY# < 483
clear camera view RGB(0,0,0)
text 0,0,text$
endif
endfunction