00001 /* $Id$ */ 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 00017 class SpriteLoader { 00018 public: 00019 struct CommonPixel { 00020 uint8 r; 00021 uint8 g; 00022 uint8 b; 00023 uint8 a; 00024 uint8 m; 00025 }; 00026 00033 struct Sprite { 00034 uint16 height; 00035 uint16 width; 00036 int16 x_offs; 00037 int16 y_offs; 00038 SpriteLoader::CommonPixel *data; 00039 00044 void AllocateData(size_t size) { this->data = Sprite::buffer.ZeroAllocate(size); } 00045 private: 00047 static ReusableBuffer<SpriteLoader::CommonPixel> buffer; 00048 }; 00049 00053 virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type) = 0; 00054 00055 virtual ~SpriteLoader() { } 00056 }; 00057 00058 #endif /* SPRITELOADER_HPP */