timing functions?

Frank Heckenbach ih8mj at fjf.gnu.de
Thu May 28 12:18:18 CEST 2009


Martin Kalbfuß wrote:

> I'm writing a small snake game with the CRT unit. I wan't to set up a
> timer for the snake movement. What is the best way to do so with gpc.

When you use CRT, it's best to use the Delay procedure (millisecond
resolution) from this unit.

Otherwise, the GPC unit has Sleep (seconds) and SleepMicroSeconds,
but they don't know about CRT, i.e., you might have to call
CRTUpdate before using them, so output is flushed.

If you need to wait conditionally (e.g., until input becomes
available), you can use IOSelect or IOSelectRead (unit GPC), but you
might also need CRTUpdate.

> If possible I would like to use ISO code.

Unfortunately, none of these are ISO Pascal -- it doesn't have any
timer routines. And the CRT unit is not ISO either.

Frank

-- 
Frank Heckenbach, f.heckenbach at fh-soft.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
http://www.gnu-pascal.de/todo.html
GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE  D101 CD02 4C9D 0FE0 E5E8





More information about the Gpc mailing list