00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef GCN_SDLGRAPHICS_HPP
00056 #define GCN_SDLGRAPHICS_HPP
00057
00058 #include <map>
00059 #include <string>
00060
00061 #include "SDL.h"
00062
00063 #include "guichan/graphics.h"
00064 #include "guichan/image.h"
00065 #include "guichan/platform.h"
00066 #include "guichan/rectangle.h"
00067
00068 namespace gcn
00069 {
00073 class GCN_EXTENSION_DECLSPEC SDLGraphics : public Graphics
00074 {
00075 public:
00076
00077
00078 using Graphics::drawImage;
00079
00083 SDLGraphics();
00084
00092 virtual void setTarget(SDL_Surface* target);
00093
00099 virtual SDL_Surface* getTarget() const;
00100
00108 virtual void drawSDLSurface(SDL_Surface* surface, SDL_Rect source,
00109 SDL_Rect destination);
00110
00111
00112
00113
00114 virtual void _beginDraw();
00115
00116 virtual void _endDraw();
00117
00118 virtual bool pushClipArea(Rectangle area);
00119
00120 virtual void popClipArea();
00121
00122 virtual void drawImage(const Image* image, int srcX, int srcY,
00123 int dstX, int dstY, int width,
00124 int height);
00125
00126 virtual void drawPoint(int x, int y);
00127
00128 virtual void drawLine(int x1, int y1, int x2, int y2);
00129
00130 virtual void drawRectangle(const Rectangle& rectangle);
00131
00132 virtual void fillRectangle(const Rectangle& rectangle);
00133
00134 virtual void setColor(const Color& color);
00135
00136 virtual const Color& getColor();
00137
00138 protected:
00146 virtual void drawHLine(int x1, int y, int x2);
00147
00155 virtual void drawVLine(int x, int y1, int y2);
00156
00157 SDL_Surface* mTarget;
00158 Color mColor;
00159 bool mAlpha;
00160 };
00161 }
00162
00163 #endif // end GCN_SDLGRAPHICS_HPP