delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/11/15:05:28

From: Marcus Rohrmoser <Marcus DOT Rohrmoser AT lrz DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: graphics with the grx library?
Date: Fri, 11 Jun 1999 11:57:53 +0200
Organization: Leibniz Rechenzentrum Muenchen
Lines: 59
Distribution: world
Message-ID: <3760DDA1.B1FCD4E9@lrz.de>
References: <7joeop$hvb$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: sun3.lrz-muenchen.de
Mime-Version: 1.0
X-Mailer: Mozilla 4.51 [en] (X11; I; SunOS 5.5.1 sun4m)
X-Accept-Language: en, de-DE
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.
--------------59918ECE2D270B36000C478C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


GRX is THE best joice if you want portability. Allegro maybe is better,
if you don't need portability (beyond VGA on DOS/Linux). But I'm not
familiar with allegro.

See the attachment for a small example.

Marcus
--------------59918ECE2D270B36000C478C
Content-Type: text/plain; charset=us-ascii;
 name="grxhello.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="grxhello.c"

/*
 * Compile on e.g. a sun:
 * gcc -I$HOME/lib/c -L$HOME/lib/c/sun grxhello.c -lgrx20 -lX11 -lsocket
 *
 */
#include <grx20.h>
#include <grxkeys.h>
int             main()
{
    char            message[] = "Hello, world!";
    float           frac = 0.40;
    GrTextOption    topt;

    GrSetMode(GR_biggest_noninterlaced_graphics);
    GrClearScreen(GrBlack());

    GrFilledBox(frac * GrSizeX(), frac * GrSizeY(),
		(1 - frac) * GrSizeX(), (1 - frac) * GrSizeY(),
		GrWhite());

    GrLine(10,50,GrSizeX(),GrSizeY(),GrWhite());

    /* topt.txo_font      = &GrFont_PC8x8; */
    topt.txo_font = &GrDefaultFont;
    topt.txo_bgcolor.v = GrOrModeColor(0);
    topt.txo_fgcolor.v = GrBlack();
    topt.txo_direct = GR_TEXT_RIGHT;
    topt.txo_xalign = GR_ALIGN_CENTER;
    topt.txo_yalign = GR_ALIGN_CENTER;
    topt.txo_chrtype = GR_BYTE_TEXT;
    GrDrawString(message, strlen(message), GrSizeX() / 2, GrSizeY() / 2, &topt);

    GrKeyRead();
    GrSetMode(GR_default_text);
    return 0;
}

--------------59918ECE2D270B36000C478C--

- Raw text -


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