Xref: news2.mv.net comp.os.msdos.djgpp:2125 From: Nabil Maria Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems with GRX 1.03 and 20 !! Date: Sat, 23 Mar 1996 22:45:37 +0100 Organization: tirf Lines: 137 Message-ID: <31547101.1785@tirf.inpg.fr> References: <4irbeq$a3c AT news DOT cea DOT fr> NNTP-Posting-Host: rubica.inpg.fr Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------15E66FFB397" To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp This is a multi-part message in MIME format. --------------15E66FFB397 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Answer to first question : -------------------------- The documentation says the following about GrGetEvent : "GrGetEvent will display the cursor it it was previously erased and the 'GR_M_NOPAINT' bit is not set in the flag passed to it. In this case it will also erase the cursor after an event has been obtained." This explains the "flashing" effect you are having. The solution is then to add the 'GR_M_NOPAINT' bit to your flag. Answer to second question : --------------------------- All you need to do is adding the call 'GrSetModeRestore(0)' to your code after initialising the graphics mode. Temptative answer to third question : ------------------------------------- I have tried using GrXOR operations with grx2 and it worked fine for me. I'm reposting back the original program with modifications coressponding to the above questions and a simple line XORing test that works. If you don't get the red box with the diagonal black line on it try using another graphics driver; your problem might be graphics card specific. ________________________________________________________________________ || MARIA Nabil || || || Neural Networks Group: TIRF-INPG || || || 46, Ave Felix Viallet || Tel: 76 57 48 22 || || 38031 Grenoble || Email: maria AT tirf DOT inpg DOT fr || || France || || ------------------------------------------------------------------------ --------------15E66FFB397 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="graph.cc" #include #include #include typedef long GrColor; GrColor red, green, blue; char MouseArrow[16*12] = { 1, 1, 1,00,00,00,00,00,00,00,00,00 , 1, 4, 1, 1,00,00,00,00,00,00,00,00 , 1, 4, 5, 1, 1,00,00,00,00,00,00,00 , 1, 4, 5, 5, 1, 1,00,00,00,00,00,00 , 1, 4, 4, 5, 5, 1, 1,00,00,00,00,00 , 1, 4, 4, 5, 5, 5, 1, 1,00,00,00,00 , 1, 4, 4, 4, 5, 5, 5, 1, 1,00,00,00 , 1, 4, 4, 4, 5, 5, 5, 5, 1, 1,00,00 , 1, 4, 4, 4, 5, 5, 5, 5, 5, 1, 1,00 , 1, 4, 4, 4, 4, 5, 5, 5, 5, 5, 1, 1 , 1, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 1 , 1, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1 , 1, 4, 4, 4, 1, 1,00,00,00,00,00,00 , 1, 4, 4, 1, 1,00,00,00,00,00,00,00 , 1, 4, 1, 1,00,00,00,00,00,00,00,00 , 1, 1, 1,00,00,00,00,00,00,00,00,00 }; int main(void) { GrCursor *CurMouse; GrMouseEvent evt; int i; // Init Graphic mode GrSetMode(GR_width_height_color_graphics,640,480,16); GrSetModeRestore(0); // Init Colors GrColor ColorTable[6]; GrColor NoSysColor[5]; ColorTable[0]=5; for(i=0;i<5;i++) { NoSysColor[i] = GrAllocColor(i*255/4,i*255/4,i*255/4); ColorTable[i+1]= NoSysColor[i]; } red = GrAllocColor(255, 0, 0); green = GrAllocColor( 0,255, 0); blue = GrAllocColor( 0, 0,255); // Init Mouse if (!GrMouseDetect()) { GrSetMode(GR_80_25_text); return 1; } GrMouseInit(); CurMouse=GrBuildCursor(MouseArrow,12,12,16, 1, 1,ColorTable); GrMouseEventMode(1); GrMouseEventEnable(1,1); GrMouseSetCursor(CurMouse); GrMouseDisplayCursor(); // Message loop : Wait for a key hit do { GrMouseGetEvent(GR_M_EVENT | GR_M_POLL,&evt); } while (!(evt.flags & GR_M_KEYPRESS)); // Line Xoring test GrFilledBox(0, 0, 400, 400, red); // Xor a diagonal line on the above drawn surface GrLine(0, 0, 400, 400, red | GrXOR); // You should see a red box with a diagonal black line on it now ! // Hide cursor test // :: 1 Hide cursor GrMouseEraseCursor(); // :: 2 Wait for an action do { GrMouseGetEvent(GR_M_EVENT | GR_M_POLL | GR_M_NOPAINT,&evt); } while (!(evt.flags & GR_M_EVENT)); // :: 3 Show cursor GrMouseDisplayCursor(); // Destroy mouse cursor GrMouseUnInit(); GrDestroyCursor(CurMouse); // Close Graphic mode GrSetMode(GR_80_25_text); printf("Back to text mode !\n"); return 0; } --------------15E66FFB397--