Just felt like making it. No media.
`setup
sync on : sync rate 60
set display mode 1024,768,32
set window on : maximize window
`Button data
type tButton
x as integer
y as integer
tx as integer
ty as integer
sx as integer
sy as integer
caption as string
endtype
dim button(0) as tButton
global buttons as integer
`Text
set text font "comic sans ms" : set text size 16
`Create grid
global snapToGrid as boolean : snapToGrid=1
global gridSize as integer : gridSize=10
create bitmap 1,screen width(),screen height() : set current bitmap 1
ink rgb(192,192,192),0 : box 0,0,screen width(),screen height()
ink rgb(128,128,128),0
for x=0 to screen width() step gridSize
for y=0 to screen height() step gridSize
line x,0,x,screen height()
line 0,y,screen width(),y
next x
next y
get image 1,0,0,screen width(),screen height()
set current bitmap 0 : delete bitmap 1
`Main Loop
do
`Show grid
paste image 1,0,0
`Get mouse position on grid
mouseGridX=int(mouseX()/gridSize)
mouseGridY=int(mouseY()/gridSize)
if snapToGrid=1
createGridX=mouseGridX*gridSize
createGridY=mouseGridY*gridSize
else
createGridX=mouseX()
createGridY=mouseY()
endif
`Toggle snap to grid
if keystate(31) then inc snaptogridchange else snaptogridchange=0
if snaptogridchange=1 then snapToGrid=1-snapToGrid
`create button
if mouseclick()=1
ink rgb(255,255,255),0 : line button(buttons).x-1,0,button(buttons).x-1,screen height() : line 0,button(buttons).y-1,screen width(),button(buttons).y-1
inc mouseClicking
if mouseClicking=1
array insert at bottom button() : buttons=array count(button())
button(buttons).x=createGridX : button(buttons).y=createGridY
button(buttons).caption="Button "+str$(buttons)
endif
if mouseClicking>1 or mouseClicking=0
button(buttons).tx=createGridX : button(buttons).ty=createGridY
ink rgb(255,255,255),0
line button(buttons).tx+1,0,button(buttons).tx+1,screen height() : line 0,button(buttons).ty+1,screen width(),button(buttons).ty+1
text button(buttons).tx+10,button(buttons).ty+10,"X: "+str$(button(buttons).x)+", Y: "+str$(button(buttons).y)
text button(buttons).tx+10,button(buttons).ty+30,"Size X: "+str$(button(buttons).sx)+", Size Y: "+str$(button(buttons).sy)
endif
endif
if mouseClick()=0 then mouseClicking=0
`Show buttons
for b=1 to buttons
button(b).sx=button(b).tx-button(b).x
button(b).sy=button(b).ty-button(b).y
createButton(button(b).x,button(b).y,button(b).sx,button(b).sy,button(b).caption,0)
next b
`End Loop
sync
cls
loop
`Functions
function createButton(x,y,sx,sy,caption as string, active as boolean)
ink rgb(128,128,128),0 : box x,y,x+sx,y+sy
box x+2,y+2,(x+sx)-2,(y+sy)-2,rgb(128,128,128),rgb(255,255,255),rgb(128,128,128),rgb(255,255,255)
ink 0,0 : center text x+(sx/2),(y+(sy/2))-(text size()/2),caption
endfunction
Click and drag to make buttons. Press 'S' to toggle snapping to grid.
[edit]
`setup
sync on : sync rate 60
set display mode 1024,768,32
set window on : maximize window
`Button data
type tButton
x as integer
y as integer
tx as integer
ty as integer
sx as integer
sy as integer
caption as string
over as boolean
deleted as boolean
endtype
dim button(0) as tButton
global buttons as integer
`Text
set text font "comic sans ms" : set text size 16
`Create grid
global snapToGrid as boolean : snapToGrid=1
global gridSize as integer : gridSize=10
create bitmap 1,screen width(),screen height() : set current bitmap 1
ink rgb(192,192,192),0 : box 0,0,screen width(),screen height()
ink rgb(128,128,128),0
for x=0 to screen width() step gridSize
for y=0 to screen height() step gridSize
line x,0,x,screen height()
line 0,y,screen width(),y
next x
next y
get image 1,0,0,screen width(),screen height()
set current bitmap 0 : delete bitmap 1
`Main Loop
do
`Show grid
paste image 1,0,0
`Get mouse position on grid
mouseGridX=int(mouseX()/gridSize)
mouseGridY=int(mouseY()/gridSize)
if snapToGrid=1
createGridX=mouseGridX*gridSize
createGridY=mouseGridY*gridSize
else
createGridX=mouseX()
createGridY=mouseY()
endif
`Toggle snap to grid
if keystate(31) then inc snaptogridchange else snaptogridchange=0
if snaptogridchange=1 then snapToGrid=1-snapToGrid
`create button
if mouseclick()=1
ink rgb(255,255,255),0 : line button(buttons).x-1,0,button(buttons).x-1,screen height() : line 0,button(buttons).y-1,screen width(),button(buttons).y-1
inc mouseClicking
if mouseClicking=1
array insert at bottom button() : buttons=array count(button())
button(buttons).x=createGridX : button(buttons).y=createGridY
button(buttons).caption="Button "+str$(buttons)
endif
if mouseClicking>1 or mouseClicking=0
button(buttons).tx=createGridX : button(buttons).ty=createGridY
ink rgb(255,255,255),0
line button(buttons).tx+1,0,button(buttons).tx+1,screen height() : line 0,button(buttons).ty+1,screen width(),button(buttons).ty+1
text button(buttons).tx+10,button(buttons).ty+10,"X: "+str$(button(buttons).x)+", Y: "+str$(button(buttons).y)
text button(buttons).tx+10,button(buttons).ty+30,"Size X: "+str$(button(buttons).sx)+", Size Y: "+str$(button(buttons).sy)
endif
endif
if mouseClick()=0 then mouseClicking=0
`Show buttons
for b=1 to buttons
button(b).sx=button(b).tx-button(b).x
button(b).sy=button(b).ty-button(b).y
if button(b).deleted=0 then button(b).over=createButton(button(b).x,button(b).y,button(b).sx,button(b).sy,button(b).caption,0)
next b
`Delete buttons
for b=1 to buttons
if button(b).over=1 and keystate(211)=1
button(b).deleted=1
endif
next b
`End Loop
sync
cls
loop
`Functions
function createButton(x,y,sx,sy,caption as string, active as boolean)
ink rgb(128,128,128),0 : box x,y,x+sx,y+sy
box x+2,y+2,(x+sx)-2,(y+sy)-2,rgb(128,128,128),rgb(255,255,255),rgb(128,128,128),rgb(255,255,255)
ink 0,0 : center text x+(sx/2),(y+(sy/2))-(text size()/2),caption
if mousex()>x and mousex()<(x+sx) and mousey()>y and mousey()<(y+sy)
exitfunction 1
endif
endfunction 0
Now press delete to delete a button.