From b2ddc14a6322ea7634c9df7e6e561b91bb0f2be1 Mon Sep 17 00:00:00 2001 From: <> Date: Wed, 25 Apr 2018 04:12:48 -0700 Subject: [PATCH] Added example of getting all textures --- docs/doc-tex.txt | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/doc-tex.txt b/docs/doc-tex.txt index 0b05d3e..cbb09c4 100644 --- a/docs/doc-tex.txt +++ b/docs/doc-tex.txt @@ -97,3 +97,32 @@ Functions true on success. false when failing checks against segmentation faults. + +Example logic to extract all textures: + { + // After reading the file in... + // Need to know how many batches are in the package. + struct TexturePack *p = (struct TexturePack*)filedata; + + // Need to know about each batch in the package. + struct TextureBatchDescriptor *d = NULL; + + struct Texture *t = NULL; + + unsigned int i; + for (i = 0; i < p -> batchNumber; i++) { + DEVIL1TEX.getbatchdesc(&d, i, filedata, filesize); + + // Batch descriptor tells how many textures are in the batch. + t = (struct Texture*) + malloc(sizeof(struct Texture) * (d -> texNumber)); + DEVIL1TEX.gettextures(t, i, filedata, filesize); + + // There are now textures in 't'. + for (j = 0; j < d -> texNumber; j++) { + // Do whatever you want with however many of them there are. + } + + } + } +