00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef DRAWLIBS_H
00023 #define DRAWLIBS_H
00024
00025 #include "SDL.h"
00026
00027 #define sgn(x) ((x<0)?-1:((x>0)?1:0))
00028
00029
00030 DLLEXPORT SDL_Surface *CreateSurface(Uint32 flags, int width, int height,
00031 int bpp = 32);
00032 DLLEXPORT void ConvertSurface(SDL_Surface ** surface);
00033
00034 DLLEXPORT void DrawPixel(SDL_Surface * screen, int x, int y, Uint32 color);
00035 DLLEXPORT void DrawLine(SDL_Surface * screen, int x1, int y1, int x2, int y2,
00036 Uint32 color);
00037 DLLEXPORT void DrawRect(SDL_Surface * screen, int x1, int y1, int x2, int y2,
00038 Uint32 color);
00039 DLLEXPORT void DrawRound(SDL_Surface * screen, int x0, int y0, int w, int h,
00040 int corner, Uint32 color);
00041
00042 DLLEXPORT void vertgradient(SDL_Surface * surf, SDL_Color c1, SDL_Color c2,
00043 Uint8 alpha = 255);
00044 DLLEXPORT void vertgradient2(SDL_Surface * surf, SDL_Rect & gradRect,
00045 SDL_Color c1, SDL_Color c2, Uint8 alpha = 255);
00046 DLLEXPORT void horizgradient2(SDL_Surface * surf, SDL_Rect & gradRect,
00047 SDL_Color c1, SDL_Color c2, Uint8 alpha = 255);
00048
00049 DLLEXPORT Uint32 GetPixel(SDL_Surface * surface, int x, int y);
00050 DLLEXPORT void FloodFill(SDL_Surface * screen, int x, int y, Uint32 c);
00051 DLLEXPORT void DrawTriangle(SDL_Surface * s, int x[3], int y[3], Uint32 c);
00052
00053 enum
00054 {
00055 ARROW_UP,
00056 ARROW_DOWN,
00057 ARROW_LEFT,
00058 ARROW_RIGHT
00059 };
00060 DLLEXPORT void DrawArrow(SDL_Surface * s, int type, int x, int y, int a,
00061 Uint32 color, bool fill = false, Uint32 fillcolor = 0);
00062
00063 #define SLOCK(surface) \
00064 do { \
00065 if(SDL_MUSTLOCK(surface)) \
00066 SDL_LockSurface(surface); \
00067 } while(0)
00068
00069 #define SUNLOCK(surface) \
00070 do { \
00071 if(SDL_MUSTLOCK(surface)) \
00072 SDL_UnlockSurface(surface); \
00073 } while(0)
00074
00075 #endif