* Draws the bordered bar filled according * to its values. */
| 181 | * to its values. |
| 182 | */ |
| 183 | void Bar::draw() |
| 184 | { |
| 185 | Surface::draw(); |
| 186 | SDL_Rect square; |
| 187 | |
| 188 | square.x = 0; |
| 189 | square.y = 0; |
| 190 | square.w = (Uint16)(_scale * _max) + 1; |
| 191 | square.h = getHeight(); |
| 192 | |
| 193 | if (_invert) |
| 194 | { |
| 195 | drawRect(&square, _color); |
| 196 | } |
| 197 | else |
| 198 | { |
| 199 | drawRect(&square, _color + 4); |
| 200 | } |
| 201 | |
| 202 | square.y++; |
| 203 | square.w--; |
| 204 | square.h -= 2; |
| 205 | |
| 206 | drawRect(&square, 0); |
| 207 | |
| 208 | if (_invert) |
| 209 | { |
| 210 | if (_secondOnTop) |
| 211 | { |
| 212 | square.w = (Uint16)(_scale * _value); |
| 213 | drawRect(&square, _color + 4); |
| 214 | square.w = (Uint16)(_scale * _value2); |
| 215 | drawRect(&square, _color2 + 4); |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | square.w = (Uint16)(_scale * _value2); |
| 220 | drawRect(&square, _color2 + 4); |
| 221 | square.w = (Uint16)(_scale * _value); |
| 222 | drawRect(&square, _color + 4); |
| 223 | } |
| 224 | } |
| 225 | else |
| 226 | { |
| 227 | if (_secondOnTop) |
| 228 | { |
| 229 | square.w = (Uint16)(_scale * _value); |
| 230 | drawRect(&square, _color); |
| 231 | square.w = (Uint16)(_scale * _value2); |
| 232 | drawRect(&square, _color2); |
| 233 | } |
| 234 | else |
| 235 | { |
| 236 | square.w = (Uint16)(_scale * _value2); |
| 237 | drawRect(&square, _color2); |
| 238 | square.w = (Uint16)(_scale * _value); |
| 239 | drawRect(&square, _color); |
| 240 | } |