delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/06/10:41:55

Message-Id: <3.0.32.19970606090310.009084c0@dataplusnet.com>
Date: Fri, 06 Jun 1997 09:03:16 -0500
To: "Chia" <chia AT top DOT net>, djgpp AT delorie DOT com
From: "Michael M." <michaelm AT dataplusnet DOT com>
Subject: Re: Easy to answer Graphics Quetion
Mime-Version: 1.0

Well, if you want a simple way, get Allegro 2.2.  Try this C code:

compile with:  gcc sample.c -o sample.exe -lalleg

<<<<<<<<<<  START of SAMPLE.C   >>>>>>>>>>
#include <stdio.h>
#include "allegro.h"

int main(void)
{
	
	
	BITMAP *buffer_screen;			/*	defines a bitmap named "buffer_screen"*/
	PALLETE buffer_pallete;			/*	defines a pallete named "buffer_pallete"*/
	buffer_screen = load_bitmap("filename.pcx", buffer_pallete);	/*loads the
PCX file "filename.pcx" to "buffer_screen"*/
	if (!buffer_screen)				/* tests if filename.pcx was loaded correctly*/
   {
      printf("Error reading bitmap file '%s'\n", "filename.pcx");
      exit(1);
   }
   
   allegro_init();					/* initilizes Allego*/
	install_keyboard();				/* initilizes the keyboard*/
   
   set_gfx_mode(GFX_AUTODETECT, 640 ,480, 0, 0);	/* sets graphics mode to
SVGA */
   set_pallete(buffer_pallete);	/* sets the pallete to the image pallete*/
   blit(buffer_screen, screen, 0, 0, 0, 0, 640, 480);	/* blits the buffer
to the screen*/
   readkey();	/* waits for a key to be pressed*/
}

<<<<<<<<<< END of SAMPLE.C >>>>>>>>>>



At 05:39 PM 6/5/97 GMT, you wrote:
>hi!
>(if you're going to help me please send it to:
>chia AT top DOT net     )
>I am rather new to this and only have got the compiler to work a couple
>days ago.  I can make some really nice graphics with some various programs
>and would like to be able to put them into either C or C++ code. I've been
>trying to figure it out on my own but all I can find is long sets of code
>and I haven't seen how I can just display an image.  Is there a way to just
>take a .bmp or any other kind of file and display it?  Thanks!
>
>						Chia
>
>

- Raw text -


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