From f7c8398239c25ca1267da22ca007a07a395bef77 Mon Sep 17 00:00:00 2001 From: James Turk Date: Wed, 24 Sep 2003 01:49:52 +0000 Subject: [PATCH] ZLib based LoadFromZip --- include/ZE_Includes.h | 8 +++----- include/ZE_Utility.h | 6 ++---- include/ZE_ZEngine.h | 46 +------------------------------------------ include/ZE_ZFont.h | 14 ++++++++++++- include/ZE_ZImage.h | 21 ++++++++++++++------ include/ZE_ZSound.h | 11 ++++++++++- include/ZEngine.h | 4 ++-- 7 files changed, 46 insertions(+), 64 deletions(-) diff --git a/include/ZE_Includes.h b/include/ZE_Includes.h index 91b6295..e2da987 100644 --- a/include/ZE_Includes.h +++ b/include/ZE_Includes.h @@ -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 files should be included from within this file. - $Id: ZE_Includes.h,v 1.17 2003/08/08 04:05:22 cozman Exp $
+ $Id: ZE_Includes.h,v 1.18 2003/09/24 01:49:52 cozman Exp $
\author James Turk **/ @@ -37,10 +37,8 @@ #ifdef USE_SDL_MIXER #include "SDL_mixer.h" #endif -#ifdef USE_PHYSFS -#include "physfs.h" -#include "external/physfsrwops.h" -#endif + +#include "../zlib/unzip.h" #include //used frequently #include //used by ZEngine for ZErrors diff --git a/include/ZE_Utility.h b/include/ZE_Utility.h index a0d0c1b..6997d24 100755 --- a/include/ZE_Utility.h +++ b/include/ZE_Utility.h @@ -14,7 +14,7 @@ Definition file for ZEngine Utilities which are used throughout the engine and can be used in conjunction with ZEngine. -
$Id: ZE_Utility.h,v 1.5 2003/06/11 00:15:25 cozman Exp $
+
$Id: ZE_Utility.h,v 1.6 2003/09/24 01:49:52 cozman Exp $
\author James Turk **/ @@ -38,9 +38,7 @@ namespace ZE **/ std::string FormatStr(const char *fmtstr, ...); -////////// -//Memory// -////////// +SDL_RWops* RWFromZip(std::string zipname, std::string filename); /*! \brief Properly free SDL_Surface. diff --git a/include/ZE_ZEngine.h b/include/ZE_ZEngine.h index 8aa1c7f..fdb18c2 100644 --- a/include/ZE_ZEngine.h +++ b/include/ZE_ZEngine.h @@ -13,7 +13,7 @@ \brief Definition file for core ZEngine class. ZEngine Game Engine core Engine definition. -
$Id: ZE_ZEngine.h,v 1.49 2003/09/21 03:28:53 cozman Exp $
+
$Id: ZE_ZEngine.h,v 1.50 2003/09/24 01:49:52 cozman Exp $
\author James Turk **/ @@ -174,16 +174,6 @@ class ZEngine void SetupSound(int rate, bool stereo); #endif -#ifdef USE_SDL_IMAGE - /*! - \brief Init Sound for ZEngine. - - Initialize sound for ZEngine. - **/ - bool InitSound(); -#endif - - /*! \brief Create Display with predefined settings. @@ -503,28 +493,6 @@ class ZEngine **/ 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// ///////////////// @@ -666,18 +634,6 @@ class ZEngine **/ 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 /*! \brief Load a Sound diff --git a/include/ZE_ZFont.h b/include/ZE_ZFont.h index 77c6c20..8806507 100644 --- a/include/ZE_ZFont.h +++ b/include/ZE_ZFont.h @@ -42,6 +42,8 @@ class ZFont TTF_Font *rFont; //! Filename, for resizing. std::string rFilename; + //! Zip filename, for resizing when file was from archive. + std::string rZipname; //! SDL_Color for current text color. SDL_Color rColor; //! SDL_Color for background color to be used in shaded draws. @@ -85,10 +87,20 @@ class ZFont **/ 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. - Release memory held by font. + Release memory held by font. (Called by destructor). **/ void Release(); diff --git a/include/ZE_ZImage.h b/include/ZE_ZImage.h index f6c21fa..67b2251 100644 --- a/include/ZE_ZImage.h +++ b/include/ZE_ZImage.h @@ -12,8 +12,8 @@ \file ZE_ZImage.h \brief Definition file for ZImage. - Definition file for ZImage, the OpenGL version of the ZImage class for ZEngine. -
$Id: ZE_ZImage.h,v 1.26 2003/09/07 20:59:20 cozman Exp $
+ Definition file for ZImage, the ZImage class for ZEngine. +
$Id: ZE_ZImage.h,v 1.27 2003/09/24 01:49:52 cozman Exp $
\author James Turk **/ @@ -29,7 +29,7 @@ namespace ZE /*! \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 { @@ -130,11 +130,20 @@ class ZImage /*! \brief Opens a file. - Open a file using ZEngine. Loads into rImage member of class. - \param filename File to open as rImage. + Open an image file using ZEngine. + \param filename File to open as new image. **/ 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. @@ -179,7 +188,7 @@ class ZImage /*! \brief Releases image. - Frees memory via call to SDL_FreeSurface for the image. + Frees memory for the image. (Called by destructor). **/ void Release(); diff --git a/include/ZE_ZSound.h b/include/ZE_ZSound.h index ede1b51..3b994be 100644 --- a/include/ZE_ZSound.h +++ b/include/ZE_ZSound.h @@ -13,7 +13,7 @@ \brief Definition file for ZSound. Definition file for ZSound, the Sound Effect wrapper for ZEngine. -
$Id: ZE_ZSound.h,v 1.9 2003/06/11 00:15:26 cozman Exp $
+
$Id: ZE_ZSound.h,v 1.10 2003/09/24 01:49:52 cozman Exp $
\author James Turk **/ @@ -80,6 +80,15 @@ class ZSound **/ 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. diff --git a/include/ZEngine.h b/include/ZEngine.h index 84063ea..1726e9b 100644 --- a/include/ZEngine.h +++ b/include/ZEngine.h @@ -4,7 +4,7 @@ Header file for ZEngine Game Engine from Concept of Zero, this is the file that programs that wish to utilize ZEngine should include. -
$Id: ZEngine.h,v 1.31 2003/08/07 07:16:11 cozman Exp $
+
$Id: ZEngine.h,v 1.32 2003/09/24 01:49:52 cozman Exp $
\author James Turk **/ @@ -19,7 +19,7 @@
    -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, - SDL_mixer, and PhysFS all of which are cross platform as well as Open Source.)
+ and SDL_mixer all of which are cross platform as well as Open Source.)
    -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.
    -ZEngine now uses OpenGL rather than SDL to do 2D drawing, thus increasing the uses of the engine