Main Page   Class Hierarchy   Compound List   File List   Compound Members  

vault.h

00001 /*--License:
00002         Kyra Sprite Engine
00003         Copyright Lee Thomason (Grinning Lizard Software) 2001-2002
00004         www.grinninglizard.com/kyra
00005         www.sourceforge.net/projects/kyra
00006 
00007         Kyra is provided under 2 licenses:
00008 
00009         - The GPL, with no additional restrictions.
00010         - The LGPL, provided you display the Kyra splash screen, described below.
00011 
00012 
00013 --- GPL License --
00014         This program is free software; you can redistribute it and/or
00015         modify it under the terms of the GNU General Public License
00016         as published by the Free Software Foundation; either version 2
00017         of the License, or (at your option) any later version.
00018 
00019         This program is distributed in the hope that it will be useful,
00020         but WITHOUT ANY WARRANTY; without even the implied warranty of
00021         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022         GNU General Public License for more details.
00023 
00024         You should have received a copy of the GNU General Public License
00025         along with this program; if not, write to the Free Software
00026         Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 
00028         The full text of the license can be found in license.txt
00029 
00030 
00031 --- LGPL License --
00032   **Provided you kindly display the Kyra splash screen (details below), 
00033         you     may use the LGPL license:**
00034 
00035     This library is free software; you can redistribute it and/or
00036     modify it under the terms of the GNU Lesser General Public
00037     License as published by the Free Software Foundation; either
00038     version 2.1 of the License, or (at your option) any later version.
00039 
00040     This library is distributed in the hope that it will be useful,
00041     but WITHOUT ANY WARRANTY; without even the implied warranty of
00042     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00043     Lesser General Public License for more details.
00044 
00045     You should have received a copy of the GNU Lesser General Public
00046     License along with this library; if not, write to the Free Software
00047     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00048 
00049         The full text of the license can be found in lgpl.txt
00050 
00051 
00052 --- Kyra Splash Screen.
00053 
00054         It would be appreciate if you display the Kyra splash screen when using
00055         either license, however it is only required for the LGPL. All the
00056         resources for the splash are compiled into the library, and it can be
00057         accessed through the following API:
00058 
00059                 KrEngine::StartSplash
00060                 KrEngine::UpdateSplash
00061                 KrEngine::EndSplash
00062 
00063         Full documentation is provided with the KrEngine class. The splash screen
00064         should be displayed for 2 seconds.
00065 
00066         Thank you.
00067 */
00068 
00069 
00070 #ifndef IO_COMPRESSOR_INCLUDED
00071 #define IO_COMPRESSOR_INCLUDED
00072 
00073 #define RLE_WRITE
00074 
00075 #include "SDL.h"
00076 #include "SDL_rwops.h"
00077 
00078 #include "../util/glutil.h"
00079 #include "../util/gllist.h"
00080 #include "../util/gldynarray.h"
00081 #include "../util/glstring.h"
00082 
00083 #include "rle.h"
00084 #include "kyraresource.h"
00085 
00086 class KrResource;
00087 class KrSpriteResource;
00088 class KrTileResource;
00089 class KrFontResource;
00090 
00104 class KrResourceVault
00105 {
00106   public:
00107         KrResourceVault()                       { memoryPoolRGBA = 0; memoryPoolLine = 0; memoryPoolSegment = 0; }
00108         virtual ~KrResourceVault();
00109 
00113         bool LoadDatFile( const char* fileName );
00114 
00118         bool LoadDatFileFromMemory( void* memory, int size );
00119 
00121         int ResourceCount();
00126         GlSListIterator< KrResource* > GetResourceIterator();
00127 
00129         void AddResource( KrResource* resource );
00130 
00132         KrResource* GetResource( const std::string& type, const std::string& name );
00134         KrResource* GetResource( U32 type, const std::string& name );
00136         KrResource* GetResource( U32 type, U32 resourceId );
00137 
00139         KrSpriteResource*       GetSpriteResource( const std::string& name );
00141         KrSpriteResource*       GetSpriteResource( U32 resourceId );
00142 
00144         KrTileResource*         GetTileResource( const std::string& name );
00146         KrTileResource*         GetTileResource( U32 resourceId );
00147 
00149         KrFontResource*         GetFontResource( const std::string& name );
00151         KrFontResource*         GetFontResource( U32 resourceId );
00152 
00154         KrTextDataResource*             GetTextDataResource( const std::string& name );
00156         KrTextDataResource*             GetTextDataResource( U32 resourceId );
00157 
00159         KrBinaryDataResource*   GetBinaryDataResource( const std::string& name );
00161         KrBinaryDataResource*   GetBinaryDataResource( U32 resourceId );
00162 
00164         virtual void CacheScale( GlFixed xScale, GlFixed yScale );
00166         virtual void FreeScaleCache();
00167 
00168   private:
00169         bool LoadDatFile( SDL_RWops* stream );
00170 
00171         GlSList< KrResource* > resList;
00172 
00173         // The vault is the owner of these memory allocators:
00174         GlLinearMemoryPool*     memoryPoolRGBA;
00175         GlLinearMemoryPool*     memoryPoolLine;
00176         GlLinearMemoryPool*     memoryPoolSegment;
00177 };
00178         
00179         
00180 
00181 #endif

Generated on Mon Sep 15 12:01:11 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001