summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-27 19:47:31 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-27 19:47:31 -0500
commitaea002f290e5eddde98eb394fa7a9145c325fffe (patch)
tree11533f72e6f56cabf26d02cd5e48d69f666b51f4 /math.c
parent4554db338221f8fd1c7b4855b8d5bc50780815d2 (diff)
buttons (for warn overwrite popup)
Diffstat (limited to 'math.c')
-rw-r--r--math.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/math.c b/math.c
index 78f1ecc..6497040 100644
--- a/math.c
+++ b/math.c
@@ -658,6 +658,10 @@ static bool rect_contains_point(Rect r, v2 point) {
return rect_contains_point_v2(r.pos, r.size, point);
}
+static Rect rect_translate(Rect r, v2 by) {
+ return rect(v2_add(r.pos, by), r.size);
+}
+
static float rect_x1(Rect r) { return r.pos.x; }
static float rect_y1(Rect r) { return r.pos.y; }
static float rect_x2(Rect r) { return r.pos.x + r.size.x; }
@@ -688,27 +692,22 @@ static void rect_render(Rect r) {
static void rect_render_border(Rect r, float border_thickness) {
float border_radius = border_thickness * 0.5f;
float x1 = r.pos.x, y1 = r.pos.y, x2 = x1 + r.size.x, y2 = y1 + r.size.y;
- //float a = 0.3f; // for debugging
- //glColor4f(1,0,0,a);
glVertex2f(x1+border_radius, y1-border_radius);
glVertex2f(x1+border_radius, y1+border_radius);
glVertex2f(x2+border_radius, y1+border_radius);
glVertex2f(x2+border_radius, y1-border_radius);
- //glColor4f(0,1,0,a);
glVertex2f(x1-border_radius, y2-border_radius);
glVertex2f(x1-border_radius, y2+border_radius);
glVertex2f(x2-border_radius, y2+border_radius);
glVertex2f(x2-border_radius, y2-border_radius);
- //glColor4f(0,0,1,a);
glVertex2f(x1-border_radius, y1-border_radius);
glVertex2f(x1+border_radius, y1-border_radius);
glVertex2f(x1+border_radius, y2-border_radius);
glVertex2f(x1-border_radius, y2-border_radius);
- //glColor4f(1,1,0,a);
glVertex2f(x2-border_radius, y1+border_radius);
glVertex2f(x2+border_radius, y1+border_radius);
glVertex2f(x2+border_radius, y2+border_radius);