Mercurial > public > algo-animator
view utils.c @ 6:40a8bdbe2005
Refactor to array of structures
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Tue, 13 Jun 2023 18:37:23 +0100 |
parents | 6be2faa7ed6e |
children | f159eec07daf |
line wrap: on
line source
#include "utils.h" void render_text(const char *text, float x, float y) { glRasterPos2f(x, y); for (const char *c = text; *c; ++c) { glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *c); } } int random_int(int min, int max) { return rand() % ((max - min) + 1) + min; } void draw_rectangle(int x_position, int rect_height, int rect_width, int window_height) { glVertex2f(x_position, window_height - 100); glVertex2f(x_position + rect_width, window_height - 100); glVertex2f(x_position + rect_width, rect_height); glVertex2d(x_position, rect_height); }