SDL_RenderDrawLine(canv, from.x, from.y, to.x, to.y);
}
-void Canvas::FillRect(Vector<int> pos, Vector<int> size) {
- SDL_Rect destRect;
- destRect.x = pos.x;
- destRect.y = pos.y;
- destRect.w = size.x;
- destRect.h = size.y;
- SDL_RenderFillRect(canv, &destRect);
+void Canvas::FillRect(Rect<int> rect) {
+ SDL_RenderFillRect(canv, &rect);
}
-void Canvas::OutlineRect(Vector<int> pos, Vector<int> size) {
- SDL_Rect destRect;
- destRect.x = pos.x;
- destRect.y = pos.y;
- destRect.w = size.x;
- destRect.h = size.y;
- SDL_RenderDrawRect(canv, &destRect);
+void Canvas::OutlineRect(Rect<int> rect) {
+ SDL_RenderDrawRect(canv, &rect);
+}
+
+void Canvas::OutlineRectRot(Rect<float> rect, Vector<float> origin, float rot) {
+ const Vector<float> topLeft(rect.x, rect.y);
+ const Vector<float> topRight(rect.x + rect.w - 1, rect.y);
+ const Vector<float> botLeft(rect.x, rect.y + rect.h - 1);
+ const Vector<float> botRight(rect.x + rect.w - 1, rect.y + rect.h - 1);
+
+ Quad(
+ Rotate(topLeft - origin, rot) + origin,
+ Rotate(topRight - origin, rot) + origin,
+ Rotate(botRight - origin, rot) + origin,
+ Rotate(botLeft - origin, rot) + origin
+ );
}