~ubuntu-branches/ubuntu/warty/zziplib/warty

« back to all changes in this revision

Viewing changes to zziplib/README.SDL

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno
  • Date: 2004-03-29 12:41:28 UTC
  • Revision ID: james.westby@ubuntu.com-20040329124128-hf9y5elywpavuh5y
Tags: upstream-0.10.82
ImportĀ upstreamĀ versionĀ 0.10.82

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
16122002, Thomas.Eder@nmi.at, Using the zziplib library with SDL
 
2
 
 
3
 
 
4
PREREQUISITES
 
5
 
 
6
  Tested versions:
 
7
    zziplib 0.10.66 (preview), SDL 1.2.5, Win32, MSVC6
 
8
 
 
9
  Homepages (download)
 
10
    zziplib.sourceforge.net (zziplib-0.10.66.tar.gz)
 
11
    www.libsdl.org (SDL-devel-1.2.5a-VC6.zip)
 
12
 
 
13
  Also you have to get zlib, I used 
 
14
    from SDL_image-1.2.2.zip in VisualC.zip:
 
15
      zlib.lib (12.7.1998, 34674 bytes)
 
16
      zlib.h   ( 9.7.1998, 41791 bytes, 1.1.3)
 
17
      zconf.h  ( 8.7.1998,  8089 bytes)
 
18
 
 
19
    from SDL_image-devel-1.2.2-VC6.zip:
 
20
      zlib.dll ( 5.4.2001, 53760 bytes, 1.1.3.1)
 
21
 
 
22
  Maybe you should get the latest version (currently 1.1.4) from
 
23
    http://gnuwin32.sourceforge.net/install.html
 
24
      (see notes at end of page!)
 
25
 
 
26
 
 
27
CREATING zzlib.dll/zzlib.lib
 
28
 
 
29
  Copy your versions of zlib.lib, zlib.h and zconf.h to the zzlib 
 
30
    directory.
 
31
  In MSVC (start zziplib.dsw)
 
32
    Add zlib.lib to the files for the zziplib_DLL project.
 
33
    Add ZLIB_DLL to the preprocessor definitions.
 
34
 
 
35
  Set the active project and the active configuration to create zziplib.dll 
 
36
  and zziplib.lib (I created and used the release version).
 
37
 
 
38
 
 
39
USING zzlib WITH SDL
 
40
 
 
41
  Include/add the following files to your SDL-Project
 
42
  (put them in proper directories, etc.):
 
43
 
 
44
  Header files:
 
45
    zconf.h
 
46
    zlib.h
 
47
    zzip.h
 
48
    zzip-conf.h
 
49
    zzip-io.h
 
50
    zziplib.h
 
51
    zzip-msvc.h
 
52
    zzip-stdint.h
 
53
 
 
54
  Libraries:
 
55
    zlib.lib
 
56
    zziplib.lib
 
57
 
 
58
  DLLs:
 
59
    zlib.dll
 
60
    zziplib.dll
 
61
 
 
62
  you may also want to use 
 
63
    SDL_rwops_zzip.c
 
64
    SDL_rwops_zzip.h
 
65
 
 
66
 
 
67
  For compiling it should be sufficient to use
 
68
    #include <zziplib.h> 
 
69
  in the files where you use zziplib-functions.
 
70
 
 
71
 
 
72
NOTE
 
73
 
 
74
  It is possible to use both original (unzipped) and zipped versions of files,
 
75
  and zziplib will take one of them (depending on the modes when calling 
 
76
  zziplib).
 
77
 
 
78
  But this didnt work for all of my original files, so I suggest using zipped
 
79
  files only (and remove the original unzipped files, so zziplib doesnt try to
 
80
  open the original version).
 
81
 
 
82
 
 
83
HINT
 
84
 
 
85
  When opening many files from a zip, its faster to open the zip-directory
 
86
  only once, and not for every file access. You may want to modify 
 
87
  SDL_rwops_zzip for this to get code like:
 
88
 
 
89
 
 
90
    SDL_Surface* image;
 
91
    SDL_RWops*   rw;
 
92
    SDL_Surface* temp1 = NULL;  //default > NULL > error
 
93
    SDL_Surface* temp2 = NULL;  //default > NULL > error
 
94
 
 
95
      //last param may be used for err return
 
96
    ZZIP_DIR* zzipdir = zzip_dir_open( "figures.zip", NULL ); 
 
97
 
 
98
    ZZIP_FILE* zfile = zzip_file_open(zzipdir, "f1.bmp", ZZIP_CASELESS);
 
99
 
 
100
    if (zfile)
 
101
    {
 
102
        rw = SDL_RWFromZZIP(zfile);  //modified version
 
103
        if (rw)
 
104
        {
 
105
            temp1 = IMG_Load_RW(rw, 0);
 
106
            SDL_FreeRW(rw);
 
107
        }
 
108
        int zret = zzip_file_close( zfile );
 
109
    }
 
110
 
 
111
    zfile = zzip_file_open(zzipdir, "f2.bmp", ZZIP_CASELESS);
 
112
    if (zfile)
 
113
    {
 
114
        rw = SDL_RWFromZZIP(zfile);  //modified version
 
115
        if (rw)
 
116
        {
 
117
            temp2 = IMG_Load_RW(rw, 0);
 
118
            SDL_FreeRW(rw);
 
119
        }
 
120
        int zret = zzip_file_close( zfile );
 
121
    }
 
122
 
 
123
    //.. etc
 
124
 
 
125
    zzip_dir_close( zzipdir );