Mercurial > public > algo-animator
comparison utils.c @ 7:f159eec07daf
refactor
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Fri, 23 Jun 2023 10:01:37 +0100 |
parents | 40a8bdbe2005 |
children | f7af7255705e |
comparison
equal
deleted
inserted
replaced
6:40a8bdbe2005 | 7:f159eec07daf |
---|---|
1 #include "utils.h" | 1 #include "utils.h" |
2 | |
3 | |
4 void render_text(const char *text, float x, float y) { | |
5 glRasterPos2f(x, y); | |
6 | |
7 for (const char *c = text; *c; ++c) { | |
8 glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *c); | |
9 } | |
10 } | |
11 | 2 |
12 | 3 |
13 int random_int(int min, int max) { | 4 int random_int(int min, int max) { |
14 return rand() % ((max - min) + 1) + min; | 5 return rand() % ((max - min) + 1) + min; |
15 } | 6 } |
16 | |
17 | |
18 void draw_rectangle(int x_position, int rect_height, int rect_width, int window_height) { | |
19 glVertex2f(x_position, window_height - 100); | |
20 glVertex2f(x_position + rect_width, window_height - 100); | |
21 glVertex2f(x_position + rect_width, rect_height); | |
22 glVertex2d(x_position, rect_height); | |
23 } |