00001 /*--License: 00002 Kyra Sprite Engine 00003 Copyright Lee Thomason (Grinning Lizard Software) 2001-2005 00004 www.grinninglizard.com/kyra 00005 www.sourceforge.net/projects/kyra 00006 00007 Kyra is provided under the LGPL. 00008 00009 I kindly request you display a splash screen (provided in the HTML documentation) 00010 to promote Kyra and acknowledge the software and everyone who has contributed to it, 00011 but it is not required by the license. 00012 00013 --- LGPL License -- 00014 00015 This library is free software; you can redistribute it and/or 00016 modify it under the terms of the GNU Lesser General Public 00017 License as published by the Free Software Foundation; either 00018 version 2.1 of the License, or (at your option) any later version. 00019 00020 This library is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00023 Lesser General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public 00026 License along with this library; if not, write to the Free Software 00027 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00028 00029 The full text of the license can be found in lgpl.txt 00030 */ 00031 00032 00033 #ifndef IO_COMPRESSOR_INCLUDED 00034 #define IO_COMPRESSOR_INCLUDED 00035 00036 #define RLE_WRITE 00037 00038 #include "SDL.h" 00039 #include "SDL_rwops.h" 00040 00041 #include "../../grinliz/glutil.h" 00042 #include "../util/gllist.h" 00043 //#include "../util/glstring.h" 00044 00045 #include "rle.h" 00046 #include "kyraresource.h" 00047 00048 class KrResource; 00049 class KrSpriteResource; 00050 class KrTileResource; 00051 class KrFontResource; 00052 00066 class KrResourceVault 00067 { 00068 public: 00069 KrResourceVault() { memoryPoolRGBA = 0; memoryPoolLine = 0; memoryPoolSegment = 0; } 00070 virtual ~KrResourceVault(); 00071 00075 bool LoadDatFile( const char* fileName ); 00076 00080 bool LoadDatFileFromMemory( void* memory, int size ); 00081 00083 int ResourceCount(); 00088 GlSListIterator< KrResource* > GetResourceIterator(); 00089 00091 void AddResource( KrResource* resource ); 00092 00094 KrResource* GetResource( const std::string& type, const std::string& name ); 00096 KrResource* GetResource( U32 type, const std::string& name ); 00098 KrResource* GetResource( U32 type, U32 resourceId ); 00099 00101 KrSpriteResource* GetSpriteResource( const std::string& name ); 00103 KrSpriteResource* GetSpriteResource( U32 resourceId ); 00104 00106 KrTileResource* GetTileResource( const std::string& name ); 00108 KrTileResource* GetTileResource( U32 resourceId ); 00109 00111 KrFontResource* GetFontResource( const std::string& name ); 00113 KrFontResource* GetFontResource( U32 resourceId ); 00114 00116 KrTextDataResource* GetTextDataResource( const std::string& name ); 00118 KrTextDataResource* GetTextDataResource( U32 resourceId ); 00119 00121 KrBinaryDataResource* GetBinaryDataResource( const std::string& name ); 00123 KrBinaryDataResource* GetBinaryDataResource( U32 resourceId ); 00124 00126 virtual void CacheScale( GlFixed xScale, GlFixed yScale ); 00128 virtual void FreeScaleCache(); 00129 00130 private: 00131 bool LoadDatFile( SDL_RWops* stream ); 00132 00133 GlSList< KrResource* > resList; 00134 00135 // The vault is the owner of these memory allocators: 00136 grinliz::LinearMemoryPool* memoryPoolRGBA; 00137 grinliz::LinearMemoryPool* memoryPoolLine; 00138 grinliz::LinearMemoryPool* memoryPoolSegment; 00139 }; 00140 00141 00142 00143 #endif