Date: Tue, 11 Oct 1994 08:57:03 -0400 (EDT) From: Edwin Phillips To: Kimberley Burchett Cc: DJGPP Mailing List Subject: Re: keyboard messups!!!! :( On Mon, 10 Oct 1994, Kimberley Burchett wrote: > > On Sun, 9 Oct 1994, Curtiss Cicco wrote: > > > > do { > > > FixRotate(x,y,angle,&x,&y); > > > PutPixel(FixWhole(x)+160, FixWhole(y)+120, 15); > > > while(kbhit() == 0); > > > } while(getch() != 'q'); > > > CloseVGA(); > > >} > I assume that FixRotate() computes: x = x*cos(angle) - y*sin(angle), and y = x*sin(angle) + y*cos(angle) with fixed point math, 16.16 bit. If angle is constant across calls, you should see x and y trace a circle (right?) about the origin, at an interval of the angle. But, you say that kbhit() and getch() are cause the values of x, and y, to NOT behave in this way. I suggestion I can offer is to open a file and right out x,y at each step through the loop. Then take out to kbhit() etc. and write them again. If the values don't match, then there may be a problem with having kbhit() or getch(). You could alternative step through the program in gdb, or (I don't know if gdb will do this) set a breakpoint to occur if x or y changes. Make sure that FixRotate() is the only function changing them. Maybe PutPixel is modifying x or y accidently (it's making a pointer into screen mem right?). Make sure that the values are correct, and find out what is changing them to be incorrect. This should be easy since it's a small prog (at least the part you showed us). Hope this helps, Ed /****************************************************************************/ /* Ed Phillips flaregun AT strauss DOT udel DOT edu University of Delaware */ /* Jr Systems Programmer (302) 831-6082 IT/Network and Systems Services */ /****************************************************************************/