# spriteloader.hpp

Go to the documentation of this file.

    00001 /* $Id: spriteloader.hpp 15556 2009-02-23 17:54:02Z rubidium $ */
    00002
    00005 #ifndef SPRITELOADER_HPP
    00006 #define SPRITELOADER_HPP
    00007
    00008 #include "../core/alloc_type.hpp"
    00009
    00010 class SpriteLoader {
    00011 public:
    00012   struct CommonPixel {
    00013     uint8 r;
    00014     uint8 g;
    00015     uint8 b;
    00016     uint8 a;
    00017     uint8 m;
    00018   };
    00019
    00026   struct Sprite {
    00027     uint16 height;
    00028     uint16 width;
    00029     int16 x_offs;
    00030     int16 y_offs;
    00031     SpriteLoader::CommonPixel *data;
    00032
    00037     void AllocateData(size_t size) { this->data = Sprite::buffer.ZeroAllocate(size); }
    00038   private:
    00040     static ReusableBuffer<SpriteLoader::CommonPixel> buffer;
    00041   };
    00042
    00046   virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos, SpriteType sprite_type) = 0;
    00047
    00048   virtual ~SpriteLoader() { }
    00049 };
    00050
    00051 #endif /* SPRITELOADER_HPP */