1 /* Raw bitmap sprite loader written by Mohammed Khoory
2 - reads three files: header file, palette file, and raw bitmap files
3 - can convert data from those files to sprites and set the DOS palette , etc.
5 based a LOT on bmpload's structure lol
25 ifstream rawBitmapFile;
29 unsigned long int width;
30 unsigned long int height;
31 unsigned long int size;
39 // opens all bitmap and palette and reads the header (filenames are passed in without extension)
40 void loadFile(const string& filename) throw(int, ios_base::failure);
43 // get methods (allocates memory!)
44 // returns the entire bitmap as a char array
45 unsigned char * getBitmap() throw(int, bad_alloc, ios_base::failure);
46 // creates a sprite from the file and returns it
47 struct sprite * getSprite(int x1 = -1, int y1 = -1, int x2 = -1, int y2 = -1)
48 throw (int, bad_alloc, ios_base::failure);
51 void setPalette(GraphicsDevice& graphics) throw (int, bad_alloc, ios_base::failure);
53 unsigned long int getWidth() throw(int);
54 unsigned long int getHeight() throw(int);
55 unsigned long int getSize() throw(int);
59 static const int FileNotLoadedException = 1; // when trying to run a function but the file isn't loaded
60 static const int BadFileNameException = 2; // when the filename isn't valid
61 static const int BadFileException = 3; // when the file makes no sense (EOF)
62 static const int CannotReadException = 4; // When it encounters an unsupported file (no palette, etc.)