spriteloader.hpp

Go to the documentation of this file.
00001 /* $Id: spriteloader.hpp 18809 2010-01-15 16:41:15Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef SPRITELOADER_HPP
00013 #define SPRITELOADER_HPP
00014 
00015 #include "../core/alloc_type.hpp"
00016 #include "../gfx_type.h"
00017 
00018 class SpriteLoader {
00019 public:
00020   struct CommonPixel {
00021     uint8 r;  
00022     uint8 g;  
00023     uint8 b;  
00024     uint8 a;  
00025     uint8 m;  
00026   };
00027 
00034   struct Sprite {
00035     uint16 height;                   
00036     uint16 width;                    
00037     int16 x_offs;                    
00038     int16 y_offs;                    
00039     SpriteLoader::CommonPixel *data; 
00040 
00045     void AllocateData(size_t size) { this->data = Sprite::buffer.ZeroAllocate(size); }
00046   private:
00048     static ReusableBuffer<SpriteLoader::CommonPixel> buffer;
00049   };
00050 
00054   virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type) = 0;
00055 
00056   virtual ~SpriteLoader() { }
00057 };
00058 
00059 #endif /* SPRITELOADER_HPP */

Generated on Wed Mar 31 22:43:28 2010 for OpenTTD by  doxygen 1.6.1