00001
00002
00003 #ifndef __UTIL_H_
00004 #define __UTIL_H_
00005
00006 #include <SDL.h>
00007 #include <string>
00008
00009 using namespace std;
00010
00011 #include "infomenu.h"
00012
00013 #ifdef __GCC__
00014 template <class T> T MIN(T a, T b) {return a<?b;};
00015 template <class T> T MAX(T a, T b) {return a>?b;};
00016 #else
00017 template <class T> T MIN(T a, T b) {return a<b ? a : b;};
00018 template <class T> T MAX(T a, T b) {return a>b ? a : b;};
00019 #endif
00020
00021 #ifdef _MSC_VER // if the compiler is from Microsoft
00022 #define DIR_SEPARATOR "\\"
00023 #else
00024 #define DIR_SEPARATOR "/"
00025 #endif
00026
00027
00028
00029
00030
00031
00032
00033
00037 Uint32 getPixel(SDL_Surface* surface, int x, int y);
00038 void putPixel(SDL_Surface* surface, int x, int y, Uint32 color);
00039
00040
00041
00042
00043
00044 SDL_Surface* fillSurface(SDL_Surface* origin, SDL_Rect src,
00045 Uint32 mask, Uint32 color);
00046
00047 int charToInt(char c);
00048 char intToChar(int i);
00049 void perierror(string c);
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 char keysym2char(SDL_keysym keysym);
00061
00062
00063 SDL_Surface* loadImage(string const & name, bool transparent=false);
00064
00065
00066 void waitForKey();
00067
00068 class Graphics;
00069
00070
00071 void infoMessage(string const& msg, Graphics& graphics);
00072
00073 #endif