delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/04/16:51:35

From: Stephen Snape <stephen DOT snape AT virgin DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Having A Problem with Allegro
Date: Sun, 04 Oct 1998 21:48:33 +0000
Organization: Virgin News Service
Lines: 32
Message-ID: <3617ED2F.B9A1239@virgin.net>
References: <6v8d73$770$1 AT news3 DOT mr DOT net>
Reply-To: stephen DOT snape AT virgin DOT net
NNTP-Posting-Host: 194.168.68.198
Mime-Version: 1.0
X-Mailer: Mozilla 4.04 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Johnny wrote:

> I just got djgpp with Rhide and allegro up and running and entered the
> following code (see below). And all I come up with is a blank screen.
> Am running Win98 on a PII 300 with a Graphics Blaster video card. This code
> should work. Thanks
> #include <allegro.h>
>
> int main()
> {
>  allegro_init();
>  install_keyboard();
>  set_gfx_mode(GFX_VGA,320,200,0,0);
>  textout_centre(screen,font,"Press Any Key.",160,100,255);
>  readkey();
>  return 0;
> }

  The problem with this code is that you're specifying color 255 but this means
nothing until you tell it which palette you're using.

Insert the line ...

set_palette(desktop_palette);

...after set_gfx_mode and change the color in textout centre to 1 instead of
255, (I know this to be red), compile link and run.

Steve

- Raw text -


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