Skip to content

Cube ASCII Art for the terminal with color for each faces

License

Notifications You must be signed in to change notification settings

Im-Rises/CubeAscii

Repository files navigation

CubeAscii

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 from Servet Gulnaroglu here

Demo

demo_video.mp4

How to use

Build

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 .

Run

To run the project, you can run the following command:

./cubeAscii

Options

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.

Github-Actions

flawfinder CMake CodeQL Cpp Cmake Publish

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

Documentations

Wikipedia:
https://en.wikipedia.org/wiki/ANSI_escape_code
https://en.wikipedia.org/wiki/Rotation_matrix

Contributors

Quentin MOREL :

GitHub contributors