delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/03/13/17:57:08

From: Gamble C O <gambcl AT essex DOT ac DOT uk>
Date: Sun, 13 Mar 94 22:06:14 GMT
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: I've found the cure!!!

Hi again all, I just thought I would let everyone know that I fixed my earlier
problem, and let you know what I noticed, just in case someone else has the
same problem.

I am using the GRX graphics library to output a menu screen on a 640 X 350
16 colour screen. I am using a black screen with a white border on it.

I am using the following commands in my code:

	GrSetMode();
	GrClearScreen(GrBlack());
	GrBox(x1, y1, x2, y2, GrWhite());
	GrTextXY(x, y, char *s, GrWhite(), GrBlack());

My program worked fine but after a certain point the white border disappeared
from view, the text was still there but the boxes were no longer visible,
even if I cleared the screen and drew them again, they just would not
display.

I noticed that this happened just after I used the scanf command to get some
user input, I only used this command once in the code so far.

I posted a cry for help and got one reply which said that the colours were
being changed but I could not work out WHY!

Anyway, I found out that if you call GrSetMode(); again, after the scanf/printf
(or whatever) then the colours are reset to their proper values and I can now
draw my boxes again.

However I am still not sure WHY this happens in the first place, if anyone has the answer could they please tell me, I am not sure if it is because of my code
or because of an 'unknown feature' of GRX.

Many thanks to all who replied to my earlier questions.

--

"Just when you see the light at the end of the tunnel . . . 
The roof caves in!" 

Charlie Gamble
gambcl AT essex DOT ac DOT uk

- Raw text -


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