www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/02/21:58:10

Sender: nate AT cartsys DOT com
Message-ID: <36158447.A88C9206@cartsys.com>
Date: Fri, 02 Oct 1998 18:56:23 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: jud <jud AT tminet DOT com>
CC: djgpp AT delorie DOT com
Subject: Re: graphics
References: <6v1mtc$4ni$1 AT supernews DOT com>

jud wrote:
> 
> what is the best way to compile grahpics into a program? would i just have
> to make a huge array? or is there a better way?

If using Allegro, you can use a datafile.  Otherwise, it might be best
to make it into an assembly file, because GCC can take absurd amounts of
memory when compiling large initialized arrays.  Basically, it would
look something like this:

--- file pic.s ---
.data
.global _pic_array
_pic_array:
	# Here follows all the bytes of your image.
	.byte 42
	.byte 17

--- file pic.h ---
extern unsigned char pic_array[];
--- end ---

Then #include "pic.h" into your files, and access the array as usual. 
You can probably write a simple program to automate this, or hack
Allegro's DAT2S.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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