While working on the Cross Development issue, I was modifying painintheworld's MOUSETEST01.BAS code to access the left and right mouse buttons. The left mouse button reads the character under the mouse pointer and prints on the top line the character and the chr$() code. The right mouse button prints to the screen at the location of the mouse pointer.
I added line 115 to find the font width and height. I had to do this because Font 0 is 6x8 and the others are 8x8. The pointer image is changed to POINTER8X8.PNG and SIZE to 16,16. I am using the MOUSETEST01.zip file linked in painintheworld's first post. I saved the code as MOUSETEST02.BAS in the same folder with the image files. The text in the upper left corner is not read by the left button because they are Pixel Graphics GPRINT characters.
I did this to test how using a mouse could interact with BASIC Engine code. Back in the day, 8bit computers used Joysticks. BASIC Engine can use both a Mouse and/or GamePad. The USB switcher was used in coding and testing this program.
MOUSETEST02.BAS
10 '* * * * * * * * * *
15 'The simplest of mouse button tests
100 SCREEN 12:PALETTE 1: font 0:
110 MAXX=PSIZE(0)-1:MAXY=PSIZE(1)-1:MAXCX=CSIZE(0)-1:MAXCY=CSIZE(1)-1
115 ftWd = int(MAXX/MAXCX): ftHt=int(MAXY/MAXCY) : Rem find Font Width and Height
120 LOAD IMAGE "POINTER8X8.PNG" AS SPRITE 0
130 SPRITE 0 SIZE 16,16 ON
135 LOCATE 15,10:PRINT "BASIC Engine"
140 WHILE INKEY$=""
150 X=MOUSEX:Y=MOUSEY
160 MOVE SPRITE 0 TO X,Y
164 IF MOUSEBUTTON(1) THEN CALL ltBtn(X,Y)
166 IF MOUSEBUTTON(2) THEN CALL rtBtn(X,Y)
170 GPRINT 0,0,"X=";X;" ";
180 GPRINT 0,8,"Y=";Y;" ";
190 VSYNC
200 WEND
300 PROC ltBtn(mx,my) rem Code for Left Mouse Button
305 cx=INT(@mx/ftWd):cy=INT(@my/ftHt):chrNo=CHAR(cx,cy)
320 LOCATE 24,0:PRINT " "
321 LOCATE 20,0:PRINT "Code=";CHAR(cx,cy)
322 LOCATE 15,0:PRINT CHR$(chrNo)
399 RETURN
400 PROC rtBtn(mx,my) rem Code for Right Mouse Button
405 cx=INT(@mx/ftWd):cy=INT(@my/ftHt):chrNo=CHAR(cx,cy)
420 LOCATE cx,cy:PRINT "Right Button"
499 RETURN