--- /dev/null
+/*
+ * utility.cpp
+ *
+ * Created on: Oct 6, 2012
+ * Author: holy
+ */
+
+#include "utility.h"
+
+#include <cmath>
+
+using geometry::Vector;
+
+namespace sdl {
+
+void HorizontalLine(SDL_Surface *dst, const Vector<int> &position, unsigned int length, Uint32 color) {
+ SDL_Rect destRect;
+ destRect.x = position.X();
+ destRect.y = position.Y();
+ destRect.w = length;
+ destRect.h = 1;
+ SDL_FillRect(dst, &destRect, color);
+}
+
+void VerticalLine(SDL_Surface *dst, const geometry::Vector<int> &position, unsigned int length, Uint32 color) {
+ SDL_Rect destRect;
+ destRect.x = position.X();
+ destRect.y = position.Y();
+ destRect.w = 1;
+ destRect.h = length;
+ SDL_FillRect(dst, &destRect, color);
+}
+
+
+void OutlineRect(SDL_Surface *dst, const Vector<int> &from, const Vector<int> &to, Uint32 color) {
+ SDL_Rect destRect;
+ destRect.x = std::min(from.X(), to.X());
+ destRect.y = std::min(from.Y(), to.Y());
+ destRect.w = std::abs(from.X() - to.X());
+ destRect.h = std::abs(from.Y() - to.Y());
+ OutlineRect(dst, &destRect, color);
+}
+
+void OutlineRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color) {
+ SDL_Rect destRect;
+ destRect.x = dstrect->x;
+ destRect.y = dstrect->y;
+ destRect.w = dstrect->w;
+ destRect.h = 1;
+ SDL_FillRect(dst, &destRect, color);
+ destRect.y += dstrect->h - 1;
+ SDL_FillRect(dst, &destRect, color);
+ destRect.y = dstrect->y;
+ destRect.w = 1;
+ destRect.h = dstrect->h;
+ SDL_FillRect(dst, &destRect, color);
+ destRect.x += dstrect->w - 1;
+ SDL_FillRect(dst, &destRect, color);
+}
+
+}
--- /dev/null
+/*
+ * utility.h
+ *
+ * Created on: Oct 6, 2012
+ * Author: holy
+ */
+
+#ifndef SDL_UTILITY_H_
+#define SDL_UTILITY_H_
+
+#include "../geometry/Vector.h"
+#include <SDL.h>
+
+namespace sdl {
+
+void HorizontalLine(SDL_Surface *dst, const geometry::Vector<int> &position, unsigned int length, Uint32 color);
+void VerticalLine(SDL_Surface *dst, const geometry::Vector<int> &position, unsigned int length, Uint32 color);
+
+void OutlineRect(SDL_Surface *dst, const geometry::Vector<int> &from, const geometry::Vector<int> &to, Uint32 color);
+void OutlineRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
+
+}
+
+#endif /* SDL_UTILITY_H_ */