Shop OBEX P1 Docs P2 Docs Learn Events
BS2+Seetron''s G12032 graphical LCD+Pak6 + mouse to capture mouse move — Parallax Forums

BS2+Seetron''s G12032 graphical LCD+Pak6 + mouse to capture mouse move

ArchiverArchiver Posts: 46,084
edited 2001-11-30 07:45 in General Discussion
Dear All

Thanks for the information, especially that from Al William is very useful.
The code works. It is only that the speed is not fast enough to capture
every "movement" of the mouse. I am not sure if it is my program not
properly designed or it is the nature of the LCD.. Most probably it is the
program.

To share with all of you, the code as follows. I would be very grateful if
somebody can suggest the way to improve performance.
========================================================
main:
gosub getMousePos ' Read mouse position.
gosub showMousePos ' Display the mouse position as a dot to complete the
trace.
goto main

showMousePos:
serout 0,n9600,[noparse][[/noparse]ESC,"I",BLACK,ESC,"P",x1+CUT0,y1+CUT0]
return

getMousePos:
......
'convert negative number. xreg is a byte (raw x move) from the mouse. I need
to do conversion for 'negative move.
x1 = x1 - ((xreg-1)^$FF)
IF x1>119 THEN convertx

goto doy
xplus:
x1=x1+xreg
x1=x1 max RMARGIN

doy:
if ysign=0 then y_up
'convert negative number
y1=y1 + ((yreg-1)^$FF)
y1=y1 MAX BMARGIN
goto ydone
y_up:
y1=y1-yreg
IF y1>31 THEN converty
ydone:

'debug sdec x1, " ", sdec y1, " ", sdec xreg, " ", sdec yreg, cr
return

converty: y1=(y1-1)^$FF
goto ydone
convertx: x1=(x1-1)^$FF
goto doy

========================================================

Thanks a lot.

John Leung
Sign In or Register to comment.