135 if (y < 0 && y2 < 0) return; |
135 if (y < 0 && y2 < 0) return; |
136 if (x > dpi->width && x2 > dpi->width) return; |
136 if (x > dpi->width && x2 > dpi->width) return; |
137 if (y > dpi->height && y2 > dpi->height) return; |
137 if (y > dpi->height && y2 > dpi->height) return; |
138 |
138 |
139 blitter->DrawLine(dpi->dst_ptr, x, y, x2, y2, dpi->width, dpi->height, color); |
139 blitter->DrawLine(dpi->dst_ptr, x, y, x2, y2, dpi->width, dpi->height, color); |
|
140 } |
|
141 |
|
142 /** |
|
143 * Draws the projection of a parallelepiped. |
|
144 * This can be used to draw boxes in world coordinates. |
|
145 * |
|
146 * @param x Screen X-coordinate of top front corner. |
|
147 * @param y Screen Y-coordinate of top front corner. |
|
148 * @param dx1 Screen X-length of first edge. |
|
149 * @param dy1 Screen Y-length of first edge. |
|
150 * @param dx2 Screen X-length of second edge. |
|
151 * @param dy2 Screen Y-length of second edge. |
|
152 * @param dx3 Screen X-length of third edge. |
|
153 * @param dy3 Screen Y-length of third edge. |
|
154 */ |
|
155 void DrawBox(int x, int y, int dx1, int dy1, int dx2, int dy2, int dx3, int dy3) |
|
156 { |
|
157 /* .... |
|
158 * .. .... |
|
159 * .. .... |
|
160 * .. ^ |
|
161 * <--__(dx1,dy1) /(dx2,dy2) |
|
162 * : --__ / : |
|
163 * : --__ / : |
|
164 * : *(x,y) : |
|
165 * : | : |
|
166 * : | .. |
|
167 * .... |(dx3,dy3) |
|
168 * .... | .. |
|
169 * ....V. |
|
170 */ |
|
171 |
|
172 static const byte color = 255; |
|
173 |
|
174 GfxDrawLine(x, y, x + dx1, y + dy1, color); |
|
175 GfxDrawLine(x, y, x + dx2, y + dy2, color); |
|
176 GfxDrawLine(x, y, x + dx3, y + dy3, color); |
|
177 |
|
178 GfxDrawLine(x + dx1, y + dy1, x + dx1 + dx2, y + dy1 + dy2, color); |
|
179 GfxDrawLine(x + dx1, y + dy1, x + dx1 + dx3, y + dy1 + dy3, color); |
|
180 GfxDrawLine(x + dx2, y + dy2, x + dx2 + dx1, y + dy2 + dy1, color); |
|
181 GfxDrawLine(x + dx2, y + dy2, x + dx2 + dx3, y + dy2 + dy3, color); |
|
182 GfxDrawLine(x + dx3, y + dy3, x + dx3 + dx1, y + dy3 + dy1, color); |
|
183 GfxDrawLine(x + dx3, y + dy3, x + dx3 + dx2, y + dy3 + dy2, color); |
140 } |
184 } |
141 |
185 |
142 |
186 |
143 /** Truncate a given string to a maximum width if neccessary. |
187 /** Truncate a given string to a maximum width if neccessary. |
144 * If the string is truncated, add three dots ('...') to show this. |
188 * If the string is truncated, add three dots ('...') to show this. |