On 3 Apr 2004 at 18:53, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
It I have written a small "graphcrt" unit that can be used instead -
Just for clarification: I don't recommend using CRT just for auxiliary routines such as Sound and Delay anyway. The only case to use GRX and CRT together IMHO is for programs that really do graphics and windowish text I/O (alternatively or concurrently).
[...]
I don't really use Graph myself - but I have tried to port some BP programs (a chess game for example) and they all seemed to use both Graph and Crt. The routines that I put in graphcrt are the ones that are mainly used in these programs.
Instead of Delay you can use Sleep and SleepMicroSeconds (unit GPC).
just to get programs to compile (see below - perhaps there is a portable way to implement "Sound" and "NoSound" without using Crt?):
Since even with CRT there's no portable way, the answer is surely no. Currently it's only implemented for DJGPP and Linux. The Linux code only runs in a terminal (i.e., not under X11 where you usually run GRX programs). I don't know if there are X11 commands for such "beeps" (if someone know, we could probably support them, and this would be for all Unix compatible systems under X11). The DJGPP code might also run in graphics mode.
procedure clrscr; begin ClearDevice; end;
I also don't recommend this because it clears the graphics screen/window which may or may not be the same as the text screen/window.
What kind of programs are these?
Games, demos, etc.
If they use CRT routines to work in a graphics context, this isn't portable anyway, and I suggest to change the programs to use the appropriate Graph calls directly. (As I said, unless they really do graphics *and* text I/O.)
Many of them use Readkey and/or Keypressed, ClrScr, Delay, and Sound/NoSound. Readkey and Keypressed are conditionally implemented in the Graph unit. Delay can be implemented using Grx. What I tried to do was to avoid using the real Crt unit by using things that are available in Grx.
As I said, I just needed to get these programs to compile (under Mingw) - and it is easier to create the graphcrt unit than to change all the source files. Indeed, I can still compile the code under BP, because graphcrt is only used when the compiler is GPC.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.bigfoot.com/~african_chief/