libgraph --- Implementing Turbo C's graphics on GNU/Linux

<<Previous Next>>
Home List of Functions


 Introduction & Usage



  • What is it?

  • It is an implementation of TC graphics.h functions in Linux using SDL -- Simple DirectMedia Layer (www.libsdl.org for more).

    The sole objective of this package is to enable people to run programs written using graphics.h functions directly in Linux. It does not aim to be a complete graphics solution. Effort has been made to suppress flexibility and genericity in order to provide an interface closer to the original. Basically this software is provided with the sincere hope that it will prevent you from booting into Windoze.

    For more power and flexibility use libSDL directly. The website (libsdl.org) contains a number of links to great useful, generic and powerful support libraries for SDL.


  • What do I need?

  • You need to have the following installed :

    SDL-x.x.x.rpm -- the main SDL library
    SDL-devel-x.x.x.rpm -- the developer package
    SDL_image-x.x.x.rpm -- image library for fonts
    SDL_image-devel-x.x.x.rpm -- image library developer package

    These libaries are a standard part of most current distributions (which is why we chose SDL over SVGAlib in the first place). The libaries will probably already be installed. You may have to install the developer packages.

    SDL can render onto X or a framebuffered console(fbdev). The VGA mode console can be used directly through SVGAlib but we haven't tried it (on the TODO list).


  • How to use?

  • Assuming that you have the above packages installed, just cd to the graphics directory and type :

    make /*To compile*/
    make install /* To install */
    ...and you are ready to go.

    You may want to use :

    make uninstall /* To purge your system of the previous installation */
    make clean /* To remove the old objects before a recompile */

    The headers are installed in /usr/include.
    Libraries go to /usr/lib.
    Fonts and documentation are in /usr/share/libgraph.

    Just include graphics.h in your C file ( as you normally would do). While compiling your applications you must link with libgraph as in :

    	$ gcc  foo.c  -lgraph  -o  foo
    

    If your fingers give you too much trouble then we have provided a simple script "grc" to the same effect.

    $grc foo

    As of now you must manually copy this script into a directory in your path.

    You can now run your executable.


  • IMPORTANT

  • If your program goes into an infinite loop press CTRL-C. The program will quit in anywhere between 10 to 30 seconds(depending on CPU load). If the program doesn't exit you may have to restart the X-server (just CTRL-BACKSPACE-ALT). We have not yet seen a complete lock-up requiring a reboot.

    If this makes you uncomfortable (too slow or too sophisticated for your taste), remove the SDL_FULLSCREEN flag from the _initflag definition in graphics.h and recompile,reinstall. Now libgraph will run in windowed mode and you can xkill it in case of a lock-up.

    There exists a loop-hole in scanf. If you enter invalid input, specifically text where numbers are expected, the function goes into a loop (the program would have seg-faulted or mal-functioned anyway).Here you can easily use CTRL-C to exit --- this feature is guaranteed to work.

    If you just want to use the library you have learnt all ye need to know. We have provided documentation of standard TC functions(see Function List). For a closer look at the functions/constants provided, just glance through the header files.

    Any problems/destructive criticism/flames may be sent on:

    <faraz_ms@rediffmail.com>


    <<Previous <Home> Next>>
    Home Top List of Functions