Skip to content

Sorting algorithm visualizer created with Raylib and C

wmpowell8/RaylibSortingVisualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raylib Sorting Visualizer

A sorting algorithm visualizer created with Raylib and C.

Features

  • Array struct pointer type for dealing with variable-length arrays (see src/Array.c for documentation on how to use)
  • Algorithm struct type for dealing with algorithms (contains a bool (*)(Array) function pointer and const char *)
  • Procedurally-generated audio for clean sounds

How to compile

I used Windows to create this but I'm sure it can be compiled on other platforms.

For Windows, run this command:

gcc src\main.c -o RaylibSortingVisualizer.exe -Iinclude -Llib -lraylib -lopengl32 -lgdi32 -lwinmm -pthread -O2

To compile in debug mode, replace -O2 with -g.

You can get GCC for Windows here.

Using my Makefile?

Please read the warnings at the top. Thank you!

To-do

Contributing new algorithms

To contribute new algorithms, first read the documentation comments in src/Array.c to get an idea of how this visualizer implements algorithms and dynamically-sized arrays. Then go into the src/algorithms/sort folder and create a new file. In this file you will define a new Algorithm which contains the data for the sorting algorithm you're implementing. Finally, go into src/main.c, include the file you just created, and add a new call to show_sort under the long if-statement in the sort_proc function. For information on which arguments you should put into the show_sort call to make your new algorithm show properly, consult the documentation comments on show_sort.

What do I think of this?

I started this project in C, so I'm sticking with C, but man, do I wish I used Rust.

About

Sorting algorithm visualizer created with Raylib and C

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages