Dan |
01 January 2018 10:57 |
Like this ?
PHP Code:
Screen Open 0,640,200,16,lowres : Flash Off Reserve Zone 10 Dim LINK(10,4) : Rem Link(x,0)=state/not used x,1=x x,2=y x,3=x1 x,4=y1 Dim LINKTEXT$(10)
Reserve Zone 11
Double Buffer Bob Update Off Autoback 0
rem setting up zone
For X=1 To 10 TXT$="Text Zone"+Str$(X) LINKTEXT$(X)=TXT$ LINK(X,0)=0 LINK(X,1)=10+(X*5) LINK(X,2)=10+(X*8) LINK(X,3)=LINK(X,1)+(Len(TXT$)*8) : Rem 8 means font width LINK(X,4)=LINK(X,2)+9 : Rem 9 here is font height 8 + 1
Set Zone X,LINK(X,1),LINK(X,2)-9 To LINK(X,3),LINK(X,4)-9 : Rem -9 here adjust to how the text x,y,txt$ is rendered on y
Next X
rem main loop Repeat Cls MX=X Mouse MY=Y Mouse M=Mouse Zone Ink 2 Text 10,9,"Zone Under cursor="+Str$(M)
rem draw text: For X=1 To 10 Ink 2 If M=X Then Ink 4 : rem if mouse is under zone, draw the text in red, else white will be drawn Text LINK(X,1),LINK(X,2),LINKTEXT$(X) Next Screen Swap : Wait Vbl Until Mouse Key=2
For a bit faster version, without double buffering, add rem in front of :
PHP Code:
Double Buffer Bob Update Off Autoback 0
...
cls
and change
PHP Code:
Text 0,9,"Zone Under cursor="+Str$(M)
to
PHP Code:
Text 0,9,"Zone Under cursor="+Str$(M)+" "
|