hi im a newb. I have a box plit into 4 equal boxes, i need help finding an algorithm that splits boxes into 4 equal boxes depending on where the mouse is. so far i have my 4 equal boxes
dim boxnode(5)
dim lv(5)
lv(1)= 1
lv(2)=2
lv(3)=3
lv(4)=4
lv(5)=5
do
cls
mx=mousex()
my=mousey()
quadbox()
loop
//quadbox
function quadbox()
a= screen width()-1
b=screen height()-1
subwidth=a/2
subheight=b/2
qx=0
qy=0
//box1
//topline
line qx,qy,a/2,qy
//right line*
line a/2,qy,a/2,b/2
//bottom line*
line a/2,b/2,qx,b/2
//left line
line qx,b/2,qx,xy
//box2
// top line
line a/2,qy,a,qy
//right line
line a,qy,a,b/2
//bottom line*
line a,b/2,a/2,b/2
//left line
line a/2,b/2,a/2,qy
//box3
// top line
line a/2,b/2,a,b/2
//right line
line a,b/2,a,b
//bottom line
line a,b,a/2,b
//left line
line a/2,b,a/2,b/2
//box4
// top line
line qx,b/2,a/2,b/2
//right line
line a/2,b/2,a/2,b
//bottom line*
line a/2,b,qx,b
//left line
line qx,b,qx,b/2
endfunction
how do i split the box on the right correctly using what algorithm?? i would like to use the same algorithm to further split it into 4 and same goes for the other boxes if the mouse hovers over them.
thank you