Hi All,
Just something that lets you draw a box the you can move the corners to change the shape.
Rem Project: dragboxes1
Rem ***** Main Source File *****
sync on
sync rate 60
global tcx tcy
tcx=screen width()/2
tcy=screen height()/2
dim boxes(8)
dim dragbox(8)
dim r(4)
dim g(4)
dim b(4)
for i = 1 to 4
r(i)=255
g(i)=255
b(i)=255
next i
rem click box size
boxes(1)=2
boxes(2)=2
rem start positions
rem top left x,y
dragbox(1)=tcx-15
dragbox(2)=tcy-15
rem top right x,y
dragbox(3)=tcx+15
dragbox(4)=tcy-15
rem bottom right x,y
dragbox(5)=tcx+15
dragbox(6)=tcy+15
rem bottom left x,y
dragbox(7)=tcx-15
dragbox(8)=tcy+15
do
cls
isindragbox()
makebox()
sync
loop
function makebox()
box dragbox(1)-boxes(1),dragbox(2)-boxes(2),dragbox(1)+boxes(1),dragbox(2)+boxes(2),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1))
box dragbox(3)-boxes(1),dragbox(4)-boxes(2),dragbox(3)+boxes(1),dragbox(4)+boxes(2),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2))
box dragbox(5)-boxes(1),dragbox(6)-boxes(2),dragbox(5)+boxes(1),dragbox(6)+boxes(2),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3))
box dragbox(7)-boxes(1),dragbox(8)-boxes(2),dragbox(7)+boxes(1),dragbox(8)+boxes(2),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4))
line dragbox(1),dragbox(2),dragbox(3),dragbox(4)
line dragbox(3),dragbox(4),dragbox(5),dragbox(6)
line dragbox(5),dragbox(6),dragbox(7),dragbox(8)
line dragbox(7),dragbox(8),dragbox(1),dragbox(2)
endfunction
function isindragbox()
mx=mousex()
my=mousey()
text 0,60,str$(mx)+" "+str$(my)
for i = 1 to 8 step 2
text 0,0+(i*6),str$(dragbox(i) )+" "+str$(dragbox(i+1) )
next i
if mx>dragbox(1)-boxes(1) and mx<dragbox(1)+boxes(1) and my>dragbox(2)-boxes(2) and my<dragbox(2)+boxes(2)
r(1)=255:g(1)=0:b(1)=0
while mouseclick()<>0
drag(1,2)
endwhile
else
r(1)=255:g(1)=255:b(1)=255
endif
if mx>dragbox(3)-boxes(1) and mx<dragbox(3)+boxes(1) and my>dragbox(4)-boxes(2) and my<dragbox(4)+boxes(2)
r(2)=255:g(2)=0:b(2)=0
while mouseclick()<>0
drag(3,4)
endwhile
else
r(2)=255:g(2)=255:b(2)=255
endif
if mx>dragbox(5)-boxes(1) and mx<dragbox(5)+boxes(1) and my>dragbox(6)-boxes(2) and my<dragbox(6)+boxes(2)
r(3)=255:g(3)=0:b(3)=0
while mouseclick()<>0
drag(5,6)
endwhile
else
r(3)=255:g(3)=255:b(3)=255
endif
if mx>dragbox(7)-boxes(1) and mx<dragbox(7)+boxes(1) and my>dragbox(8)-boxes(2) and my<dragbox(8)+boxes(2)
r(4)=255:g(4)=0:b(4)=0
while mouseclick()<>0
drag(7,8)
endwhile
else
r(4)=255:g(4)=255:b(4)=255
endif
endfunction
function drag(a,b)
cls
text 0,0,"draging on"
mx=mousex()
my=mousey()
dragbox(a)=mx
dragbox(b)=my
makebox()
sync
endfunction
update added midpoints
Rem Project: dragboxes1
Rem ***** Main Source File *****
sync on
sync rate 60
global tcx tcy
tcx=screen width()/2
tcy=screen height()/2
dim boxes(8)
dim dragbox(8)
dim r(4)
dim g(4)
dim b(4)
for i = 1 to 4
r(i)=255
g(i)=255
b(i)=255
next i
rem click box size
boxes(1)=2
boxes(2)=2
rem start positions
rem top left x,y
dragbox(1)=tcx-15
dragbox(2)=tcy-15
rem top right x,y
dragbox(3)=tcx+15
dragbox(4)=tcy-15
rem bottom right x,y
dragbox(5)=tcx+15
dragbox(6)=tcy+15
rem bottom left x,y
dragbox(7)=tcx-15
dragbox(8)=tcy+15
do
cls
isindragbox()
makebox()
sync
loop
function makebox()
rem corners points
box dragbox(1)-boxes(1),dragbox(2)-boxes(2),dragbox(1)+boxes(1),dragbox(2)+boxes(2),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1))
box dragbox(3)-boxes(1),dragbox(4)-boxes(2),dragbox(3)+boxes(1),dragbox(4)+boxes(2),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2))
box dragbox(5)-boxes(1),dragbox(6)-boxes(2),dragbox(5)+boxes(1),dragbox(6)+boxes(2),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3))
box dragbox(7)-boxes(1),dragbox(8)-boxes(2),dragbox(7)+boxes(1),dragbox(8)+boxes(2),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4))
rem midpoint boxes
box (dragbox(1)+dragbox(3))/2-boxes(1),(dragbox(2)+dragbox(4))/2-boxes(2),(dragbox(1)+dragbox(3))/2+boxes(1),(dragbox(2)+dragbox(4))/2+boxes(2)
box (dragbox(3)+dragbox(5))/2-boxes(1),(dragbox(4)+dragbox(6))/2-boxes(2),(dragbox(3)+dragbox(5))/2+boxes(1),(dragbox(4)+dragbox(6))/2+boxes(2)
box (dragbox(5)+dragbox(7))/2-boxes(1),(dragbox(6)+dragbox(8))/2-boxes(2),(dragbox(5)+dragbox(7))/2+boxes(1),(dragbox(6)+dragbox(8))/2+boxes(2)
box (dragbox(1)+dragbox(7))/2-boxes(1),(dragbox(8)+dragbox(2))/2-boxes(2),(dragbox(1)+dragbox(7))/2+boxes(1),(dragbox(8)+dragbox(2))/2+boxes(2)
rem connecting lines
line dragbox(1),dragbox(2),dragbox(3),dragbox(4)
line dragbox(3),dragbox(4),dragbox(5),dragbox(6)
line dragbox(5),dragbox(6),dragbox(7),dragbox(8)
line dragbox(7),dragbox(8),dragbox(1),dragbox(2)
endfunction
function isindragbox()
mx=mousex()
my=mousey()
text 0,60,str$(mx)+" "+str$(my)
for i = 1 to 8 step 2
text 0,0+(i*6),str$(dragbox(i) )+" "+str$(dragbox(i+1) )
next i
if mx>dragbox(1)-boxes(1) and mx<dragbox(1)+boxes(1) and my>dragbox(2)-boxes(2) and my<dragbox(2)+boxes(2)
r(1)=255:g(1)=0:b(1)=0
while mouseclick()<>0
drag(1,2)
endwhile
else
r(1)=255:g(1)=255:b(1)=255
endif
if mx>dragbox(3)-boxes(1) and mx<dragbox(3)+boxes(1) and my>dragbox(4)-boxes(2) and my<dragbox(4)+boxes(2)
r(2)=255:g(2)=0:b(2)=0
while mouseclick()<>0
drag(3,4)
endwhile
else
r(2)=255:g(2)=255:b(2)=255
endif
if mx>dragbox(5)-boxes(1) and mx<dragbox(5)+boxes(1) and my>dragbox(6)-boxes(2) and my<dragbox(6)+boxes(2)
r(3)=255:g(3)=0:b(3)=0
while mouseclick()<>0
drag(5,6)
endwhile
else
r(3)=255:g(3)=255:b(3)=255
endif
if mx>dragbox(7)-boxes(1) and mx<dragbox(7)+boxes(1) and my>dragbox(8)-boxes(2) and my<dragbox(8)+boxes(2)
r(4)=255:g(4)=0:b(4)=0
while mouseclick()<>0
drag(7,8)
endwhile
else
r(4)=255:g(4)=255:b(4)=255
endif
endfunction
function drag(a,b)
cls
text 0,0,"draging on"
mx=mousex()
my=mousey()
dragbox(a)=mx
dragbox(b)=my
makebox()
sync
endfunction
edit 2
now all points do as they should.
Rem Project: dragboxes1
Rem ***** Main Source File *****
sync on
sync rate 60
global tcx tcy
tcx=screen width()/2
tcy=screen height()/2
dim boxes(8)
dim dragbox(8)
dim r(8)
dim g(8)
dim b(8)
for i = 1 to 8
r(i)=255
g(i)=255
b(i)=255
next i
rem click box size
boxes(1)=2
boxes(2)=2
rem start positions
rem top left x,y
dragbox(1)=tcx-15
dragbox(2)=tcy-15
rem top right x,y
dragbox(3)=tcx+15
dragbox(4)=tcy-15
rem bottom right x,y
dragbox(5)=tcx+15
dragbox(6)=tcy+15
rem bottom left x,y
dragbox(7)=tcx-15
dragbox(8)=tcy+15
do
cls
isindragbox()
makebox()
sync
loop
function makebox()
rem corners points
box dragbox(1)-boxes(1),dragbox(2)-boxes(2),dragbox(1)+boxes(1),dragbox(2)+boxes(2),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1)),rgb(r(1),g(1),b(1))
box dragbox(3)-boxes(1),dragbox(4)-boxes(2),dragbox(3)+boxes(1),dragbox(4)+boxes(2),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2)),rgb(r(2),g(2),b(2))
box dragbox(5)-boxes(1),dragbox(6)-boxes(2),dragbox(5)+boxes(1),dragbox(6)+boxes(2),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3)),rgb(r(3),g(3),b(3))
box dragbox(7)-boxes(1),dragbox(8)-boxes(2),dragbox(7)+boxes(1),dragbox(8)+boxes(2),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4)),rgb(r(4),g(4),b(4))
rem midpoint boxes
box (dragbox(1)+dragbox(3))/2-boxes(1),(dragbox(2)+dragbox(4))/2-boxes(2),(dragbox(1)+dragbox(3))/2+boxes(1),(dragbox(2)+dragbox(4))/2+boxes(2),rgb(r(5),g(5),b(5)),rgb(r(5),g(5),b(5)),rgb(r(5),g(5),b(5)),rgb(r(5),g(5),b(5))
box (dragbox(3)+dragbox(5))/2-boxes(1),(dragbox(4)+dragbox(6))/2-boxes(2),(dragbox(3)+dragbox(5))/2+boxes(1),(dragbox(4)+dragbox(6))/2+boxes(2),rgb(r(6),g(6),b(6)),rgb(r(6),g(6),b(6)),rgb(r(6),g(6),b(6)),rgb(r(6),g(6),b(6))
box (dragbox(5)+dragbox(7))/2-boxes(1),(dragbox(6)+dragbox(8))/2-boxes(2),(dragbox(5)+dragbox(7))/2+boxes(1),(dragbox(6)+dragbox(8))/2+boxes(2),rgb(r(7),g(7),b(7)),rgb(r(7),g(7),b(7)),rgb(r(7),g(7),b(7)),rgb(r(7),g(7),b(7))
box (dragbox(1)+dragbox(7))/2-boxes(1),(dragbox(8)+dragbox(2))/2-boxes(2),(dragbox(1)+dragbox(7))/2+boxes(1),(dragbox(8)+dragbox(2))/2+boxes(2),rgb(r(8),g(8),b(8)),rgb(r(8),g(8),b(8)),rgb(r(8),g(8),b(8)),rgb(r(8),g(8),b(8))
rem connecting lines
line dragbox(1),dragbox(2),dragbox(3),dragbox(4)
line dragbox(3),dragbox(4),dragbox(5),dragbox(6)
line dragbox(5),dragbox(6),dragbox(7),dragbox(8)
line dragbox(7),dragbox(8),dragbox(1),dragbox(2)
endfunction
function isindragbox()
mx=mousex()
my=mousey()
text 0,60,str$(mx)+" "+str$(my)
for i = 1 to 8 step 2
text 0,0+(i*6),str$(dragbox(i) )+" "+str$(dragbox(i+1) )
next i
if mx>dragbox(1)-boxes(1) and mx<dragbox(1)+boxes(1) and my>dragbox(2)-boxes(2) and my<dragbox(2)+boxes(2)
r(1)=255:g(1)=0:b(1)=0
while mouseclick()<>0
drag(1,2)
endwhile
else
r(1)=255:g(1)=255:b(1)=255
endif
if mx>dragbox(3)-boxes(1) and mx<dragbox(3)+boxes(1) and my>dragbox(4)-boxes(2) and my<dragbox(4)+boxes(2)
r(2)=255:g(2)=0:b(2)=0
while mouseclick()<>0
drag(3,4)
endwhile
else
r(2)=255:g(2)=255:b(2)=255
endif
if mx>dragbox(5)-boxes(1) and mx<dragbox(5)+boxes(1) and my>dragbox(6)-boxes(2) and my<dragbox(6)+boxes(2)
r(3)=255:g(3)=0:b(3)=0
while mouseclick()<>0
drag(5,6)
endwhile
else
r(3)=255:g(3)=255:b(3)=255
endif
if mx>dragbox(7)-boxes(1) and mx<dragbox(7)+boxes(1) and my>dragbox(8)-boxes(2) and my<dragbox(8)+boxes(2)
r(4)=255:g(4)=0:b(4)=0
while mouseclick()<>0
drag(7,8)
endwhile
else
r(4)=255:g(4)=255:b(4)=255
endif
rem mid point boxes
if mx>(dragbox(1)+dragbox(3))/2-boxes(1) and mx<(dragbox(1)+dragbox(3))/2+boxes(1) and my>(dragbox(2)+dragbox(4))/2-boxes(2) and my<(dragbox(2)+dragbox(4))/2+boxes(2)
r(5)=255:g(5)=0:b(5)=0
oldmy=my
oldy1=dragbox(2)
oldy2=dragbox(4)
while mouseclick()<>0
cls
text 0,0,"draging on"
my=mousey()
dragbox(2)=oldy1+( my-oldmy)
dragbox(4)= oldy2+(my -oldmy)
makebox()
sync
endwhile
else
r(5)=255:g(5)=255:b(5)=255
endif
if mx>(dragbox(3)+dragbox(5))/2-boxes(1) and mx<(dragbox(3)+dragbox(5))/2+boxes(1) and my>(dragbox(4)+dragbox(6))/2-boxes(2) and my<(dragbox(4)+dragbox(6))/2+boxes(2)
r(6)=255:g(6)=0:b(6)=0
oldmx=mx
oldx1=dragbox(3)
oldx2=dragbox(5)
while mouseclick()<>0
cls
text 0,0,"draging on"
mx=mousex()
dragbox(3)=oldx1+(mx-oldmx)
dragbox(5)= oldx2+(mx-oldmx)
makebox()
sync
endwhile
else
r(6)=255:g(6)=255:b(6)=255
endif
if mx>(dragbox(5)+dragbox(7))/2-boxes(1) and mx<(dragbox(5)+dragbox(7))/2+boxes(1) and my>(dragbox(6)+dragbox(8))/2-boxes(2) and my<(dragbox(6)+dragbox(8))/2+boxes(2)
r(7)=255:g(7)=0:b(7)=0
oldmy=my
oldy1=dragbox(6)
oldy2=dragbox(8)
while mouseclick()<>0
cls
text 0,0,"draging on"
my=mousey()
dragbox(6)=oldy1+( my-oldmy)
dragbox(8)= oldy2+(my -oldmy)
makebox()
sync
endwhile
else
r(7)=255:g(7)=255:b(7)=255
endif
if mx>(dragbox(7)+dragbox(1))/2-boxes(1) and mx<(dragbox(7)+dragbox(1))/2+boxes(1) and my>(dragbox(8)+dragbox(2))/2-boxes(2) and my<(dragbox(8)+dragbox(2))/2+boxes(2)
r(8)=255:g(8)=0:b(8)=0
oldmx=mx
oldx1=dragbox(7)
oldx2=dragbox(1)
while mouseclick()<>0
cls
text 0,0,"draging on"
mx=mousex()
dragbox(7)=oldx1+( mx-oldmx)
dragbox(1)= oldx2+(mx -oldmx)
makebox()
sync
endwhile
else
r(8)=255:g(8)=255:b(8)=255
endif
endfunction
function drag(a,b)
cls
text 0,0,"draging on"
mx=mousex()
my=mousey()
dragbox(a)=mx
dragbox(b)=my
makebox()
sync
endfunction
Dark Physics makes any hot drink go cold.