Mercurial > public > algo-animator
comparison src/main.c @ 39:b656ed2e8957
refactor
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Fri, 14 Jul 2023 20:16:29 +0100 |
parents | 8ed1256dd518 |
children | 62b7c457510d |
comparison
equal
deleted
inserted
replaced
38:8ed1256dd518 | 39:b656ed2e8957 |
---|---|
163 // r: Reset state | 163 // r: Reset state |
164 if (key == 114) { | 164 if (key == 114) { |
165 reset_state(&algo_args, &thread_state); | 165 reset_state(&algo_args, &thread_state); |
166 } | 166 } |
167 | 167 |
168 // u: Increase speed | 168 // u: Increase delay |
169 if (key == 117) { | 169 if (key == 117) { |
170 change_delay(&algo_args, 10); | 170 change_delay(&algo_args, 10); |
171 } | 171 } |
172 | 172 |
173 // d: reduce speed | 173 // d: reduce delay |
174 if (key == 100) { | 174 if (key == 100) { |
175 change_delay(&algo_args, -10); | 175 change_delay(&algo_args, -10); |
176 } | 176 } |
177 | 177 |
178 // enter: Run program | 178 // enter: Run program |
195 void setup_gl() { | 195 void setup_gl() { |
196 | 196 |
197 // Set background dark | 197 // Set background dark |
198 glClearColor(0.0, 0.0, 0.0, 1.0); | 198 glClearColor(0.0, 0.0, 0.0, 1.0); |
199 | 199 |
200 // Set point color and size to 1 pixel | 200 // Set point color and size |
201 glColor3f(1.0, 0.7569, 0.0); | 201 glColor3f(1.0, 0.7569, 0.0); |
202 glPointSize(5.0); | 202 glPointSize(5.0); |
203 | 203 |
204 // Matrix projection and reset with identity | 204 // Matrix projection and reset with identity |
205 glMatrixMode(GL_PROJECTION); | 205 glMatrixMode(GL_PROJECTION); |
316 randomize_array(algo_args.arr, algo_args.arr_size); | 316 randomize_array(algo_args.arr, algo_args.arr_size); |
317 | 317 |
318 glutInit(&argc, argv); | 318 glutInit(&argc, argv); |
319 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); | 319 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); |
320 glutInitWindowSize(window_width, window_height); | 320 glutInitWindowSize(window_width, window_height); |
321 glutCreateWindow("Visualization of sorting algorithms | Developed by Dennis CM"); | 321 glutCreateWindow("Visualization of sorting algorithms"); |
322 | 322 |
323 setup_gl(); | 323 setup_gl(); |
324 setup_freetype(); | 324 setup_freetype(); |
325 | 325 |
326 glutDisplayFunc(display); | 326 glutDisplayFunc(display); |