A simple sorting algorithm visualizer built with C++ and raylib.
It renders a shuffled array as vertical bars and sorts them step-by-step in real time, so you can watch the algorithm work frame by frame.
Currently implements Bubble Sort, advancing one comparison per frame.
| Key | Action |
|---|---|
Space |
Shuffle and restart |
Esc / close window |
Quit |
Requires CMake 3.31+ and a C++ compiler. raylib is fetched automatically via CMake's FetchContent.
cmake -B build
cmake --build build
./build/SortingVisualizerConstants in include/globals.h:
| Constant | Default | Description |
|---|---|---|
NUMBER_COUNT |
200 | Number of elements / target FPS |
SCREEN_WIDTH |
800 | Window width |
SCREEN_HEIGHT |
600 | Window height |
LINE_WIDTH |
10 | Width of each bar in pixels |
LINE_HEIGHT_FACTOR |
10 | Multiplier for bar height |
