ZLib based LoadFromZip

This commit is contained in:
James Turk 2003-09-24 01:49:52 +00:00
parent f03de195d0
commit f7c8398239
7 changed files with 46 additions and 64 deletions

View File

@ -14,7 +14,7 @@
ZE_*.h files should only include this file and any other ZE_*.h files that they need, External Library or C/C++ Standard Library ZE_*.h files should only include this file and any other ZE_*.h files that they need, External Library or C/C++ Standard Library
files should be included from within this file. files should be included from within this file.
$Id: ZE_Includes.h,v 1.17 2003/08/08 04:05:22 cozman Exp $<br> $Id: ZE_Includes.h,v 1.18 2003/09/24 01:49:52 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -37,10 +37,8 @@
#ifdef USE_SDL_MIXER #ifdef USE_SDL_MIXER
#include "SDL_mixer.h" #include "SDL_mixer.h"
#endif #endif
#ifdef USE_PHYSFS
#include "physfs.h" #include "../zlib/unzip.h"
#include "external/physfsrwops.h"
#endif
#include <string> //used frequently #include <string> //used frequently
#include <queue> //used by ZEngine for ZErrors #include <queue> //used by ZEngine for ZErrors

View File

@ -14,7 +14,7 @@
Definition file for ZEngine Utilities which are used throughout the engine and can be used in Definition file for ZEngine Utilities which are used throughout the engine and can be used in
conjunction with ZEngine. conjunction with ZEngine.
<br>$Id: ZE_Utility.h,v 1.5 2003/06/11 00:15:25 cozman Exp $<br> <br>$Id: ZE_Utility.h,v 1.6 2003/09/24 01:49:52 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -38,9 +38,7 @@ namespace ZE
**/ **/
std::string FormatStr(const char *fmtstr, ...); std::string FormatStr(const char *fmtstr, ...);
////////// SDL_RWops* RWFromZip(std::string zipname, std::string filename);
//Memory//
//////////
/*! /*!
\brief Properly free SDL_Surface. \brief Properly free SDL_Surface.

View File

@ -13,7 +13,7 @@
\brief Definition file for core ZEngine class. \brief Definition file for core ZEngine class.
ZEngine Game Engine core Engine definition. ZEngine Game Engine core Engine definition.
<br>$Id: ZE_ZEngine.h,v 1.49 2003/09/21 03:28:53 cozman Exp $<br> <br>$Id: ZE_ZEngine.h,v 1.50 2003/09/24 01:49:52 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -174,16 +174,6 @@ class ZEngine
void SetupSound(int rate, bool stereo); void SetupSound(int rate, bool stereo);
#endif #endif
#ifdef USE_SDL_IMAGE
/*!
\brief Init Sound for ZEngine.
Initialize sound for ZEngine.
**/
bool InitSound();
#endif
/*! /*!
\brief Create Display with predefined settings. \brief Create Display with predefined settings.
@ -503,28 +493,6 @@ class ZEngine
**/ **/
void SetEventFilter(SDL_EventFilter filter); void SetEventFilter(SDL_EventFilter filter);
#ifdef USE_PHYSFS
////////////////////
//Physfs Utilities//
////////////////////
/*!
\brief Initialize PhysicsFS
Sets up PhysicsFS, must be called when application is started.
\param argv argv[0] from application's main.
**/
void InitPhysFS(std::string argv);
/*!
\brief Add Directory to PhysFS Search Path.
Add Directory to PhysicsFS search path, the path it looks in for files when attempting to load.
\param dir Directory to add to search path.
**/
void AddPhysFSDir(std::string dir);
#endif //USE_PHYSFS
///////////////// /////////////////
//Error Logging// //Error Logging//
///////////////// /////////////////
@ -666,18 +634,6 @@ class ZEngine
**/ **/
double RandDouble(); double RandDouble();
////////////////////////////
//Data Loading + Unloading//
////////////////////////////
/*!
\brief Load an Image.
Loads an Image to an ImageData class which keeps vital information on the Image.
\param filename path to file to load.
\return A SDL_Surface pointer to data.
**/
SDL_Surface* LoadImage(std::string filename);
#ifdef USE_SDL_MIXER #ifdef USE_SDL_MIXER
/*! /*!
\brief Load a Sound \brief Load a Sound

View File

@ -42,6 +42,8 @@ class ZFont
TTF_Font *rFont; TTF_Font *rFont;
//! Filename, for resizing. //! Filename, for resizing.
std::string rFilename; std::string rFilename;
//! Zip filename, for resizing when file was from archive.
std::string rZipname;
//! SDL_Color for current text color. //! SDL_Color for current text color.
SDL_Color rColor; SDL_Color rColor;
//! SDL_Color for background color to be used in shaded draws. //! SDL_Color for background color to be used in shaded draws.
@ -85,10 +87,20 @@ class ZFont
**/ **/
void Open(std::string filename, int size); void Open(std::string filename, int size);
/*!
\brief Opens a font from within a zip archive.
Open a font from within a zip archive using zlib and SDL_RWops.
\param zipname Zip file to open image from.
\param filename File to open as new image.
\param size Size to use for font.
**/
void OpenFromZip(std::string zipname, std::string filename, int size);
/*! /*!
\brief Release font. \brief Release font.
Release memory held by font. Release memory held by font. (Called by destructor).
**/ **/
void Release(); void Release();

View File

@ -12,8 +12,8 @@
\file ZE_ZImage.h \file ZE_ZImage.h
\brief Definition file for ZImage. \brief Definition file for ZImage.
Definition file for ZImage, the OpenGL version of the ZImage class for ZEngine. Definition file for ZImage, the ZImage class for ZEngine.
<br>$Id: ZE_ZImage.h,v 1.26 2003/09/07 20:59:20 cozman Exp $<br> <br>$Id: ZE_ZImage.h,v 1.27 2003/09/24 01:49:52 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -29,7 +29,7 @@ namespace ZE
/*! /*!
\brief ZImage class for basic Image use. \brief ZImage class for basic Image use.
ZImage image drawing class, class wraps common features of SDL_Surface. Inherited from ZObject. ZImage image drawing class, class wraps 2d textures under OpenGL or SDL_Surface under SDL.
**/ **/
class ZImage class ZImage
{ {
@ -130,11 +130,20 @@ class ZImage
/*! /*!
\brief Opens a file. \brief Opens a file.
Open a file using ZEngine. Loads into rImage member of class. Open an image file using ZEngine.
\param filename File to open as rImage. \param filename File to open as new image.
**/ **/
void Open(std::string filename); void Open(std::string filename);
/*!
\brief Opens an image file from within a zip archive.
Open an image file from within a zip archive using zlib and SDL_RWops.
\param zipname Zip file to open image from.
\param filename File to open as new image.
**/
void OpenFromZip(std::string zipname, std::string filename);
/*! /*!
\brief Cuts part of an existing image to create a new image. \brief Cuts part of an existing image to create a new image.
@ -179,7 +188,7 @@ class ZImage
/*! /*!
\brief Releases image. \brief Releases image.
Frees memory via call to SDL_FreeSurface for the image. Frees memory for the image. (Called by destructor).
**/ **/
void Release(); void Release();

View File

@ -13,7 +13,7 @@
\brief Definition file for ZSound. \brief Definition file for ZSound.
Definition file for ZSound, the Sound Effect wrapper for ZEngine. Definition file for ZSound, the Sound Effect wrapper for ZEngine.
<br>$Id: ZE_ZSound.h,v 1.9 2003/06/11 00:15:26 cozman Exp $<br> <br>$Id: ZE_ZSound.h,v 1.10 2003/09/24 01:49:52 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -80,6 +80,15 @@ class ZSound
**/ **/
void Open(std::string filename); void Open(std::string filename);
/*!
\brief Opens a sound effect file from within a zip archive.
Open a sound effect file from within a zip archive using zlib and SDL_RWops.
\param zipname Zip file to open sound effect from.
\param filename File to open as new sound effect.
**/
void OpenFromZip(std::string zipname, std::string filename);
/*! /*!
\brief Release sound effect. \brief Release sound effect.

View File

@ -4,7 +4,7 @@
Header file for ZEngine Game Engine from Concept of Zero, this is the file that programs that wish to Header file for ZEngine Game Engine from Concept of Zero, this is the file that programs that wish to
utilize ZEngine should include. utilize ZEngine should include.
<br>$Id: ZEngine.h,v 1.31 2003/08/07 07:16:11 cozman Exp $<br> <br>$Id: ZEngine.h,v 1.32 2003/09/24 01:49:52 cozman Exp $<br>
\author James Turk \author James Turk
**/ **/
@ -19,7 +19,7 @@
<br> <br>
&nbsp;&nbsp;&nbsp;&nbsp;-ZEngine is designed to provide a powerful yet easy to use 2D game engine in a well designed &nbsp;&nbsp;&nbsp;&nbsp;-ZEngine is designed to provide a powerful yet easy to use 2D game engine in a well designed
Object Oriented manner, and uses cross platform libraries such as SDL and OpenGL. (ZEngine can use SDL_ttf,SDL_image, Object Oriented manner, and uses cross platform libraries such as SDL and OpenGL. (ZEngine can use SDL_ttf,SDL_image,
SDL_mixer, and PhysFS all of which are cross platform as well as Open Source.)<br> and SDL_mixer all of which are cross platform as well as Open Source.)<br>
&nbsp;&nbsp;&nbsp;&nbsp;-It is licensed under a BSD-style license, and anyone is free to suggest or implement changes &nbsp;&nbsp;&nbsp;&nbsp;-It is licensed under a BSD-style license, and anyone is free to suggest or implement changes
to be added to the Engine, as well as modify the engine to their own needs or use it however they like.<br> to be added to the Engine, as well as modify the engine to their own needs or use it however they like.<br>
&nbsp;&nbsp;&nbsp;&nbsp;-ZEngine now uses OpenGL rather than SDL to do 2D drawing, thus increasing the uses of the engine &nbsp;&nbsp;&nbsp;&nbsp;-ZEngine now uses OpenGL rather than SDL to do 2D drawing, thus increasing the uses of the engine