| 1 | // $Id: dfont.h,v 1.3 2003/04/14 05:51:03 mbridak Exp $ |
| 2 | #ifndef DFONT_H |
| 3 | #define DFONT_H |
| 4 | |
| 5 | #include <SDL/SDL.h> |
| 6 | #include <SDL/SDL_image.h> |
| 7 | |
| 8 | #include <iostream> |
| 9 | using std::ios; |
| 10 | |
| 11 | #include <fstream> |
| 12 | using std::istream; |
| 13 | using std::ostream; |
| 14 | using std::ofstream; |
| 15 | using std::ifstream; |
| 16 | using std::cerr; |
| 17 | using std::cin; |
| 18 | using std::cout; |
| 19 | |
| 20 | #include <map> |
| 21 | |
| 22 | |
| 23 | |
| 24 | class DFont |
| 25 | { |
| 26 | protected: |
| 27 | std::map <char, SDL_Rect> fonts; |
| 28 | SDL_Surface *fontSurface; |
| 29 | int gap; |
| 30 | |
| 31 | private: |
| 32 | void initMap (char *); |
| 33 | void loadMap (char *); |
| 34 | void loadImage (char *); |
| 35 | Uint32 GetPixel (SDL_Surface *, Sint32, Sint32); |
| 36 | |
| 37 | public: |
| 38 | DFont (char *, char * ); |
| 39 | ~DFont (); |
| 40 | void PutString(SDL_Surface *, Sint16 , Sint16 , char * ); |
| 41 | void PutChar(SDL_Surface *, Sint16, Sint16, char); |
| 42 | }; |
| 43 | |
| 44 | ostream& operator << (ostream & , SDL_Rect const &);//output a record |
| 45 | istream& operator >> (istream & , SDL_Rect &);//input a record |
| 46 | #endif |