Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

spriteloader.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           spriteloader.h  -  description
00003                              -------------------
00004     begin                : Thu Apr 10 2003
00005     copyright            : (C) 2003 by Tyler Montbriand
00006     email                : tsm@accesscomm.ca
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef SPRITELOADER_H
00019 #define SPRITELOADER_H
00020 
00021 #include <malloc.h>
00022 #include "RotateImage.h"
00023 #include "sprite.h"
00024 
00025 #include <SDL/begin_code.h>
00026 
00033 
00038 #if defined(WIN32) || (_WIN32_WCE)
00039 
00040 #define SLASH "\\"
00041 #else
00042 
00043 #define SLASH "/"
00044 #endif
00045 
00047 extern "C" DECLSPEC char * SDLCALL SprMakePath(const char *filename, const char *path, char *buf);
00048 
00114 class DECLSPEC SpriteLoader
00115 {
00116 public:
00117   SpriteLoader();
00119   SpriteLoader(const char *fname, const char *path="");
00121   bool Load(const char *fname, const char *path="");
00122 
00124   bool Good(); 
00125   
00127   Sprite *GetSprite(Sprite *sprite=NULL);
00128 
00130   inline int YFrames()              const { return(yframes);  }
00132   inline int XFrames()              const { return(xframes);  }
00134   inline Uint8 R()                  const { return(r);        }
00136   inline Uint8 G()                  const { return(g);        }
00138   inline Uint8 B()                  const { return(b);        }
00140   inline bitmask **Bmask()          const { return(bmask);    }
00142   inline SDL_Surface *GetSurface()  const { return(image);    }
00144   inline ColType Layer()            const { return(colmask);  }
00146   inline ColType Index()            const { return(colindex); }
00148   inline int DrawLayer()            const { return(drawlayer);}
00149 
00151   ~SpriteLoader();
00152 
00153 protected:
00155   bool ProcessLine(const char *buf);
00157   void Reset();  
00158 
00160   bitmask    **bmask;
00162   SDL_Surface *image;
00164   int r,g,b;
00166   int drawlayer;
00168   Uint32 colindex;
00170   Uint32 colmask;
00172   bool good;
00174   bool loadbitmask;
00176   char imagename[300];
00178   int xframes,yframes;
00180   Sfxp framerate;
00181 };
00182 
00184 
00185 #include <SDL/close_code.h>
00186 
00187 #endif

Generated on Sat Oct 11 13:19:26 2003 for Spritelib by doxygen 1.3.4