* Draws the bordered window with a graphic background. * The background never moves with the window, it's * always aligned to the top-left corner of the screen * and cropped to fit the inside area. */
| 160 | * and cropped to fit the inside area. |
| 161 | */ |
| 162 | void Window::draw() |
| 163 | { |
| 164 | Surface::draw(); |
| 165 | SDL_Rect square; |
| 166 | |
| 167 | if (_popup == POPUP_HORIZONTAL || _popup == POPUP_BOTH) |
| 168 | { |
| 169 | square.x = (int)((getWidth() - getWidth() * _popupStep) / 2); |
| 170 | square.w = (int)(getWidth() * _popupStep); |
| 171 | } |
| 172 | else |
| 173 | { |
| 174 | square.x = 0; |
| 175 | square.w = getWidth(); |
| 176 | } |
| 177 | if (_popup == POPUP_VERTICAL || _popup == POPUP_BOTH) |
| 178 | { |
| 179 | square.y = (int)((getHeight() - getHeight() * _popupStep) / 2); |
| 180 | square.h = (int)(getHeight() * _popupStep); |
| 181 | } |
| 182 | else |
| 183 | { |
| 184 | square.y = 0; |
| 185 | square.h = getHeight(); |
| 186 | } |
| 187 | |
| 188 | int mul = 1; |
| 189 | if (_contrast) |
| 190 | { |
| 191 | mul = 2; |
| 192 | } |
| 193 | Uint8 color = _color + 3 * mul; |
| 194 | |
| 195 | if (_thinBorder) |
| 196 | { |
| 197 | color = _color + 1 * mul; |
| 198 | for (int i = 0; i < 5; ++i) |
| 199 | { |
| 200 | drawRect(&square, color); |
| 201 | |
| 202 | if (i % 2 == 0) |
| 203 | { |
| 204 | square.x++; |
| 205 | square.y++; |
| 206 | } |
| 207 | square.w--; |
| 208 | square.h--; |
| 209 | |
| 210 | switch (i) |
| 211 | { |
| 212 | case 0: |
| 213 | color = _color + 5 * mul; |
| 214 | setPixel(square.w, 0, color); |
| 215 | break; |
| 216 | case 1: |
| 217 | color = _color + 2 * mul; |
| 218 | break; |
| 219 | case 2: |