Mercurial > public > algo-animator
comparison src/utils.h @ 29:dae463bbf5ca
implementing multi-thread and refactoring
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Wed, 28 Jun 2023 20:10:55 +0100 |
parents | |
children | f945bcc3571f |
comparison
equal
deleted
inserted
replaced
28:99592fae8ea1 | 29:dae463bbf5ca |
---|---|
1 #ifndef UTILS_H | |
2 #define UTILS_H | |
3 | |
4 #include <stdio.h> | |
5 #include <stdlib.h> | |
6 #include <time.h> | |
7 #include <stdbool.h> | |
8 #include <unistd.h> | |
9 | |
10 | |
11 struct Element { | |
12 float value; | |
13 bool current; | |
14 }; | |
15 | |
16 struct Algo { | |
17 char name[50]; | |
18 void *(*function)(void *); | |
19 }; | |
20 | |
21 void create_array(struct Element *arr, int arr_size, int window_height, int vpadding); | |
22 void swap_elements(int x, int y, struct Element *arr); | |
23 void randomize_array(struct Element *arr, int arr_size); | |
24 bool array_sorted(struct Element *arr, int arr_size); | |
25 void algorithm_selector(struct Algo *algos, int direction, int *selected_algorithm); | |
26 void delay_flow(useconds_t *delay, bool *pause); | |
27 | |
28 | |
29 #endif // UTILS_H |