Mail Archives: djgpp/1997/08/23/03:19:17
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:
// MouseGRX.c
#include <stdio.h>
#include <grx20.h>
void main (void)
{
GrMouseEvent MS; // mouse structure
if (!(GrMouseDetect()))
{
puts("\n\nNo mouse found on this system\n\n");
return;
}
if (!(GrSetMode(GR_width_height_graphics, 640, 480)))
{
puts("\n\nNo Graphics Hardware Support\n\n");
return;
}
GrMouseEventMode(0); // init mouse to polled mode
GrMouseInit(); // turn on the mouse
GrMouseDisplayCursor(); // make the cursor visible
while (!(MS.buttons & GR_M_RIGHT))
{
GrMouseGetEvent(GR_M_POLL, &MS);
if (MS.buttons & GR_M_LEFT)
GrPlot(MS.x, MS.y, 15);
}
GrMouseEraseCursor(); // erase mouse
GrMouseUnInit(); // no more mouse
GrSetMode(GR_80_25_text); // no more graphics
}
- Raw text -