Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

sprite2.h

Go to the documentation of this file.
00001 /*
00002         $Id: sprite2.h,v 1.1 2001/03/06 15:09:12 mbn Exp $
00003 
00004         ------------------------------------------------------------------------
00005         ClanLib, the platform independent game SDK.
00006 
00007         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00008         version 2. See COPYING for details.
00009 
00010         For a total list of contributers see CREDITS.
00011 
00012         ------------------------------------------------------------------------
00013 
00014         File purpose:
00015                 Sprite surface provider especially designed for the font class.
00016                 Most likely not very usable other places.
00017 
00018 */
00019 
00021 
00022 #ifndef header_sprite2
00023 #define header_sprite2
00024 
00025 #include "generic_surfaceprovider.h"
00026 #include "../../Core/IOData/inputsource.h"
00027 #include "../../Core/IOData/inputsource_provider.h"
00028 #include "../Display/pixelformat.h"
00029 
00030 class CL_Sprite2Provider : public CL_SurfaceProvider_Generic
00031 {
00032 protected:
00033         std::string surface_id;
00034         void *surface_data;
00035         int width, height, no_sprs, transcol;
00036         CL_Palette *palette;
00037         EPixelFormat pixelformat;
00038         unsigned int red_mask, green_mask, blue_mask, alpha_mask;
00039         unsigned int bpp;
00040         bool m_is_indexed;
00041 
00042         void load_data(CL_InputSource *datafile);
00043 
00044 public:
00045         CL_Sprite2Provider(CL_InputSource *source);
00046         CL_Sprite2Provider(
00047                 CL_SurfaceProvider *src,
00048                 int x, int y, int width, int height,
00049                 int *tcols, int tcols_num);
00050         virtual ~CL_Sprite2Provider();
00051 
00052         virtual unsigned int get_width() const;
00053         //: Returns the width of the sprite2.
00054 
00055         virtual unsigned int get_height() const;
00056         //: Returns the height of the sprite2.
00057 
00058         virtual unsigned int get_pitch() const;
00059         //: Returns the pitch of the sprite2.
00060         
00061         virtual unsigned int get_num_frames() const;
00062         //: Returns the number of subsprite2s in this sprite2.
00063         
00064 //      virtual EPixelFormat get_pixel_format() const;
00065         //: Returns the pixel format used by the sprite2.
00066 
00067         virtual CL_Palette *get_palette() const;
00068         //: Returns the palette used by the surface. NULL if the system palette is 
00069         //: used.
00070 
00071         virtual bool uses_src_colorkey() const;
00072         virtual unsigned int get_src_colorkey() const;
00073         //: Returns the transparency color used, or -1 if none.
00074 
00075         virtual bool is_indexed() const;
00076         virtual unsigned int get_red_mask() const;
00077         virtual unsigned int get_green_mask() const;
00078         virtual unsigned int get_blue_mask() const;
00079         virtual unsigned int get_alpha_mask() const;
00080         virtual unsigned int get_depth() const;
00081         
00082         virtual void *get_data() const;
00083         //: Returns a pointer to the sprite2s image data. Can only be called between 
00084         //: lock() and unlock().
00085 
00086         virtual void perform_lock();
00087         //: Locks the surface provider. This causes the sprite2 to retrieve its 
00088         //: surface data from the datafile.
00089         
00090         virtual void perform_unlock();
00091         //: Unlocks the surface provider. The sprite2 releases its surface data when
00092         //: it is called.
00093 };
00094 
00095 #endif

Generated at Wed Apr 4 19:54:03 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001