This is a C project to print a 3D rotating cube in the terminal using ASCII characters with each face having a different color.
It uses ANSI escape codes to move the cursor and change the color of the text. I used my header only library for this project, you can find it at cUnicodeLib this library is used to print the unicode characters and to change the color of the text (foreground and background).
Note
This project is based on the work fromServet Gulnaroglu
here
demo_video.mp4
To build the project, you need to have CMake
installed on your computer.
Then, you can run the following commands:
mkdir build
cd build
cmake ..
cmake --build .
To run the project, you can run the following command:
./cubeAscii
You can use the following options:
-h
: to display the usage-c <count>
: to set the number of cubes to display (default: 1) choose between 1 and 3-g
: to display in gray mode the cubes-m
: to set the max rotation speed-n
: to set the min rotation speed
You can combine the commands to set the number of cubes and to display in gray mode at the same time:
./cubeAscii -c 3 -g
This will display 3 cubes in gray mode.
The project is set with a set of different scripts:
- flawfinder : to check for security flaws in the code
- CMake : to build the project for Windows, macOS and Linux
- CodeQl : to check for code quality and security
- Cpp Cmake Publish : to publish the project on GitHub
Wikipedia:
https://en.wikipedia.org/wiki/ANSI_escape_code
https://en.wikipedia.org/wiki/Rotation_matrix
Quentin MOREL :
- @Im-Rises
- https://github.com/Im-Rises