Svgalib-Gpc-20000216
What is it?
Svgalib-Gpc is a set of Pascal units to make Svgalib accessible by user-made
programs. The developing environment provided Svgalib 1.4.1, and
the units probably wouldn't work with previous versions.
How do I use it?
First of all copy/move the units (*.pas) to a directory where
you want to store all your commonly used units, for
example ~/units, and then remember to tell gpc about
it, with the option --unit-path=$HOME/units, of course changing
the path as appropriate.
Then you just have to include the appropriate units in your
programs, using the keyword uses.
Contents of the units
- vga.pas
Everything which is located in vga.h has been translated
into Pascal. Some functions related to input devices support (like
vga_getch() or vga_waitevent()) have been omitted
on purpose. This is because input devices support (as far as
keyboard and mouse) has been written using TFDDs (see
gpc.pas from the gpc distribution) and placed in
other units.
Also, I don't like the way Svgalib header files declare function
prototypes, so they have been slighly changed. See the example
(which should be enough to explain):
int vga_setmode(int mode);
function VgaSetMode(mode: Integer) : Integer;
- vgagl.pas
I wrote this unit just like the one above, rewriting function names
as appropriate.
-
vganormalkeyboard.pas
This unit is made to handle the keyboard in normal mode. It
provides some useful functions:
KeyboardInit: this is used to initialize the keyboard to be
used in normal mode. For raw mode you should use
vgarawkeyboard.pas.
KeyboardClose: this closes the keyboard file (keyboard is
treated as a file).
AnyKeyPressed: this function returns a boolean value which
tells if any of the key has been pressed.
KeyPressed: this function returns a boolean value which
tells if the key given as argument has been pressed.
WaitKey: This read a character from the keyboard file: if
the character is not there ready to be read, the function waits for
it. After that the function returns the key pressed and flushed the
file.
GetKey: It's like Svgalib vga_getkey() but it's
been rewritten using TFDD capabilities.
KeyboardFile: This is a text variable useful if you want to
select(2) on the Keyboard file and other files
contemporarily. Under GNU-Pascal you must use
IOSelect.
- vgarawkeyboard.pas
This is quite the same as vganormalkeyboard.pas, except
that "Raw" is prepended to each function. For example
KeyPressed becomes RawKeyPressed.
- vgajoystick.pas
Plain translation of the appropriate header file. Like
vga[gl].pas.
- vgamouse.pas
It's mainly the translation of vgamouse.h but there are
some things to say (because the unit was written using a TFDD):
MouseInit: Opens the mouse file and assigns related
functions (with AssignTFDD)
MouseClose: Close the mouse file.
MouseMoved: Tells if the mouse is moved.
Mousefile: It's a text variable, that is the mouse file.
It's useful for using select(2) on the mouse file and
other files (and why not the keyboard file?).
Where do I get it?
You can get it by HTTP or
FTP
Aknowledgements
Special thanks go to Frank Heckenbach who helped out with the
TFDD stuff and to Peter Gerwinski who gave me the account on this
server.
If any of you found any bug or have suggestions, please tell
me about it at the address shown below.
Nicola Girardi girardi(at)keycomm.it