From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: Suggestion for Allegro... Date: 16 Oct 1997 11:58:26 GMT Organization: Oxford University, England Lines: 30 Message-ID: <624vh2$6kg$1@news.ox.ac.uk> References: <3445339A DOT 7F98CE24 AT anest DOT azg DOT nl> <1a5be7d947%mattbee AT soup-kitchen DOT demon DOT co DOT uk> NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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 Merton College, Oxford