Mail Archives: djgpp/1997/08/23/12:34:41
Meta wrote:
>
> After hacking up some code for using the mouse, in polled mode, I was
> horrified by the amount of flicker. Can someone post interrupt driven or
> some flicker free mouse code for GRX v2? Here's what I got:
[...]
Your code works well for moving the mouse without drawing, the flicker
seems to be acceptable.
When drawing with the left mouse button, the GrPlot() function call
triggers the mouse blocking:
GrPlot(x,y)
blocked_mouse = 0
if x,y in mouse area:
blocked_mouse = 1;
erase mouse
restore original screen
draw pixel on screen
if blocked_mouse
display mouse
With this in mind enhance your code:
int last_x = -1;
int last_y = -1;
...
if ( (MS.buttons&GR_M_LEFT) && (last_x!=MS.x || last_y!=MS.y)) {
last_x = MS.x; last_y = MS.y;
GrPlot(MS.x,MS.y,15);
}
...
This way the pixel is only drawn once and much less flicker occures.
Hartmut
--
Hartmut Schirmer | Phone: +49-431-77572-709 FAX:-703
Automatisierungs- & Regelungstech. | hsc AT techfak DOT uni-kiel DOT de
Technische Fakult"at, | http://www.techfak.uni-kiel.de/~hsc
Kaiserstr. 2, 24143 Kiel, Germany | PGP key via WWW, Key ID:6D84AEC1
- Raw text -