www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/05/14:55:39

From: "Charles Wood" <c DOT dot DOT r DOT dot DOT wood AT worldnet DOT att DOT net DOT null>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to optimize this mouse function..
Date: Wed, 5 Jan 2000 12:14:01 -0800
Organization: AT&T WorldNet Services
Lines: 75
Message-ID: <8505k0$q6p$1@bgtnsc02.worldnet.att.net>
References: <210046ed DOT e1267171 AT usw-ex0101-007 DOT remarq DOT com>
NNTP-Posting-Host: 63.28.161.48
X-Trace: bgtnsc02.worldnet.att.net 947100096 26841 63.28.161.48 (5 Jan 2000 19:21:36 GMT)
X-Complaints-To: abuse AT worldnet DOT att DOT net
NNTP-Posting-Date: 5 Jan 2000 19:21:36 GMT
X-Newsreader: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

The reason you are delaying is to make it visible?

in that case make a mouse_move function...

read_mouse();
if  cur_mouse_loc is  != to old_mouse_ loc then
        move_mouse();

move_mouse() {
    erase_old_mouse();
    get_back_ground_for_new_location();
    draw_new_mouse();
    old_mouse_loc = cur_mouse_loc;
    }

//No delay needed, and no additional code needed.

Something like that should have the desired effect, the only problem is that
changes behind the mouse after it's background has been copied will mess it
up.. Your choices are to erase the mouse before drawing info in that area,
or go to a "windowed' system that can actively draw the area behind the
mouse at any time..

       The first suggestion is the easiest..

Charles.


--
Charles Wood
REMOVEMEc DOT r DOT wood AT worldnet DOT att DOT net


hellbaron wrote in message <210046ed DOT e1267171 AT usw-ex0101-007 DOT remarq DOT com>...
>I've been working on a big graphix project all week, everything is
>going ok, exept for this mouse function. The thing is, I would like to
>save some valuable time when executing this function by eliminating the
>delay(50), but I just cant seem to be able to substitute it with
>anything else, I tried with a simple if, but it just doesnt work..
>Please help me out!!, any feedback will be greatly apriciated, thanx in
>advance to anyone who replies to this message, and here is the function:
>
>void PlotMouse()
>{
>int x, y, px, py, ox, oy;
>char back[16][16];
>
>ReadMouse();
>ox = MouseX;
>oy = MouseY;
>
>for (x=MouseX, px=0; x<MouseX+16; x++, px++)
>  for (y=MouseY, py=0; y<MouseY+16; y++, py++)
>  {
>    back[px][py] = getpixel(x,y);
>    if (cursor[(py*16)+px] != 0)
>      putpixel(x, y, (cursor[(py*16)+px]));
>  }
>
>delay(50);
>//ReadMouse();
>//if ((ox != MouseX) || (oy != MouseY))
>for (x=ox, px=0; x<ox+16; x++, px++)
>  for (y=oy, py=0; y<oy+16; y++, py++)
>    putpixel(x, y, back[px][py]);
>}
>
>
>
>* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
>The fastest and easiest way to search and participate in Usenet - Free!
>


- Raw text -


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