cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/23/12:34:41

From: Hartmut Schirmer <hsc AT techfak DOT uni-kiel DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GRX 2.0 and Mouse Flicker
Date: Wed, 20 Aug 1997 09:53:04 +0200
Organization: Technische Fakultaet, University of Kiel, Germany
Lines: 43
Message-ID: <33FAA260.760A@techfak.uni-kiel.de>
References: <33FA55B1 DOT 404B AT concentric DOT net>
NNTP-Posting-Host: zora.techfak.uni-kiel.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019