Main Page | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

CSBitmap.h

Go to the documentation of this file.
00001 #ifndef CSBitmapLoader_h
00002 #define CSBitmapLoader_h
00003 
00004 #include "CSLoadable.h"
00005 
00006 // USES SDL_Surface
00007 // USES SDL_Rect 
00008 
00009 struct SDL_Surface;
00010 
00011 
00012 //! this class is little more than a wrapper - not really c++ like
00013 //! but ...
00014 class CSBitmap
00015 {
00016     public:
00017         SDL_Surface *picture;
00018         int r;
00019         int g;
00020         int b;
00021 };
00022 
00023 
00024 /**
00025     The Bitmap class is the innermost class for graphical entities,
00026     Here we use SDL images loaded thru the
00027         image = SDL_LoadBMP(bitmapFilename);
00028     function.
00029 
00030     The Class provides:
00031         \arg The use of a CSLoadable Interface
00032         \arg loads a "ini" - file beforehand and sets (if appropriate 
00033            (all RGB values >0)) a transparancy color
00034     
00035     But (as of now) now, values are NOT stored in any "data" section (like with 
00036     the other graphical entities).
00037     The Loader returns a (CSBitmap *).<BR>
00038 
00039     This class (or the loader... that is) holds the images as they are loaded,
00040     Upon switching between different resolutions, the surfaces are "recreated" using 
00041     the images that are hold within the loader class.
00042     Thus the used images are allways recreated from the original bitmap.
00043     Also this one holds the transparent-rgb values for (re-)setting the 
00044     color-key values.<BR>
00045     
00046     The Loader IS responsible for freeing the surface.(parent class!)
00047     (thru destroy)<BR>
00048     */
00049 class CSBitmapLoader : public Loadable<CSBitmap>
00050 {
00051     protected:
00052         virtual void destroy(CSBitmap *image);
00053         virtual CSBitmap *create(const std::string &filename);
00054 
00055     public:
00056         static CSBitmapLoader INSTANCE;
00057         static void scale(char *name, int width, int divideX, int height, int divideY);
00058 };
00059 
00060 class CSBitmapDirectLoader : public CSBitmapLoader
00061 {
00062     protected:
00063         virtual CSBitmap *create(const std::string &filename);
00064 
00065     public:
00066         static CSBitmapDirectLoader INSTANCE;
00067 };
00068 
00069 #endif //CSBitmapLoader_h

Generated on Wed Jul 14 00:43:29 2004 for CSLib by doxygen 1.3.6