Mail Archives: djgpp/1997/10/16/10:02:11
On Thu, 16 Oct 1997 11:02:40 +0100 in comp.os.msdos.djgpp Matthew Bloch
(mattbee AT eh DOT org) wrote:
: Well... the thing that has confused me about the DAT files is that you have
: a separate call in the API for pulling out BMPs, WAVs etc., but they're all
: essentially *data*. Why can't you just have some extract_resource() call
: which doesn't care about filetype? Do poke me with sticks if I've missed the
: point, but I think that'd be a good way of doing things.
/me hits Matthew with a large wooden club :)
The point, I think, is that the bitmap loader returns a BITMAP * to a nicely
prepared bitmap ready for blitting to the screen or wherever else. Likewise
for the sound sample loader, the midi loader, the font loader, and anything
else you can think of. Allegro doesn't work all the time with raw binary
data; internally it uses special data structures, and the datafile images of
these structures are (of course) not identical to the structures themselves;
doing a simple fwrite (or pack_fwrite as the case may be) of a struct is
extremely bad practice.
Admittedly, an extract_resource function could return a void *, castable to
a pointer to any of the internal structs, but that's exactly what
load_datafile does anyway ;). When you're loading individual objects, you
probably know what each one is (since you have to set some variable to equal
the returned pointer). If you're loading all your data in one go, why not use
the normal datafile loader? :)
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -