Turbo C graphics library

thomas.j.roberts tjr at cbnewsc.ATT.COM
Tue Apr 10 01:19:51 AEST 1990


>From article <35769 at cci632.UUCP>, by tre at cci632.UUCP (Todd Engle):
> 	I would like to find out if one can have a visible cursor in a 
> graphics window...
> Also, is it possible to have reverse video in graphics mode in Turbo C?

A cursor CAN be displayed in graphics mode, but you must do it manually.
On most PCs, printf (etc.) can be used in graphics mode, and will work
as expected (chars 0-127 only), storing the pixel representation of the
characters onto the graphics screen (both background and foreground).
If you use a direct BIOS call to display with the BLINK attribute, then
the foreground pixels of the character will be XORed onto the display.
Thus, you can display an underscore (_) as a cursor, using XOR mode,
and move it for every character typed (must use getch() or getche(), or
a similar BIOS call, cannot do a buffered read). Getting the cursor to
blink is a real challenge, as you must do the timing yourself, in parallel
with the getch(); if you are also looking for mouse events as well, it can
get pretty complicated, so you will probably need to go to an input-event
design with a single input-event queue into which TIMER, KEYBOARD, and
MOUSE events are all placed. Good Luck.

I have never tried using TC's TEXTMODE routines (cprintf, gotoxy(), etc.)
in GRAPHICS mode.

Tom Roberts
att!ihlpl!tjrob



More information about the Comp.lang.c mailing list