4 * Created on: Oct 6, 2012
12 using geometry::Vector;
16 void HorizontalLine(SDL_Surface *dst, const Vector<int> &position, unsigned int length, Uint32 color) {
18 destRect.x = position.X();
19 destRect.y = position.Y();
22 SDL_FillRect(dst, &destRect, color);
25 void VerticalLine(SDL_Surface *dst, const geometry::Vector<int> &position, unsigned int length, Uint32 color) {
27 destRect.x = position.X();
28 destRect.y = position.Y();
31 SDL_FillRect(dst, &destRect, color);
35 void OutlineRect(SDL_Surface *dst, const Vector<int> &from, const Vector<int> &to, Uint32 color) {
37 destRect.x = std::min(from.X(), to.X());
38 destRect.y = std::min(from.Y(), to.Y());
39 destRect.w = std::abs(from.X() - to.X());
40 destRect.h = std::abs(from.Y() - to.Y());
41 OutlineRect(dst, &destRect, color);
44 void OutlineRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) {
46 destRect.x = dstrect->x;
47 destRect.y = dstrect->y;
48 destRect.w = dstrect->w;
50 SDL_FillRect(dst, &destRect, color);
51 destRect.y += dstrect->h - 1;
52 SDL_FillRect(dst, &destRect, color);
53 destRect.y = dstrect->y;
55 destRect.h = dstrect->h;
56 SDL_FillRect(dst, &destRect, color);
57 destRect.x += dstrect->w - 1;
58 SDL_FillRect(dst, &destRect, color);