diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-13 11:42:52 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-13 11:42:52 -0500 |
commit | e7330bacc808cfc54cc9f7b46f12295811edee65 (patch) | |
tree | 9495a77c88bcf2b3af7d871bcfb47976dbda06a4 /math.cpp | |
parent | 442bb01af8b9cbf88189a4d2368548f41149413f (diff) |
evolve menu working well
Diffstat (limited to 'math.cpp')
-rw-r--r-- | math.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -701,6 +701,12 @@ static void gl_quad(float x1, float y1, float x2, float y2) { glVertex2f(x1, y2); } +// returns average of red green and blue components of color +static float rgba_brightness(u32 color) { + u8 r = (u8)(color >> 24), g = (u8)(color >> 16), b = (u8)(color >> 8); + return ((float)r+(float)g+(float)b) * (1.0f / 3); +} + static float rects_intersect(Rect r1, Rect r2) { if (r1.pos.x >= r2.pos.x + r2.size.x) return false; // r1 is to the right of r2 if (r2.pos.x >= r1.pos.x + r1.size.x) return false; // r2 is to the right of r1 |