[comp.lang.pascal] Graphics cursor handling in Turbo Pascal

tswingle@oucsace.cs.ohiou.edu (Tom Swingle) (01/25/91)

I am starting a graphics program using Turbo Pascal.  The program will use a
mouse, if one is present, but I would also like to make the program run without
a mouse.  This requires me to handle my own cursor if no mouse is detected.  I
have been doing this with Putimage, in a way like the mouse driver handles the
cursor:  Have one set of pixels which is ANDed with the screen to turn off 
certain pixels, and then another set which is XORed with the screen to make the
shape of the cursor.  I have been successful, except for two points:

1.  It's a bit slow.  I can live with it, but there is probably a faster way to
do it.  Any suggestions?

2.  If part of the cursor goes off the screen, which is necessary when plotting
points near top or right side of the screen (the "point of interest" of the
cursor, the point on the cursor which "plots" the dots, is in the lower left-
hand corner of the cursor), the cursor will disappear, since Putimage will 
not work if part of the image to be put up lies outside of the screen.  Is
there anything I can do to get around this?  I could draw the cursor on a pixel
by pixel basis if the cursor is partly off the edge of the screen, but this
seems to slow (see point #1).  Can anybody think of anything better?

E-mail would probably be best but I do read this group almost every day so a
follow-up post would be fine too.  Thanks to anyone who can help.

ts@uwasa.fi (Timo Salmi) (01/25/91)

In article <2829@oucsace.cs.OHIOU.EDU> tswingle@oucsace.cs.ohiou.edu (Tom Swingle) writes:
>I am starting a graphics program using Turbo Pascal.  The program will use a
>mouse, if one is present, but I would also like to make the program run without
>a mouse.  This requires me to handle my own cursor if no mouse is detected.  I
>have been doing this with Putimage, in a way like the mouse driver handles the
:

One way of having a cursor in a graphics program is simply drawing
it.  It won't flash, though.  In my own programs I have used the Bar
procedure for the drawing.  No fancy Xor'ings to complicate matters. 
Perhaps /pc/ts/tsdemo14.arc at our archives will give you some ideas
about what it looks like, although it won't give you any code. 

...................................................................
Prof. Timo Salmi        
Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.12.37
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun