Mercurial > fife-parpg
comparison ext/guichan-0.8.1/include/guichan/sdl/sdlgraphics.hpp @ 0:4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
author | mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 29 Jun 2008 18:44:17 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4a0efb7baf70 |
---|---|
1 /* _______ __ __ __ ______ __ __ _______ __ __ | |
2 * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ | |
3 * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / | |
4 * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / | |
5 * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / | |
6 * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / | |
7 * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ | |
8 * | |
9 * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson | |
10 * | |
11 * | |
12 * Per Larsson a.k.a finalman | |
13 * Olof Naessén a.k.a jansem/yakslem | |
14 * | |
15 * Visit: http://guichan.sourceforge.net | |
16 * | |
17 * License: (BSD) | |
18 * Redistribution and use in source and binary forms, with or without | |
19 * modification, are permitted provided that the following conditions | |
20 * are met: | |
21 * 1. Redistributions of source code must retain the above copyright | |
22 * notice, this list of conditions and the following disclaimer. | |
23 * 2. Redistributions in binary form must reproduce the above copyright | |
24 * notice, this list of conditions and the following disclaimer in | |
25 * the documentation and/or other materials provided with the | |
26 * distribution. | |
27 * 3. Neither the name of Guichan nor the names of its contributors may | |
28 * be used to endorse or promote products derived from this software | |
29 * without specific prior written permission. | |
30 * | |
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
35 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
36 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | |
37 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
38 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
39 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
42 */ | |
43 | |
44 #ifndef GCN_SDLGRAPHICS_HPP | |
45 #define GCN_SDLGRAPHICS_HPP | |
46 | |
47 #include "SDL.h" | |
48 | |
49 #include "guichan/color.hpp" | |
50 #include "guichan/graphics.hpp" | |
51 #include "guichan/platform.hpp" | |
52 | |
53 namespace gcn | |
54 { | |
55 class Image; | |
56 class Rectangle; | |
57 | |
58 /** | |
59 * SDL implementation of the Graphics. | |
60 */ | |
61 class GCN_EXTENSION_DECLSPEC SDLGraphics : public Graphics | |
62 { | |
63 public: | |
64 | |
65 // Needed so that drawImage(gcn::Image *, int, int) is visible. | |
66 using Graphics::drawImage; | |
67 | |
68 /** | |
69 * Constructor. | |
70 */ | |
71 SDLGraphics(); | |
72 | |
73 /** | |
74 * Sets the target SDL_Surface to draw to. The target can be any | |
75 * SDL_Surface. This funtion also pushes a clip areas corresponding to | |
76 * the dimension of the target. | |
77 * | |
78 * @param target the target to draw to. | |
79 */ | |
80 virtual void setTarget(SDL_Surface* target); | |
81 | |
82 /** | |
83 * Gets the target SDL_Surface. | |
84 * | |
85 * @return the target SDL_Surface. | |
86 */ | |
87 virtual SDL_Surface* getTarget() const; | |
88 | |
89 /** | |
90 * Draws an SDL_Surface on the target surface. Normaly you'll | |
91 * use drawImage, but if you want to write SDL specific code | |
92 * this function might come in handy. | |
93 * | |
94 * NOTE: The clip areas will be taken into account. | |
95 */ | |
96 virtual void drawSDLSurface(SDL_Surface* surface, | |
97 SDL_Rect source, | |
98 SDL_Rect destination); | |
99 | |
100 | |
101 // Inherited from Graphics | |
102 | |
103 virtual void _beginDraw(); | |
104 | |
105 virtual void _endDraw(); | |
106 | |
107 virtual bool pushClipArea(Rectangle area); | |
108 | |
109 virtual void popClipArea(); | |
110 | |
111 virtual void drawImage(const Image* image, | |
112 int srcX, | |
113 int srcY, | |
114 int dstX, | |
115 int dstY, | |
116 int width, | |
117 int height); | |
118 | |
119 virtual void drawPoint(int x, int y); | |
120 | |
121 virtual void drawLine(int x1, int y1, int x2, int y2); | |
122 | |
123 virtual void drawRectangle(const Rectangle& rectangle); | |
124 | |
125 virtual void fillRectangle(const Rectangle& rectangle); | |
126 | |
127 virtual void setColor(const Color& color); | |
128 | |
129 virtual const Color& getColor() const; | |
130 | |
131 protected: | |
132 /** | |
133 * Draws a horizontal line. | |
134 * | |
135 * @param x1 the start coordinate of the line. | |
136 * @param y the y coordinate of the line. | |
137 * @param x2 the end coordinate of the line. | |
138 */ | |
139 virtual void drawHLine(int x1, int y, int x2); | |
140 | |
141 /** | |
142 * Draws a vertical line. | |
143 * | |
144 * @param x the x coordinate of the line. | |
145 * @param y1 the start coordinate of the line. | |
146 * @param y2 the end coordinate of the line. | |
147 */ | |
148 virtual void drawVLine(int x, int y1, int y2); | |
149 | |
150 SDL_Surface* mTarget; | |
151 Color mColor; | |
152 bool mAlpha; | |
153 }; | |
154 } | |
155 | |
156 #endif // end GCN_SDLGRAPHICS_HPP |